From nobody Thu Nov 21 13:20:32 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=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1731938059240539.1475328715978; Mon, 18 Nov 2024 05:54:19 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 094531A56; Mon, 18 Nov 2024 08:54:18 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 2A9731A09; Mon, 18 Nov 2024 08:54:01 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id C0C7919F7; Mon, 18 Nov 2024 08:53:58 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 3C60B19F4 for ; Mon, 18 Nov 2024 08:53:58 -0500 (EST) Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-397-F5JTjkBjNfWl5hfAJVwyEA-1; Mon, 18 Nov 2024 08:53:56 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8784D1954233 for ; Mon, 18 Nov 2024 13:53:55 +0000 (UTC) Received: from cash.home.annexia.org (unknown [10.42.28.15]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DE4961956056 for ; Mon, 18 Nov 2024 13:53:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731938037; h=from:from: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; bh=WZKxc42Pbb/xG5Ed5N2CtfNTTHlBab1aLwhihcZr9aY=; b=DKO2XgcybvEr4jbsFkb5zpV/BQvgU/e/F4qAvrNfVd4zlEhtHHg20zpKABcZkZ6ES63HlF dccP0Cbug6CXSe6XQcWLT4lq5joVb4tiYLzMcfC3PkaXJ4zSNeQfow/Gv92AbXlgGb2dCi p641Ez/KrZFj4pShUG50YFDErV+e6GI= X-MC-Unique: F5JTjkBjNfWl5hfAJVwyEA-1 X-Mimecast-MFC-AGG-ID: F5JTjkBjNfWl5hfAJVwyEA From: "Richard W.M. Jones" To: devel@lists.libvirt.org Subject: [PATCH] vmx: Get the VMware boolean uefi.secureBoot.enabled Date: Mon, 18 Nov 2024 13:53:48 +0000 Message-ID: <20241118135352.2769535-1-rjones@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: jZYsattfHfuctIxgC7gsakGmE5eN4qRJtcMp4rjjs4U_1731938035 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: JPDVF45XFT3SJOZFXFFDC2NUQV2O4FOF X-Message-ID-Hash: JPDVF45XFT3SJOZFXFFDC2NUQV2O4FOF X-MailFrom: rjones@redhat.com 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; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1731938060403116600 Content-Type: text/plain; charset="utf-8"; x-default="true" Some VMware guests have a boolean uefi.secureBoot.enabled. If found, and it's set to "TRUE", and if it's a UEFI guest, then add this clause into the domain XML: This approximates the meaning of this VMware flag. Signed-off-by: Richard W.M. Jones Fixes: https://issues.redhat.com/browse/RHEL-67836 Reviewed-by: Michal Privoznik --- src/vmx/vmx.c | 22 ++++++++++++++++++++++ tests/vmx2xmldata/esx-in-the-wild-12.xml | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 132e54e15f..23a8a35360 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -1387,6 +1387,7 @@ virVMXParseConfig(virVMXContext *ctx, char *sched_cpu_shares =3D NULL; char *guestOS =3D NULL; bool smbios_reflecthost =3D false; + bool uefi_secureboot =3D false; int controller; int bus; int port; @@ -1963,6 +1964,27 @@ virVMXParseConfig(virVMXContext *ctx, } } =20 + /* vmx:uefi.secureBoot.enabled */ + if (virVMXGetConfigBoolean(conf, "uefi.secureBoot.enabled", + &uefi_secureboot, false, true) < 0) { + goto cleanup; + } + if (uefi_secureboot && + def->os.firmware =3D=3D VIR_DOMAIN_OS_DEF_FIRMWARE_EFI) { + int *features =3D def->os.firmwareFeatures; + + if (!features) { + features =3D g_new0(int, VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_LA= ST); + def->os.firmwareFeatures =3D features; + } + /* Just set both to true, as VMware doesn't have any concept + * of the two features separately. + */ + features[VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_SECURE_BOOT] =3D + features[VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_ENROLLED_KEYS] =3D + VIR_TRISTATE_BOOL_YES; + } + if (virDomainDefPostParse(def, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, xmlopt, NULL) < 0) goto cleanup; diff --git a/tests/vmx2xmldata/esx-in-the-wild-12.xml b/tests/vmx2xmldata/e= sx-in-the-wild-12.xml index 42184501d0..c5aad90677 100644 --- a/tests/vmx2xmldata/esx-in-the-wild-12.xml +++ b/tests/vmx2xmldata/esx-in-the-wild-12.xml @@ -9,6 +9,10 @@ hvm + + + + destroy --=20 2.46.0