现在igd assign又出问题了,在i3-6100的平台上,显示器没有任何输出!
从dmesg和Qemu的输出都看不出问题,难道在Bios阶段就出问题了?从Seabios的源码看,确实做了初始化的操作。看一下Bios的打印吧!
查看Bios打印在文档docs/Debugging.md,中说的很清楚。简单来说就这几步:
1 打开配置CONFIG_DEBUG_SERIAL,然后编译。
2 创建管道文件,mkfifo qemudebugpipe。
3 启动虚拟机,加入配置:-chardev pipe,path=qemudebugpipe,id=seabios -device isa-debugcon,iobase=0x402,chardev=seabios。
4 用脚本查看打印输出:./scripts/readserial.py -nf qemudebugpipe。
获得如下打印信息:
00.057: Intel IGD OpRegion enabled at 0x07ffe000, size 8KB, dev 00:02.0
00.057: Intel IGD BDSM enabled at 0x07700000, size 8MB, dev 00:02.0
00.067: PCI: init bdf=00:1f.0 id=8086:a143
00.067: PCI: Using 00:02.0 for primary VGA
没有任何有价值的错误信息!抓狂中!没办法发maillist了!
等待回复中!这个时间也不能浪费,我决定打开Qemu的Trace,看看Trace信息中有没有有价值的信息!
上面的信息有误,Bios的打印信息很有价值,基本定位了问题根源。而且虚拟机是卡死在bios阶段!具体就是卡在vgarom_setup阶段,bios无法从IGD获取vga rom。这个就是问题的根源,为什么无法获取vga rom?找到问题所在,是解决问题的第一步,总算有点收获了。
收到Alex的邮件回复:
Assuming IGD is the primary graphics on the host, my guess would be that the host system boots in pure UEFI mode and the VGA ROM is not installed into the VGA option ROM. Look in the BIOS settings to see if you can boot into legacy/compatibility/CSM mode. If this causes you to be unable to boot the installed OS, boot with a live CD, dump the VGA option ROM to a file and upload that file somewhere safe. Reboot, return the BIOS to the original settings, boot the system, and copy the ROM file to the host system. Make a backup of the ROM file and run rom-fixer (https://github.com/awilliam/rom-parser) on it to fix the checksum and device ID (run lspci -nns 00:02.0 to determine what the device ID should be). Modify your vm XML to include aand cross your fingers. If it doesn't work, check your security configuration to make sure the file is somewhere that libvirt has access to it. Thanks,
经过深入分析,我发现情况和Alex想的不太一样,他以为问题是bios无法找到vga rom,但真实的情况是bios可以找到IGD里面的vga rom,并且能够成功的拷贝出来,问题出在运行vga rom上,卡死在运行vga rom上,我回邮件给到他,不知道这个问题如何处理。
既然是vga rom运行出问题,搞清楚vga rom是什么很有必要,网上找到一个vga bios reference
直接看代码是王道,通过log信息可以看到程序调用流程:
00.073: Scan for VGA option rom[vgarom_setup]
00.079: Attempting to init PCI bdf 00:02.0 (vd 8086:5912)[init_pcirom]
00.079: Attempting to map option rom on dev 00:02.0[map_pcirom]
00.079: Option rom sizing returned fe000000 ffff0000
00.080: Inspecting possible rom at 0xfe000000 (vd=8086:5912 bdf=00:02.0)
00.080: Copying option rom (size 65536) from 0xfe000000 to 0x000c0000[copy_rom]
00.084: Checking rom 0x000c0000 (sig aa55 size 128)[init_optionrom -> is_valid_rom]
00.084:Running option rom atc000:0003[callrom ->__callrom ]
程序卡死在__callrom上了,进一步往里跟,发现是卡死在方法call16里面的嵌套汇编代码里面了。
上面代码的目的就是初始化optionrom,那optionrom是什么呢?这个optionrom是VBIOS,intel gpu vbios相关信息。