The e1000e is an emulated network device based on the Intel 82574,
present in qemu 2.7.0 and later. Among other differences from the
e1000, it presents itself as a PCIe device rather than legacy PCI. In
order to get it assigned to a PCIe controller, this patch updates the
flags setting for network devices when the model name is "e1000e".
(Note that for some reason libvirt has never validated the network
device model names other than to check that there are no dangerous
characters in them. That should probably change, but is the subject of
another patch.)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1343094
---
src/qemu/qemu_domain_address.c | 2 ++
tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.args | 24 +++
tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.xml | 5
.../qemuxml2argv-q35-virtio-pci.args | 4
.../qemuxml2xmloutdata/qemuxml2xmlout-q35-pcie.xml | 28 +++---
.../qemuxml2xmlout-q35-virtio-pci.xml | 10
6 files changed, 54 insertions(+), 19 deletions(-)
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index c8a8f6b..e11a23b 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -468,6 +468,8 @@ qemuDomainDeviceConnectFlagsInternal(virDomainDeviceDefPtr
dev,
flags = 0;
else if (STREQ(net->model, "virtio"))
flags = virtioFlags;
+else if (STREQ(net->model, "e1000e"))
+flags = pcieFlags;
break;
}
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.args
b/tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.args
index 2ea0c08..40c8063 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.args
@@ -29,15 +29,16 @@ QEMU_AUDIO_DRV=none \
-device ioh3420,port=0x50,chassis=11,id=pci.11,bus=pcie.0,addr=0xa \
-device ioh3420,port=0x58,chassis=12,id=pci.12,bus=pcie.0,addr=0xb \
-device ioh3420,port=0x60,chassis=13,id=pci.13,bus=pcie.0,addr=0xc \
+-device ioh3420,port=0x68,chassis=14,id=pci.14,bus=pcie.0,addr=0xd \
-device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x1d.0x7 \
-device
ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,\
addr=0x1d \
-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x1d.0x1 \
-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x1d.0x2 \
--device virtio-scsi-pci,id=scsi0,bus=pci.6,addr=0x0 \
--device virtio-serial-pci,id=virtio-serial0,bus=pci.5,addr=0x0 \
+-device virtio-scsi-pci,id=scsi0,bus=pci.7,addr=0x0 \
+-device virtio-serial-pci,id=virtio-serial0,bus=pci.6,addr=0x0 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk1 \
--device virtio-blk-pci,bus=pci.7,addr=0x0,drive=drive-virtio-disk1,\
+-device virtio-blk-pci,bus=pci.8,addr=0x0,drive=drive-virtio-disk1,\
id=virtio-disk1 \
-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/to/guest \
-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=/import/from/host,\
@@ -45,13 +46,16 @@ bus=pci.3,addr=0x0 \
-netdev user,id=hostnet0 \
-device
virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.4,\
addr=0x0 \
--device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.10,\
+-netdev user,id=hostnet1 \
+-device e1000e,netdev=hostnet1,id=net1,mac=00:11:22:33:44:66,bus=pci.5,\
addr=0x0 \
--device virtio-mouse-pci,id=input1,bus=pci.11,addr=0x0 \
--device virtio-keyboard-pci,id=input2,bus=pci.12,addr=0x0 \
--device virtio-tablet-pci,id=input3,bus=pci.13,addr=0x0 \
+-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.11,\
+addr=0x0 \
+-device virtio-mouse-pci,id=input1,bus=pci.12,addr=0x0 \
+-device virtio-keyboard-pci,id=input2,bus=pci.13,addr=0x0 \
+-device virtio-tablet-pci,id=input3,bus=pci.14,addr=0x0 \
-device virtio-vga,id=video0,bus=pcie.0,addr=0x1 \
--device virtio-balloon-pci,id=balloon0,bus=pci.8,addr=0x0 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.9,addr=0x0 \
-object rng-random,id=objrng0,filename=/dev/urandom \
--device
virtio-rng-pci,rng=objrng0,id=rng0,max-bytes=123,period=1234,bus=pci.9,\
-addr=0x0
+-device virtio-rng-pci,rng=objrng0,id=rng0,max-bytes=123,period=1234,\
+bus=pci.10,addr=0x0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.xml
b/tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.xml
index 7bed08c..39db5f0 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.xml
@@ -28,6 +28,7 @@
+
@@ -45,6 +46,10 @@
+
+
+
+
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35-virtio-pci.args
b/tests/qemuxml2argvdata/qemuxml2argv-q35-virtio-pci.args
index 7cedc82..5723af7 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-q35-virtio-pci.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-q35-virtio-pci.args
@