From nobody Sat May 4 13:57:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153537184119347.18220204915201; Mon, 27 Aug 2018 05:10:41 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2A305C050DEC; Mon, 27 Aug 2018 12:10:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA83760157; Mon, 27 Aug 2018 12:10:35 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id F29F54BB75; Mon, 27 Aug 2018 12:10:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w7RCAW3e031425 for ; Mon, 27 Aug 2018 08:10:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id EB4132026DFD; Mon, 27 Aug 2018 12:10:31 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4E69C2026D6B; Mon, 27 Aug 2018 12:10:29 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Mon, 27 Aug 2018 14:10:18 +0200 Message-Id: <20180827121018.11304-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: Introduce 16550A serial console model X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 27 Aug 2018 12:10:39 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" None of the existing models is suitable for use with RISC-V virt guests, and we don't want information about the serial console to be missing from the XML. The name is based on comments in qemu/hw/riscv/virt.c: RISC-V machine with 16550a UART and VirtIO MMIO and in qemu/hw/char/serial.c: QEMU 16550A UART emulation along with the output of dmesg in the guest: Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled 10000000.uart: ttyS0 at MMIO 0x10000000 (irq =3D 13, base_baud=3D 230400) is a 16550A Signed-off-by: Andrea Bolognani Reviewed-by: J=EF=BF=BDn Tomko --- CC'ing Rich mostly so that he can double-check the name choice is sensible. docs/formatdomain.html.in | 12 +++++----- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 1 + src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 12 ++++++++++ src/qemu/qemu_domain.c | 27 ++++++++++++++++------- tests/qemuxml2xmloutdata/riscv64-virt.xml | 4 +++- 7 files changed, 44 insertions(+), 14 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 0cbf570a13..eb619a1656 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -7011,7 +7011,8 @@ qemu-kvm -net nic,model=3D? /dev/null is available) and pci-serial (usable whenever PCI suppo= rt is available); since 3.10.0, spapr-vio-serial (usable with ppc64/pseries guests), - system-serial (usable with aarch64/virt guests) and + system-serial (usable with aarch64/virt and, + since 4.7.0, riscv/virt guests) and sclp-serial (usable with s390 and s390x guests) are available as well.

@@ -7025,10 +7026,11 @@ qemu-kvm -net nic,model=3D? /dev/null target type); pci-serial (usable with the pci-serial target type); spapr-vty (usable with the spapr-vio-serial - target type); pl011 (usable with the - system-serial target type); sclpconsole and - sclplmconsole (usable with the sclp-serial - target type). + target type); pl011 and, + since 4.7.0, 16550a (usable + with the system-serial target type); + sclpconsole and sclplmconsole (usable with + the sclp-serial target type).

=20

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index f176538195..3796eb4b5e 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3733,6 +3733,7 @@ pci-serial spapr-vty pl011 + 16550a sclpconsole sclplmconsole diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index bde9fef914..8af59bb4bb 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -493,6 +493,7 @@ VIR_ENUM_IMPL(virDomainChrSerialTargetModel, "pl011", "sclpconsole", "sclplmconsole", + "16550a", ); =20 VIR_ENUM_IMPL(virDomainChrDevice, VIR_DOMAIN_CHR_DEVICE_TYPE_LAST, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index c0ad072db5..8a3673361a 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1133,6 +1133,7 @@ typedef enum { VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011, VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE, VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE, + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16550A, =20 VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST } virDomainChrSerialTargetModel; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index fd9e58fd5d..f63e35444e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9149,6 +9149,7 @@ qemuChrSerialTargetModelToCaps(virDomainChrSerialTarg= etModel targetModel) return QEMU_CAPS_DEVICE_SCLPLMCONSOLE; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: return QEMU_CAPS_DEVICE_PL011; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16550A: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: break; @@ -9189,6 +9190,16 @@ qemuChrIsPlatformDevice(const virDomainDef *def, } } =20 + if (ARCH_IS_RISCV(def->os.arch)) { + + /* 16550a (used by riscv/virt guests) is a platform device */ + if (chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + chr->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTE= M && + chr->targetModel =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_165= 50A) { + return true; + } + } + /* If we got all the way here and we're still stuck with the default * target type for a serial device, it means we have no clue what kind= of * device we're talking about and we must treat it as a platform devic= e. */ @@ -10579,6 +10590,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, break; =20 case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16550A: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: /* Except from _LAST, which is just a guard value and will never diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 886e3fbb72..1cc4cefbd1 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4183,6 +4183,7 @@ qemuDomainChrSerialTargetModelToTargetType(int target= Model) case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16550A: return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE: @@ -4248,6 +4249,7 @@ qemuDomainChrTargetDefValidate(const virDomainChrDef = *chr) case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16550A: =20 expected =3D qemuDomainChrSerialTargetModelToTargetType(chr->t= argetModel); =20 @@ -4298,18 +4300,23 @@ qemuDomainChrDefValidate(const virDomainChrDef *dev, if (dev->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) { bool isCompatible =3D true; =20 + if (dev->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTE= M) { + if (dev->targetModel =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL= _PL011 && + !qemuDomainIsARMVirt(def)) { + isCompatible =3D false; + } + if (dev->targetModel =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL= _16550A && + !qemuDomainIsRISCVVirt(def)) { + isCompatible =3D false; + } + } + if (!qemuDomainIsPSeries(def) && (dev->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAP= R_VIO || dev->targetModel =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SP= APR_VTY)) { isCompatible =3D false; } =20 - if (!qemuDomainIsARMVirt(def) && - (dev->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYST= EM || - dev->targetModel =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL= 011)) { - isCompatible =3D false; - } - if (!ARCH_IS_S390(def->os.arch) && (dev->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP= || dev->targetModel =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SC= LPCONSOLE || @@ -6129,7 +6136,7 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; } else if (qemuDomainIsPSeries(def)) { chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VI= O; - } else if (qemuDomainIsARMVirt(def)) { + } else if (qemuDomainIsARMVirt(def) || qemuDomainIsRISCVVirt(def))= { chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM; } else if (ARCH_IS_S390(def->os.arch)) { chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP; @@ -6153,7 +6160,11 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, chr->targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_= VTY; break; case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: - chr->targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011; + if (qemuDomainIsARMVirt(def)) { + chr->targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL= 011; + } else if (qemuDomainIsRISCVVirt(def)) { + chr->targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16= 550A; + } break; case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP: chr->targetModel =3D VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCO= NSOLE; diff --git a/tests/qemuxml2xmloutdata/riscv64-virt.xml b/tests/qemuxml2xmlo= utdata/riscv64-virt.xml index 822a59a604..daf9ca4978 100644 --- a/tests/qemuxml2xmloutdata/riscv64-virt.xml +++ b/tests/qemuxml2xmloutdata/riscv64-virt.xml @@ -24,7 +24,9 @@ - + + + --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list