kvm下pci透传

首先查看pcie设备号

lspci -nn|grep PCIe
3f:13.0 System peripheral [0880]: Intel Corporation Xeon E7 v2/Xeon E5 v2/Core i7 R2PCIe [8086:0e1d] (rev 07)
3f:13.1 Performance counters [1101]: Intel Corporation Xeon E7 v2/Xeon E5 v2/Core i7 R2PCIe [8086:0e34] (rev 07)
7f:13.0 System peripheral [0880]: Intel Corporation Xeon E7 v2/Xeon E5 v2/Core i7 R2PCIe [8086:0e1d] (rev 07)
7f:13.1 Performance counters [1101]: Intel Corporation Xeon E7 v2/Xeon E5 v2/Core i7 R2PCIe [8086:0e34] (rev 07)
81:00.0 Non-Volatile memory controller [0108]: Intel Corporation PCIe Data Center SSD [8086:0953] (rev 01)
bf:13.0 System peripheral [0880]: Intel Corporation Xeon E7 v2/Xeon E5 v2/Core i7 R2PCIe [8086:0e1d] (rev 07)
bf:13.1 Performance counters [1101]: Intel Corporation Xeon E7 v2/Xeon E5 v2/Core i7 R2PCIe [8086:0e34] (rev 07)
ff:13.0 System peripheral [0880]: Intel Corporation Xeon E7 v2/Xeon E5 v2/Core i7 R2PCIe [8086:0e1d] (rev 07)
ff:13.1 Performance counters [1101]: Intel Corporation Xeon E7 v2/Xeon E5 v2/Core i7 R2PCIe [8086:0e34] (rev 07)

查看设备pci信息

virsh nodedev-list|grep 81

输出如下


block_sdd_36e8611f0000b7fa81f47d96517df612b
block_sdh_3600144f07ab48d5c00005923ee81002d
pci_0000_81_00_0

解绑


virsh nodedev-dettach pci_0000_81_00_0

已分离设备 pci_0000_81_00_0
新建xml文件,输入设备信息

vi pcie81.xml

内容如下:


<hostdev mode='subsystem' type='pci' managed='yes'>
         <source>
             <address domain='0x0000' bus='0x81' slot='0x00' function='0x0' />
         source>
         hostdev>
virsh attach-device instance-00000097 pcie81.xml

成功附加设备
[root@XXXXX ~]#

你可能感兴趣的:(kvm下pci透传)