From: Pino Toscano <ptoscano@xxxxxxxxxx> Introduce specific target types for the two console devices (sclp and sclplm) used in s390 and s390x guests, so isa-serial is no more used for them. This makes <serial> usable on s390 and s390x guests, with at most only a single sclpconsole and one sclplmconsole devices usable in a single guest (due to limitations in QEMU, which will enforce already at runtime). Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1449265 Signed-off-by: Pino Toscano <ptoscano@xxxxxxxxxx> --- docs/formatdomain.html.in | 5 ++-- docs/schemas/domaincommon.rng | 2 ++ src/conf/domain_conf.c | 4 +++ src/conf/domain_conf.h | 2 ++ src/qemu/qemu_command.c | 9 ++++++ src/qemu/qemu_domain.c | 14 ++++++++++ src/qemu/qemu_domain_address.c | 2 ++ .../qemuxml2argv-s390-serial-2.args | 24 ++++++++++++++++ .../qemuxml2argv-s390-serial-2.xml | 17 ++++++++++++ .../qemuxml2argv-s390-serial-console.args | 25 +++++++++++++++++ .../qemuxml2argv-s390-serial-console.xml | 15 ++++++++++ .../qemuxml2argvdata/qemuxml2argv-s390-serial.args | 22 +++++++++++++++ .../qemuxml2argvdata/qemuxml2argv-s390-serial.xml | 14 ++++++++++ tests/qemuxml2argvtest.c | 15 ++++++++++ .../qemuxml2xmlout-s390-serial-2.xml | 29 ++++++++++++++++++++ .../qemuxml2xmlout-s390-serial-console.xml | 32 ++++++++++++++++++++++ .../qemuxml2xmlout-s390-serial.xml | 26 ++++++++++++++++++ tests/qemuxml2xmltest.c | 6 ++++ 18 files changed, 261 insertions(+), 2 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-2.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 9f46b411a..7c819d8bf 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6528,8 +6528,9 @@ qemu-kvm -net nic,model=? /dev/null <code>type</code> attribute <span class="since">since 1.0.2</span> which can be used to pick between <code>isa-serial</code>, <code>usb-serial</code>, <code>pci-serial</code> and, - <span class="since">since 3.10.0</span>, <code>spapr-vty</code> and - <code>pl011</code>. + <span class="since">since 3.10.0</span>, <code>spapr-vty</code>, + <code>pl011</code>, <code>sclpconsole</code> and + <code>sclplmconsole</code>. Some values are not compatible with all architecture and machine types; if the value is missing altogether, libvirt will try to pick an appropriate default. diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 6dca83a62..26e4ee7fd 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3585,6 +3585,8 @@ <value>isa-serial</value> <value>usb-serial</value> <value>pci-serial</value> + <value>sclpconsole</value> + <value>sclplmconsole</value> <value>spapr-vty</value> <value>pl011</value> </choice> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index aadbfc0cd..ccd81ef97 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -452,6 +452,8 @@ VIR_ENUM_IMPL(virDomainChrSerialTarget, "pci-serial", "spapr-vty", "pl011", + "sclpconsole", + "sclplmconsole", ); VIR_ENUM_IMPL(virDomainChrChannelTarget, @@ -4045,6 +4047,8 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def) case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PL011: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLPLM: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: { /* Create a stub console to match the serial port. diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index ae239b09c..93a326018 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1087,6 +1087,8 @@ typedef enum { VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI, VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR, VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PL011, + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP, + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLPLM, VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST } virDomainChrSerialTargetType; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index fb6f69123..4897d0895 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10249,6 +10249,15 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, } break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLPLM: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCLP_S390)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("sclp/sclplm console requires QEMU to support s390-sclp")); + return -1; + } + break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PL011: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b506fedd0..a6467ba4b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3522,6 +3522,16 @@ qemuDomainChrDefValidate(const virDomainChrDef *dev, return -1; } + if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + (dev->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP || + dev->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLPLM) && + !ARCH_IS_S390(def->os.arch)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("sclp/sclplm serial devices are only supported on " + "s390 and s390x guests")); + return -1; + } + return 0; } @@ -4082,6 +4092,8 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR; } else if (qemuDomainIsVirt(def)) { chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PL011; + } else if (ARCH_IS_S390(def->os.arch)) { + chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP; } } @@ -5002,6 +5014,8 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver, case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLPLM: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: /* Nothing to do */ diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 4a7854740..374249e0a 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -785,6 +785,8 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PL011: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLPLM: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: return 0; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.args b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.args new file mode 100644 index 000000000..346dcd16b --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.args @@ -0,0 +1,24 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-s390x \ +-name QEMUGuest1 \ +-S \ +-M s390-ccw-virtio \ +-m 214 \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=readline \ +-boot c \ +-chardev pty,id=charserial0 \ +-device sclpconsole,chardev=charserial0,id=serial0 \ +-chardev pty,id=charserial1 \ +-device sclplmconsole,chardev=charserial1,id=serial1 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.xml b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.xml new file mode 100644 index 000000000..b5371372e --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.xml @@ -0,0 +1,17 @@ +<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="s390x" machine="s390-ccw-virtio">hvm</type> + </os> + <devices> + <emulator>/usr/bin/qemu-system-s390x</emulator> + <serial type='pty'/> + <serial type='pty'> + <target type='sclplmconsole'/> + </serial> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args new file mode 100644 index 000000000..c405fb59e --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args @@ -0,0 +1,25 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-s390x \ +-name QEMUGuest1 \ +-S \ +-M s390-ccw-virtio \ +-m 214 \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=readline \ +-boot c \ +-device virtio-serial-ccw,id=virtio-serial0,devno=fe.0.0000 \ +-chardev pty,id=charserial0 \ +-device sclpconsole,chardev=charserial0,id=serial0 \ +-chardev pty,id=charconsole1 \ +-device virtconsole,chardev=charconsole1,id=console1 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.xml b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.xml new file mode 100644 index 000000000..c841f1f24 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.xml @@ -0,0 +1,15 @@ +<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="s390x" machine="s390-ccw-virtio">hvm</type> + </os> + <devices> + <emulator>/usr/bin/qemu-system-s390x</emulator> + <serial type='pty'/> + <console type='pty'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.args b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.args new file mode 100644 index 000000000..20968f794 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.args @@ -0,0 +1,22 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-s390x \ +-name QEMUGuest1 \ +-S \ +-M s390-ccw-virtio \ +-m 214 \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=readline \ +-boot c \ +-chardev pty,id=charserial0 \ +-device sclpconsole,chardev=charserial0,id=serial0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.xml b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.xml new file mode 100644 index 000000000..55b45bac0 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.xml @@ -0,0 +1,14 @@ +<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="s390x" machine="s390-ccw-virtio">hvm</type> + </os> + <devices> + <emulator>/usr/bin/qemu-system-s390x</emulator> + <serial type='pty'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 24662cc09..a280a8a85 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2046,6 +2046,21 @@ mymain(void) QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); + DO_TEST("s390-serial", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_VIRTIO_CCW, + QEMU_CAPS_VIRTIO_S390, + QEMU_CAPS_SCLP_S390); + DO_TEST("s390-serial-2", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_VIRTIO_CCW, + QEMU_CAPS_VIRTIO_S390, + QEMU_CAPS_SCLP_S390); + DO_TEST("s390-serial-console", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_VIRTIO_CCW, + QEMU_CAPS_VIRTIO_S390, + QEMU_CAPS_SCLP_S390); DO_TEST("ppc-dtb", QEMU_CAPS_KVM, diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-2.xml new file mode 100644 index 000000000..5debc3fad --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-2.xml @@ -0,0 +1,29 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='s390x' machine='s390-ccw-virtio'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-s390x</emulator> + <serial type='pty'> + <target type='sclpconsole' port='0'/> + </serial> + <serial type='pty'> + <target type='sclplmconsole' port='1'/> + </serial> + <console type='pty'> + <target type='serial' port='0'/> + </console> + <memballoon model='none'/> + <panic model='s390'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xml new file mode 100644 index 000000000..f3364fa23 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xml @@ -0,0 +1,32 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='s390x' machine='s390-ccw-virtio'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-s390x</emulator> + <controller type='virtio-serial' index='0'> + <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/> + </controller> + <serial type='pty'> + <target type='sclpconsole' port='0'/> + </serial> + <console type='pty'> + <target type='serial' port='0'/> + </console> + <console type='pty'> + <target type='virtio' port='0'/> + </console> + <memballoon model='none'/> + <panic model='s390'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial.xml new file mode 100644 index 000000000..201156445 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial.xml @@ -0,0 +1,26 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='s390x' machine='s390-ccw-virtio'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-s390x</emulator> + <serial type='pty'> + <target type='sclpconsole' port='0'/> + </serial> + <console type='pty'> + <target type='serial' port='0'/> + </console> + <memballoon model='none'/> + <panic model='s390'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 9fb09316b..bf76d5986 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1155,6 +1155,12 @@ mymain(void) QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); DO_TEST("s390-panic-no-address", QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); + DO_TEST("s390-serial", + QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); + DO_TEST("s390-serial-2", + QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); + DO_TEST("s390-serial-console", + QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); DO_TEST("pcihole64", NONE); DO_TEST("pcihole64-gib", NONE); -- 2.13.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list