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 6DA4E941270 for ; Mon, 20 Nov 2023 06:30:17 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=TbJ+PsjVnEda0HtrW3fGqrB9hXqTBKTAd1L5d1P7BLY=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1700461815; v=1; b=ogtEGqMfoQHrDyKZLVMeDT64df8xEoIxaNbmvf8cj1oRTmK5TP6ICG3l5gPY6pSVieHnUU/2 dqrSFMUITZjDkNKIrm3WxaG+B93814/qDAvhN/5ErAqxLXkGe1jvmh9AUNNIcl4TeJq4ANM6F2v hYCLb6OKV1qiBn06ZC+67AfQ= X-Received: by 127.0.0.2 with SMTP id 2o1vYY7687511xnsrwqMf5hc; Sun, 19 Nov 2023 22:30:15 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mx.groups.io with SMTP id smtpd.web11.45161.1700461814988290015 for ; Sun, 19 Nov 2023 22:30:15 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10899"; a="4735443" X-IronPort-AV: E=Sophos;i="6.04,212,1695711600"; d="scan'208";a="4735443" X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2023 22:30:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10899"; a="742632797" X-IronPort-AV: E=Sophos;i="6.04,212,1695711600"; d="scan'208";a="742632797" X-Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga006.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 19 Nov 2023 22:30:14 -0800 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Sun, 19 Nov 2023 22:30:13 -0800 X-Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34 via Frontend Transport; Sun, 19 Nov 2023 22:30:13 -0800 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.168) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.34; Sun, 19 Nov 2023 22:30:13 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GzBvuiYnzmeFvIh0uQuodDU3JDbxCrDorMp1slCdYh6gqtABHcUQTiO/fWDZHPCpwFCGYXG8MjdJEpTuUAs8pm0ymxtCem7D35xLH+GsGz9Y5iQVG/Cj+7VHcUZGyZEY/4BlYTh3x+TMIkAp4rF/pN0wuEDCOX8lRwF2gIgtydcS+sjiWbRMy68BAmqmlGEjjr0fTtR0/oBZgEXBZg8Hu7vYNRM7l6fKrzU9AfI3wcEYEMoJs2ttnplyyhaxM6RnnjfThOcEUCNW5LTmo7V4srYU05fJPlJ3SwsVbDAVoel5PrtJHQY0inHtQrxfNmoxugJymrXRDJuFHT+Ce+txgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kd/wV0AHHE3HfUkU4yqnUc7JrEOB+JO+qRL5kMqj2kU=; b=NEDZkn08BDuFrDnXLkJ4zNF5PIJBU0uc/PQey6rQO0x6fkwnp0qx6xpYtm3HcOEI95vtl72T/kPmH206TfidPIRiTrRgqUmSL2BzlWderJ1sYEH2tzXLlWSMVA1udVw6z8+EJa5Dyj9MfnJ0WNL2c0cODhDzAJnpnMilN2pD8rQrGAtT08R5Kpi+ug1fZMRuyXUEWTUL1HHLTj04EbMjBGk8JgK9vgaypRlebADIns1EpURAW8wEhBAPNm6OOTE0yVXsrFRR7YuII93f4ODOZ+ahXgb2FZYvECklpKoGGSyyRUqDuk21ygIscDmm++m7lCB7xGjW9iyfdxycMpPexg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none X-Received: from DM8PR11MB5752.namprd11.prod.outlook.com (2603:10b6:8:13::15) by MW4PR11MB6570.namprd11.prod.outlook.com (2603:10b6:303:1e3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.27; Mon, 20 Nov 2023 06:30:11 +0000 X-Received: from DM8PR11MB5752.namprd11.prod.outlook.com ([fe80::1f3:4ad1:ee6c:ef22]) by DM8PR11MB5752.namprd11.prod.outlook.com ([fe80::1f3:4ad1:ee6c:ef22%5]) with mapi id 15.20.7002.026; Mon, 20 Nov 2023 06:30:11 +0000 From: "Wang Fan" To: "devel@edk2.groups.io" , "Gao, Liming" , "Kinney, Michael D" Subject: Re: [edk2-devel] [PATCH V2 1/1] MdeModulePkg: Support customized FV Migration Information Thread-Topic: [PATCH V2 1/1] MdeModulePkg: Support customized FV Migration Information Thread-Index: AQHZ5JWgUm8bwGm6pE24QY/v9huHP7BNHj2AgBBptQCAJaR3IA== Date: Mon, 20 Nov 2023 06:30:11 +0000 Message-ID: References: <76cde14616a559c6939f8814d0e79afa7f1a7fcf.1694425833.git.fan.wang@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM8PR11MB5752:EE_|MW4PR11MB6570:EE_ x-ms-office365-filtering-correlation-id: cd9a657d-abcc-40ae-32b3-08dbe99225d7 x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: ZmnUU3CCvZ+P8l4Mz69qdAyL1wdbM2e8yOuZxouf/QZ0hqB9xRiyS5velvltDYSuZsd8ytjMAScFKN9Dl7bbY73fQA0kLIR2ocTo9hb7/EXjyZZR/E+Jl6K82bRhTUiUXYB2y4Un9j8J+o1qehGz1aQvUskCkcrqRf+hooENSg0K3Ls6NO5/adAPV7lIvU6qCADrtZK5TnM8dscPf3S5ISBVi5vhO5wEulyOHSWebKkhCTMPLDI7tVgQ+himGhxcLeP3hkv/8sqYVpJsDFNReYj7XekQVlaB7Mk3ypwVTPSNOC+ABSTcXFoMmQcT0Kd2LPJVw6FPasmNv36iZx/9cR5PZGe4BcPFZq5PfNdx8uweWLXzLqz/g3Dwnjk2teiVae+CQn7g4Z2lkHQZXGDF72c7oBTeEUN7eGL4ye9DHaS0x18zdGAXSzBj1teGI1Zz18z3yztME3oSbyXvHzvg//5MkfkLytDzwhK6GjijfXSlX4HtR7xTTCAjtbUX1ukFShzl/zQvh1qHrAfts4E7HfNyH3TIRUmXeHGDblHGJMorgpkrVeDza3A63xzifmx2lpft2mvu3gQRbEcP37D3DPfo7jHlCrAfdMEHKZ8z7WlCsDlYKppyTgoME/FrAo/hOBJfYV7zcQGs7EuCVpCeEQ== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?XvEntvIxpC8mtU0pRbp3ROqOEadxLwu2L0HSdsZ/3vbs50MuiulpKT1L4BXT?= =?us-ascii?Q?ba8R4EH32V7QdwHz3gMIYplXRc8g+WAeGTOfICQ7QFMP7O60Iecqrtocv+nI?= =?us-ascii?Q?3xWRcrQxQWM3S4FuNf9k+8YYMwlXwAwPw5bgUwlOjmKGxwLT3+vKAmp8rL2S?= =?us-ascii?Q?bBY9i6JYttGRQiJJ71D7WV9ni2fpHVUB0WmhbNas6VmegYX46+i4lrNopS8N?= =?us-ascii?Q?pq5X7OvuWKRTKpywmJEel8Xx2ghAk+7Un+d5W1y1IFzX/26nS5KWHnH4KBrt?= =?us-ascii?Q?gqs6m0UCoguBxMR/JBp8qgoDocuKQAHDrMR4eva+B3/2wqBevt5gIoreMPHe?= =?us-ascii?Q?v+YkSH0+t2cBNIQ4SoBniEoqw6lxIphI4gBFd9Dzb4wXGu3xvJyEJmXGxg99?= =?us-ascii?Q?InjkxKLG8hAzHGy0X9RNYVbdYZAqzni9AALEjuvy4cCHe3REVqR0rkuJN0Up?= =?us-ascii?Q?+5jXg/WLUpm4uUPKZqcbhC9ozf0d6RHXE8hp8YQ1joYGlt5CegdwnEi6q5oj?= =?us-ascii?Q?Lfr3W7YkOp/gA6fd/FkGEtibUR3V1YqZ61d3aqCQW6xKE/lR2fAtX4RZTG7l?= =?us-ascii?Q?4eijwaDF5Pkg2tOMTtTmodlNt73f6RyTsyvOlT2MGDWIc7xL7C3ZAMA3LQE4?= =?us-ascii?Q?YDQq166Zug/67ZhR/FVCFExPT/KbEuRsOaOtMIRzjzuiPDx/Tpi8dnEKMOS9?= =?us-ascii?Q?s+ck6ceZ6wNhxOMggovRjqF5p1hBqRNuoIOjJIEWfkk2C/CKYrU3xp6Pyatx?= =?us-ascii?Q?r0ncxy1IroRIBxAPYFB5qbHM8dgv29BnIAw4B64SKcDRDm9Mt4ZbMWdMWyKs?= =?us-ascii?Q?sigo6mlj8bdni3faBzkOEZ/vNa1+xxUOGq7KzPSwajbQQvoutbJJoAmsu6oc?= =?us-ascii?Q?vnrynCanC+XVB4NHL68KeDe0xuPcdplEoMqHtcepdgSVecoW7ypwZeymPuDL?= =?us-ascii?Q?veb8f32BGZ/gEhN5zASwZ8PhZazMg9VS5P6W37h1Wowtwh5Q2c1spkhZ3LS4?= =?us-ascii?Q?lXWOWHRFjUlV1c+fP1jyD0ovhh5ltracVs1IeeMN5Uq8JzI4lvNpg2Y4y01g?= =?us-ascii?Q?a/tmJymbjy/sDNdAw++hzXJjQDhz2EIDfIYLV6mEgA59S18SFryoHktutf5A?= =?us-ascii?Q?vbqDYPRhzGJConydULGBYr9YlmC0oQO6fxm6XmelfxPMKFAnh6AQAA7jqNZO?= =?us-ascii?Q?HYisUpF0NgIt57PtNtJBffTkIt+dW74YnoOdIb0PcCmRUu1C3et2ss6jUKyx?= =?us-ascii?Q?zTbNaIx+ZAXME5u7PKSdK6U5O9BIxKpUqXjxbeEAgOMhgDHHFzpZsR752HPf?= =?us-ascii?Q?lo8aLfpV6MaL4jpf00nOHzgCWflTFcR5srD9FZ561KKL4TT34TJmwvLKR3+M?= =?us-ascii?Q?s2/358S88IPOrlB/qIFuJ2Px8fJTcsMRzrtWbjyfbBhbY46X/91Ne1nehUg9?= =?us-ascii?Q?qN/OrejtpxaWPIcBvKNNHP5YAUNjcNX2S/K2Qzsqxo9f0QWciPiZ+qpeyys0?= =?us-ascii?Q?atiAxNm094ZhJlb/LBI7mXzmFroP27I4Erz8uqPaDtQWE3n9TpqIjnLFYmn7?= =?us-ascii?Q?omBDFVpL6Wy9BM1BgudOfD021Lqfdl8U2ClkEmgz?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM8PR11MB5752.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd9a657d-abcc-40ae-32b3-08dbe99225d7 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Nov 2023 06:30:11.2228 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: drWpj0LfQxRomIVKSwaYVqAscU1auJqnOSz1/k4kpwczvz89ioLY2y14yeyr/hZehRZ8QYWf8x0nrNzla9Rozw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6570 X-OriginatorOrg: intel.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,fan.wang@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: IopaWWwgyrcDZ2RlC5nCYcrwx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" 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=ogtEGqMf; 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 Hi Mike and Liming Do you have time to take a look this update? V3: https://edk2.groups.io/g/devel/message/110197 Pull Request: https://github.com/tianocore/edk2/pull/4970 Best Regards Fan -----Original Message----- From: Wang, Fan=20 Sent: Friday, October 27, 2023 4:24 PM To: Kinney, Michael D ; devel@edk2.groups.io Cc: Gao, Liming ; Jiang, Guomin ; Bi, Dandan Subject: RE: [PATCH V2 1/1] MdeModulePkg: Support customized FV Migration I= nformation Hi Mike Thank you for your feedback. I have updated the patch to v3: https://edk2.groups.io/g/devel/message/1101= 97 Pull Request: https://github.com/tianocore/edk2/pull/4970 Based on V2, this update includes changes: - Add more descriptions for "gEdkiiToMigrateFvInfoGuid" PPI usages and back= ground, but still keep the name. - Update "FvOrgBase" to "FvTemporaryRamBase" in EDKII_TO_MIGRATE_FV_INFO. - Remove flag "FLAGS_SKIP_FV_MIGRATION", since it's not needed. - Add more descriptions to flag "FLAGS_SKIP_FV_RAW_DATA_COPY". - Remove the variable MigrateAllFvs to simplify logic. - Correct "allocate pool" to "allocate pages" to align with descriptions. For other two questions you are mentioning: 1. For "Should FvOrgBase be a UINT64 or support temp RAM above 4GB?": I think UINT32 should be enough, all pre-mem FVs are below 4G as far as I k= now, even we enabled X64 in pre-mem phase. This setting is also aligning wi= th "FvOrgBase" defined in "EDKII_MIGRATED_FV_INFO". 2. For "The call to RemoveFvHobsInTemporaryMemory (Private) was removed": Since this function will remove all FV hobs for physical addresses, it shou= ld be called only when all pre-mem FVs are migrated. In EvacuateTempRam(), = when one FV is migrated, ConvertFvHob() will be called for this FV and all = its' child FVs, this is enough to ensure already migrated FV hobs are all p= ointing to addresses on permanent address.=20 What do you think? Best Regards Fan -----Original Message----- From: Kinney, Michael D Sent: Tuesday, October 17, 2023 5:00 AM To: Wang, Fan ; devel@edk2.groups.io Cc: Gao, Liming ; Jiang, Guomin ; Bi, Dandan ; Kinney, Michael D Subject: RE: [PATCH V2 1/1] MdeModulePkg: Support customized FV Migration I= nformation Hi Fan, The logic looks functional, but there are some names and descriptions that = could be added to help describe this feature and some code changes to make = the code easier to understand. 1) The GUID gEdkiiToMigrateFvInfoGuid is hard to understand what information it conveys from the name of the GUID variable. I know that the intent is that it is a GUID with data that=20 tells the PEI core which FVs in temporary RAM should be=20 migrated to permanent RAM. And that the use of this information is only a performance optimization to not migrate FVs that=20 are not needed after the PEI Core migrates temp RAM to=20 permanent RAM. The name and description in comments do not express all these details. 2) The structure name EDKII_TO_MIGRATE_FV_INFO has the same issue as (1). a) Should FvOrgBase be a UINT64 or support temp RAM above 4GB? b) Since only temp RAM to perm RAM migrations are supported the field name "FvOrgBase" should be "FvTemporaryRamBase". 3) The #define for FLAGS_SKIP_FV_MIGRATION should have a comment block that describes the meaning of this bit. What is the=20 meaning when the bit is set and what is the meaning when the bit is clear. 4) The #define for FLAGS_SKIP_FV_RAW_DATA_COPY should have a comment block that describes the meaning of this bit. What is the=20 meaning when the bit is set and what is the meaning when the bit is clear. 5) Why are there 2 bits? If an FV is skipped, then that means do not copy. If an FV is not skipped, then that means do copy. 6) I think the variable MigrateAllFvs can be removed, and the HOB list check can be made for gEdkiiToMigrateFvInfoGuid can be made on each FV found in temporary RAM. This looks like a performance optimization that makes the logic harder to understand and it is not clear that the performance optimization has any benefit. 7) The call to RemoveFvHobsInTemporaryMemory (Private) was removed. Why? 8) The comment where memory is allocated for the migrated FV says "allocate pool" when PeiServicesAllocatePages() is used. Please=20 update the comment. Mike > -----Original Message----- > From: Wang, Fan > Sent: Monday, September 11, 2023 2:52 AM > To: devel@edk2.groups.io > Cc: Wang, Fan ; Kinney, Michael D=20 > ; Gao, Liming ;=20 > Jiang, Guomin ; Bi, Dandan=20 > > Subject: [PATCH V2 1/1] MdeModulePkg: Support customized FV Migration=20 > Information >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4533 >=20 > There are use cases which not all FVs need be migrated from TempRam to=20 > permanent memory before TempRam tears down. This new guid is=20 > introduced to avoid unnecessary FV migration to improve boot=20 > performance. > Platform > can publish ToMigrateFvInfo hob with this guid to customize FV=20 > migration info, and PeiCore will only migrate FVs indicated by this=20 > Hob info. >=20 > This is a backwards compatible change, PeiCore will check=20 > ToMigrateFvInfo hob before migration. If ToMigrateFvInfo hobs exists,=20 > only migrate FVs recorded by hobs. If ToMigrateFvInfo hobs not exists,=20 > migrate all FVs to permanent memory. >=20 > Cc: Michael D Kinney > Cc: Liming Gao > Cc: Guomin Jiang > Cc: Dandan Bi > Signed-off-by: Wang Fan > --- > MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 82 +++++++++++++----- > - > MdeModulePkg/Core/Pei/PeiMain.inf | 1 + > MdeModulePkg/Include/Guid/MigratedFvInfo.h | 19 +++++ > MdeModulePkg/MdeModulePkg.dec | 3 +- > 4 files changed, 79 insertions(+), 26 deletions(-) >=20 > diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c > b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c > index 5f32ebb560ae..e84849ec6db1 100644 > --- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c > +++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c > @@ -1184,7 +1184,11 @@ EvacuateTempRam ( >=20 > PEI_CORE_FV_HANDLE PeiCoreFvHandle; > EFI_PEI_CORE_FV_LOCATION_PPI *PeiCoreFvLocationPpi; > + EDKII_TO_MIGRATE_FV_INFO *ToMigrateFvInfo; > EDKII_MIGRATED_FV_INFO MigratedFvInfo; > + EFI_PEI_HOB_POINTERS Hob; > + BOOLEAN MigrateAllFvs; > + UINT32 MigrationFlags; >=20 > ASSERT (Private->PeiMemoryInstalled); >=20 > @@ -1211,6 +1215,17 @@ EvacuateTempRam ( >=20 > ConvertPeiCorePpiPointers (Private, &PeiCoreFvHandle); >=20 > + // > + // Check if platform defined hobs to indicate which FVs are > expected to migrate or keep raw data. > + // If ToMigrateFvInfo hobs exists, only migrate FVs recorded by > hobs. > + // If ToMigrateFvInfo hobs not exists, migrate all FVs to permanent > memory. > + // > + MigrateAllFvs =3D TRUE; > + Hob.Raw =3D GetFirstGuidHob (&gEdkiiToMigrateFvInfoGuid); > + if (Hob.Raw !=3D NULL) { > + MigrateAllFvs =3D FALSE; > + } > + > for (FvIndex =3D 0; FvIndex < Private->FvCount; FvIndex++) { > FvHeader =3D Private->Fv[FvIndex].FvHeader; > ASSERT (FvHeader !=3D NULL); > @@ -1224,6 +1239,25 @@ EvacuateTempRam ( > ) > ) > { > + if (MigrateAllFvs) { > + MigrationFlags =3D 0; > + } else { > + MigrationFlags =3D FLAGS_SKIP_FV_MIGRATION | > FLAGS_SKIP_FV_RAW_DATA_COPY; > + Hob.Raw =3D GetFirstGuidHob (&gEdkiiToMigrateFvInfoGuid); > + while (Hob.Raw !=3D NULL) { > + ToMigrateFvInfo =3D GET_GUID_HOB_DATA (Hob); > + if (ToMigrateFvInfo->FvOrgBase =3D=3D (UINT32)(UINTN)FvHeader) > { > + MigrationFlags =3D ToMigrateFvInfo->MigrationFlags; > + break; > + } > + Hob.Raw =3D GET_NEXT_HOB (Hob); > + Hob.Raw =3D GetNextGuidHob (&gEdkiiToMigrateFvInfoGuid, > Hob.Raw); > + } > + } > + if (MigrationFlags & FLAGS_SKIP_FV_MIGRATION) { > + continue; > + } > + > // > // Allocate page to save the rebased PEIMs, the PEIMs will get=20 > dispatched later. > // > @@ -1234,18 +1268,7 @@ EvacuateTempRam ( > ); > ASSERT_EFI_ERROR (Status); > MigratedFvHeader =3D (EFI_FIRMWARE_VOLUME_HEADER=20 > *)(UINTN)FvHeaderAddress; > - > - // > - // Allocate pool to save the raw PEIMs, which is used to keep > consistent context across > - // multiple boot and PCR0 will keep the same no matter if the > address of allocated page is changed. > - // > - Status =3D PeiServicesAllocatePages ( > - EfiBootServicesCode, > - EFI_SIZE_TO_PAGES ((UINTN)FvHeader->FvLength), > - &FvHeaderAddress > - ); > - ASSERT_EFI_ERROR (Status); > - RawDataFvHeader =3D (EFI_FIRMWARE_VOLUME_HEADER > *)(UINTN)FvHeaderAddress; > + CopyMem (MigratedFvHeader, FvHeader, (UINTN)FvHeader- > >FvLength); >=20 > DEBUG (( > DEBUG_VERBOSE, > @@ -1256,18 +1279,29 @@ EvacuateTempRam ( > )); >=20 > // > - // Copy the context to the rebased pages and raw pages, and > create hob to save the > - // information. The MigratedFvInfo HOB will never be produced > when > - // PcdMigrateTemporaryRamFirmwareVolumes is FALSE, because the > PCD control the > - // feature. > + // Copy the context to the raw pages, and create hob to save > the information. The MigratedFvInfo > + // HOB will never be produced when > PcdMigrateTemporaryRamFirmwareVolumes is FALSE, because the PCD > + // controls the feature. > // > - CopyMem (MigratedFvHeader, FvHeader, (UINTN)FvHeader- > >FvLength); > - CopyMem (RawDataFvHeader, MigratedFvHeader, (UINTN)FvHeader- > >FvLength); > - MigratedFvInfo.FvOrgBase =3D (UINT32)(UINTN)FvHeader; > - MigratedFvInfo.FvNewBase =3D (UINT32)(UINTN)MigratedFvHeader; > - MigratedFvInfo.FvDataBase =3D (UINT32)(UINTN)RawDataFvHeader; > - MigratedFvInfo.FvLength =3D (UINT32)(UINTN)FvHeader->FvLength; > - BuildGuidDataHob (&gEdkiiMigratedFvInfoGuid, &MigratedFvInfo, > sizeof (MigratedFvInfo)); > + if ((MigrationFlags & FLAGS_SKIP_FV_RAW_DATA_COPY) !=3D > FLAGS_SKIP_FV_RAW_DATA_COPY) { > + // > + // Allocate pool to save the raw PEIMs, which is used to keep > consistent context across > + // multiple boot and PCR0 will keep the same no matter if the > address of allocated page is changed. > + // > + Status =3D PeiServicesAllocatePages ( > + EfiBootServicesCode, > + EFI_SIZE_TO_PAGES ((UINTN)FvHeader->FvLength), > + &FvHeaderAddress > + ); > + ASSERT_EFI_ERROR (Status); > + RawDataFvHeader =3D (EFI_FIRMWARE_VOLUME_HEADER > *)(UINTN)FvHeaderAddress; > + CopyMem (RawDataFvHeader, MigratedFvHeader, (UINTN)FvHeader- > >FvLength); > + MigratedFvInfo.FvOrgBase =3D (UINT32)(UINTN)FvHeader; > + MigratedFvInfo.FvNewBase =3D (UINT32)(UINTN)MigratedFvHeader; > + MigratedFvInfo.FvDataBase =3D (UINT32)(UINTN)RawDataFvHeader; > + MigratedFvInfo.FvLength =3D (UINT32)(UINTN)FvHeader- > >FvLength; > + BuildGuidDataHob (&gEdkiiMigratedFvInfoGuid, &MigratedFvInfo, > sizeof (MigratedFvInfo)); > + } >=20 > // > // Migrate any children for this FV now @@ -1330,8 +1364,6 @@=20 > EvacuateTempRam ( > } > } >=20 > - RemoveFvHobsInTemporaryMemory (Private); > - > return Status; > } >=20 > diff --git a/MdeModulePkg/Core/Pei/PeiMain.inf > b/MdeModulePkg/Core/Pei/PeiMain.inf > index 0cf357371a16..944b230b0e19 100644 > --- a/MdeModulePkg/Core/Pei/PeiMain.inf > +++ b/MdeModulePkg/Core/Pei/PeiMain.inf > @@ -78,6 +78,7 @@ > gEfiFirmwareFileSystem3Guid > gStatusCodeCallbackGuid > gEdkiiMigratedFvInfoGuid ## SOMETIMES_PRODUCES > ## HOB > + gEdkiiToMigrateFvInfoGuid ## SOMETIMES_CONSUMES > ## HOB >=20 > [Ppis] > gEfiPeiStatusCodePpiGuid ## SOMETIMES_CONSUMES > # PeiReportStatusService is not ready if this PPI doesn't exist diff=20 > --git a/MdeModulePkg/Include/Guid/MigratedFvInfo.h > b/MdeModulePkg/Include/Guid/MigratedFvInfo.h > index aca2332a0ec6..543cd9ba7ddd 100644 > --- a/MdeModulePkg/Include/Guid/MigratedFvInfo.h > +++ b/MdeModulePkg/Include/Guid/MigratedFvInfo.h > @@ -9,6 +9,24 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef=20 > __EDKII_MIGRATED_FV_INFO_GUID_H__ #define=20 > __EDKII_MIGRATED_FV_INFO_GUID_H__ >=20 > +#define FLAGS_SKIP_FV_MIGRATION BIT0 > +#define FLAGS_SKIP_FV_RAW_DATA_COPY BIT1 > + > +/// > +/// EDKII_TO_MIGRATE_FV_INFO Hob information should be published by > platform to indicate > +/// one FV is expected to migrate to permarnant memory or not before > TempRam tears down. > +/// > +typedef struct { > + UINT32 FvOrgBase; // original FV address > + // > + // Migration Flags: > + // Bit0: Indicate to skip FV migration or not > + // Bit1: Indicate to skip FV raw data copy or not > + // Others: Reserved bits > + // > + UINT32 MigrationFlags; > +} EDKII_TO_MIGRATE_FV_INFO; > + > typedef struct { > UINT32 FvOrgBase; // original FV address > UINT32 FvNewBase; // new FV address > @@ -16,6 +34,7 @@ typedef struct { > UINT32 FvLength; // Fv Length > } EDKII_MIGRATED_FV_INFO; >=20 > +extern EFI_GUID gEdkiiToMigrateFvInfoGuid; > extern EFI_GUID gEdkiiMigratedFvInfoGuid; >=20 > #endif // #ifndef __EDKII_MIGRATED_FV_INFO_GUID_H__ diff --git=20 > a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index=20 > dd182c02fdf6..d6cbcc721a5e 100644 > --- a/MdeModulePkg/MdeModulePkg.dec > +++ b/MdeModulePkg/MdeModulePkg.dec > @@ -416,7 +416,8 @@ > gEdkiiCapsuleOnDiskNameGuid =3D { 0x98c80a4f, 0xe16b, 0x4d11, { 0x93,= =20 > 0x9a, 0xab, 0xe5, 0x61, 0x26, 0x3, 0x30 } } >=20 > ## Include/Guid/MigratedFvInfo.h > - gEdkiiMigratedFvInfoGuid =3D { 0xc1ab12f7, 0x74aa, 0x408d, { 0xa2,=20 > 0xf4, 0xc6, 0xce, 0xfd, 0x17, 0x98, 0x71 } } > + gEdkiiToMigrateFvInfoGuid =3D { 0xb4b140a5, 0x72f6, 0x4c21, { 0x93, > 0xe4, 0xac, 0xc4, 0xec, 0xcb, 0x23, 0x23 } } > + gEdkiiMigratedFvInfoGuid =3D { 0xc1ab12f7, 0x74aa, 0x408d, { 0xa2, > 0xf4, 0xc6, 0xce, 0xfd, 0x17, 0x98, 0x71 } } >=20 > ## Include/Guid/RngAlgorithm.h > gEdkiiRngAlgorithmUnSafe =3D { 0x869f728c, 0x409d, 0x4ab4, {0xac,=20 > 0x03, 0x71, 0xd3, 0x09, 0xc1, 0xb3, 0xf4 }} > -- > 2.29.2.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111458): https://edk2.groups.io/g/devel/message/111458 Mute This Topic: https://groups.io/mt/101289546/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-