![qemu 直通已停止工作](https://linux22.com/image/1154079/qemu%20%E7%9B%B4%E9%80%9A%E5%B7%B2%E5%81%9C%E6%AD%A2%E5%B7%A5%E4%BD%9C.png)
过去几天,我一直在努力通过 qemu 在 Ubuntu 17.10 上设置带有 GPU Passthrough 的 Windows 虚拟机。我取得的最大进展是运行与此非常相似的脚本:
#!/bin/bash
vmname="betterwin10vm"
if ps -A | grep -q $vmname; then
echo "$vmname is already running." &
exit 1
else
# use pulseaudio
export QEMU_AUDIO_DRV=pa
export QEMU_PA_SAMPLES=8192
export QEMU_AUDIO_TIMER_PERIOD=99
export QEMU_PA_SERVER=/run/user/1000/pulse/native
cp /usr/share/OVMF/OVMF_VARS.fd /tmp/my_vars.fd
qemu-system-x86_64 \
-name $vmname,process=$vmname \
-machine type=pc,accel=kvm \
-cpu host \
-smp 3,sockets=1,cores=3,threads=1 \
-m size=4G \
-mem-path /dev/hugepages \
-mem-prealloc \
-balloon none \
-rtc clock=host,base=localtime \
-vga none \
-nographic \
-serial none \
-parallel none \
-soundhw hda \
-usb -usbdevice host:1532:0214 -usbdevice host:1532:0043 \
-device vfio-pci,host=04:00.0,multifunction=on \
-device vfio-pci,host=04:00.1 \
-drive if=pflash,format=raw,readonly,file=/usr/share/OVMF/OVMF_CODE.fd \
-drive if=pflash,format=raw,file=/tmp/my_vars.fd \
-boot order=dc \
-drive if=virtio,id=disk0,cache=none,format=raw,file=/dev/sdb1 \
-drive file=/home/keith/Downloads/lubuntu-17.10.1-desktop-amd64.iso,index=1,media=cdrom \
-drive file=/home/keith/WIN_VM/virtio-win-0.1.141-2.iso,index=2,media=cdrom \
exit 0
fi
昨天,我可以在计划用于 Windows 的 VM 中运行 lubuntu,然后运行 windows10 安装(直到无法安装我的 virtio 驱动程序)。今天,我甚至无法启动 iso,也无法在插入 GPU 的辅助显示器上显示 bios(04:00.0)。我能看到没有任何东西启动的唯一方法是禁用该-vga none
属性并允许 qemu 在窗口中运行。我的鼠标和键盘也连接到 VM,所以我知道它已打开。虽然我无法解释为什么我的 iso 无法启动,但当我运行时dmesg | grep vfio
,我会多次重复这个冗长的(缩短的)响应。
[ 2.303445] vfio-pci 0000:04:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=io+mem:owns=none
[ 2.320128] vfio_pci: add [1002:67df[ffff:ffff]] class 0x000000/00000000
[ 2.344187] vfio_pci: add [1002:aaf0[ffff:ffff]] class 0x000000/00000000
[ 2805.815146] vfio-pci 0000:04:00.0: Refused to change power state, currently in D3
[ 2805.835195] vfio-pci 0000:04:00.0: Refused to change power state, currently in D3
[ 2805.855139] vfio-pci 0000:04:00.0: Refused to change power state, currently in D3
[ 2806.583096] vfio-pci 0000:04:00.0: timed out waiting for pending transaction; performing function level reset anyway
[ 2807.771124] vfio-pci 0000:04:00.0: Failed to return from FLR
[ 2807.773191] vfio_cap_init: 0000:04:00.0 hiding cap 0xff
[ 2807.773194] vfio_cap_init: 0000:04:00.0 hiding cap 0xff
[ 2807.773198] vfio_cap_init: 0000:04:00.0 hiding cap 0xff
[ 2807.773201] vfio_cap_init: 0000:04:00.0 hiding cap 0xff
[ 2807.773336] vfio_cap_init: 0000:04:00.0 hiding cap 0xff
[ 2807.773339] vfio_cap_init: 0000:04:00.0 hiding cap 0xff
[ 2807.795138] vfio-pci 0000:04:00.1: Refused to change power state, currently in D3
[ 2807.815138] vfio-pci 0000:04:00.1: Refused to change power state, currently in D3
[ 2807.835154] vfio-pci 0000:04:00.1: Refused to change power state, currently in D3
[ 2808.567093] vfio-pci 0000:04:00.1: timed out waiting for pending transaction; performing function level reset anyway
[ 2809.755122] vfio-pci 0000:04:00.1: Failed to return from FLR
[ 2809.757190] vfio_cap_init: 0000:04:00.1 hiding cap 0xff
[ 2809.757194] vfio_cap_init: 0000:04:00.1 hiding cap 0xff
[ 2809.757197] vfio_cap_init: 0000:04:00.1 hiding cap 0xff
[ 2809.757200] vfio_cap_init: 0000:04:00.1 hiding cap 0xff
[ 2809.757204] vfio_cap_init: 0000:04:00.1 hiding cap 0xff
[ 2809.757207] vfio_cap_init: 0000:04:00.1 hiding cap 0xff
[ 2809.757331] vfio_cap_init: 0000:04:00.1 hiding cap 0xff
[ 2809.757334] vfio_cap_init: 0000:04:00.1 hiding cap 0xff
[ 2809.757337] vfio_cap_init: 0000:04:00.1 hiding cap 0xff
[ 2809.831139] vfio-pci 0000:04:00.1: Refused to change power state, currently in D3
[ 2810.583131] vfio-pci 0000:04:00.1: timed out waiting for pending transaction; performing function level reset anyway
[ 2811.771126] vfio-pci 0000:04:00.1: Failed to return from FLR
[ 2811.791130] vfio-pci 0000:04:00.0: Refused to change power state, currently in D3
[ 2812.535123] vfio-pci 0000:04:00.0: timed out waiting for pending transaction; performing function level reset anyway
[ 2813.723127] vfio-pci 0000:04:00.0: Failed to return from FLR
[ 2945.935092] vfio-pci 0000:04:00.1: Refused to change power state, currently in D3
[ 2946.679158] vfio-pci 0000:04:00.1: timed out waiting for pending transaction; performing function level reset anyway
[ 2947.867152] vfio-pci 0000:04:00.1: Failed to return from FLR
[ 2947.887159] vfio-pci 0000:04:00.0: Refused to change power state, currently in D3
[ 2948.631161] vfio-pci 0000:04:00.0: timed out waiting for pending transaction; performing function level reset anyway
[ 2949.819151] vfio-pci 0000:04:00.0: Failed to return from FLR
[ 3692.523889] vfio-pci 0000:04:00.0: Refused to change power state, currently in D3
[ 3692.543829] vfio-pci 0000:04:00.0: Refused to change power state, currently in D3
[ 3692.563836] vfio-pci 0000:04:00.0: Refused to change power state, currently in D3
[ 3693.307807] vfio-pci 0000:04:00.0: timed out waiting for pending transaction; performing function level reset anyway
[ 3694.495843] vfio-pci 0000:04:00.0: Failed to return from FLR
这可能与我的问题有关吗?如果是,我该如何处理?谢谢 :)