From nobody Sat Nov 23 18:51:56 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=1723453863; cv=none; d=zohomail.com; s=zohoarc; b=jmwdHtd5F2Wbeog/5ImqEDagp1bmYI07sw8HkGcg2jO9t++n8QvirDsVKv1frS4CyVbzOd9P3zemrY+R9tQBg0PC5WkMdwqBiSCnnWshSKLqzO2UH3vuHJBrXsrbJ3eKE/sGf6HycVOBYBC9RNjULbVF2bJhZFtRWsf0G1JJ6HA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723453863; 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=MvnYEawdrsN5cyJps0mWeFAk8Ia5UMoRue5ttrKnAoA=; b=SDGZ1VjEzHWFwRos7SrcahEFAGy9pVClcmnn4SeQ3cRQttZOGkibSCAC84ayhENi1UIAgGVLXk/rBDREZ6WCnWc5u+EfOScdFvkdVF4XUbT4CemjRFN4WvnsBXgGzfQ7+eX/Flz0JowyiLdUd/PX/V2ALuxcBouSZrJWUIMAwhc= 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 1723453863895257.1514276317016; Mon, 12 Aug 2024 02:11:03 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C48EF1575; Mon, 12 Aug 2024 05:11:02 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 49B3815CF; Mon, 12 Aug 2024 05:08:58 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9812013E9; Sun, 11 Aug 2024 12:55:37 -0400 (EDT) Received: from mail-41103.protonmail.ch (mail-41103.protonmail.ch [185.70.41.103]) (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 0ABC213C8 for ; Sun, 11 Aug 2024 12:55:37 -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, 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=protonmail3; t=1723395330; x=1723654530; bh=MvnYEawdrsN5cyJps0mWeFAk8Ia5UMoRue5ttrKnAoA=; 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=ZofPR/6m0ItA5YQurK5gaFCDmDsUy+W+X6FFpud4uLSZbR7v1IN/dERomVUKMpW0o 3ZT6kHd2YP4N4WDQosMg2CirF9fT5zukG7rR012IYmGp5iZmnNEgcOEo7xEPfT4xce kyy35x4i3aCVAo8ApgUr/aUMQHn3bMbu7xxd8sZVkJqln75i5YbqjiDJVBZZUp4PJa OEcT5rzNW2QMkpGixPELOLth2f7IpPbeFwwIxPH7mhLUp5CNH02NUdjF953iJWsOc/ IfIC7AJ7o0ptL3gSHNVTJ0wUIQszDv+WRosIO2SSuXhpHuIUFJCkIWb4CWK1u99rAA 6Q+l0VEcjbZyw== Date: Sun, 11 Aug 2024 16:55:27 +0000 To: "devel@lists.libvirt.org" From: =?utf-8?Q?Kamil_Szcz=C4=99k?= Subject: [PATCH v2 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: 0a11fb6c47fab9427df850a4bc9416614cd64976 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: DS2FVMTBPGZMKPYUFDROKF7QFMDRJD6T X-Message-ID-Hash: DS2FVMTBPGZMKPYUFDROKF7QFMDRJD6T 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: 1723453864534116600 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 2765fba7c8..191a04ea53 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 @@ -1754,6 +1755,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), @@ -1764,6 +1769,9 @@ static virQEMUCapsObjectTypeProps virQEMUCapsMachineP= rops[] =3D { { "none", virQEMUCapsMachinePropsGeneric, G_N_ELEMENTS(virQEMUCapsMachinePropsGeneric), -1 }, + { "generic-pc", virQEMUCapsMachinePropsGenericPC, + G_N_ELEMENTS(virQEMUCapsMachinePropsGenericPC), + -1 }, }; =20 static void @@ -2900,6 +2908,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; } @@ -6028,6 +6037,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..5b03d28a2c 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 */ =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