Basically all existing guest types, regardless of the architectur, get both a USB controller and a virtio memory balloon by default. s390 guests are an exception, for the very good reason that they don't support USB at all; the other exception is aarch64/virt guests, but in the latter case isn't a compelling reason for them to deviate from the widely adopted convention, especially since: * x86/q35 guests, which aarch64/virt guests are for the most part identical to, add these devices by default; * it's trivial to opt out of both default devices by setting model='none'; * higher level applications such as Nova expect at least the USB controller to be present. So add it by default for newly-defined guests. Existing guests will, of course, be left unchanged. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1538637 Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- src/qemu/qemu_domain.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 6b4bd3cca..f1c3b3d1e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2630,7 +2630,8 @@ qemuDomainDefAddImplicitInputDevice(virDomainDef *def) static int qemuDomainDefAddDefaultDevices(virDomainDefPtr def, - virQEMUCapsPtr qemuCaps) + virQEMUCapsPtr qemuCaps, + unsigned int parseFlags) { bool addDefaultUSB = true; int usbModel = -1; /* "default for machinetype" */ @@ -2680,10 +2681,33 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def, case VIR_ARCH_ARMV7L: case VIR_ARCH_AARCH64: - addDefaultUSB = false; - addDefaultMemballoon = false; - if (qemuDomainIsVirt(def)) + if (qemuDomainIsVirt(def)) { + /* All mach-virt guests get a PCIe Root, if supported by + * the QEMU binary */ addPCIeRoot = virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_GPEX); + } + + if (qemuDomainIsVirt(def) && + parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE) { + /* In addition to PCIe Root, newly-defined mach-virt guests + * also get a couple more devices so that they're more similar + * to guests on other architectures, notably x86/q35: + * + * 1) a USB3 controller, if supported by the QEMU binary; + * 2) a virtio memory balloon, as per the defaults defined + * above. + */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QEMU_XHCI)) + usbModel = VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI; + else + addDefaultUSB = false; + } else { + /* Other ARM guests (and existing mach-virt guests, in order + * to preserve guest ABI compatibility) don't get a PCIe Root, + * a USB controller or a memory balloon */ + addDefaultUSB = false; + addDefaultMemballoon = false; + } break; case VIR_ARCH_PPC64: @@ -3187,7 +3211,7 @@ qemuDomainDefPostParse(virDomainDefPtr def, goto cleanup; } - if (qemuDomainDefAddDefaultDevices(def, qemuCaps) < 0) + if (qemuDomainDefAddDefaultDevices(def, qemuCaps, parseFlags) < 0) goto cleanup; if (qemuCanonicalizeMachine(def, qemuCaps) < 0) -- 2.14.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list