mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
qemu: add a USB3 controller to Q35 domains by default
Previously we added a set of EHCI+UHCI controllers to Q35 machines to mimic real hardware as closely as possible, but recent discussions have pointed out that the nec-usb-xhci (USB3) controller is much more virtualization-friendly (uses less CPU), so this patch switches the default for Q35 machinetypes to add an XHCI instead (if it's supported, which it of course *will* be). Since none of the existing test cases left out USB controllers in the input XML, a new Q35 test case was added which has *no* devices, so ends up with only the defaults always put in by qemu, plus those added by libvirt.
This commit is contained in:
parent
807232203a
commit
d8bd837669
@ -2190,10 +2190,14 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
|
||||
addPCIeRoot = true;
|
||||
addImplicitSATA = true;
|
||||
|
||||
/* add a USB2 controller set, but only if the
|
||||
* ich9-usb-ehci1 device is supported
|
||||
/* Prefer adding USB3 controller if supported
|
||||
* (nec-usb-xhci). Failing that, add a USB2 controller set
|
||||
* if the ich9-usb-ehci1 device is supported. Otherwise
|
||||
* don't add anything.
|
||||
*/
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_USB_EHCI1))
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI))
|
||||
usbModel = VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI;
|
||||
else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_USB_EHCI1))
|
||||
usbModel = VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1;
|
||||
else
|
||||
addDefaultUSB = false;
|
||||
|
@ -0,0 +1,22 @@
|
||||
LC_ALL=C \
|
||||
PATH=/bin \
|
||||
HOME=/home/test \
|
||||
USER=test \
|
||||
LOGNAME=test \
|
||||
QEMU_AUDIO_DRV=none \
|
||||
/usr/libexec/qemu-kvm \
|
||||
-name q35-test \
|
||||
-S \
|
||||
-M q35 \
|
||||
-m 2048 \
|
||||
-smp 2,sockets=2,cores=1,threads=1 \
|
||||
-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \
|
||||
-nographic \
|
||||
-nodefaults \
|
||||
-monitor unix:/tmp/lib/domain--1-q35-test/monitor.sock,server,nowait \
|
||||
-no-acpi \
|
||||
-boot c \
|
||||
-device ioh3420,port=0x8,chassis=1,id=pci.1,bus=pcie.0,addr=0x1 \
|
||||
-device ioh3420,port=0x10,chassis=2,id=pci.2,bus=pcie.0,addr=0x2 \
|
||||
-device nec-usb-xhci,id=usb,bus=pci.1,addr=0x0 \
|
||||
-device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x0
|
@ -0,0 +1,18 @@
|
||||
<domain type='qemu'>
|
||||
<name>q35-test</name>
|
||||
<uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
|
||||
<memory unit='KiB'>2097152</memory>
|
||||
<currentMemory unit='KiB'>2097152</currentMemory>
|
||||
<vcpu placement='static' cpuset='0-1'>2</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64' machine='q35'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/libexec/qemu-kvm</emulator>
|
||||
</devices>
|
||||
</domain>
|
@ -1844,6 +1844,29 @@ mymain(void)
|
||||
QEMU_CAPS_ICH9_USB_EHCI1,
|
||||
QEMU_CAPS_NEC_USB_XHCI,
|
||||
QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
|
||||
DO_TEST("q35-default-devices-only",
|
||||
QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
|
||||
QEMU_CAPS_DEVICE_VIRTIO_RNG,
|
||||
QEMU_CAPS_OBJECT_RNG_RANDOM,
|
||||
QEMU_CAPS_NETDEV,
|
||||
QEMU_CAPS_DEVICE_VIRTIO_NET,
|
||||
QEMU_CAPS_DEVICE_VIRTIO_GPU,
|
||||
QEMU_CAPS_VIRTIO_GPU_VIRGL,
|
||||
QEMU_CAPS_VIRTIO_KEYBOARD,
|
||||
QEMU_CAPS_VIRTIO_MOUSE,
|
||||
QEMU_CAPS_VIRTIO_TABLET,
|
||||
QEMU_CAPS_VIRTIO_INPUT_HOST,
|
||||
QEMU_CAPS_VIRTIO_SCSI,
|
||||
QEMU_CAPS_FSDEV,
|
||||
QEMU_CAPS_FSDEV_WRITEOUT,
|
||||
QEMU_CAPS_DEVICE_PCI_BRIDGE,
|
||||
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
|
||||
QEMU_CAPS_DEVICE_IOH3420,
|
||||
QEMU_CAPS_ICH9_AHCI,
|
||||
QEMU_CAPS_PCI_MULTIFUNCTION,
|
||||
QEMU_CAPS_ICH9_USB_EHCI1,
|
||||
QEMU_CAPS_NEC_USB_XHCI,
|
||||
QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
|
||||
DO_TEST("pcie-root-port",
|
||||
QEMU_CAPS_DEVICE_PCI_BRIDGE,
|
||||
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
|
||||
|
@ -0,0 +1,40 @@
|
||||
<domain type='qemu'>
|
||||
<name>q35-test</name>
|
||||
<uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
|
||||
<memory unit='KiB'>2097152</memory>
|
||||
<currentMemory unit='KiB'>2097152</currentMemory>
|
||||
<vcpu placement='static' cpuset='0-1'>2</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64' machine='q35'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/libexec/qemu-kvm</emulator>
|
||||
<controller type='usb' index='0' model='nec-xhci'>
|
||||
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
|
||||
</controller>
|
||||
<controller type='sata' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='pci' index='0' model='pcie-root'/>
|
||||
<controller type='pci' index='1' model='pcie-root-port'>
|
||||
<model name='ioh3420'/>
|
||||
<target chassis='1' port='0x8'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
|
||||
</controller>
|
||||
<controller type='pci' index='2' model='pcie-root-port'>
|
||||
<model name='ioh3420'/>
|
||||
<target chassis='2' port='0x10'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||
</controller>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<input type='keyboard' bus='ps2'/>
|
||||
<memballoon model='virtio'>
|
||||
<address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
|
||||
</memballoon>
|
||||
</devices>
|
||||
</domain>
|
@ -765,6 +765,29 @@ mymain(void)
|
||||
QEMU_CAPS_ICH9_USB_EHCI1,
|
||||
QEMU_CAPS_NEC_USB_XHCI,
|
||||
QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
|
||||
DO_TEST("q35-default-devices-only",
|
||||
QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
|
||||
QEMU_CAPS_DEVICE_VIRTIO_RNG,
|
||||
QEMU_CAPS_OBJECT_RNG_RANDOM,
|
||||
QEMU_CAPS_NETDEV,
|
||||
QEMU_CAPS_DEVICE_VIRTIO_NET,
|
||||
QEMU_CAPS_DEVICE_VIRTIO_GPU,
|
||||
QEMU_CAPS_VIRTIO_GPU_VIRGL,
|
||||
QEMU_CAPS_VIRTIO_KEYBOARD,
|
||||
QEMU_CAPS_VIRTIO_MOUSE,
|
||||
QEMU_CAPS_VIRTIO_TABLET,
|
||||
QEMU_CAPS_VIRTIO_INPUT_HOST,
|
||||
QEMU_CAPS_VIRTIO_SCSI,
|
||||
QEMU_CAPS_FSDEV,
|
||||
QEMU_CAPS_FSDEV_WRITEOUT,
|
||||
QEMU_CAPS_DEVICE_PCI_BRIDGE,
|
||||
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
|
||||
QEMU_CAPS_DEVICE_IOH3420,
|
||||
QEMU_CAPS_ICH9_AHCI,
|
||||
QEMU_CAPS_PCI_MULTIFUNCTION,
|
||||
QEMU_CAPS_ICH9_USB_EHCI1,
|
||||
QEMU_CAPS_NEC_USB_XHCI,
|
||||
QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
|
||||
DO_TEST("pcie-root",
|
||||
QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
|
||||
QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI,
|
||||
|
Loading…
x
Reference in New Issue
Block a user