28 simple steps to run pci-passthrough in a virtual machine with Spice
Red Hat is a very important actor in the virtualization open-source world. So I ran a try with CentOs from Red Hat on my all Intel cpu + mobo. It’s definitely easier than Ubuntu. Here are the steps :
- go into your bios and enable vt-d
- download the netinstall of CentOS 6.3
- use UNetbootin to put that on your usb key
- let’s go to the netinstall!
- hard disk I created a
- /boot 500mb
- a volume vg_pctele with three partitions
- /vg_pctele/root = / (10gb)
- /vg_pctele/swap = swap (8 gb)
- /vg_pctele/windows = /media/secondos (20gb)
- choose the configuration mini desktop and customize to add all the packages needed for virtualization
#yum install kvm kvm_intel
- #append intel_iommu=on to the kernel line in /boot/grub/grub.conf
- #/etc/sysconfig/network-scripts/ -> create a bridge br0 of eth0 (cf doc)
#chkconfig NetworkManager off
#chkconfig network on
#/etc/init.d/NetworkManager stop;/etc/init.d/network restart
- get the name of your pci to passthrough with
- get the name of the driver using your pci with
#echo "blacklist mydriver" >> /etc/modprobe.d/blacklist4myvm.conf
- get the corresponding libvirt name in
virsh nodedev-list | grep pci
#virsh nodedev-dettach pci_0000_03_00_0
#virt-install --connect qemu:///system --arch=x86_64 -n vm1 -r 4096 --vcpus=4 -c /dev/dvd --vnc --noautoconsole --os-type windows --os-variant winxp --network=bridge:br0 --disk path=/dev/vg --accelerate --host-device=pci_0000_03_00_0
#chkconfig libvirtd on
#service libvirtd start
#nano /etc/polkit-1/localauthority/50-local.d/50-libvirt.pklaand paste :
[libvirt Management Access]
#sudo groupadd libvirt
#usermod -G libvirt -a fred
I did two changes before starting the vm with my user fred:
- Processor : copy Host configuration and set the topology to 4 cores 4 threads 1 socket (adjust these numbers to your fit!)
- add Cdrom to the boot menu
install the virtualized os with the driver for your pci card!
I hope every steps are in this article to help you.
I forgot smthg? please let me know.
- Spice for linux/windows xp/7
- yum install spice-server spice-client spice-protocol –y
- in virt-manager, set Spice in Graphics and qxl in Video
- install the drivers from http://spice-space.org/download.html
- no windows 8 won’t be possible for now due to a new kind of window manager from microsoft
- try virtio disk and virtio network to improve the performance.
- personally, it didn’t work so well. I replaced the real tek network card by an e1000 to increase the network performance.