From nobody Fri May 3 04:04:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1642685733; cv=none; d=zohomail.com; s=zohoarc; b=gk5t8uWc+M9M+bza6YyufTXYe3cUx2zf5m1OP4Tcy6sZHqRKwjm3rVoUHU1adCxrm23RS91tUsWkmAFDY19TQ/9r4ErU73vLn/ZlLlrwltO7dGrAVkPP9YGkbDwcVbjoL1lYsIGoct7ATcy/g7FJSSlftOtY20fZPWhWLdRG1XM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642685733; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vYOX+WkRSHwjIHx0/ZV3GgHk3FtvwhZcayfl5usHGio=; b=LUOmdITj96tgHtqLXORykFIcHqFY2MhMATTiIrJ8/ZesOlgK3w69TjIeKE+k1I4g93pjN/2cT0QcFC7V4KPc/8ztxz98jkqwN3ccIHsdG2Alh4uFmIH3cpMXCDy6rEYuD6Leei0XqUqgAg9nbdHr5HdbTe72et9KKVeAJc8LKtA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1642685733713970.8454051675883; Thu, 20 Jan 2022 05:35:33 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-45-vDrJMU0wOe-Y5rsBRnIouA-1; Thu, 20 Jan 2022 08:35:30 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id B2A33801B04; Thu, 20 Jan 2022 13:35:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 558897E225; Thu, 20 Jan 2022 13:35:25 +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 777B01809CBA; Thu, 20 Jan 2022 13:35:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20KDXIdA006121 for ; Thu, 20 Jan 2022 08:33:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 120F27E239; Thu, 20 Jan 2022 13:33:18 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5466E7E23C; Thu, 20 Jan 2022 13:33:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642685732; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=vYOX+WkRSHwjIHx0/ZV3GgHk3FtvwhZcayfl5usHGio=; b=bmSaK6ps7Y+meBLCu70F9ZcaCQSfKXxNEbB5wibtb3fUFC70Wgf9A51d8hBJZ3lp4Coy4E T+AU8LhfoK1PIIr1m4yi+yXZM6ZTGUMpVrNqznJXCvlHmricSEOb9qhFHGxcpJIFNY1xWs Y8Xq7B08Nu9FvqoYM9FJsMBcctuaAqY= X-MC-Unique: vDrJMU0wOe-Y5rsBRnIouA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/2] conf: support firmware ISA debug console Date: Thu, 20 Jan 2022 13:33:02 +0000 Message-Id: <20220120133303.452285-2-berrange@redhat.com> In-Reply-To: <20220120133303.452285-1-berrange@redhat.com> References: <20220120133303.452285-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1642685735838100001 Introduce support for which is used as a way to receive debug messages from the firmware on x86 platforms. The iobase port will default to 0x402 which is what SeaBIOS/OVMF expect normally. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Krempa --- docs/formatdomain.rst | 3 ++- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 23 +++++++++++++++++------ src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 1 + 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index acd9020830..9e4e5fd036 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -6483,7 +6483,8 @@ values for the ``type`` attribute are: ``serial`` (de= scribed below); ``virtio`` (usable for s390 and s390x QEMU guests) are supported for compatibility re= asons but should not be used for new guests: use the ``sclpconsole`` and ``sclplmconsole`` target models, respectively, with the ``serial`` element -instead. +instead. ``isa-debug`` provides a virtual console for receiving debug +messages from the firmware on x86 platforms. :since:`Since: 8.1.0`. =20 Of the target types listed above, ``serial`` is special in that it doesn't represents a separate device, but rather the same device as the first ``se= rial`` diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 169b8d8dee..4ff3bcda24 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4387,6 +4387,7 @@ openvz sclp sclplm + isa-debug diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 393f9d9478..c73085a513 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -672,6 +672,7 @@ VIR_ENUM_IMPL(virDomainChrConsoleTarget, "openvz", "sclp", "sclplm", + "isa-debug", ); =20 VIR_ENUM_IMPL(virDomainChrSerialTargetModel, @@ -5382,7 +5383,7 @@ virDomainChrIsaSerialDefPostParse(virDomainDef *def) } =20 =20 -static void +static int virDomainChrDefPostParse(virDomainChrDef *chr, const virDomainDef *def) { @@ -5391,9 +5392,18 @@ virDomainChrDefPostParse(virDomainChrDef *chr, =20 virDomainChrGetDomainPtrs(def, chr->deviceType, &arrPtr, &cnt); =20 - if (chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE && - chr->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE) { - chr->targetType =3D VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL; + if (chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE) { + switch (chr->targetType) { + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE: + chr->targetType =3D VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL; + break; + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_ISA_DEBUG: + if (!ARCH_IS_X86(def->os.arch)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("isa-debug console type only valid on x86= architecture")); + return -1; + } + } } =20 if (chr->target.port =3D=3D -1 && @@ -5409,6 +5419,8 @@ virDomainChrDefPostParse(virDomainChrDef *chr, =20 chr->target.port =3D maxport + 1; } + + return 0; } =20 =20 @@ -5620,8 +5632,7 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDef = *dev, =20 switch ((virDomainDeviceType)dev->type) { case VIR_DOMAIN_DEVICE_CHR: - virDomainChrDefPostParse(dev->data.chr, def); - ret =3D 0; + ret =3D virDomainChrDefPostParse(dev->data.chr, def); break; =20 case VIR_DOMAIN_DEVICE_RNG: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e2f35fe20b..7f845b609d 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1183,6 +1183,7 @@ typedef enum { VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ, VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP, VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM, + VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_ISA_DEBUG, =20 VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST } virDomainChrConsoleTargetType; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 60b4f96e06..030c27b963 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10845,6 +10845,7 @@ qemuBuildConsoleChrDeviceProps(const virDomainDef *= def, case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML: case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC: case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_ISA_DEBUG: case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unsupported console target type %s"), --=20 2.33.1 From nobody Fri May 3 04:04:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1642685741; cv=none; d=zohomail.com; s=zohoarc; b=lKxZwbrbEikaDNeurTS9aBIaUcY+8HD7mWXMC7mBdje8BgPGtHK941ZHRYYXc1Qiz1suek+1DjhIECVh5yfftnBDmkKXdqtoGVTWf7LQf2Xd1v76hE6jdh1yhIevpefJEo620YCkyosFmvXICpnwX+dJgp6BXmPSEdDsQdvEKHc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642685741; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CaPRFd4WRjNBwC2T794IIRbFNZiq6IB1nqAoaygjT5M=; b=nDUkbm9gSdQjsYoqQI2H7npF6RqkxFPvXB7EJOXFZhYSY9y5wYfZF5ufoINoo/eqlGucKKQCLQA+WhZ5cydHoLlTI0asHSeQoZSGbjbnf6Hv2rFehzRITRknxuBeMuY5BhJyQxllzRebMTm7SR5s45tCEUmyTP2oX6/JsWKi184= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 164268574138388.11670238436773; Thu, 20 Jan 2022 05:35:41 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-632-kjAjJK4SMWyew4kl1CGcHQ-1; Thu, 20 Jan 2022 08:35:36 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2ED851091DA5; Thu, 20 Jan 2022 13:35:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 091177B6E5; Thu, 20 Jan 2022 13:35:31 +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 C2F32180B654; Thu, 20 Jan 2022 13:35:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20KDXgNS006165 for ; Thu, 20 Jan 2022 08:33:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0F1BC7E20D; Thu, 20 Jan 2022 13:33:42 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id 478247E668; Thu, 20 Jan 2022 13:33:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642685740; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=CaPRFd4WRjNBwC2T794IIRbFNZiq6IB1nqAoaygjT5M=; b=KlPwkj8sFOQ5Q75EVASh2qoTBpXpicrHnzJotb38cnKn5knMLjjgH+9vYvz/WuY61xeY5t L1pyd2NdtawckQBqaPYcAKdEHxLEbQOO4YEoIei18punN2vXfDm3kWlXtCs/mRd5B/Mp4Z COZmke2Z57BSwbCyNj8fQ60f6iF+Jno= X-MC-Unique: kjAjJK4SMWyew4kl1CGcHQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/2] qemu: wire up support for isa-debugcon Date: Thu, 20 Jan 2022 13:33:03 +0000 Message-Id: <20220120133303.452285-3-berrange@redhat.com> In-Reply-To: <20220120133303.452285-1-berrange@redhat.com> References: <20220120133303.452285-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1642685742532100001 This wires up the command line generator so that it can emit the args needed to enable the ISA debug console in QEMU. No capability check is required since this has been around forever in QEMU and the conf parser rejects it on non-x86 configs already. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Krempa --- src/qemu/qemu_command.c | 36 +++++++++++++++-- src/qemu/qemu_domain_address.c | 25 ++++++++++++ src/qemu/qemu_validate.c | 18 ++++++++- .../debugcon.x86_64-latest.args | 39 +++++++++++++++++++ tests/qemuxml2argvdata/debugcon.xml | 27 +++++++++++++ tests/qemuxml2argvtest.c | 2 + 6 files changed, 141 insertions(+), 6 deletions(-) create mode 100644 tests/qemuxml2argvdata/debugcon.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/debugcon.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 030c27b963..b91998a5f5 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5634,6 +5634,27 @@ qemuBuildSclpDevProps(virDomainChrDef *dev) } =20 =20 +static virJSONValue * +qemuBuildISADebugDevProps(const virDomainDef *def, + virDomainChrDef *dev) +{ + g_autoptr(virJSONValue) props =3D NULL; + g_autofree char *chardev =3D g_strdup_printf("char%s", dev->info.alias= ); + + if (virJSONValueObjectAdd(&props, + "s:driver", "isa-debugcon", + "s:chardev", chardev, + "s:id", dev->info.alias, + NULL) < 0) + return NULL; + + if (qemuBuildDeviceAddressProps(props, def, &dev->info) < 0) + return NULL; + + return g_steal_pointer(&props); +} + + static int qemuBuildRNGBackendChrdev(virCommand *cmd, virDomainRNGDef *rng, @@ -9317,7 +9338,6 @@ qemuBuildChrDeviceCommandLine(virCommand *cmd, virQEMUCaps *qemuCaps) { g_autoptr(virJSONValue) props =3D NULL; - if (!(props =3D qemuBuildChrDeviceProps(def, chr, qemuCaps))) return -1; =20 @@ -9500,10 +9520,11 @@ qemuBuildConsoleCommandLine(virCommand *cmd, virDomainChrDef *console =3D def->consoles[i]; g_autofree char *charAlias =3D qemuAliasChardevFromDevAlias(consol= e->info.alias); =20 - switch (console->targetType) { + switch ((virDomainChrConsoleTargetType)console->targetType) { case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP: case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM: case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_ISA_DEBUG: if (qemuBuildChardevCommand(cmd, console->source, charAlias, @@ -9517,7 +9538,12 @@ qemuBuildConsoleCommandLine(virCommand *cmd, case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL: break; =20 - default: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST: return -1; } } @@ -10839,13 +10865,15 @@ qemuBuildConsoleChrDeviceProps(const virDomainDef= *def, case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO: return qemuBuildVirtioSerialPortDevProps(def, chr); =20 + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_ISA_DEBUG: + return qemuBuildISADebugDevProps(def, chr); + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL: case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE: case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN: case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML: case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC: case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ: - case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_ISA_DEBUG: case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unsupported console target type %s"), diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 18fc34d049..e97c612762 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -3174,6 +3174,28 @@ qemuDomainAssignUSBAddresses(virDomainDef *def, } =20 =20 +static int +qemuDomainAssignISAAddresses(virDomainDef *def) +{ + size_t i; + + for (i =3D 0; i < def->nconsoles; i++) { + virDomainChrDef *chr =3D def->consoles[i]; + + if (chr->targetType !=3D VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_ISA_DE= BUG) { + continue; + } + + if (chr->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { + chr->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA; + chr->info.addr.isa.iobase =3D 0x402; + } + } + + return 0; +} + + int qemuDomainAssignAddresses(virDomainDef *def, virQEMUCaps *qemuCaps, @@ -3201,6 +3223,9 @@ qemuDomainAssignAddresses(virDomainDef *def, if (qemuDomainAssignMemorySlots(def) < 0) return -1; =20 + if (qemuDomainAssignISAAddresses(def) < 0) + return -1; + return 0; } =20 diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index ae0ee4e744..fd25701fd3 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -862,7 +862,7 @@ qemuValidateDomainDefConsole(const virDomainDef *def, for (i =3D 0; i < def->nconsoles; i++) { virDomainChrDef *console =3D def->consoles[i]; =20 - switch (console->targetType) { + switch ((virDomainChrConsoleTargetType)console->targetType) { case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP: if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SCLPCONSOLE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -879,11 +879,25 @@ qemuValidateDomainDefConsole(const virDomainDef *def, } break; =20 + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_ISA_DEBUG: + if (console->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA= ) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("isa-debug console target must has ISA ad= dress type not %s"), + virDomainDeviceAddressTypeToString(console-= >info.type)); + return -1; + } + break; + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO: case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL: break; =20 - default: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unsupported console target type %s"), NULLSTR(virDomainChrConsoleTargetTypeToString(c= onsole->targetType))); diff --git a/tests/qemuxml2argvdata/debugcon.x86_64-latest.args b/tests/qem= uxml2argvdata/debugcon.x86_64-latest.args new file mode 100644 index 0000000000..fa6c422329 --- /dev/null +++ b/tests/qemuxml2argvdata/debugcon.x86_64-latest.args @@ -0,0 +1,39 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pc,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ram \ +-accel tcg \ +-cpu qemu64 \ +-m 214 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}'= \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","no= de-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ","file":"libvirt-1-storage"}' \ +-device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-form= at","id":"ide0-0-0","bootindex":1}' \ +-chardev pty,id=3Dcharconsole0 \ +-device '{"driver":"isa-debugcon","chardev":"charconsole0","id":"console0"= ,"iobase":1026}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","add= r":"0x2"}' \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/debugcon.xml b/tests/qemuxml2argvdata/d= ebugcon.xml new file mode 100644 index 0000000000..662284c79a --- /dev/null +++ b/tests/qemuxml2argvdata/debugcon.xml @@ -0,0 +1,27 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + +
+ + + +
+ + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 9d2de2a569..7100a4d7f1 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1257,6 +1257,8 @@ mymain(void) DO_TEST_NOCAPS("q35-noacpi-nouefi"); DO_TEST_NOCAPS("q35-acpi-nouefi"); =20 + DO_TEST_CAPS_LATEST("debugcon"); + DO_TEST_NOCAPS("clock-utc"); DO_TEST_NOCAPS("clock-localtime"); DO_TEST_NOCAPS("clock-localtime-basis-localtime"); --=20 2.33.1