qemu: use qemu-xhci USB controller by default for ppc64 and aarch64

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Acked-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
Pavel Hrdina 2017-04-27 17:56:41 +02:00
parent 278e70f8f8
commit 568887a32f
6 changed files with 72 additions and 3 deletions

View File

@ -3268,9 +3268,12 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont,
} else if (ARCH_IS_PPC64(def->os.arch)) { } else if (ARCH_IS_PPC64(def->os.arch)) {
/* To not break migration we need to set default USB controller /* To not break migration we need to set default USB controller
* for ppc64 to pci-ohci if we cannot change ABI of the VM. * for ppc64 to pci-ohci if we cannot change ABI of the VM.
* The nec-usb-xhci controller is used as default only for * The nec-usb-xhci or qemu-xhci controller is used as default
* newly defined domains or devices. */ * only for newly defined domains or devices. */
if ((parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE) && if ((parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE) &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QEMU_XHCI)) {
cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI;
} else if ((parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE) &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI)) { virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI)) {
cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI; cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI;
} else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI)) { } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI)) {
@ -3280,7 +3283,9 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont,
cont->model = -1; cont->model = -1;
} }
} else if (def->os.arch == VIR_ARCH_AARCH64) { } else if (def->os.arch == VIR_ARCH_AARCH64) {
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI)) if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QEMU_XHCI))
cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI;
else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI))
cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI; cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI;
} }
} }

View File

@ -0,0 +1,19 @@
LC_ALL=C \
PATH=/bin \
HOME=/home/test \
USER=test \
LOGNAME=test \
QEMU_AUDIO_DRV=none \
/usr/bin/qemu-system-aarch64 \
-name QEMUGuest1 \
-S \
-M virt \
-m 214 \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-nographic \
-nodefaults \
-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
-no-acpi \
-boot c \
-device qemu-xhci,id=usb,bus=pcie.0,addr=0x1

View File

@ -0,0 +1,16 @@
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219100</memory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='aarch64' machine='virt'>hvm</type>
</os>
<devices>
<emulator>/usr/bin/qemu-system-aarch64</emulator>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</controller>
<memballoon model='none'/>
</devices>
</domain>

View File

@ -0,0 +1,19 @@
LC_ALL=C \
PATH=/bin \
HOME=/home/test \
USER=test \
LOGNAME=test \
QEMU_AUDIO_DRV=none \
/usr/bin/qemu-system-ppc64 \
-name QEMUGuest1 \
-S \
-M pseries \
-m 256 \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-nographic \
-nodefaults \
-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
-boot c \
-device qemu-xhci,id=usb,bus=pci.0,addr=0x1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6

View File

@ -0,0 +1 @@
qemuxml2argv-ppc64-usb-controller.xml

View File

@ -2472,6 +2472,15 @@ mymain(void)
QEMU_CAPS_PCI_OHCI); QEMU_CAPS_PCI_OHCI);
DO_TEST("ppc64-usb-controller-legacy", DO_TEST("ppc64-usb-controller-legacy",
QEMU_CAPS_PIIX3_USB_UHCI); QEMU_CAPS_PIIX3_USB_UHCI);
DO_TEST_FULL("ppc64-usb-controller-qemu-xhci", NULL, -1, 0,
VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, GIC_NONE,
QEMU_CAPS_NEC_USB_XHCI,
QEMU_CAPS_DEVICE_QEMU_XHCI);
DO_TEST("aarch64-usb-controller-qemu-xhci",
QEMU_CAPS_OBJECT_GPEX,
QEMU_CAPS_NEC_USB_XHCI,
QEMU_CAPS_DEVICE_QEMU_XHCI);
DO_TEST("aarch64-usb-controller-nec-xhci", DO_TEST("aarch64-usb-controller-nec-xhci",
QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_OBJECT_GPEX,