[libvirt] [PATCH] qemu: Use legacy USB on ppc64

Andrea Bolognani abologna at redhat.com
Tue Jul 19 14:17:43 UTC 2016


Commit 8156493d8db9 changed libvirt so that '-device pci-ohci'
would be used instead of '-usb' on ppc64 when no specific USB
controller model had been specified in the guest configuration.

While the device that ends up being presented by the guest is
exactly the same, '-usb' causes it to be assigned to PCI address
00:00.0 while '-device pci-ohci', being subject to the regular
PCI address assignment logic, will be at a different address.

This PCI address mismatch breaks migration of existing guests
to new libvirt versions.

Luckily, when QEMU has switched its default '-usb' controller
from pci-ohci to nec-usb-xhci (QEMU commit 57040d451315), it
has done so without affecting older machine types, which means
we can keep using '-usb' without risking guest ABI breakage.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1357468
---
 src/qemu/qemu_command.c                                       | 8 +++++---
 tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.args | 2 +-
 tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args  | 2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2e04f57..9050e77 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2827,9 +2827,11 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
 
                 /* 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;
+                    /* ppc64 needs to use the -usb flag in order not to break
+                     * migration of existing guests: the legacy USB controller
+                     * uses a PCI address that we have no way of assigning
+                     * using the usual -device machinery */
+                    need_legacy = true;
                 } else {
                     /* For anything else, we used PIIX3_USB_UHCI */
                     if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI))
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.args b/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.args
index 2ec2231..bed5045 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.args
@@ -15,5 +15,5 @@ QEMU_AUDIO_DRV=none \
 -nodefaults \
 -monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
 -boot c \
--device pci-ohci,id=usb,bus=pci,addr=0x1 \
+-usb \
 -device virtio-balloon-pci,id=balloon0,bus=pci,addr=0x6
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args
index 251e786..2839dea 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args
@@ -19,6 +19,6 @@ server,nowait \
 -mon chardev=charmonitor,id=monitor,mode=readline \
 -no-acpi \
 -boot c \
--device pci-ohci,id=usb,bus=pci,addr=0x1 \
+-usb \
 -chardev pty,id=charserial0 \
 -device spapr-vty,chardev=charserial0,reg=0x30000000
-- 
2.7.4




More information about the libvir-list mailing list