From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web11.14662.1612066814935187792 for ; Sat, 30 Jan 2021 20:20:15 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=cuwDpz4n; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: benjamin.you@intel.com) IronPort-SDR: qolmQ15RXUBm25PhxW4nwbBUowBRrg88mcmVo7N3iuhElq8Yr1k5kWgqKEa4O5GXBY3dDS1RV6 cOU4AkbXKOJw== X-IronPort-AV: E=McAfee;i="6000,8403,9880"; a="168236143" X-IronPort-AV: E=Sophos;i="5.79,389,1602572400"; d="scan'208";a="168236143" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2021 20:20:13 -0800 IronPort-SDR: QxW19/glgVHEOk5IndPu9dZ2RVu8o+A3LjcGiDhOGRdGlm38fLGCToBBfjBvAzgjoreM+rjw4p avTV7+RKah9w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,389,1602572400"; d="scan'208";a="390082250" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga008.jf.intel.com with ESMTP; 30 Jan 2021 20:20:12 -0800 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Sat, 30 Jan 2021 20:20:12 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Sat, 30 Jan 2021 20:20:12 -0800 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.109) 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.1713.5; Sat, 30 Jan 2021 20:19:55 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YSKqHNPlKAevDQdtoz9/z1pY5NV7F2vHbQuVVYpsGYZvLTFpwzBkxi7+DSHr04QOEJI/3h3OwqtRSlQT3Bev866kBYBBp0pmQppM4Yt1wQWu7nLOXXF7hfL8vO+aWV5T2cPeeMcSnMA69o0ASgskS1ML5mRub0OR9RPtIO4j/U1jFHXde5qpvIBG06yXnbtPtXA/zoVA8WCxXrQQmAzToAvF58jhH69Yw9zoAKxJHjJ1w0ZxWVYYkpBiNAmRIQtjhunA5qdTA4oZ+z+6x5YY1OvEAK1pKpjH+CD2IF+IQ8m+633Oh1o1cZzpOd0uKyX63BLngzanl7p9U3NrXwUbNQ== 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-SenderADCheck; bh=SQlA4Suz+0PVoQFc3qpvgMVoKJLRo827VQYThcLd084=; b=KXpVLm9OIYqewsopgHL2MpqSiDmY8EW7mZionPxW1lruxsCF/4XMpfF3qiLvhzAu/Bmb40w8s42cpKXO1xEhYP3zhAN0HlI6OoHRNULbm2z020eZEV6fiJJ54P6/PuL7cZZ2NGiP8Mzv+0bjI+bXxPSaJY1P5uvkk+RmzN7T+D+xGnjjJ5n6iL8gCpCtK/CpJnQqImfYkgGXG1f8HIjBmcoXu70Vuevi/Iy3esYeuHLVzgOOFE/SiJs4CGToq+ziNa38JPSxntUvKBYh7GLLBPAcfHl6oYVgN1pnE1X+4hH+XXkx2c3nzkR4Ntalbl49IgkflBWNN/xK2KFhYxV4aw== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SQlA4Suz+0PVoQFc3qpvgMVoKJLRo827VQYThcLd084=; b=cuwDpz4nFNQiR4BEQpssc51IsqjEvazydZ03UNd3tereNYNgzL9YnmVgNZMhdJgbh/9iJxRZcZeEAmenu3wl+Qbd7mJgrgygq/GB8Q7RyTO1GmDycGbzbVYT+UXvaR9kWkDrNOcTK3nu2+8XcODjf+purP+bYdiZU8Y/RICWc18= Received: from BN8PR11MB3748.namprd11.prod.outlook.com (2603:10b6:408:86::21) by BN6PR1101MB2210.namprd11.prod.outlook.com (2603:10b6:405:58::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.17; Sun, 31 Jan 2021 04:19:54 +0000 Received: from BN8PR11MB3748.namprd11.prod.outlook.com ([fe80::e4ef:ec7e:a3be:4bcf]) by BN8PR11MB3748.namprd11.prod.outlook.com ([fe80::e4ef:ec7e:a3be:4bcf%4]) with mapi id 15.20.3805.021; Sun, 31 Jan 2021 04:19:53 +0000 From: "Benjamin You" To: "devel@edk2.groups.io" , "Park, Aiden" , "Ni, Ray" , "Dong, Guo" , "Ma, Maurice" Subject: Re: [edk2-devel] [PATCH] UefiPayloadPkg: Update EFI Memory Service conditions Thread-Topic: [edk2-devel] [PATCH] UefiPayloadPkg: Update EFI Memory Service conditions Thread-Index: AQHW9eJ0dD5ATzOAQEuFISOMOZSg36o99o0AgAEjZYCAAggtIA== Date: Sun, 31 Jan 2021 04:19:53 +0000 Message-ID: References: <20210129015937.1983-1-aiden.park@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.208] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 113f8f81-7e65-4cf8-8c20-08d8c59f75bf x-ms-traffictypediagnostic: BN6PR1101MB2210: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: CNbr1BYaWqAyTzoXOc4t5PrnABqtyFl8FGBL43L5PODC7VMi2x4j9TnIDaLwI0iGpjqBzBwO/WFvwCp5Y6SIngwpvGIQrtmbYzjY8JeZO+ehc5lpgKa6zZPYFL+PWURnYCEvYE1ckYu3ICmeaj+7CIHvzvF16ru5nWHSHdaP9Fqd0i9xCMdXSVCMRNZGijpA+25a9mEmHRhjKz3E5tTisIkyhpyKySCiXcZnjlhBtV152kFVXfEG1ZWg435sBCd3JarWMkaW2IOtWS/zH5agOw8O5ubm083yAt/gt123M4N5UIf0wHQlCxPK8FGjZN/JM2bpsXXdT3p/PlZASU2UUok2RnhRTUeZjzRdwmdjOOZtkvKYt9YdwyDkhs39EUTkqD3DJos9iVoZ13/OIMeARsp7ABGyPzSsFn7EaMUFp/scJ1Y5Y32fHDfRfgeHtMgPxH3kAUD7JCREmthWOuX6pqBscr1iZEGAkLFkez+n6QLfWzwkmjHw5H8po6sAaugTHj02lCjanQJx0ebLhXbvRODLKHA08ruViKu2QDx9BUgZEK5hNSfBfSytJSMB8BC1jmbN3pcINteUdtfLpTQdMo01Z58U0ZbNIsOrJ+Bj0Q0= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR11MB3748.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(136003)(376002)(396003)(39850400004)(346002)(186003)(26005)(5660300002)(8936002)(8676002)(86362001)(83380400001)(71200400001)(15650500001)(9686003)(33656002)(66476007)(52536014)(6636002)(55016002)(76116006)(7696005)(966005)(478600001)(66446008)(316002)(110136005)(2906002)(66946007)(64756008)(66556008)(6506007)(53546011);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?+kmROgwhWoEjphnQw+Kf7ocqkH3rZbF8ovJQiF38bOZ8Gg0t8VftmusLByXa?= =?us-ascii?Q?o+nu2D4v7Bu7ls+PNUCEKudGssPOIfftvUVu6l0HWbxIUUqJKvzgU7xGrvt/?= =?us-ascii?Q?mqhtYZERrW1ks+KyBxHPsBzsCNklnDLGNSjlSQyD9+G/dD3be5xh2Xt2hVgF?= =?us-ascii?Q?eC4+gACJyuAOTQpdqcxsQvo4l41aRWfP4YBr7lMrCX2ZLfTVjoiY+qbSn3jL?= =?us-ascii?Q?e+mjnD42uCyRdJBwJqXtKAmhlvzW15Xy3csjv9qZ6+VSI9XH7YVE29lAYofr?= =?us-ascii?Q?Q/tBr9KIqfFjv62TjLH4nCXOGSTb5YevGgUeRh7GhAWzWw9sEHHeKKolUivE?= =?us-ascii?Q?umYNUsSkSA0m5CWiNI0EKlW5p+9G59uwTONOCOnZBuPbe0vybNiX+VYYQ2A/?= =?us-ascii?Q?H1z781PZtPEXkWz1VcAJY3tPbP7h0I4UUC2fm2w3Y4C1HmS5oL7PVL1XtRFZ?= =?us-ascii?Q?PqbNDcfhyzwZ7qeXNAyWjcl8hA6Nb0hDN+Y33NDTADCkjXHzlS/f5qO0a0Ks?= =?us-ascii?Q?NimdXKLmiAOIqKexdU4rmkddY09orHUivQhbdpE8e3E+gfVxDb9xzOVo3EX9?= =?us-ascii?Q?2aPX8j4SiZLLld9VMszlaBnSf0nV35B+eqgL+3pnDsXqiIXKtblGFG4HembP?= =?us-ascii?Q?tSG/5IRgP7sIK7QIBjjGZ0Muk+oQUvOOe8beKxdfTU+uy/ETTljTTUP/KRaV?= =?us-ascii?Q?qHFdy21xl6sf/vdH2zv0Oyq72AftA9vzvaest+cbE6XxOy2LpBraPgpbCPlM?= =?us-ascii?Q?SL1FLsr938xdjTtyu6ZUmlSfBV00I3lD5zk91uRKbdjzeqxED466kZppX7CU?= =?us-ascii?Q?KSLSwvb5mXXb0rOL00lOCe2wwkNmFN0RhJGQUQtXf7V7uGER1yvApQ9llyku?= =?us-ascii?Q?2d3tNYpcZ6YzvPUuYgfSQCGl8viCtLhXn88Rtks9ySOPlMaG8hDbaR/EAV8E?= =?us-ascii?Q?G+025TYZRqFD2XbIsPiIm/5LWwpGuPr0omIEbv7O966LtbPeNlfq1GqwqPwZ?= =?us-ascii?Q?4kfTc+ILaEKeWD6cCpWFHHmFZfCmHwUprGTwfDT8G334nS1mq1vZ6SZpS4hJ?= =?us-ascii?Q?qVyJW8tk?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR11MB3748.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 113f8f81-7e65-4cf8-8c20-08d8c59f75bf X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Jan 2021 04:19:53.5766 (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: 1QorKpJDQSKs12OBG5sTmmjuKd1prciEgZSmEsSUltexNgoGzReXXNX/EUxl66e5S9wKw1VmFYtEZdXjXiFKQA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1101MB2210 Return-Path: benjamin.you@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Aiden, Could you please insert some comments for below codes? + if (Base =3D=3D 0x00) { + Attribue &=3D ~EFI_RESOURCE_ATTRIBUTE_TESTED; } Also, is this removal of legacy region to protect coreboot data structures= in the region? Thanks, - ben > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Park, Aid= en > Sent: Saturday, January 30, 2021 5:08 AM > To: Ni, Ray ; devel@edk2.groups.io; Dong, Guo > ; Ma, Maurice > Subject: Re: [edk2-devel] [PATCH] UefiPayloadPkg: Update EFI Memory Serv= ice > conditions >=20 > Hi Ray, >=20 > You are absolutely right. This patch does not have the adjust/recovery p= ath. > The reasons we have the initial values here are > 1. Without default memory type, the EFI memory service look for an usabl= e > conventional memory region calculated with the minimal memory size 64KB. > This patch will increase the minimal memory size condition to 1.3MB. > 2. The default memory type PCD values are enough for UefiPayload memory > service since most of necessary memory are already covered in pre-stage = boot > firmware. > 3. The default memory type PCDs can be updated or overridden by a platfo= rm > DSC if necessary > 4. UefiPayload is using EmuVariableNvMode by default >=20 > The main goal of this patch is > - To avoid legacy memory region to be selected for EFI memory service > - To select Fair enough conventional memory region by increasing the mi= nimal > memory size >=20 > > -----Original Message----- > > From: Ni, Ray > > Sent: Thursday, January 28, 2021 7:45 PM > > To: devel@edk2.groups.io; Park, Aiden ; Dong, Gu= o > > ; Ma, Maurice > > Subject: RE: [edk2-devel] [PATCH] UefiPayloadPkg: Update EFI Memory > Service > > conditions > > > > The EDKII UEFI bios flow is: > > 1. platform PEI creates a default memory type information HOB 2. DXE C= ORE > > reserves the memory according to the HOB for allocation 3. BDS checks > whether > > the pre-reserved memory meets the needs and saves the real needs to a = NV > > variable if the pre-reserved is not enough 4. Next time boot, platform= PEI > loads > > the NV variable to create the memory type information HOB > > > > But this patch only creates a default HOB and don't provides a mechani= sm to > > consume the NV and create the HOB. > > > > > -----Original Message----- > > > From: devel@edk2.groups.io On Behalf Of Park, > > > Aiden > > > Sent: Friday, January 29, 2021 10:00 AM > > > To: Dong, Guo ; Ma, Maurice > > > ; devel@edk2.groups.io > > > Cc: Park, Aiden > > > Subject: [edk2-devel] [PATCH] UefiPayloadPkg: Update EFI Memory > > > Service conditions > > > > > > From: Aiden Park > > > > > > The CoreInitializeMemoryServices() looks for a suitable memory regio= n > > > for EFI Memory Service from the ResourceDescriptor Hob. > > > This patch does not allow legacy memory region for the Memory Servic= e > > > and provides default memory type information to calculate minimal > > > required memory size properly for the Memory Service. > > > > > > Signed-off-by: Aiden Park > > > --- > > > .../UefiPayloadEntry/UefiPayloadEntry.c | 20 ++++++++++++++++= +++ > > > .../UefiPayloadEntry/UefiPayloadEntry.inf | 5 +++++ > > > 2 files changed, 25 insertions(+) > > > > > > diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c > > > b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c > > > index 805f5448d9..d2e6f962cd 100644 > > > --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c > > > +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c > > > @@ -6,6 +6,16 @@ > > > **/ > > > > > > #include "UefiPayloadEntry.h" > > > +#include > > > + > > > +EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] =3D > { > > > + { EfiACPIReclaimMemory, FixedPcdGet32 > > (PcdMemoryTypeEfiACPIReclaimMemory) }, > > > + { EfiACPIMemoryNVS, FixedPcdGet32 > > (PcdMemoryTypeEfiACPIMemoryNVS) }, > > > + { EfiReservedMemoryType, FixedPcdGet32 > > > +(PcdMemoryTypeEfiReservedMemoryType) }, > > > + { EfiRuntimeServicesData, FixedPcdGet32 > > > +(PcdMemoryTypeEfiRuntimeServicesData) }, > > > + { EfiRuntimeServicesCode, FixedPcdGet32 > > (PcdMemoryTypeEfiRuntimeServicesCode) }, > > > + { EfiMaxMemoryType, 0 } > > > +}; > > > > > > /** > > > Callback function to build resource descriptor HOB @@ -44,6 +54,= 9 > > > @@ MemInfoCallback ( > > > // Remove tested attribute to avoid DXE core to dispatch driver= to > memory > > above 4GB > > > Attribue &=3D ~EFI_RESOURCE_ATTRIBUTE_TESTED; > > > } > > > + if (Base =3D=3D 0x00) { > > > + Attribue &=3D ~EFI_RESOURCE_ATTRIBUTE_TESTED; } > > > > > > BuildResourceDescriptorHob (Type, Attribue, > (EFI_PHYSICAL_ADDRESS)Base, > > Size); > > > DEBUG ((DEBUG_INFO , "buildhob: base =3D 0x%lx, size =3D 0x%lx, t= ype =3D > > > 0x%x\n", Base, Size, Type)); @@ -315,6 +328,13 @@ BuildGenericHob ( > > > UINT8 PhysicalAddressBits; > > > EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute; > > > > > > + // > > > + // Create Memory Type Information HOB // BuildGuidDataHob > > > + (&gEfiMemoryTypeInformationGuid, > > > + mDefaultMemoryTypeInformation, > > > + sizeof (mDefaultMemoryTypeInformation)); > > > + > > > // The UEFI payload FV > > > BuildMemoryAllocationHob (PcdGet32 (PcdPayloadFdMemBase), PcdGet3= 2 > > > (PcdPayloadFdMemSize), EfiBootServicesData); > > > > > > diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf > > > b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf > > > index cc59f1903b..5cb084ca51 100644 > > > --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf > > > +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf > > > @@ -86,6 +86,11 @@ > > > gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize > > > gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop > > > gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize > > > + > gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory > > > + gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS > > > + > gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType > > > + > gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData > > > + > gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode > > > > > > gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## > > SOMETIMES_CONSUMES > > > gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy ## > > > SOMETIMES_CONSUMES > > > -- > > > 2.20.1 > > > > > > > > > > > > > > > >=20 > Best Regards, > Aiden >=20 >=20 >=20 >=20