public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wang Fan" <fan.wang@intel.com>
To: devel@edk2.groups.io
Cc: Fan Wang <fan.wang@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	Rahul Kumar <rahul1.kumar@intel.com>,
	Jian J Wang <jian.j.wang@intel.com>
Subject: [edk2-devel] [PATCH v5 2/2] SecurityPkg: Support customized FV Migration Information
Date: Thu, 14 Dec 2023 21:53:19 +0800	[thread overview]
Message-ID: <20231214135319.3986-3-fan.wang@intel.com> (raw)
In-Reply-To: <20231214135319.3986-1-fan.wang@intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4533

In Tcg driver, when MigratedFvInfo hob is detected, existing code logic
is assuming FV raw data is already copied, and raw data base address is
also recorded. Due to the new PeiCore change, the platform can publish
hob to indicate raw data need be copied or not along with FV migration.

Two cases need be considered to skip copy for boot performance: The first
case is FV is not expected to be measured in post-mem phase, we should
use MeasurementExcludedPpiGuid to skip measurement. The second case is
FV raw data has no need to do rebase operation after migration, then
measurement should calculate hash directly from FV base address.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Fan Wang <fan.wang@intel.com>
---
 SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c | 7 +++++--
 SecurityPkg/Tcg/TcgPei/TcgPei.c   | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
index 1caaa4e319bc..daaf49e644b2 100644
--- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
+++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
@@ -726,8 +726,11 @@ MeasureFvImage (
       //
       // Found the migrated FV info
       //
-      FvOrgBase  = (EFI_PHYSICAL_ADDRESS)(UINTN)MigratedFvInfo->FvOrgBase;
-      FvDataBase = (EFI_PHYSICAL_ADDRESS)(UINTN)MigratedFvInfo->FvDataBase;
+      FvOrgBase = (EFI_PHYSICAL_ADDRESS)(UINTN)MigratedFvInfo->FvOrgBase;
+      if (MigratedFvInfo->FvDataBase != 0) {
+        FvDataBase = (EFI_PHYSICAL_ADDRESS)(UINTN)MigratedFvInfo->FvDataBase;
+      }
+
       break;
     }
 
diff --git a/SecurityPkg/Tcg/TcgPei/TcgPei.c b/SecurityPkg/Tcg/TcgPei/TcgPei.c
index 5aa80511aa81..d35c2ad0bc55 100644
--- a/SecurityPkg/Tcg/TcgPei/TcgPei.c
+++ b/SecurityPkg/Tcg/TcgPei/TcgPei.c
@@ -463,8 +463,11 @@ MeasureFvImage (
       //
       // Found the migrated FV info
       //
-      FvOrgBase  = (EFI_PHYSICAL_ADDRESS)(UINTN)MigratedFvInfo->FvOrgBase;
-      FvDataBase = (EFI_PHYSICAL_ADDRESS)(UINTN)MigratedFvInfo->FvDataBase;
+      FvOrgBase = (EFI_PHYSICAL_ADDRESS)(UINTN)MigratedFvInfo->FvOrgBase;
+      if (MigratedFvInfo->FvDataBase != 0) {
+        FvDataBase = (EFI_PHYSICAL_ADDRESS)(UINTN)MigratedFvInfo->FvDataBase;
+      }
+
       break;
     }
 
-- 
2.29.2.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112532): https://edk2.groups.io/g/devel/message/112532
Mute This Topic: https://groups.io/mt/103169824/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



      parent reply	other threads:[~2023-12-14 13:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14 13:53 [edk2-devel] [PATCH v5 0/2] Support customized FV Migration Information Wang Fan
2023-12-14 13:53 ` [edk2-devel] [PATCH v5 1/2] MdeModulePkg: " Wang Fan
2023-12-14 13:53 ` Wang Fan [this message]

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=20231214135319.3986-3-fan.wang@intel.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