public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: Bob Feng <bob.c.feng@intel.com>,
	Yuwei Chen <yuwei.chen@intel.com>,
	Erdem Aktas <erdemaktas@google.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Peter Grehan <grehan@freebsd.org>,
	Rebecca Cran <rebecca@bsdio.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Jiewen Yao <jiewen.yao@intel.com>, Min Xu <min.m.xu@intel.com>,
	Brijesh Singh <brijesh.singh@amd.com>,
	Oliver Steffen <osteffen@redhat.com>,
	Pawel Polawski <ppolawsk@redhat.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	James Bottomley <jejb@linux.ibm.com>
Subject: [PATCH 03/14] OvmfPkg/PlatformPei: AmdSev: stop using mPlatformInfoHob
Date: Fri,  2 Dec 2022 14:09:58 +0100	[thread overview]
Message-ID: <20221202131009.3190040-4-kraxel@redhat.com> (raw)
In-Reply-To: <20221202131009.3190040-1-kraxel@redhat.com>

Stop using the mPlatformInfoHob global variable in AmdSevInitialize()
and AmdSevEsInitialize() functions.  Pass a pointer to the
PlatformInfoHob instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 OvmfPkg/PlatformPei/Platform.h |  2 +-
 OvmfPkg/PlatformPei/AmdSev.c   | 14 +++++++-------
 OvmfPkg/PlatformPei/Platform.c |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h
index 29b51b2debd8..f245025fb46f 100644
--- a/OvmfPkg/PlatformPei/Platform.h
+++ b/OvmfPkg/PlatformPei/Platform.h
@@ -82,7 +82,7 @@ InstallClearCacheCallback (
 
 VOID
 AmdSevInitialize (
-  VOID
+  IN EFI_HOB_PLATFORM_INFO  *PlatformInfoHob
   );
 
 /**
diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c
index e1b9fd9b7f68..c23fae7fcae0 100644
--- a/OvmfPkg/PlatformPei/AmdSev.c
+++ b/OvmfPkg/PlatformPei/AmdSev.c
@@ -201,7 +201,7 @@ GhcbRegister (
 STATIC
 VOID
 AmdSevEsInitialize (
-  VOID
+  IN EFI_HOB_PLATFORM_INFO  *PlatformInfoHob
   )
 {
   UINT8                *GhcbBase;
@@ -228,7 +228,7 @@ AmdSevEsInitialize (
   //   Since the pages must survive across the UEFI to OS transition
   //   make them reserved.
   //
-  GhcbPageCount = mPlatformInfoHob.PcdCpuMaxLogicalProcessorNumber * 2;
+  GhcbPageCount = PlatformInfoHob->PcdCpuMaxLogicalProcessorNumber * 2;
   GhcbBase      = AllocateReservedPages (GhcbPageCount);
   ASSERT (GhcbBase != NULL);
 
@@ -266,7 +266,7 @@ AmdSevEsInitialize (
   // Allocate #VC recursion backup pages. The number of backup pages needed is
   // one less than the maximum VC count.
   //
-  GhcbBackupPageCount = mPlatformInfoHob.PcdCpuMaxLogicalProcessorNumber * (VMGEXIT_MAXIMUM_VC_COUNT - 1);
+  GhcbBackupPageCount = PlatformInfoHob->PcdCpuMaxLogicalProcessorNumber * (VMGEXIT_MAXIMUM_VC_COUNT - 1);
   GhcbBackupBase      = AllocatePages (GhcbBackupPageCount);
   ASSERT (GhcbBackupBase != NULL);
 
@@ -320,7 +320,7 @@ AmdSevEsInitialize (
   **/
 VOID
 AmdSevInitialize (
-  VOID
+  IN OUT EFI_HOB_PLATFORM_INFO  *PlatformInfoHob
   )
 {
   UINT64         EncryptionMask;
@@ -367,7 +367,7 @@ AmdSevInitialize (
   // until after re-encryption, in order to prevent an information leak to the
   // hypervisor.
   //
-  if (mPlatformInfoHob.SmmSmramRequire && (mPlatformInfoHob.BootMode != BOOT_ON_S3_RESUME)) {
+  if (PlatformInfoHob->SmmSmramRequire && (PlatformInfoHob->BootMode != BOOT_ON_S3_RESUME)) {
     RETURN_STATUS  LocateMapStatus;
     UINTN          MapPagesBase;
     UINTN          MapPagesCount;
@@ -378,7 +378,7 @@ AmdSevInitialize (
                         );
     ASSERT_RETURN_ERROR (LocateMapStatus);
 
-    if (mPlatformInfoHob.Q35SmramAtDefaultSmbase) {
+    if (PlatformInfoHob->Q35SmramAtDefaultSmbase) {
       //
       // The initial SMRAM Save State Map has been covered as part of a larger
       // reserved memory allocation in InitializeRamRegions().
@@ -400,7 +400,7 @@ AmdSevInitialize (
   //
   // Check and perform SEV-ES initialization if required.
   //
-  AmdSevEsInitialize ();
+  AmdSevEsInitialize (PlatformInfoHob);
 
   //
   // Set the Confidential computing attr PCD to communicate which SEV
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index b1f8140d6041..f2c1e2b213cb 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -379,7 +379,7 @@ InitializePlatform (
   }
 
   InstallClearCacheCallback ();
-  AmdSevInitialize ();
+  AmdSevInitialize (&mPlatformInfoHob);
   if (mPlatformInfoHob.HostBridgeDevId == 0xffff) {
     MiscInitializationForMicrovm (&mPlatformInfoHob);
   } else {
-- 
2.38.1


  parent reply	other threads:[~2022-12-02 13:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02 13:09 [PATCH 00/14] OvmfPkg: avoid global variables in PEI Gerd Hoffmann
2022-12-02 13:09 ` [PATCH 01/14] tools_def: remove GCC_IA32_CC_FLAGS/GCC_X64_CC_FLAGS Gerd Hoffmann
2022-12-02 13:09 ` [PATCH 02/14] tools_def: add -fno-omit-frame-pointer to GCC48_{IA32,X64}_CC_FLAGS Gerd Hoffmann
2022-12-02 13:09 ` Gerd Hoffmann [this message]
2022-12-02 13:09 ` [PATCH 04/14] OvmfPkg/PlatformPei: PeiFv: stop using mPlatformInfoHob Gerd Hoffmann
2022-12-02 13:10 ` [PATCH 05/14] OvmfPkg/PlatformPei Q35 SMM helpers: " Gerd Hoffmann
2022-12-02 13:10 ` [PATCH 06/14] OvmfPkg/PlatformPei: PeiMemory: " Gerd Hoffmann
2022-12-02 13:10 ` [PATCH 07/14] OvmfPkg/PlatformPei: MemTypeInfo: " Gerd Hoffmann
2022-12-02 13:10 ` [PATCH 08/14] OvmfPkg/PlatformPei: NoExec: " Gerd Hoffmann
2022-12-02 13:10 ` [PATCH 09/14] OvmfPkg/PlatformPei: Verification: " Gerd Hoffmann
2022-12-02 13:10 ` [PATCH 10/14] OvmfPkg/PlatformPei: remove mPlatformInfoHob Gerd Hoffmann
2022-12-02 13:10 ` [PATCH 11/14] OvmfPkg/PlatformPei: remove mFeatureControlValue Gerd Hoffmann
2022-12-02 13:10 ` [PATCH 12/14] OvmfPkg/DebugLibIoPort: use Rom version for PEI Gerd Hoffmann
2022-12-02 13:10 ` [PATCH 13/14] OvmfPkg/QemuFwCfgLib: rewrite fw_cfg probe Gerd Hoffmann
2022-12-02 13:10 ` [PATCH 14/14] OvmfPkg/QemuFwCfgLib: remove mQemuFwCfgSupported + mQemuFwCfgDmaSupported Gerd Hoffmann
2022-12-12 16:58 ` [PATCH 00/14] OvmfPkg: avoid global variables in PEI Lendacky, Thomas
2022-12-14 17:26   ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221202131009.3190040-4-kraxel@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox