From nobody Sat Nov 23 18:33:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=none dis=none) header.from=szczek.dev ARC-Seal: i=1; a=rsa-sha256; t=1723454013; cv=none; d=zohomail.com; s=zohoarc; b=B+X9qGw++BJKZ4vngw/vlSQ7GEl4PQZvVW7RdEdJbZaa+yrVd5zL1cWOMab2DaXDAa0elmddKIZ9g7h1l/ebqtKUTM5fv0lWuCUXcGE793FLsLEdAvtxDGbh4eW/Y2140nGhpzJcJCiOOxnpuQBXkaKP4zrjVwQeo9f5nYrTZcI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723454013; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=ZzmzYper7+P0hGk5nS0+SyZX/JircJb84vge38Ixg/c=; b=U2ZVM5JM1u/E8MeILBvJbCoQQ0rhpsQ1aIfZ1LsNy0qekOwfeRe7L5EVVNjMRRTMg9anR3i9QlP+pM6FmBxHeZcihTg9J0paqeQSkuedF1+3B43U2FKoorR8QZak54Yw++LTDGwmgqNMzKaxhKLmgLXXFFlFl7jzFNqmFjax71o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1723454012999833.4771162397249; Mon, 12 Aug 2024 02:13:32 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EB87D1612; Mon, 12 Aug 2024 05:13:31 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id B994915E5; Mon, 12 Aug 2024 05:09:03 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1EFA513C8; Sun, 11 Aug 2024 12:57:29 -0400 (EDT) Received: from mail-4018.proton.ch (mail-4018.proton.ch [185.70.40.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 3EF41130F for ; Sun, 11 Aug 2024 12:57:28 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-Greylist: delayed 175 seconds by postgrey-1.37 at lists.libvirt.org; Sun, 11 Aug 2024 12:57:28 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szczek.dev; s=protonmail3; t=1723395447; x=1723654647; bh=ZzmzYper7+P0hGk5nS0+SyZX/JircJb84vge38Ixg/c=; h=Date:To:From:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=GOCsvlD9ULV5GPRxd0crI/IErjQ+vlHl2Dy2xzZuBLoeK2uSub+9X/icqAY+lE73R HAEou0hgL2yuYVg1Q4MasQUWeyoz5F7l87/UY4LTMeJ9rfmedprxJduKjzI6VmMFJK losQ4ti7gYYvhM68I2ZvMi/PnG+yfe372rbnDhJhqvxXQqq5/qQPZKLv1fdiflos21 dg9utBKRPlxgU3RYN1OPAiJCViS2yNUtcPMPa8fc43cvCvduyfHOvqCvFsjhOMu2ul +5+JLXiEmsSoA0nl6fG2Fjvuzd/UBhEWlY9vz/F+ZFSOW+SKCQdd49Z7+wwcmFEbto d/9lJyaSAZ5TA== Date: Sun, 11 Aug 2024 16:57:24 +0000 To: "devel@lists.libvirt.org" From: =?utf-8?Q?Kamil_Szcz=C4=99k?= Subject: [PATCH v2 4/6] qemu: Introduce 'ps2' feature Message-ID: In-Reply-To: References: Feedback-ID: 37679334:user:proton X-Pm-Message-ID: 9431b8e0b2788af19b437826b5940eeb57dc1ba0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-MailFrom: kamil@szczek.dev X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 Message-ID-Hash: 3ZQSCSEJ5JLLOAKORZZDQWYLAJN7IUCQ X-Message-ID-Hash: 3ZQSCSEJ5JLLOAKORZZDQWYLAJN7IUCQ X-Mailman-Approved-At: Mon, 12 Aug 2024 09:08:49 -0400 X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: pass (identity @szczek.dev) X-ZM-MESSAGEID: 1723454015077116600 Content-Type: text/plain; charset="utf-8" This introduces a new 'ps2' feature which, when disabled, results in no implicit PS/2 bus input devices being automatically added to the domain and addition of the 'i8042=3Doff' machine option to the QEMU command-line. A notable side effect of disabling the i8042 controller in QEMU is that the vmport device won't be created. For this reason we will not allow setting the vmport feature if the ps2 feature is explicitly disabled. Signed-off-by: Kamil Szcz=C4=99k --- docs/formatdomain.rst | 5 +++++ src/conf/domain_conf.c | 6 +++++- src/conf/domain_conf.h | 1 + src/conf/domain_validate.c | 23 +++++++++++++++++++++++ src/conf/schemas/domaincommon.rng | 5 +++++ src/qemu/qemu_command.c | 5 +++++ src/qemu/qemu_domain.c | 3 ++- src/qemu/qemu_validate.c | 23 +++++++++++++++++++++++ 8 files changed, 69 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index e1e219bcb5..12c34887dd 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2262,6 +2262,11 @@ are: exceptions when enabled (``on``). If the attribute is not defined, the hypervisor default will be used. :since:`Since 10.4.0` (QEMU/KVM and ARM virt guests only) +``ps2`` + Depending on the ``state`` attribute (values ``on``, ``off``) enable or + disable the emulation of a PS/2 controller used by ``ps2`` bus input de= vices. + If the attribute is not defined, the hypervisor default will be used. + :since:`Since 10.7.0` (QEMU only) =20 Time keeping ------------ diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d950921667..a897b0b727 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -185,6 +185,7 @@ VIR_ENUM_IMPL(virDomainFeature, "tcg", "async-teardown", "ras", + "ps2", ); =20 VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, @@ -17019,7 +17020,8 @@ virDomainFeaturesDefParse(virDomainDef *def, case VIR_DOMAIN_FEATURE_HTM: case VIR_DOMAIN_FEATURE_NESTED_HV: case VIR_DOMAIN_FEATURE_CCF_ASSIST: - case VIR_DOMAIN_FEATURE_RAS: { + case VIR_DOMAIN_FEATURE_RAS: + case VIR_DOMAIN_FEATURE_PS2: { virTristateSwitch state; =20 if (virXMLPropTristateSwitch(nodes[i], "state", @@ -20883,6 +20885,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDef = *src, case VIR_DOMAIN_FEATURE_NESTED_HV: case VIR_DOMAIN_FEATURE_CCF_ASSIST: case VIR_DOMAIN_FEATURE_RAS: + case VIR_DOMAIN_FEATURE_PS2: if (src->features[i] !=3D dst->features[i]) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("State of feature '%1$s' differs: source:= '%2$s', destination: '%3$s'"), @@ -27685,6 +27688,7 @@ virDomainDefFormatFeatures(virBuffer *buf, case VIR_DOMAIN_FEATURE_NESTED_HV: case VIR_DOMAIN_FEATURE_CCF_ASSIST: case VIR_DOMAIN_FEATURE_RAS: + case VIR_DOMAIN_FEATURE_PS2: switch ((virTristateSwitch) def->features[i]) { case VIR_TRISTATE_SWITCH_LAST: case VIR_TRISTATE_SWITCH_ABSENT: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index eae621f900..f65cdd87b6 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2181,6 +2181,7 @@ typedef enum { VIR_DOMAIN_FEATURE_TCG, VIR_DOMAIN_FEATURE_ASYNC_TEARDOWN, VIR_DOMAIN_FEATURE_RAS, + VIR_DOMAIN_FEATURE_PS2, =20 VIR_DOMAIN_FEATURE_LAST } virDomainFeature; diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 39b8d67928..56f1092841 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -2744,6 +2744,29 @@ virDomainInputDefValidate(const virDomainInputDef *i= nput, return -1; } =20 + switch ((virDomainInputBus) input->bus) { + case VIR_DOMAIN_INPUT_BUS_PS2: + if (def->features[VIR_DOMAIN_FEATURE_PS2] =3D=3D VIR_TRISTATE_SWIT= CH_OFF) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("ps2 bus inputs require the ps2 feature not t= o be disabled")); + return -1; + } + break; + + case VIR_DOMAIN_INPUT_BUS_DEFAULT: + case VIR_DOMAIN_INPUT_BUS_USB: + case VIR_DOMAIN_INPUT_BUS_XEN: + case VIR_DOMAIN_INPUT_BUS_PARALLELS: + case VIR_DOMAIN_INPUT_BUS_VIRTIO: + case VIR_DOMAIN_INPUT_BUS_NONE: + break; + + case VIR_DOMAIN_INPUT_BUS_LAST: + default: + virReportEnumRangeError(virDomainInputBus, input->bus); + return -1; + } + return 0; } =20 diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index 05ba697924..a71f1d97b9 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -6917,6 +6917,11 @@ + + + + + diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 28914c9c34..bb6fee4bfd 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6888,6 +6888,11 @@ qemuAppendDomainFeaturesMachineParam(virBuffer *buf, virBufferAsprintf(buf, ",ras=3D%s", str); } =20 + if (def->features[VIR_DOMAIN_FEATURE_PS2] !=3D VIR_TRISTATE_SWITCH_ABS= ENT) { + const char *str =3D virTristateSwitchTypeToString(def->features[VI= R_DOMAIN_FEATURE_PS2]); + virBufferAsprintf(buf, ",i8042=3D%s", str); + } + return 0; } =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 2b4bb54efc..d1767c326d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3928,7 +3928,8 @@ static int qemuDomainDefAddImplicitInputDevice(virDomainDef *def, virQEMUCaps *qemuCaps) { - if (virQEMUCapsSupportsI8042(qemuCaps, def)) { + if (virQEMUCapsSupportsI8042(qemuCaps, def) && + def->features[VIR_DOMAIN_FEATURE_PS2] !=3D VIR_TRISTATE_SWITCH_OFF= ) { if (virDomainDefMaybeAddInput(def, VIR_DOMAIN_INPUT_TYPE_MOUSE, VIR_DOMAIN_INPUT_BUS_PS2) < 0) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 6f7aeababe..88774f5383 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -143,6 +143,13 @@ qemuValidateDomainDefFeatures(const virDomainDef *def, _("vmport is not available with this QEMU b= inary")); return -1; } + + if (def->features[i] =3D=3D VIR_TRISTATE_SWITCH_ON && + def->features[VIR_DOMAIN_FEATURE_PS2] =3D=3D VIR_TRISTATE_= SWITCH_OFF) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("vmport feature requires the ps2 feature = not to be disabled")); + return -1; + } break; =20 case VIR_DOMAIN_FEATURE_VMCOREINFO: @@ -242,6 +249,22 @@ qemuValidateDomainDefFeatures(const virDomainDef *def, } break; =20 + case VIR_DOMAIN_FEATURE_PS2: + if (def->features[i] !=3D VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsSupportsI8042(qemuCaps, def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("ps2 feature is not available with this Q= EMU binary")); + return -1; + } + + if (def->features[i] !=3D VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsSupportsI8042Toggle(qemuCaps, def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("ps2 feature state cannot be controlled w= ith this QEMU binary")); + return -1; + } + break; + case VIR_DOMAIN_FEATURE_SMM: case VIR_DOMAIN_FEATURE_KVM: case VIR_DOMAIN_FEATURE_XEN: --=20 2.45.0