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 587B5740039 for ; Thu, 14 Dec 2023 13:53:34 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=OHjhYEfHML7PS33kfqywQ24o3GCVUxbqLjKm3bnEkdE=; 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; s=20140610; t=1702562013; v=1; b=JLdUsSLRUPrLygykPEsjMkzpFj+DPC6N8OVE+v39x5YT629jwiMlS+1XAVzeqbOmOv4EYGY2 SPVVjN+zIOLqxcrcggYYVzdSdZTIVWqbW7Blz8LICaFtrEEy1Lvh3FGAoGXH4TNuC6yYDLJFgrz Ohky7frXCnrwr1ZrA5VqPhwE= X-Received: by 127.0.0.2 with SMTP id P6rsYY7687511xhfBQ6hUCYV; Thu, 14 Dec 2023 05:53:33 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) by mx.groups.io with SMTP id smtpd.web10.22605.1702562004503781636 for ; Thu, 14 Dec 2023 05:53:32 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10924"; a="1957352" X-IronPort-AV: E=Sophos;i="6.04,275,1695711600"; d="scan'208";a="1957352" X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2023 05:53:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10924"; a="947581780" X-IronPort-AV: E=Sophos;i="6.04,275,1695711600"; d="scan'208";a="947581780" X-Received: from sh1gapp1015.ccr.corp.intel.com ([10.239.189.85]) by orsmga005.jf.intel.com with ESMTP; 14 Dec 2023 05:53:30 -0800 From: "Wang Fan" To: devel@edk2.groups.io Cc: Fan Wang , Liming Gao , Rahul Kumar , Jian J Wang Subject: [edk2-devel] [PATCH v5 2/2] SecurityPkg: Support customized FV Migration Information Date: Thu, 14 Dec 2023 21:53:19 +0800 Message-Id: <20231214135319.3986-3-fan.wang@intel.com> In-Reply-To: <20231214135319.3986-1-fan.wang@intel.com> References: <20231214135319.3986-1-fan.wang@intel.com> MIME-Version: 1.0 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,fan.wang@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: k5uw1G6IoS8jHLXv6P90Tlk5x7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=JLdUsSLR; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.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 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4533 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 Cc: Rahul Kumar Cc: Jian J Wang Signed-off-by: Fan Wang --- 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/Tc= g2Pei.c index 1caaa4e319bc..daaf49e644b2 100644 --- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c +++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c @@ -726,8 +726,11 @@ MeasureFvImage ( //=0D // Found the migrated FV info=0D //=0D - FvOrgBase =3D (EFI_PHYSICAL_ADDRESS)(UINTN)MigratedFvInfo->FvOrgBas= e;=0D - FvDataBase =3D (EFI_PHYSICAL_ADDRESS)(UINTN)MigratedFvInfo->FvDataBa= se;=0D + FvOrgBase =3D (EFI_PHYSICAL_ADDRESS)(UINTN)MigratedFvInfo->FvOrgBase= ;=0D + if (MigratedFvInfo->FvDataBase !=3D 0) {=0D + FvDataBase =3D (EFI_PHYSICAL_ADDRESS)(UINTN)MigratedFvInfo->FvData= Base;=0D + }=0D +=0D break;=0D }=0D =0D diff --git a/SecurityPkg/Tcg/TcgPei/TcgPei.c b/SecurityPkg/Tcg/TcgPei/TcgPe= i.c index 5aa80511aa81..d35c2ad0bc55 100644 --- a/SecurityPkg/Tcg/TcgPei/TcgPei.c +++ b/SecurityPkg/Tcg/TcgPei/TcgPei.c @@ -463,8 +463,11 @@ MeasureFvImage ( //=0D // Found the migrated FV info=0D //=0D - FvOrgBase =3D (EFI_PHYSICAL_ADDRESS)(UINTN)MigratedFvInfo->FvOrgBas= e;=0D - FvDataBase =3D (EFI_PHYSICAL_ADDRESS)(UINTN)MigratedFvInfo->FvDataBa= se;=0D + FvOrgBase =3D (EFI_PHYSICAL_ADDRESS)(UINTN)MigratedFvInfo->FvOrgBase= ;=0D + if (MigratedFvInfo->FvDataBase !=3D 0) {=0D + FvDataBase =3D (EFI_PHYSICAL_ADDRESS)(UINTN)MigratedFvInfo->FvData= Base;=0D + }=0D +=0D break;=0D }=0D =0D --=20 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] -=-=-=-=-=-=-=-=-=-=-=-