Eu tenho um servidor com 2 NICs
01:00.0 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 01) 01:00.1 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 01)
e eu quero atribuir o theise 2 dispositivos NICs para um convidado (servidor ubuntu 14.04), eu estou seguindo este tópico este tópico: Como atribuir dispositivos com o VT-d no KVM então eu fiz o que está escrito:
make menuconfig set "Bus options (PCI etc.)" -> "Support for DMA Remapping Devices" to "" set "Bus options (PCI etc.)" -> "Enable DMA Remapping Devices" to "" set "Bus options (PCI etc.)" -> "PCI Stub driver" to "*" save and rebuild kernel
meu dmesg | grep -e DMAR -e IOMMU mostra:
[ 0.000000] ACPI: DMAR 00000000ddfaabc8 000078 (v01 INTEL SNB 00000001 INTL 00000001) [ 0.000000] Intel-IOMMU: enabled [ 0.018789] dmar: IOMMU 0: reg_base_addr fed90000 ver 1:0 cap >c9008020660262 ecap f010da [ 0.018860] IOAPIC id 2 under DRHD base 0xfed90000 IOMMU 0 [ 1.610427] DMAR: No ATSR found [ 1.610449] IOMMU 0 0xfed90000: using Queued invalidation [ 1.610451] IOMMU: Setting RMRR: [ 1.610460] IOMMU: Setting identity map for device 0000:00:1d.0 >[0xdde16000 - 0xdde32fff] [ 1.610478] IOMMU: Setting identity map for device 0000:00:1a.0 >[0xdde16000 - 0xdde32fff] [ 1.610487] IOMMU: Prepare 0-16MiB unity mapping for LPC [ 1.610494] IOMMU: Setting identity map for device 0000:00:1f.0 [0x0 - 0xffffff]
desvincule o nic do driver do kernel do host:
echo "8086 10b9" > /sys/bus/pci/drivers/pci-stub/new_id echo 0000:01:00.0 > /sys/bus/pci/devices/0000:01:00.0/driver/unbind echo 0000:01:00.0 > /sys/bus/pci/drivers/pci-stub/bind
eu verifiquei o unbinding com lspci -k: o driver era pci_stub
E quando eu adiciono as seguintes linhas no arquivo XML do guest vm, recebi um erro
device 01:00.0 already in use
O XML adiciona
hostdev mode='subsystem' type='pci' managed='yes' source address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/ /source /hostdev
Tags nic pci kvm-virtualization