mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
qemu: assign e1000e network devices to PCIe slots when appropriate
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
This commit is contained in:
parent
c7fc151eec
commit
9dfe733e99
@ -428,8 +428,7 @@ qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def,
|
|||||||
*/
|
*/
|
||||||
static virDomainPCIConnectFlags
|
static virDomainPCIConnectFlags
|
||||||
qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
|
qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
|
||||||
virDomainPCIConnectFlags pcieFlags
|
virDomainPCIConnectFlags pcieFlags,
|
||||||
ATTRIBUTE_UNUSED,
|
|
||||||
virDomainPCIConnectFlags virtioFlags)
|
virDomainPCIConnectFlags virtioFlags)
|
||||||
{
|
{
|
||||||
virDomainPCIConnectFlags pciFlags = (VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
|
virDomainPCIConnectFlags pciFlags = (VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
|
||||||
@ -520,6 +519,9 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
|
|||||||
if (STREQ(net->model, "virtio"))
|
if (STREQ(net->model, "virtio"))
|
||||||
return virtioFlags;
|
return virtioFlags;
|
||||||
|
|
||||||
|
if (STREQ(net->model, "e1000e"))
|
||||||
|
return pcieFlags;
|
||||||
|
|
||||||
return pciFlags;
|
return pciFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,10 +35,10 @@ QEMU_AUDIO_DRV=none \
|
|||||||
addr=0x1d \
|
addr=0x1d \
|
||||||
-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x1d.0x1 \
|
-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 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-scsi-pci,id=scsi0,bus=pci.7,addr=0x0 \
|
||||||
-device virtio-serial-pci,id=virtio-serial0,bus=pci.5,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 \
|
-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 \
|
id=virtio-disk1 \
|
||||||
-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/to/guest \
|
-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,\
|
-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=/import/from/host,\
|
||||||
@ -46,13 +46,16 @@ bus=pci.3,addr=0x0 \
|
|||||||
-netdev user,id=hostnet0 \
|
-netdev user,id=hostnet0 \
|
||||||
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.4,\
|
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.4,\
|
||||||
addr=0x0 \
|
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 \
|
addr=0x0 \
|
||||||
-device virtio-mouse-pci,id=input1,bus=pci.11,addr=0x0 \
|
-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.11,\
|
||||||
-device virtio-keyboard-pci,id=input2,bus=pci.12,addr=0x0 \
|
addr=0x0 \
|
||||||
-device virtio-tablet-pci,id=input3,bus=pci.13,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-gpu-pci,id=video0,bus=pcie.0,addr=0x1 \
|
-device virtio-gpu-pci,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 \
|
-object rng-random,id=objrng0,filename=/dev/urandom \
|
||||||
-device virtio-rng-pci,rng=objrng0,id=rng0,max-bytes=123,period=1234,bus=pci.9,\
|
-device virtio-rng-pci,rng=objrng0,id=rng0,max-bytes=123,period=1234,\
|
||||||
addr=0x0
|
bus=pci.10,addr=0x0
|
||||||
|
@ -46,6 +46,10 @@
|
|||||||
<mac address='00:11:22:33:44:55'/>
|
<mac address='00:11:22:33:44:55'/>
|
||||||
<model type='virtio'/>
|
<model type='virtio'/>
|
||||||
</interface>
|
</interface>
|
||||||
|
<interface type='user'>
|
||||||
|
<mac address='00:11:22:33:44:66'/>
|
||||||
|
<model type='e1000e'/>
|
||||||
|
</interface>
|
||||||
<memballoon model='virtio'/>
|
<memballoon model='virtio'/>
|
||||||
<rng model='virtio'>
|
<rng model='virtio'>
|
||||||
<rate bytes='123' period='1234'/>
|
<rate bytes='123' period='1234'/>
|
||||||
|
@ -46,6 +46,9 @@ bus=pci.2,addr=0x1 \
|
|||||||
-netdev user,id=hostnet0 \
|
-netdev user,id=hostnet0 \
|
||||||
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\
|
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\
|
||||||
addr=0x2 \
|
addr=0x2 \
|
||||||
|
-netdev user,id=hostnet1 \
|
||||||
|
-device e1000e,netdev=hostnet1,id=net1,mac=00:11:22:33:44:66,bus=pci.3,\
|
||||||
|
addr=0x0 \
|
||||||
-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.2,\
|
-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.2,\
|
||||||
addr=0x8 \
|
addr=0x8 \
|
||||||
-device virtio-mouse-pci,id=input1,bus=pci.2,addr=0x9 \
|
-device virtio-mouse-pci,id=input1,bus=pci.2,addr=0x9 \
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<disk type='block' device='disk'>
|
<disk type='block' device='disk'>
|
||||||
<source dev='/dev/HostVG/QEMUGuest1'/>
|
<source dev='/dev/HostVG/QEMUGuest1'/>
|
||||||
<target dev='vdb' bus='virtio'/>
|
<target dev='vdb' bus='virtio'/>
|
||||||
<address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
|
||||||
</disk>
|
</disk>
|
||||||
<controller type='pci' index='0' model='pcie-root'/>
|
<controller type='pci' index='0' model='pcie-root'/>
|
||||||
<controller type='pci' index='1' model='dmi-to-pci-bridge'>
|
<controller type='pci' index='1' model='dmi-to-pci-bridge'>
|
||||||
@ -90,10 +90,10 @@
|
|||||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/>
|
||||||
</controller>
|
</controller>
|
||||||
<controller type='virtio-serial' index='0'>
|
<controller type='virtio-serial' index='0'>
|
||||||
<address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
|
||||||
</controller>
|
</controller>
|
||||||
<controller type='scsi' index='0' model='virtio-scsi'>
|
<controller type='scsi' index='0' model='virtio-scsi'>
|
||||||
<address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
|
||||||
</controller>
|
</controller>
|
||||||
<controller type='usb' index='0' model='ich9-ehci1'>
|
<controller type='usb' index='0' model='ich9-ehci1'>
|
||||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x7'/>
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x7'/>
|
||||||
@ -123,19 +123,24 @@
|
|||||||
<model type='virtio'/>
|
<model type='virtio'/>
|
||||||
<address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
|
||||||
</interface>
|
</interface>
|
||||||
|
<interface type='user'>
|
||||||
|
<mac address='00:11:22:33:44:66'/>
|
||||||
|
<model type='e1000e'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
|
||||||
|
</interface>
|
||||||
<input type='passthrough' bus='virtio'>
|
<input type='passthrough' bus='virtio'>
|
||||||
<source evdev='/dev/input/event1234'/>
|
<source evdev='/dev/input/event1234'/>
|
||||||
<address type='pci' domain='0x0000' bus='0x0a' slot='0x00' function='0x0'/>
|
|
||||||
</input>
|
|
||||||
<input type='mouse' bus='virtio'>
|
|
||||||
<address type='pci' domain='0x0000' bus='0x0b' slot='0x00' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x0b' slot='0x00' function='0x0'/>
|
||||||
</input>
|
</input>
|
||||||
<input type='keyboard' bus='virtio'>
|
<input type='mouse' bus='virtio'>
|
||||||
<address type='pci' domain='0x0000' bus='0x0c' slot='0x00' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x0c' slot='0x00' function='0x0'/>
|
||||||
</input>
|
</input>
|
||||||
<input type='tablet' bus='virtio'>
|
<input type='keyboard' bus='virtio'>
|
||||||
<address type='pci' domain='0x0000' bus='0x0d' slot='0x00' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x0d' slot='0x00' function='0x0'/>
|
||||||
</input>
|
</input>
|
||||||
|
<input type='tablet' bus='virtio'>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x0e' slot='0x00' function='0x0'/>
|
||||||
|
</input>
|
||||||
<input type='mouse' bus='ps2'/>
|
<input type='mouse' bus='ps2'/>
|
||||||
<input type='keyboard' bus='ps2'/>
|
<input type='keyboard' bus='ps2'/>
|
||||||
<video>
|
<video>
|
||||||
@ -143,12 +148,12 @@
|
|||||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
|
||||||
</video>
|
</video>
|
||||||
<memballoon model='virtio'>
|
<memballoon model='virtio'>
|
||||||
<address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x09' slot='0x00' function='0x0'/>
|
||||||
</memballoon>
|
</memballoon>
|
||||||
<rng model='virtio'>
|
<rng model='virtio'>
|
||||||
<rate bytes='123' period='1234'/>
|
<rate bytes='123' period='1234'/>
|
||||||
<backend model='random'>/dev/urandom</backend>
|
<backend model='random'>/dev/urandom</backend>
|
||||||
<address type='pci' domain='0x0000' bus='0x09' slot='0x00' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x0a' slot='0x00' function='0x0'/>
|
||||||
</rng>
|
</rng>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -123,6 +123,11 @@
|
|||||||
<model type='virtio'/>
|
<model type='virtio'/>
|
||||||
<address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
|
||||||
</interface>
|
</interface>
|
||||||
|
<interface type='user'>
|
||||||
|
<mac address='00:11:22:33:44:66'/>
|
||||||
|
<model type='e1000e'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
|
||||||
|
</interface>
|
||||||
<input type='passthrough' bus='virtio'>
|
<input type='passthrough' bus='virtio'>
|
||||||
<source evdev='/dev/input/event1234'/>
|
<source evdev='/dev/input/event1234'/>
|
||||||
<address type='pci' domain='0x0000' bus='0x02' slot='0x08' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x02' slot='0x08' function='0x0'/>
|
||||||
|
Loading…
Reference in New Issue
Block a user