IOMMU howto

Reference:

How to assign devices with VT-d in KVM
http://www.linux-kvm.org/page/How_to_assign_devices_with_VT-d_in_KVM

Adding a PCI device with virsh
http://www.linuxtopia.org/online_books/rhel6/rhel_6_virtualization/rhel_6_virtualization_chap-Virtualization-PCI_passthrough.html

PCI passthrough on VirtualBox
http://howtoware.blogspot.com/2012/01/oracle-vm-virtualbox-how-to-use-pci.html

List of IOMMU-supporting hardware
http://en.wikipedia.org/wiki/List_of_IOMMU-supporting_hardware


http://pic.dhe.ibm.com/infocenter/lnxinfo/v3r0m0/index.jsp?topic=%2Fliaat%2Fliaatbppcipassthru.htm


SR-IOV howto:
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Virtualization/sect-Para-virtualized_Windows_Drivers_Guide-How_SR_IOV_Libvirt_Works.html

Linux virtualization and PCI passthrough
http://www.ibm.com/developerworks/library/l-pci-passthrough/


内核启动参数要加上intel_iommu=on


dmesg | grep -e DMAR -e IOMMU


有输出,没问题,继续


lspci -nn

找到相应的的pci设备,关于pci数据格式参考:http://prefetch.net/articles/linuxpci.html

01:00.0 Ethernet controller [0200]: Intel Corporation 82576 Gigabit Network Connection [8086:10c9] (rev 01)
01:00.1 Ethernet controller [0200]: Intel Corporation 82576 Gigabit Network Connection[8086:10c9] (rev 01)


如果通过libvirt:

<hostdev mode='subsystem' type='pci' managed='yes'>
    <source>
      <address domain='0x000' bus='0x01' slot='0x00' function='0x1'/>
    </source>
</hostdev> 


如果通过qemu命令行(未测试)

echo "8086 10c9" > /sys/bus/pci/drivers/pci-stub/new_id

echo "0000:01:00.1" > /sys/bus/pci/devices/0000:01:00.1/driver/unbind

echo "0000:01:00.1" > /sys/bus/pci/drivers/pci-stub/bind


qemu 参数:-device pci-assign,host=01:00.1


如参数:qemu-kvm   -enable-kvm -nographic -drive file=/mnt/sdb/vms/testfc/testfc.qcow2,if=virtio,index=0,format=qcow2 -device pci-assign,host=01:00.1

hot add: 
device_add pci-assign,host=01:00.0,id=mydevice
hot remove:
device_del mydevice


你可能感兴趣的:(IOMMU howto)