PCI passthrough in KVM

1.  make sure to add “iommu=on” in the grub otion.

e.g. /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT=”iommu=on”

2.  unbind pci from the host

find the pci id by “lscpi”  and “lspci -n” command, and do something like below.

e.g.

echo "1033 0194" > /sys/bus/pci/drivers/pci-stub/new_id
echo "0000:0d:00.0" > /sys/bus/pci/drivers/xhci_hcd/unbind
echo "0000:0d:00.0" > /sys/bus/pci/drivers/pci-stub/bind
echo "1033 0194" > /sys/bus/pci/drivers/pci-stub/remove_id

3. Attach the pci to the VM before booting, and boot the VM.

Advertisements
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: