|
|
c1c534 |
From 6c6f469f08a2fd5d61d91bf0488ade5ef0033f2d Mon Sep 17 00:00:00 2001
|
|
|
c1c534 |
Message-Id: <6c6f469f08a2fd5d61d91bf0488ade5ef0033f2d@dist-git>
|
|
|
c1c534 |
From: Andrea Bolognani <abologna@redhat.com>
|
|
|
c1c534 |
Date: Wed, 29 Nov 2017 16:23:13 +0100
|
|
|
c1c534 |
Subject: [PATCH] qemu: Support usb-serial and pci-serial on pSeries
|
|
|
c1c534 |
|
|
|
c1c534 |
The existing implementation set the address type for all serial
|
|
|
c1c534 |
devices to spapr-vio, which made it impossible to use other devices
|
|
|
c1c534 |
such as usb-serial and pci-serial; moreover, some decisions were
|
|
|
c1c534 |
made based on the address type rather than the device type.
|
|
|
c1c534 |
|
|
|
c1c534 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1512934
|
|
|
c1c534 |
|
|
|
c1c534 |
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
|
|
c1c534 |
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
c1c534 |
(cherry picked from commit b342e94399eee7fd519234a12ca3ea04f6564154)
|
|
|
c1c534 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c1c534 |
---
|
|
|
c1c534 |
src/qemu/qemu_command.c | 9 ------
|
|
|
c1c534 |
src/qemu/qemu_domain_address.c | 3 +-
|
|
|
c1c534 |
.../qemuxml2argv-pseries-serial-pci.args | 22 +++++++++++++++
|
|
|
c1c534 |
.../qemuxml2argv-pseries-serial-pci.xml | 18 ++++++++++++
|
|
|
c1c534 |
.../qemuxml2argv-pseries-serial-usb.args | 23 ++++++++++++++++
|
|
|
c1c534 |
.../qemuxml2argv-pseries-serial-usb.xml | 21 ++++++++++++++
|
|
|
c1c534 |
tests/qemuxml2argvtest.c | 7 +++++
|
|
|
c1c534 |
.../qemuxml2xmlout-pseries-serial-pci.xml | 31 +++++++++++++++++++++
|
|
|
c1c534 |
.../qemuxml2xmlout-pseries-serial-usb.xml | 32 ++++++++++++++++++++++
|
|
|
c1c534 |
tests/qemuxml2xmltest.c | 7 +++++
|
|
|
c1c534 |
10 files changed, 163 insertions(+), 10 deletions(-)
|
|
|
c1c534 |
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-pci.args
|
|
|
c1c534 |
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-pci.xml
|
|
|
c1c534 |
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-usb.args
|
|
|
c1c534 |
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-usb.xml
|
|
|
c1c534 |
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-pci.xml
|
|
|
c1c534 |
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-usb.xml
|
|
|
c1c534 |
|
|
|
c1c534 |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
c1c534 |
index 91083dc73d..056dafea39 100644
|
|
|
c1c534 |
--- a/src/qemu/qemu_command.c
|
|
|
c1c534 |
+++ b/src/qemu/qemu_command.c
|
|
|
c1c534 |
@@ -9260,15 +9260,6 @@ static bool
|
|
|
c1c534 |
qemuChrIsPlatformDevice(const virDomainDef *def,
|
|
|
c1c534 |
virDomainChrDefPtr chr)
|
|
|
c1c534 |
{
|
|
|
c1c534 |
- if ((def->os.arch == VIR_ARCH_PPC) || ARCH_IS_PPC64(def->os.arch)) {
|
|
|
c1c534 |
- if (!qemuDomainIsPSeries(def))
|
|
|
c1c534 |
- return true;
|
|
|
c1c534 |
- /* only pseries need -device spapr-vty with -chardev */
|
|
|
c1c534 |
- if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
|
|
|
c1c534 |
- chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO)
|
|
|
c1c534 |
- return true;
|
|
|
c1c534 |
- }
|
|
|
c1c534 |
-
|
|
|
c1c534 |
if (def->os.arch == VIR_ARCH_ARMV7L || def->os.arch == VIR_ARCH_AARCH64) {
|
|
|
c1c534 |
/* TARGET_TYPE_ISA here really means 'the default platform device' */
|
|
|
c1c534 |
if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
|
|
|
c1c534 |
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
|
|
|
c1c534 |
index 2319e503eb..f62bb2f97e 100644
|
|
|
c1c534 |
--- a/src/qemu/qemu_domain_address.c
|
|
|
c1c534 |
+++ b/src/qemu/qemu_domain_address.c
|
|
|
c1c534 |
@@ -246,8 +246,9 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def,
|
|
|
c1c534 |
|
|
|
c1c534 |
for (i = 0; i < def->nserials; i++) {
|
|
|
c1c534 |
if (def->serials[i]->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
|
|
|
c1c534 |
- qemuDomainIsPSeries(def))
|
|
|
c1c534 |
+ def->serials[i]->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO) {
|
|
|
c1c534 |
def->serials[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
|
|
|
c1c534 |
+ }
|
|
|
c1c534 |
if (qemuDomainAssignSpaprVIOAddress(def, &def->serials[i]->info,
|
|
|
c1c534 |
VIO_ADDR_SERIAL) < 0)
|
|
|
c1c534 |
goto cleanup;
|
|
|
c1c534 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-pci.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-pci.args
|
|
|
c1c534 |
new file mode 100644
|
|
|
c1c534 |
index 0000000000..eb2a9bf0e0
|
|
|
c1c534 |
--- /dev/null
|
|
|
c1c534 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-pci.args
|
|
|
c1c534 |
@@ -0,0 +1,22 @@
|
|
|
c1c534 |
+LC_ALL=C \
|
|
|
c1c534 |
+PATH=/bin \
|
|
|
c1c534 |
+HOME=/home/test \
|
|
|
c1c534 |
+USER=test \
|
|
|
c1c534 |
+LOGNAME=test \
|
|
|
c1c534 |
+QEMU_AUDIO_DRV=none \
|
|
|
c1c534 |
+/usr/bin/qemu-system-ppc64 \
|
|
|
c1c534 |
+-name guest \
|
|
|
c1c534 |
+-S \
|
|
|
c1c534 |
+-M pseries \
|
|
|
c1c534 |
+-m 512 \
|
|
|
c1c534 |
+-smp 1,sockets=1,cores=1,threads=1 \
|
|
|
c1c534 |
+-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \
|
|
|
c1c534 |
+-nographic \
|
|
|
c1c534 |
+-nodefconfig \
|
|
|
c1c534 |
+-nodefaults \
|
|
|
c1c534 |
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-guest/monitor.sock,\
|
|
|
c1c534 |
+server,nowait \
|
|
|
c1c534 |
+-mon chardev=charmonitor,id=monitor,mode=readline \
|
|
|
c1c534 |
+-boot c \
|
|
|
c1c534 |
+-chardev pty,id=charserial0 \
|
|
|
c1c534 |
+-device pci-serial,chardev=charserial0,id=serial0,bus=pci.0,addr=0x1
|
|
|
c1c534 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-pci.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-pci.xml
|
|
|
c1c534 |
new file mode 100644
|
|
|
c1c534 |
index 0000000000..2c2534b4c2
|
|
|
c1c534 |
--- /dev/null
|
|
|
c1c534 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-pci.xml
|
|
|
c1c534 |
@@ -0,0 +1,18 @@
|
|
|
c1c534 |
+<domain type='qemu'>
|
|
|
c1c534 |
+ <name>guest</name>
|
|
|
c1c534 |
+ <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
|
|
|
c1c534 |
+ <memory unit='KiB'>524288</memory>
|
|
|
c1c534 |
+ <vcpu placement='static'>1</vcpu>
|
|
|
c1c534 |
+ <os>
|
|
|
c1c534 |
+ <type arch='ppc64' machine='pseries'>hvm</type>
|
|
|
c1c534 |
+ </os>
|
|
|
c1c534 |
+ <devices>
|
|
|
c1c534 |
+ <emulator>/usr/bin/qemu-system-ppc64</emulator>
|
|
|
c1c534 |
+ <controller type='usb' model='none'/>
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+ <serial type='pty'>
|
|
|
c1c534 |
+ <target type='pci-serial'/>
|
|
|
c1c534 |
+ </serial>
|
|
|
c1c534 |
+ <memballoon model='none'/>
|
|
|
c1c534 |
+ </devices>
|
|
|
c1c534 |
+</domain>
|
|
|
c1c534 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-usb.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-usb.args
|
|
|
c1c534 |
new file mode 100644
|
|
|
c1c534 |
index 0000000000..0403985dc4
|
|
|
c1c534 |
--- /dev/null
|
|
|
c1c534 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-usb.args
|
|
|
c1c534 |
@@ -0,0 +1,23 @@
|
|
|
c1c534 |
+LC_ALL=C \
|
|
|
c1c534 |
+PATH=/bin \
|
|
|
c1c534 |
+HOME=/home/test \
|
|
|
c1c534 |
+USER=test \
|
|
|
c1c534 |
+LOGNAME=test \
|
|
|
c1c534 |
+QEMU_AUDIO_DRV=none \
|
|
|
c1c534 |
+/usr/bin/qemu-system-ppc64 \
|
|
|
c1c534 |
+-name guest \
|
|
|
c1c534 |
+-S \
|
|
|
c1c534 |
+-M pseries \
|
|
|
c1c534 |
+-m 512 \
|
|
|
c1c534 |
+-smp 1,sockets=1,cores=1,threads=1 \
|
|
|
c1c534 |
+-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \
|
|
|
c1c534 |
+-nographic \
|
|
|
c1c534 |
+-nodefconfig \
|
|
|
c1c534 |
+-nodefaults \
|
|
|
c1c534 |
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-guest/monitor.sock,\
|
|
|
c1c534 |
+server,nowait \
|
|
|
c1c534 |
+-mon chardev=charmonitor,id=monitor,mode=readline \
|
|
|
c1c534 |
+-boot c \
|
|
|
c1c534 |
+-device qemu-xhci,id=usb,bus=pci.0,addr=0x1 \
|
|
|
c1c534 |
+-chardev pty,id=charserial0 \
|
|
|
c1c534 |
+-device usb-serial,chardev=charserial0,id=serial0,bus=usb.0,port=1
|
|
|
c1c534 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-usb.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-usb.xml
|
|
|
c1c534 |
new file mode 100644
|
|
|
c1c534 |
index 0000000000..734c90c66f
|
|
|
c1c534 |
--- /dev/null
|
|
|
c1c534 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-usb.xml
|
|
|
c1c534 |
@@ -0,0 +1,21 @@
|
|
|
c1c534 |
+<domain type='qemu'>
|
|
|
c1c534 |
+ <name>guest</name>
|
|
|
c1c534 |
+ <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
|
|
|
c1c534 |
+ <memory unit='KiB'>524288</memory>
|
|
|
c1c534 |
+ <vcpu placement='static'>1</vcpu>
|
|
|
c1c534 |
+ <os>
|
|
|
c1c534 |
+ <type arch='ppc64' machine='pseries'>hvm</type>
|
|
|
c1c534 |
+ </os>
|
|
|
c1c534 |
+ <devices>
|
|
|
c1c534 |
+ <emulator>/usr/bin/qemu-system-ppc64</emulator>
|
|
|
c1c534 |
+ <controller type='usb' model='qemu-xhci'/>
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+ in the file generated by qemuxml2xmltest due to limitations in the
|
|
|
c1c534 |
+ test suite, but it will be there when actually running libvirt;
|
|
|
c1c534 |
+ moreover, the USB address will be present in the .args file -->
|
|
|
c1c534 |
+ <serial type='pty'>
|
|
|
c1c534 |
+ <target type='usb-serial'/>
|
|
|
c1c534 |
+ </serial>
|
|
|
c1c534 |
+ <memballoon model='none'/>
|
|
|
c1c534 |
+ </devices>
|
|
|
c1c534 |
+</domain>
|
|
|
c1c534 |
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
|
|
c1c534 |
index 4b63dd141d..2b3bbd1b8b 100644
|
|
|
c1c534 |
--- a/tests/qemuxml2argvtest.c
|
|
|
c1c534 |
+++ b/tests/qemuxml2argvtest.c
|
|
|
c1c534 |
@@ -1884,6 +1884,13 @@ mymain(void)
|
|
|
c1c534 |
DO_TEST("pseries-serial-compat",
|
|
|
c1c534 |
QEMU_CAPS_NODEFCONFIG,
|
|
|
c1c534 |
QEMU_CAPS_DEVICE_SPAPR_VTY);
|
|
|
c1c534 |
+ DO_TEST("pseries-serial-pci",
|
|
|
c1c534 |
+ QEMU_CAPS_NODEFCONFIG,
|
|
|
c1c534 |
+ QEMU_CAPS_DEVICE_PCI_SERIAL);
|
|
|
c1c534 |
+ DO_TEST("pseries-serial-usb",
|
|
|
c1c534 |
+ QEMU_CAPS_NODEFCONFIG,
|
|
|
c1c534 |
+ QEMU_CAPS_DEVICE_QEMU_XHCI,
|
|
|
c1c534 |
+ QEMU_CAPS_DEVICE_USB_SERIAL);
|
|
|
c1c534 |
DO_TEST("pseries-console-native",
|
|
|
c1c534 |
QEMU_CAPS_NODEFCONFIG,
|
|
|
c1c534 |
QEMU_CAPS_DEVICE_SPAPR_VTY);
|
|
|
c1c534 |
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-pci.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-pci.xml
|
|
|
c1c534 |
new file mode 100644
|
|
|
c1c534 |
index 0000000000..cba7ea96bb
|
|
|
c1c534 |
--- /dev/null
|
|
|
c1c534 |
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-pci.xml
|
|
|
c1c534 |
@@ -0,0 +1,31 @@
|
|
|
c1c534 |
+<domain type='qemu'>
|
|
|
c1c534 |
+ <name>guest</name>
|
|
|
c1c534 |
+ <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
|
|
|
c1c534 |
+ <memory unit='KiB'>524288</memory>
|
|
|
c1c534 |
+ <currentMemory unit='KiB'>524288</currentMemory>
|
|
|
c1c534 |
+ <vcpu placement='static'>1</vcpu>
|
|
|
c1c534 |
+ <os>
|
|
|
c1c534 |
+ <type arch='ppc64' machine='pseries'>hvm</type>
|
|
|
c1c534 |
+ <boot dev='hd'/>
|
|
|
c1c534 |
+ </os>
|
|
|
c1c534 |
+ <clock offset='utc'/>
|
|
|
c1c534 |
+ <on_poweroff>destroy</on_poweroff>
|
|
|
c1c534 |
+ <on_reboot>restart</on_reboot>
|
|
|
c1c534 |
+ <on_crash>destroy</on_crash>
|
|
|
c1c534 |
+ <devices>
|
|
|
c1c534 |
+ <emulator>/usr/bin/qemu-system-ppc64</emulator>
|
|
|
c1c534 |
+ <controller type='usb' index='0' model='none'/>
|
|
|
c1c534 |
+ <controller type='pci' index='0' model='pci-root'>
|
|
|
c1c534 |
+ <model name='spapr-pci-host-bridge'/>
|
|
|
c1c534 |
+ <target index='0'/>
|
|
|
c1c534 |
+ </controller>
|
|
|
c1c534 |
+ <serial type='pty'>
|
|
|
c1c534 |
+ <target type='pci-serial' port='0'>
|
|
|
c1c534 |
+ <model name='pci-serial'/>
|
|
|
c1c534 |
+ </target>
|
|
|
c1c534 |
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
|
|
|
c1c534 |
+ </serial>
|
|
|
c1c534 |
+ <memballoon model='none'/>
|
|
|
c1c534 |
+ <panic model='pseries'/>
|
|
|
c1c534 |
+ </devices>
|
|
|
c1c534 |
+</domain>
|
|
|
c1c534 |
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-usb.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-usb.xml
|
|
|
c1c534 |
new file mode 100644
|
|
|
c1c534 |
index 0000000000..34f651308d
|
|
|
c1c534 |
--- /dev/null
|
|
|
c1c534 |
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-usb.xml
|
|
|
c1c534 |
@@ -0,0 +1,32 @@
|
|
|
c1c534 |
+<domain type='qemu'>
|
|
|
c1c534 |
+ <name>guest</name>
|
|
|
c1c534 |
+ <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
|
|
|
c1c534 |
+ <memory unit='KiB'>524288</memory>
|
|
|
c1c534 |
+ <currentMemory unit='KiB'>524288</currentMemory>
|
|
|
c1c534 |
+ <vcpu placement='static'>1</vcpu>
|
|
|
c1c534 |
+ <os>
|
|
|
c1c534 |
+ <type arch='ppc64' machine='pseries'>hvm</type>
|
|
|
c1c534 |
+ <boot dev='hd'/>
|
|
|
c1c534 |
+ </os>
|
|
|
c1c534 |
+ <clock offset='utc'/>
|
|
|
c1c534 |
+ <on_poweroff>destroy</on_poweroff>
|
|
|
c1c534 |
+ <on_reboot>restart</on_reboot>
|
|
|
c1c534 |
+ <on_crash>destroy</on_crash>
|
|
|
c1c534 |
+ <devices>
|
|
|
c1c534 |
+ <emulator>/usr/bin/qemu-system-ppc64</emulator>
|
|
|
c1c534 |
+ <controller type='usb' index='0' model='qemu-xhci'>
|
|
|
c1c534 |
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
|
|
|
c1c534 |
+ </controller>
|
|
|
c1c534 |
+ <controller type='pci' index='0' model='pci-root'>
|
|
|
c1c534 |
+ <model name='spapr-pci-host-bridge'/>
|
|
|
c1c534 |
+ <target index='0'/>
|
|
|
c1c534 |
+ </controller>
|
|
|
c1c534 |
+ <serial type='pty'>
|
|
|
c1c534 |
+ <target type='usb-serial' port='0'>
|
|
|
c1c534 |
+ <model name='usb-serial'/>
|
|
|
c1c534 |
+ </target>
|
|
|
c1c534 |
+ </serial>
|
|
|
c1c534 |
+ <memballoon model='none'/>
|
|
|
c1c534 |
+ <panic model='pseries'/>
|
|
|
c1c534 |
+ </devices>
|
|
|
c1c534 |
+</domain>
|
|
|
c1c534 |
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
|
|
|
c1c534 |
index ad429ead4d..f76bd5a68d 100644
|
|
|
c1c534 |
--- a/tests/qemuxml2xmltest.c
|
|
|
c1c534 |
+++ b/tests/qemuxml2xmltest.c
|
|
|
c1c534 |
@@ -775,6 +775,13 @@ mymain(void)
|
|
|
c1c534 |
DO_TEST("pseries-serial-compat",
|
|
|
c1c534 |
QEMU_CAPS_NODEFCONFIG,
|
|
|
c1c534 |
QEMU_CAPS_DEVICE_SPAPR_VTY);
|
|
|
c1c534 |
+ DO_TEST("pseries-serial-pci",
|
|
|
c1c534 |
+ QEMU_CAPS_NODEFCONFIG,
|
|
|
c1c534 |
+ QEMU_CAPS_DEVICE_PCI_SERIAL);
|
|
|
c1c534 |
+ DO_TEST("pseries-serial-usb",
|
|
|
c1c534 |
+ QEMU_CAPS_NODEFCONFIG,
|
|
|
c1c534 |
+ QEMU_CAPS_DEVICE_QEMU_XHCI,
|
|
|
c1c534 |
+ QEMU_CAPS_DEVICE_USB_SERIAL);
|
|
|
c1c534 |
DO_TEST("pseries-console-native",
|
|
|
c1c534 |
QEMU_CAPS_NODEFCONFIG,
|
|
|
c1c534 |
QEMU_CAPS_DEVICE_SPAPR_VTY);
|
|
|
c1c534 |
--
|
|
|
c1c534 |
2.15.1
|
|
|
c1c534 |
|