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 8CDACAC1972 for ; Mon, 16 Oct 2023 20:59:58 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Zlso1NF+xl6f27Syjomi+FFC4b3mCldkbyYAyfOI+tc=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC: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=1697489997; v=1; b=Z2yZTG+B99AkFARCeKAs1MCgyBtCg1zxC7sfhWAureFBya7Sm97hQL5AuOGtqXD7/aDPzTdN YKkdYsnh9ulvE1f9X5SPJmSFdsc8/9VANl2BnTwKGyGDW4+mnvppVSOq3/6Fam44tOrn3N6IaPb 8DAd6Nr/jqR0wseQ+GedI8kA= X-Received: by 127.0.0.2 with SMTP id wc8EYY7687511xDCD2YjO9Ca; Mon, 16 Oct 2023 13:59:57 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web11.179960.1697489996570464265 for ; Mon, 16 Oct 2023 13:59:56 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="389506566" X-IronPort-AV: E=Sophos;i="6.03,230,1694761200"; d="scan'208";a="389506566" X-Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 13:59:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="1087232540" X-IronPort-AV: E=Sophos;i="6.03,230,1694761200"; d="scan'208";a="1087232540" X-Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga005.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 16 Oct 2023 13:59:55 -0700 X-Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Mon, 16 Oct 2023 13:59:55 -0700 X-Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Mon, 16 Oct 2023 13:59:54 -0700 X-Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Mon, 16 Oct 2023 13:59:54 -0700 X-Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.101) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Mon, 16 Oct 2023 13:59:54 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U7h5NW0F/a0sGTJYSpTN7y2dqUp73/htU+ah5Hbl9HyxNb+ygB3f7qHvPeFd6Ft76G9V5rLKX4BcedaUWCNuxzUlf+4D3XyyhAiFOSUkGFf6zXlwvczA2UaUSzexlQEuTOh+BuI9HCNmkB7x6Ab75bYTDEHRT1Nfhv3dL0UKe3uG+m9EfUiWDdo4YZhbhPTE31Nz1h6K/gEFmwHB+LY2u2AvA7oqY2dTGN+Z+kS9YW8zgaoLzKsgLOmGgZQMkbmMgsIS4goKVXm8tUeVQABvL8TXXAszJzn3cpI68Y2lGrzjpOUT0IMogH0ImzqhlE81V8nkCCFVvqsVymZ7vpnMQQ== 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=mNRAizRDWBtcUSJWr/kV5crxeFkfvTn9blHiqzIsZaU=; b=Md5c9Xz7DTo/PrwediqpS2HjXtTPA5L8nqdo23X8UjciEd4X/sM6YBxzPJNuROwrkTBW9WYINeeEEHMNbLnAC0+mH0bC2S2+HzioXBncd+LEmKQiaUvS2sfTonwCT16DSsCQqTaDOprzMBRFAIqZLZnTvjyirPxgr/a7RNnBd8TfN2IVM7+z/Zn6h9gxXlHYGIr2d4Sy5UODCi1lw+vgoJv7Vy9/S8O6fYX8grUzMnsPoMS+k1WMVGlhMqYAll/Xh40VLypE2fpsluhIldr+DeJut6GKA1Ep2e8g1qHW60/WoXNzfjkZLEicNPPdcJwpDwSRGJRR/OBdzlcHWCRPlw== 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 CO1PR11MB4929.namprd11.prod.outlook.com (2603:10b6:303:6d::19) by DM4PR11MB7351.namprd11.prod.outlook.com (2603:10b6:8:104::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.34; Mon, 16 Oct 2023 20:59:51 +0000 X-Received: from CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::2ebf:3b09:b169:ee2c]) by CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::2ebf:3b09:b169:ee2c%4]) with mapi id 15.20.6886.034; Mon, 16 Oct 2023 20:59:51 +0000 From: "Michael D Kinney" To: "Wang, Fan" , "devel@edk2.groups.io" CC: "Gao, Liming" , "Jiang, Guomin" , "Bi, Dandan" , "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: AQHZ5JWgaxfMeM4um0eHEIIRSt1ZjLBM3Z0Q Date: Mon, 16 Oct 2023 20:59:51 +0000 Message-ID: References: <76cde14616a559c6939f8814d0e79afa7f1a7fcf.1694425833.git.fan.wang@intel.com> In-Reply-To: <76cde14616a559c6939f8814d0e79afa7f1a7fcf.1694425833.git.fan.wang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CO1PR11MB4929:EE_|DM4PR11MB7351:EE_ x-ms-office365-filtering-correlation-id: 8e0aa4a5-cf4e-4c47-e98d-08dbce8ad732 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: NNtxkW493th/33XJhBNhkTmu7HlpclVMQGGKgE9mlUhB/vWWZfXWafKjgjtD8tPhek1CBRneo0GqJXK8TvgoTbhVccFczRE2FYon0AoMPkjWmZYvp75LyZf1S0/C869Rqu/5USBMyOPhjxWLSbosCXQlIZeoktWwn+Risfkn6oFALl/qltF/tcZkD/tgpq8N7JtCVtiaC2twaXQsWwIGSdfaGcKGGa/COXUt0ZJDCH7f6U2fcfBc/o1eqomdb1i0HSynDFIsoUR+19eU7wE7GC9pml/mygk8zOjy/aSsdSKdA7ZioW8mJKWZuQeTsg+uIJoXtClizm/bS8s4JaS9VaQx4mNahfF1krUqXD4Fim20qbFTcgBRLHeExYLgsvla87xyuSpfHDs4kwGgDEw6ltj692JQK3f3horlfWof/MSQbCMcTKF11SGNxtbwqkuXRGwTgcYh8fLjrmaEiZ4j/utRXKoY1CE74lHJXTtwfvJFXBAwm541fKxuY0/q7G+B86MC+PGm4zfs88YxuQ7zarfICbrTnutixNf+pj5fnq8P1KLdC+UmS6BOD1Jng7APRADL4hhk81gilDie4LpeK4HbtaLwQhgg5xAVMScDOzc= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?hV/+0MdNWpV473PJX+U5E7U9i5HECZ+vnwBmWhqqc3qHDXveK+AKDoSZuMNC?= =?us-ascii?Q?p2vfXTaMvy84Kibdwp/MKN5n4bGr6a5cH3D/0BLx7sIH3hqzFONnDV6Hkcps?= =?us-ascii?Q?85pdB9wq3dC30dBmpHNLDUykUEOEVnhlA5Rv96xs+OxHnDA0lDQ5czfmliEG?= =?us-ascii?Q?7lPjBw+ZFcSb+LVvm1vxX9ZQIS2KJaRUL8QH4zBKFpxYMGKU8lgeXeiGwB2j?= =?us-ascii?Q?mexjGoM3aAKM3/a+p/TkFAaiS3PLQF0ff5s2IibGVIIEZ/ckq8BzSY3bvSP8?= =?us-ascii?Q?bxG8vv2jCCRESbphhLP8+vmioFBSLlz+5xVRP+ogIfiWhEVdDWhz2SpIoY16?= =?us-ascii?Q?NFFNXfmtw39tnrGpIBY2pykrgpRi/VLAZua3WIYNymqZxlxwzMuPSOs4hmwZ?= =?us-ascii?Q?WSLwYwWjEuVACdHQxrVOZLpQlju1F1qumfoFN0eyQJfHeNxdJJ+PIHnmnoYC?= =?us-ascii?Q?oSitlrimpUU7MYm5XBKYPxknE6OgF0zS7NyBqRQvY2HAZfEXKN0cdSjSey0p?= =?us-ascii?Q?enb3QzcdkV/xfsGsBhwRoxALdcsviJb0YgxZVZ+Jw82BN83xAuhBZXyY1rA5?= =?us-ascii?Q?mdaCBOItKQ1Y2S1f40WK+wmV7sYJG1sjzBRonFU8zh/7WMeGbjwjkw6ybxk8?= =?us-ascii?Q?i0uyVM4ZY461RUaAU8e7yUnzmArVENpzDQ1efGOvi6z1qmup/PamCxt5etTG?= =?us-ascii?Q?sKZYsxjOiFJu9UgPiZIq0Dd+MJA+kK1l5+m2t4kK0QyQDASl+CxCPdiE6oOC?= =?us-ascii?Q?R3MN0Y1xvhzOF7Sxrme7+MuNaiyrkKkdD3TkLzhU5LQ5olgfGQN2ziIm6RmZ?= =?us-ascii?Q?O1AWtgOazozdts9bxFi9iTBuTLurvNNWpLy2fKj5+stAHF/gJg5v1MdJyml+?= =?us-ascii?Q?+MG9NRyXD2yEwt/8T/RgAyuY5OxVRg451J9EaHn3vhD7EYRQ+yxvki3ZxD1u?= =?us-ascii?Q?m1xqjrBrGRJvjtTcqwaRsMDB8ARFIXDsqO8RtIoMVi7BD/yNtzPdO9KY+0V3?= =?us-ascii?Q?pKSjxLreUvUgxsAFTpr5bHBQ1NuBdPVoopIk7PcJxHAhoGWjvglSfMSYcwKv?= =?us-ascii?Q?tsTp4r2c56TV/n/lsmBmYhTxBa8I1mZCk5gft8SQIsu8VYrRbZ0EcBzCVmlr?= =?us-ascii?Q?ImPS5+XMXLgR6NMP2TTVeh/J/N5zqyxoCrkH+Fdb2uRHdxBujvlB0okrc9hp?= =?us-ascii?Q?0OrOUlQewEbeQbuWvtVCjylcRLhQdI15c9gbn26RPoS2zRe2QAEEVpFFsUGG?= =?us-ascii?Q?aq4HRuJvAyZG6WQ6zjLGe4e/Esey0FWU7Sz1c17BMbnUT8Dpg4rDAivZ27/p?= =?us-ascii?Q?ocUA+1axE1Ysc5ENPOP4hLFv3s2DAsWwWq/wbF1K/lmRcrulej9CwxlARnBq?= =?us-ascii?Q?zPfj43PdO8HrbfADp3Ca6/+WvHNeQ7rmcIeZBzcC1d33RgaGJHLXcFWsmgpj?= =?us-ascii?Q?R4lfFnHISLZAJVh+vjshimSoVB9ryyjLVvrsIDaypPAtGkGD42uF+UzNIXdv?= =?us-ascii?Q?5Bgdh48BHr03u58HSVE/LZl+OS33p328lLcI1O0+Es42KIZ/M3wUDHafk3qD?= =?us-ascii?Q?tgXr2uFUYXivKb5o+tmH2Mgy3aesS6cusGFT887kuiDYmu5/fbCq/N9kWDxE?= =?us-ascii?Q?ZQ=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4929.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8e0aa4a5-cf4e-4c47-e98d-08dbce8ad732 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Oct 2023 20:59:51.4201 (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: SvlWJ5xlMS0s4hzBP8ov2QgnSe+v2R2HEpsb+rnJG6qj1wJ9nJOhtUINUXJAHOKrj8OUuHuW/Yr8miNHKv37O/sfGmdhhmyK9zHigFrMQ8I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB7351 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,michael.d.kinney@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: C65YMb37ZbnIcp4kT6kfMZaxx7686176AA= 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=Z2yZTG+B; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); 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 Fan, The logic looks functional, but there are some names and descriptions that could be added to help describe this feature and some code=20 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 > ; Gao, Liming ; > Jiang, Guomin ; Bi, Dandan > > Subject: [PATCH V2 1/1] MdeModulePkg: Support customized FV Migration > 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 > permanent memory before TempRam tears down. This new guid is > introduced > to avoid unnecessary FV migration to improve boot performance. > Platform > can publish ToMigrateFvInfo hob with this guid to customize FV > migration > info, and PeiCore will only migrate FVs indicated by this Hob info. >=20 > This is a backwards compatible change, PeiCore will check > ToMigrateFvInfo > hob before migration. If ToMigrateFvInfo hobs exists, only migrate FVs > recorded by hobs. If ToMigrateFvInfo hobs not exists, 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 > dispatched later. > // > @@ -1234,18 +1268,7 @@ EvacuateTempRam ( > ); > ASSERT_EFI_ERROR (Status); > MigratedFvHeader =3D (EFI_FIRMWARE_VOLUME_HEADER > *)(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 @@ 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 --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 __EDKII_MIGRATED_FV_INFO_GUID_H__ > #define __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 a/MdeModulePkg/MdeModulePkg.dec > b/MdeModulePkg/MdeModulePkg.dec > index dd182c02fdf6..d6cbcc721a5e 100644 > --- a/MdeModulePkg/MdeModulePkg.dec > +++ b/MdeModulePkg/MdeModulePkg.dec > @@ -416,7 +416,8 @@ > gEdkiiCapsuleOnDiskNameGuid =3D { 0x98c80a4f, 0xe16b, 0x4d11, { 0x93, > 0x9a, 0xab, 0xe5, 0x61, 0x26, 0x3, 0x30 } } >=20 > ## Include/Guid/MigratedFvInfo.h > - gEdkiiMigratedFvInfoGuid =3D { 0xc1ab12f7, 0x74aa, 0x408d, { 0xa2, > 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, > 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 (#109655): https://edk2.groups.io/g/devel/message/109655 Mute This Topic: https://groups.io/mt/101289546/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-