我正在尝试在 virt-manager 中设置 PCI 直通,以授予我的 Debian Wheezy 来宾 VM 访问我的笔记本电脑的 Intel Centrino N 无线卡的权限。
Debian 默认内核启用了 Intel IOMMU,并且我已intel_iommu=on
在启动时传递到内核(通过编辑/etc/default/grub
和设置GRUB_CMDLINE_LINUX="intel_iommu=on"
,然后运行grub-update
)...
查看 dmesg 以验证 IOMMU 确实已启用,我看到:[ 0.000000] Intel-IOMMU: enabled
...
我尝试按照说明进行操作这里,并在将 PCI 设备添加到 VM(即 )之前使用 virsh 分离 PCI 设备,virsh nodedev-detach pci_0000_01_00_0
只是为了确定。
但是,在为此无线卡启用 PCI 直通的情况下,我根本无法启动到来宾 VM,并且收到以下错误(来自/var/log/libvirt/libvirtd.log
):
2014-09-22 04:45:19.325+0000: 2990: error : qemuMonitorOpenUnix:305 : failed to connect to monitor socket: No such process
2014-09-22 04:45:19.325+0000: 2990: error : qemuProcessWaitForMonitor:1593 : internal error process exited while connecting to monitor: char device redirected to /dev/pts/1
**No IOMMU found. Unable to assign device "hostdev0"
kvm: -device pci-assign,host=01:00.0,id=hostdev0,configfd=22,bus=pci.0,addr=0x7: Device 'pci-assign' could not be initialized**
这是完整的输出/var/log/libvirt/qemu/
:
2014-09-22 04:10:47.002+0000: starting up
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin HOME=/ QEMU_AUDIO_DRV=none /usr/bin/kvm -S -M pc-1.1 -cpu Nehalem,+rdtscp,+avx,+osxsave,+xsave,+tsc-deadline,+x2apic,+pdcm,+xtpr,+tm2,+est,+vmx,+ds_cpl,+monitor,+dtes64,+pclmuldq,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme -enable-kvm -m 2500 -smp 4,sockets=4,cores=1,threads=1 -name DebianStableSandbox -uuid c18e2808-c98a-2b4d-54f1-00977d3ec1d2 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/DebianStableSandbox.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/var/lib/libvirt/images/DebianNET.img,if=none,id=drive-virtio-disk0,format=raw -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive if=none,id=drive-ide0-1-0,readonly=on,format=raw -device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=21,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:c5:4a:a9,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0 -vnc 127.0.0.1:0 -vga cirrus -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device pci-assign,host=01:00.0,id=hostdev0,configfd=22,bus=pci.0,addr=0x7 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
char device redirected to /dev/pts/1
No IOMMU found. Unable to assign device "hostdev0"
kvm: -device pci-assign,host=01:00.0,id=hostdev0,configfd=22,bus=pci.0,addr=0x7: Device 'pci-assign' could not be initialized
2014-09-22 04:10:47.610+0000: shutting down
我认为“无法连接到监视器”消息在某种程度上是相关的。如果我使用 virt-manager 将无线卡添加为 PCI 设备,而不首先使用virsh nodedev-detach
(如上所述)将其分离,那么我会从 virt-manager 收到一条错误消息:
Error starting domain: Unable to read from monitor: Connection reset by peer
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 45, in cb_wrapper
callback(asyncjob, *args, **kwargs)
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 66, in tmpcb
callback(*args, **kwargs)
File "/usr/share/virt-manager/virtManager/domain.py", line 1114, in startup
self._backend.create()
File "/usr/lib/python2.7/dist-packages/libvirt.py", line 620, in create
if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: Unable to read from monitor: Connection reset by peer
...在这种情况下出现的所有内容/var/log/libvirt/libvirtd.log
是:2014-09-22 04:48:26.387+0000: 2985: error : qemuMonitorIORead:523 : Unable to read from monitor: Connection reset by peer
如果有帮助,这里是一些相关输出lspci -v
:
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
Subsystem: Dell Device 04d8
Flags: bus master, fast devsel, latency 0
Capabilities: [e0] Vendor Specific Information: Len=0c <?>
Kernel driver in use: agpgart-intel
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b5) (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0
Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
Memory behind bridge: d1600000-d16fffff
Capabilities: [40] Express Root Port (Slot+), MSI 00
Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
Capabilities: [90] Subsystem: Dell Device 04d8
Capabilities: [a0] Power Management version 2
Kernel driver in use: pcieport
01:00.0 Network controller: Intel Corporation Centrino Wireless-N 1030 [Rainbow Peak] (rev 34)
Subsystem: Intel Corporation Centrino Wireless-N 1030 BGN
Flags: fast devsel, IRQ 16
Memory at d1600000 (64-bit, non-prefetchable) [size=8K]
Capabilities: [c8] Power Management version 3
Capabilities: [d0] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [e0] Express Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting
Capabilities: [140] Device Serial Number bc-77-37-ff-ff-0d-3f-90
Kernel driver in use: pci-stub
另外,需要明确的是,在将无线卡添加为 PCI 直通设备之前,我能够正常启动到此虚拟机,一旦我通过 virt-manager 删除它,一切都会恢复正常工作。
有谁知道如何解决这个问题?谢谢!
答案1
实际上,我刚刚发现这个处理器支持VT-x但不支持VT-d,所以我不能做IOMMU。