lost and found ( for me ? )

KVM PCI pass through

host: Fedora11 64bit
guest: WinXP Pro

qemu-kvm-0.10.6-9.fc11.x86_64

仮想マシン -> 詳細 -> add hardware -> physical host device


pass through するデバイスを指定

NIC ( eth0 ) をアサイン。

02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)



アサインするとホスト上の eth0 が消える。

- アサイン前

[root@arizona ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:1D:60:77:A1:38
inet addr:192.168.1.150 Bcast:192.168.255.255 Mask:255.255.0.0

- アサイン後

[root@arizona ~]# ifconfig eth0
eth0: error fetching interface information: Device not found

シスログより eth0 がホストよりはずされたのが確認できる。

arizona avahi-daemon[1535]: Interface eth0.IPv4 no longer relevant for mDNS.
arizona avahi-daemon[1535]: Leaving mDNS multicast group on interface eth0.IPv4 with address 192.168.1.150.
arizona avahi-daemon[1535]: Withdrawing address record for fe80::21d:60ff:fe77:a138 on eth0.
arizona avahi-daemon[1535]: Withdrawing address record for 192.168.1.150 on eth0.
arizona kernel: r8169 0000:02:00.0: PCI INT A disabled

VMを起動して終わり

CLI で pass through をする場合は、-pcidevice host=bus:dev.func[,dma=none][,name=string]
bus:dev.func は lspci コマンドで確認できる。

[root@arizona ~]# ps aux | grep kvm | grep -v grep
root 2831 25.1 13.4 967728 541180 ? Sl 09:33 1:06 /usr/bin/qemu-kvm -S -M pc -m 512 -smp 1 -name winxp-vm -uuid 3870f9f5-0025-4a83-37de-45f8a6b6f4b5 -monitor pty -pidfile /var/run/libvirt/qemu//winxp-vm.pid -localtime -boot c -drive file=/var/lib/libvirt/images/winxp-vm.img,if=ide,index=0,boot=on -drive file=,if=ide,media=cdrom,index=2 -net none -serial pty -parallel none -usb -usbdevice tablet -vnc 127.0.0.1:0 -soundhw es1370 -pcidevice host=02:00.0

[root@arizona ~]# lspci
00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control
01:00.0 VGA compatible controller: nVidia Corporation GeForce 8500 GT (rev a1)
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.