From: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
Currently, -device xxx still can't work well for ppc64 platform.
It's better use legacy USB option with default for ppc64.
This patch is to legacy USB option with default for ppc64.
Signed-off-by: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
---
v2 -> v1:
* Add test cases for USB controller configuration on PPC64.
src/qemu/qemu_command.c | 3 ++-
.../qemuxml2argv-pseries-usb-default.args | 1 +
.../qemuxml2argv-pseries-usb-default.xml | 17 +++++++++++++++++
.../qemuxml2argv-pseries-usb-multi.args | 1 +
.../qemuxml2argv-pseries-usb-multi.xml | 19 +++++++++++++++++++
tests/qemuxml2argvtest.c | 8 ++++++++
6 files changed, 48 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.xml
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 63b9350..a48eada 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6467,7 +6467,8 @@ qemuBuildCommandLine(virConnectPtr conn,
}
} else if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
cont->model == -1 &&
- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) {
+ (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI) ||
+ def->os.arch == VIR_ARCH_PPC64)) {
if (usblegacy) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Multiple legacy USB controllers are
"
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args
b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args
new file mode 100644
index 0000000..745910b
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu-system-ppc64 -S
-M pseries -m 512 -smp 1 -nographic -nodefconfig -nodefaults -chardev
socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon
chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -usb -chardev
pty,id=charserial0 -device spapr-vty,chardev=charserial0,reg=0x30000000
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.xml
b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.xml
new file mode 100644
index 0000000..e62a78c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.xml
@@ -0,0 +1,17 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+ <memory unit='KiB'>524288</memory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='ppc64' machine='pseries'>hvm</type>
+ </os>
+ <clock offset='utc'/>
+ <devices>
+ <emulator>/usr/bin/qemu-system-ppc64</emulator>
+ <console type='pty'>
+ <address type="spapr-vio"/>
+ </console>
+ <memballoon model="none"/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.args
b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.args
new file mode 100644
index 0000000..ac17b8c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu-system-ppc64 -S
-M pseries -m 512 -smp 1 -nographic -nodefconfig -nodefaults -chardev
socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon
chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -device
piix3-usb-uhci,id=usb,bus=pci,addr=0x1.0x2 -device pci-ohci,id=usb1,bus=pci,addr=0x3
-chardev pty,id=charserial0 -device spapr-vty,chardev=charserial0,reg=0x30000000
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.xml
b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.xml
new file mode 100644
index 0000000..f45d9d1
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.xml
@@ -0,0 +1,19 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+ <memory unit='KiB'>524288</memory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='ppc64' machine='pseries'>hvm</type>
+ </os>
+ <clock offset='utc'/>
+ <devices>
+ <emulator>/usr/bin/qemu-system-ppc64</emulator>
+ <console type='pty'>
+ <address type="spapr-vio"/>
+ </console>
+ <controller type='usb' index='0' model='piix3-uhci'/>
+ <controller type='usb' index='1' model='pci-ohci'/>
+ <memballoon model="none"/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index be6c759..3bbe395 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -902,6 +902,14 @@ mymain(void)
QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
DO_TEST("pseries-vio", QEMU_CAPS_DRIVE,
QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
+ DO_TEST("pseries-usb-default", QEMU_CAPS_DRIVE,
+ QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
+ QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_PIIX3_USB_UHCI,
+ QEMU_CAPS_PCI_OHCI, QEMU_CAPS_PCI_MULTIFUNCTION);
+ DO_TEST("pseries-usb-multi", QEMU_CAPS_DRIVE,
+ QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
+ QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_PIIX3_USB_UHCI,
+ QEMU_CAPS_PCI_OHCI, QEMU_CAPS_PCI_MULTIFUNCTION);
DO_TEST("pseries-vio-user-assigned", QEMU_CAPS_DRIVE,
QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
DO_TEST_ERROR("pseries-vio-address-clash", QEMU_CAPS_DRIVE,
--
1.8.1.4