[libvirt] [PATCH] Fix USB model defaults for ppc64

Andrea Bolognani abologna at redhat.com
Fri Jan 8 18:35:16 UTC 2016


On Fri, 2016-01-08 at 13:53 +0100, Martin Kletzander wrote:
> The condition was checking for UHCI (and OHCI for ppc64) availability so
> that it can specify the proper device instead of legacy usb.  However,
> for ppc64, we don't need to check both OHCI and UHCI, but only OHCI as
> that is the legacy default.  The condition is so big that it was just a
> matter of time when someone will make a mistake there, so let's use more
> lines so that it is visible what the condition checks for.
> 
> This fixes usage of -device instead of -usb for ppc64 that supports
> pci-usb-ohci and does not support piix3-usb-uhci.

I've filed

  https://bugzilla.redhat.com/show_bug.cgi?id=1297020

to keep track of this, you might want to reference it in your commit
message.

> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 1f0593526b55..3f464a5fc21d 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -10049,18 +10049,30 @@ qemuBuildCommandLine(virConnectPtr conn,
> 
>                  if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
>                      cont->model == -1 &&
> -                    !qemuDomainMachineIsQ35(def) &&
> -                    (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI) ||
> -                     (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI) &&
> -                      ARCH_IS_PPC64(def->os.arch)))) {
> -                    if (usblegacy) {
> -                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> -                                       _("Multiple legacy USB controllers are "
> -                                         "not supported"));
> -                        goto error;
> +                    !qemuDomainMachineIsQ35(def)) {
> +                    bool need_legacy = false;
> +
> +                    /* We're not using legacy usb controller for q35 */
> +                    if (ARCH_IS_PPC64(def->os.arch)) {
> +                        /* For ppc64 the legacy was OHCI */
> +                        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI))
> +                            need_legacy = true;
> +                    } else {
> +                        /* For anything else, we used * PIIX3_USB_UHCI */

                                                    -----^

I guess you joined together two lines, please get rid of it.

ACK with that fixed and the other diff[1] squashed in.

Cheers.


[1] https://www.redhat.com/archives/libvir-list/2016-January/msg00248.html
-- 
Andrea Bolognani
Software Engineer - Virtualization Team




More information about the libvir-list mailing list