From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.74421.1669986624329922040 for ; Fri, 02 Dec 2022 05:10:24 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YDhhusHS; spf=pass (domain: redhat.com, ip: 170.10.129.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669986623; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/zqHJQ9NhHCTZFBMRFN0t3auUw3x029TU0mq33XMVX0=; b=YDhhusHSkjwycbvHnATiCTEUSyIVLJhJhHll4aC0xenVyd+YyExztxtzy03LgdmoqJpucP ehy0TgLBd8/brT2tNwrKT/VipwVDAihHNPDojLf2qJyXQ9n0nr/ebEdn5Hfu0QP2yiiNJx 8oVbkzt8zQDj4M+DLJByZGBFxGbpe5I= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-659-jk8YOv6AOF2Vm1pJEgtOVg-1; Fri, 02 Dec 2022 08:10:19 -0500 X-MC-Unique: jk8YOv6AOF2Vm1pJEgtOVg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CE34A811E81; Fri, 2 Dec 2022 13:10:18 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 919BB200D8D4; Fri, 2 Dec 2022 13:10:18 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id D5B3B1801543; Fri, 2 Dec 2022 14:10:09 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Bob Feng , Yuwei Chen , Erdem Aktas , Jordan Justen , Peter Grehan , Rebecca Cran , Liming Gao , Ard Biesheuvel , Gerd Hoffmann , Jiewen Yao , Min Xu , Brijesh Singh , Oliver Steffen , Pawel Polawski , Tom Lendacky , James Bottomley Subject: [PATCH 03/14] OvmfPkg/PlatformPei: AmdSev: stop using mPlatformInfoHob Date: Fri, 2 Dec 2022 14:09:58 +0100 Message-Id: <20221202131009.3190040-4-kraxel@redhat.com> In-Reply-To: <20221202131009.3190040-1-kraxel@redhat.com> References: <20221202131009.3190040-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true Stop using the mPlatformInfoHob global variable in AmdSevInitialize() and AmdSevEsInitialize() functions. Pass a pointer to the PlatformInfoHob instead. Signed-off-by: Gerd Hoffmann --- 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