From nobody Sat Jul 12 09:27:55 2025 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1510746640375978.3254382736149; Wed, 15 Nov 2017 03:50:40 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B5C7C4C380; Wed, 15 Nov 2017 11:50:38 +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 8BFB89ECF7; Wed, 15 Nov 2017 11:50:38 +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 50E6C3D38A; Wed, 15 Nov 2017 11:50:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAFBoTO0022438 for ; Wed, 15 Nov 2017 06:50:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id E9DBC121F32; Wed, 15 Nov 2017 11:50:29 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.219]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6E52A121F22 for ; Wed, 15 Nov 2017 11:50:29 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 15 Nov 2017 12:50:08 +0100 Message-Id: <20171115115017.10092-6-abologna@redhat.com> In-Reply-To: <20171115115017.10092-1-abologna@redhat.com> References: <20171115115017.10092-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/14] conf: Introduce VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 15 Nov 2017 11:50:39 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This is the first step in getting rid of the assumption that isa-serial is the default target type for serial devices. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- src/conf/domain_conf.c | 8 +++++--- src/conf/domain_conf.h | 3 ++- src/qemu/qemu_command.c | 13 +++++++++++++ src/qemu/qemu_domain.c | 21 +++++++++++++++++++++ src/qemu/qemu_domain_address.c | 1 + 5 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index bd3a23c0a..23ae68b9a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -446,6 +446,7 @@ VIR_ENUM_IMPL(virDomainChrDeviceState, VIR_DOMAIN_CHR_D= EVICE_STATE_LAST, =20 VIR_ENUM_IMPL(virDomainChrSerialTarget, VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST, + "none", "isa-serial", "usb-serial", "pci-serial") @@ -4014,7 +4015,7 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def) =20 /* modify it to be a serial port */ def->serials[0]->deviceType =3D VIR_DOMAIN_CHR_DEVICE_TYPE_SER= IAL; - def->serials[0]->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_T= YPE_ISA; + def->serials[0]->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_T= YPE_NONE; def->serials[0]->target.port =3D 0; } else { /* if the console source doesn't match */ @@ -4038,7 +4039,8 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def) def->serials[0]->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TY= PE_SERIAL) { =20 switch ((virDomainChrSerialTargetType) def->serials[0]->targetType= ) { - case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: { + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: { =20 /* Create a stub console to match the serial port. * console[0] either does not exist @@ -11479,7 +11481,7 @@ virDomainChrDefaultTargetType(int devtype) return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE; =20 case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: - return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE; =20 case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL: case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 41443a02c..645845dfc 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1081,7 +1081,8 @@ typedef enum { } virDomainChrDeviceType; =20 typedef enum { - VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA =3D 0, + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE =3D 0, + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA, VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB, VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI, =20 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 010c2992f..60bdcfb2a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9143,6 +9143,14 @@ qemuChrIsPlatformDevice(const virDomainDef *def, return true; } =20 + /* 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 */ + if (chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + chr->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE) { + return true; + } + return false; } =20 @@ -10246,7 +10254,12 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, } break; =20 + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + /* Except from _LAST, which is just a guard value and will nev= er + * be used, all of the above are platform devices, which means + * qemuBuildSerialCommandLine() will have taken the appropriate + * branch and we will not have ended up here */ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid target type for serial device")); goto error; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 2d5eee01e..15ab51dbd 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4047,6 +4047,27 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, chr->targetType =3D VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO; } =20 + /* Historically, isa-serial and the default matched, so in order to + * maintain backwards compatibility we map them here. The actual defau= lt + * will be picked below based on the architecture and machine type */ + if (chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + chr->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA) { + chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE; + } + + /* Set the default serial type */ + if (chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + chr->targetType =3D=3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE) { + if (ARCH_IS_X86(def->os.arch)) { + chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; + } else if (qemuDomainIsPSeries(def)) { + /* Setting TYPE_ISA here is just a temporary hack to reduce te= st + * suite churn. Later on we will have a proper serial type for + * pSeries and this line will be updated accordingly */ + chr->targetType =3D VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; + } + } + return 0; } =20 diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 7f4ac0f45..989c0e6c9 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -782,6 +782,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevic= eDefPtr dev, =20 case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: return 0; } --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list