From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 787E8AC1428 for ; Thu, 23 Nov 2023 15:02:47 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=cEmkmNrlGciIJvPniODpmNMX4yMMVTCxpTcVYe9tOSc=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1700751766; v=1; b=CWYhpz2Fu9Yai8vHKUqbyzlJNaGJG1bieD72c6v4yQ1dsgpT4htdNQfaxEDMd/IegSeU9e8P m8KrT+S6fyr0/yiNK6vGmSDybjno62EWffE50CWutBHIbcdNqgJwYcMpm2rP7MuSLwx0MXmixSf IPf3nD9eJtUX43CWT62HkzT8= X-Received: by 127.0.0.2 with SMTP id PgjHYY7687511xfL1GVilq3Y; Thu, 23 Nov 2023 07:02:46 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.93013.1700751765365869104 for ; Thu, 23 Nov 2023 07:02:45 -0800 X-Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-208-81ztUjC1OmqucAmjp-ZvNw-1; Thu, 23 Nov 2023 10:02:40 -0500 X-MC-Unique: 81ztUjC1OmqucAmjp-ZvNw-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1353B3800BCF for ; Thu, 23 Nov 2023 15:02:39 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.193.187]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF92C2166B26; Thu, 23 Nov 2023 15:02:38 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DDEAC1800DDC; Thu, 23 Nov 2023 16:02:34 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Oliver Steffen , =?UTF-8?q?L=C3=A1szl=C3=B3=20=C3=89rsek?= , Gerd Hoffmann Subject: [edk2-devel] [PATCH 4/7] OvmfPkg: add PcdQemuVarsRequire Date: Thu, 23 Nov 2023 16:02:31 +0100 Message-ID: <20231123150234.117835-5-kraxel@redhat.com> In-Reply-To: <20231123150234.117835-1-kraxel@redhat.com> References: <20231123150234.117835-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: gBcZzXj3nd5WGD7lvbwMYoVyx7686176AA= Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=CWYhpz2F; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Add PcdQemuVarsRequire FeaturePcd, so firmware code can figure whenever the given build is supposed to use the qemu uefi variable service. Skip the emulated variable store setup in case PcdQemuVarsRequire is true. This is needed to make secure boot work. Signed-off-by: Gerd Hoffmann --- OvmfPkg/OvmfPkg.dec | 3 +++ OvmfPkg/OvmfPkgX64.dsc | 1 + OvmfPkg/PlatformPei/PlatformPei.inf | 1 + OvmfPkg/PlatformPei/Platform.c | 4 ++++ 4 files changed, 9 insertions(+) diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index e3861e5c1b39..7fa7ee5e99e3 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -502,3 +502,6 @@ [PcdsFeatureFlag] # firmware contains a CSM (Compatibility Support Module). # gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable|FALSE|BOOLEAN|0x35 + + ## This feature flag indicates the firmware build needs the qemu variable service. + gUefiOvmfPkgTokenSpaceGuid.PcdQemuVarsRequire|FALSE|BOOLEAN|0x6e diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 4b044321e31b..a27ea95dedc5 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -505,6 +505,7 @@ [PcdsFeatureFlag] gEfiMdeModulePkgTokenSpaceGuid.PcdEnableVariableRuntimeCache|FALSE !endif !if $(QEMU_VARS) == TRUE + gUefiOvmfPkgTokenSpaceGuid.PcdQemuVarsRequire|TRUE gEfiMdeModulePkgTokenSpaceGuid.PcdEnableVariableRuntimeCache|FALSE !endif !if $(SECURE_BOOT_ENABLE) == TRUE diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf index 3934aeed9514..0794e605ef4c 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -135,6 +135,7 @@ [FixedPcd] [FeaturePcd] gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire + gUefiOvmfPkgTokenSpaceGuid.PcdQemuVarsRequire [Ppis] gEfiPeiMasterBootModePpiGuid diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index f5dc41c3a8c4..31922a91fbfd 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -219,6 +219,10 @@ ReserveEmuVariableNvStore ( EFI_PHYSICAL_ADDRESS VariableStore; RETURN_STATUS PcdStatus; + if (FeaturePcdGet (PcdQemuVarsRequire)) { + return; + } + VariableStore = (EFI_PHYSICAL_ADDRESS)(UINTN)PlatformReserveEmuVariableNvStore (); PcdStatus = PcdSet64S (PcdEmuVariableNvStoreReserved, VariableStore); -- 2.42.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111683): https://edk2.groups.io/g/devel/message/111683 Mute This Topic: https://groups.io/mt/102767941/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-