From nobody Wed Nov 27 08:43:40 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=1724056811; cv=none; d=zohomail.com; s=zohoarc; b=e5jIgUijfoI3dxl6B8UcLtDccrfl2SdPK3OXQP+bVSUwWlMn2abZ21HcU0dCnDTQnzgU4BH/dAg2OOdKfmrYm4lpjNdkHU2OmzircVsxYxPdH55f3tXraFqHDD14PzQglRIURT/eLZZZAGrJShbWRo24nXZ/IX+L6LvAHlwHPnI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724056811; 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=FcOj+8X39Sc7S51d0YOQwNI+acPzjtoMALb2Z+NGzv4=; b=ZcPzUe3uLNm6u7kvrxJUz8wsn3NNGuG2p+drw1MVGPE7svewW98ui6UaNSrSrxOayZUwe2+BKqY//mVZsEcG5Ti01jXM23/vYu1n66TSDAxGMdJl2Tb0BGjP54C1R2IY725RaLBUjSckvdi7U6y6JLNX1X/6YfSAEwbXqxaKxp0= 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 1724056811144947.987658308874; Mon, 19 Aug 2024 01:40:11 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1F9D615CA; Mon, 19 Aug 2024 04:40:10 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id D9E3815F1; Mon, 19 Aug 2024 04:38:24 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 7A4EA1409; Sun, 18 Aug 2024 21:18:03 -0400 (EDT) Received: from mail-4317.proton.ch (mail-4317.proton.ch [185.70.43.17]) (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 D7C7B1400 for ; Sun, 18 Aug 2024 21:18:02 -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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szczek.dev; s=protonmail; t=1724030281; x=1724289481; bh=FcOj+8X39Sc7S51d0YOQwNI+acPzjtoMALb2Z+NGzv4=; 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=UF69Ui+FncudqTXk+r59PGZ54fP6RTFeZF4rqXznQMp3OIJ9koryFOKh5LfiYpzSq uasQ/Ot3UX6CwfVuLrSl4+om7TKX5mJh/KY3v8cm3G2lAR9/aLcwQ/omXRnoxCZvlw 7TkTuoX0Juu1pyuWj678Mnd8jqIj3XYKHIfiFryEvUN4UemlGuUPFsxnr4O6ME6G5A w5i0zWlTw73xKCYjxqtgGKzgRvnfV4ioCOCsLu+GiZfCpmYa+vvemY+9MJfY3sioCv eBPWwWVhDZ5ZLRK5cj4Srmi0ptTWtbgRG58f9MjhPiZl69M0FSe/3mLUftiggX8CbX k7NPB1yZS2pRw== Date: Mon, 19 Aug 2024 01:17:56 +0000 To: "devel@lists.libvirt.org" From: =?utf-8?Q?Kamil_Szcz=C4=99k?= Subject: [PATCH v3 2/6] qemu_capabilities: Introduce QEMU_CAPS_MACHINE_I8042_OPT Message-ID: In-Reply-To: References: Feedback-ID: 37679334:user:proton X-Pm-Message-ID: e4761da4a1cb1a5e8af4bd961517a9a8f29c2a6a 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: 2KXDGZWJQNSZSUF4MLOBXUUMU5CB4QQS X-Message-ID-Hash: 2KXDGZWJQNSZSUF4MLOBXUUMU5CB4QQS X-Mailman-Approved-At: Mon, 19 Aug 2024 08:38:18 -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: 1724056812040116600 Content-Type: text/plain; charset="utf-8" This capability tells us whether given QEMU binary supports the '-machine xxx,i8042=3Don/off' toggle used to enable/disable PS/2 controller emulation. A few facts: - This option was introduced in QEMU 7.0 and defaults to 'on' - QEMU versions before 7.0 enabled i8042 controller emulation implicitly - This option (and i8042 controller emulation itself) is only supported by descendants of the generic PC machine type (e.g. i440fx, q35, etc.) Signed-off-by: Kamil Szcz=C4=99k --- src/qemu/qemu_capabilities.c | 22 ++++++++++++++++++++++ src/qemu/qemu_capabilities.h | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index dd833fb3ff..2d53e87ff3 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -714,6 +714,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "netdev.user", /* QEMU_CAPS_NETDEV_USER */ "acpi-erst", /* QEMU_CAPS_DEVICE_ACPI_ERST */ "intel-iommu.dma-translation", /* QEMU_CAPS_INTEL_IOMMU_DMA_= TRANSLATION */ + "machine-i8042-opt", /* QEMU_CAPS_MACHINE_I8042_OPT */ ); =20 =20 @@ -1747,6 +1748,10 @@ static struct virQEMUCapsStringFlags virQEMUCapsMach= inePropsGeneric[] =3D { { "confidential-guest-support", QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SU= PPORT }, }; =20 +static struct virQEMUCapsStringFlags virQEMUCapsMachinePropsGenericPC[] = =3D { + { "i8042", QEMU_CAPS_MACHINE_I8042_OPT }, +}; + static virQEMUCapsObjectTypeProps virQEMUCapsMachineProps[] =3D { { "pseries", virQEMUCapsMachinePropsPSeries, G_N_ELEMENTS(virQEMUCapsMachinePropsPSeries), @@ -1757,6 +1762,9 @@ static virQEMUCapsObjectTypeProps virQEMUCapsMachineP= rops[] =3D { { "none", virQEMUCapsMachinePropsGeneric, G_N_ELEMENTS(virQEMUCapsMachinePropsGeneric), -1 }, + { "generic-pc", virQEMUCapsMachinePropsGenericPC, + G_N_ELEMENTS(virQEMUCapsMachinePropsGenericPC), + -1 }, }; =20 static void @@ -2893,6 +2901,7 @@ virQEMUCapsProbeQMPMachineProps(virQEMUCaps *qemuCaps, g_auto(GStrv) values =3D NULL; =20 if (STRNEQ(canon, "none") && + (!ARCH_IS_X86(qemuCaps->arch) || STRNEQ(canon, "generic-pc")) = && !virQEMUCapsIsMachineSupported(qemuCaps, virtType, canon)) { continue; } @@ -6021,6 +6030,19 @@ virQEMUCapsSupportsI8042(virQEMUCaps *qemuCaps, STREQ(def->os.machine, "isapc"); } =20 +bool +virQEMUCapsSupportsI8042Toggle(virQEMUCaps *qemuCaps, + const virDomainDef *def) +{ + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_I8042_OPT)) + return false; + + return qemuDomainIsI440FX(def) || + qemuDomainIsQ35(def) || + qemuDomainIsXenFV(def) || + STREQ(def->os.machine, "isapc"); +} + =20 /* * The preferred machine to use if none is listed explicitly diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 659efd9182..9c577c1505 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -693,6 +693,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_NETDEV_USER, /* -netdev user */ QEMU_CAPS_DEVICE_ACPI_ERST, /* -device acpi-erst */ QEMU_CAPS_INTEL_IOMMU_DMA_TRANSLATION, /* intel-iommu.dma-translation = */ + QEMU_CAPS_MACHINE_I8042_OPT, /* -machine xxx,i8042=3Don/off; use virQE= MUCapsSupportsI8042Toggle() to query this capability */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; @@ -721,6 +722,9 @@ bool virQEMUCapsSupportsVmport(virQEMUCaps *qemuCaps, bool virQEMUCapsSupportsI8042(virQEMUCaps *qemuCaps, const virDomainDef *def); =20 +bool virQEMUCapsSupportsI8042Toggle(virQEMUCaps *qemuCaps, + const virDomainDef *def); + const char *virQEMUCapsGetBinary(virQEMUCaps *qemuCaps); virArch virQEMUCapsGetArch(virQEMUCaps *qemuCaps); unsigned int virQEMUCapsGetVersion(virQEMUCaps *qemuCaps); --=20 2.45.0