From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web10.141.1611954500744794661 for ; Fri, 29 Jan 2021 13:08:21 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=XQKDhn3/; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: aiden.park@intel.com) IronPort-SDR: r/uGqhi4+WIO1L/7eBEwFobI9gIBpUDggIx5vlZIfSia/3tduuKvJZ5eba7HfA8+tZEUdVeHnv V7tmc6VS9UTA== X-IronPort-AV: E=McAfee;i="6000,8403,9879"; a="244569762" X-IronPort-AV: E=Sophos;i="5.79,386,1602572400"; d="scan'208";a="244569762" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jan 2021 13:08:18 -0800 IronPort-SDR: hSIakyMsgurOOti2WJq8PY94d8Jg7RciAQb+/7rWNJ4hNv1CeIR7SSSltVG5mcHJzr85RV08Tn klqqG05DaCxw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,386,1602572400"; d="scan'208";a="475531088" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga001.fm.intel.com with ESMTP; 29 Jan 2021 13:08:18 -0800 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Fri, 29 Jan 2021 13:08:18 -0800 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Fri, 29 Jan 2021 13:08:17 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Fri, 29 Jan 2021 13:08:17 -0800 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.177) 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.1713.5; Fri, 29 Jan 2021 13:08:17 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L/Ytlyn56X6Ee8myI7Nook3wXnnNTbzu3yyXzUoQoFO/PXYWHr3IsHJWsbmmIuTdFS2khqxpnB6TzXWNrV6SopQjAhAnHhsIE2782Lyf2ikFye8kbMZ5Kl0xE2DjfJ/hMWbHEoTgITrCygYNGidCWCKr9ZkyH8p1G7srxReFLBT5jPuf4rf8j6ux743i0B5cHE14N87X548Xufo53huEBJKm09cXW+7rDDEdMWpV5DLBlofadHFz3UzBkJ2SklNEbx6j6nF+UHqCtd/gGI9ouP8fZ3gzg7BrrEl4K7UrfY/2u7DQDdqXKIqG437VdTZznFM3usoDUSoiTQqmd/PXIw== 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=VUv2WGq23vfFJWS8UnKo8G0F4N6GaSFrrTgOwGKM+Ig=; b=WDV8q5QZauN5en28XrQda2NTR7gSdhQ30lsQYpbaHQZPtyRixNbRdebECFE1yn9fieLEdTjsPnSJV5d9AqEKSZJ9DKGpicb13GdR6SVkqDXygdcC+fLpWl0418F9KqqfyKUw5sdmOookW1XAvqI5UINy5pV0iiENISlo8HEEZkccxLMdmDGVhJQU45j6ZfMCBbphotYjezptzHqt951gQdJTzO+OAUc62nImgLCMgld0QTEIqc3X62VnzTLzaBANl11FPzzX8rd1OWU6uxWCiVNN4yHrn9/4ZfMd2oK3M+bBmNWGKTnIW6c6Ag57rZmQevr1XL47yASNfVuB42MYAg== 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=VUv2WGq23vfFJWS8UnKo8G0F4N6GaSFrrTgOwGKM+Ig=; b=XQKDhn3/+FwnC/Ud3XTc01NBjEytBGzWzGh/eDLIiiwtGVGshGTcQVhTCU4rmZ9O6gTZcgB6Yy8alXOHmwMSN9FttbDNXGlrvTcpcn5ik23bzR1TRouBFYbW5MJMd2LoaAqcfFXDVKvrqdQ1IZ06P5QVvYCZuKqRcIfXc4JG+TA= Received: from MW3PR11MB4570.namprd11.prod.outlook.com (2603:10b6:303:5f::22) by MWHPR11MB1696.namprd11.prod.outlook.com (2603:10b6:300:23::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.13; Fri, 29 Jan 2021 21:08:16 +0000 Received: from MW3PR11MB4570.namprd11.prod.outlook.com ([fe80::d1b1:838a:7ea7:539c]) by MW3PR11MB4570.namprd11.prod.outlook.com ([fe80::d1b1:838a:7ea7:539c%3]) with mapi id 15.20.3805.019; Fri, 29 Jan 2021 21:08:16 +0000 From: "Park, Aiden" To: "Ni, Ray" , "devel@edk2.groups.io" , "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: AQHW9eJpTrVQDoT3X0OXkMGZGo5bYKo99o0AgAEAYIA= Date: Fri, 29 Jan 2021 21:08:15 +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-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [162.213.76.84] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 37a6fe45-247b-4c9c-d88a-08d8c499ff0b x-ms-traffictypediagnostic: MWHPR11MB1696: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: sCRNl5OUT/Y4kLd5hm5qtpJh81xVBkzxnEJZ/NbWbsHH2cEYwFBSe2Nk1MhQmZiGxsss/b3RJ31iUbqtXvxF04/GjJUtGRQ4XnwqOXjPxZnPx07PHIn38Ws/S2ZBPFSFoqBpoB2YXfq7k/iXKXpO6JKPpT8XRg+LpAkyHYr1ixpXsx1dWH02oRXfPqvA3qWyEmzU4lAt5a0/+QL63KfQA7VqvcFkPlNRFYGURjciq1NJW78KzIzImctzd7OfGvIrUD+9K4l1O22ThDfPW0ahyvq0M0Mdutbe7Vyo2SDYfa/STo7iI5FELQA2kXx88uBJxyLfXGOO4qBBIxvcxiLfqCN/oUOGdHphAHo3/LoDwB/wskiGdiGl5OVZWaD1OqWUwKSth0QYM5D9MVL9mhxEsoqK2MJTf3zhhzN2v1hVjTryLcuhKhBmoG2r/rGTfcemzjB2NaBF/oHe6MdeqNQwQKo/LzYU3Fcbs6Py27pamQkC/tEaqkqpQuMBoJN3n52GTY/v4vCCo6js6pXq4AncTOt3ewDvfIRp2UVjXksFzYfeE/jn1Pxkt35I3CZ/CBQbf2IryQo3i5OFdZMPYekjzgisHEYxQxB9YDPEwwxfygk= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW3PR11MB4570.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(396003)(136003)(39860400002)(346002)(376002)(66446008)(52536014)(83380400001)(966005)(9686003)(66556008)(8676002)(86362001)(8936002)(66476007)(64756008)(2906002)(7696005)(33656002)(186003)(66946007)(55016002)(53546011)(5660300002)(316002)(6636002)(71200400001)(6506007)(478600001)(15650500001)(26005)(76116006)(110136005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?BehnQfC/Z4pr5CsDcOQcBwl6/5MJUKDI3OtMiyUq4UKPGCIb2PUWim4SvpkW?= =?us-ascii?Q?p9z/ofyvaVkGwy3CT7Jeo63S73PQjeyAgT+1z1dQ4gL/NpCtd9ouwWWx+V4g?= =?us-ascii?Q?J4yzYcChUYciVPrTzGuNnYeDf9DrkklOuw/Lcv7B7wOBSuj9cYzcYwma9mQC?= =?us-ascii?Q?IPw3GITikMxR4YrUD4mf+xnnUgj1mT+pNv5AXkejMRgYX99PPMM1WoIYwxIW?= =?us-ascii?Q?QFFHoRAhQLKa2mjuYQmuwXCqphWySIZc3V6DLZqfkayO4St0y9VBrl+vCN98?= =?us-ascii?Q?VgxMi0iw+1pE54WVoRW0oAxkBV/i23f+P3a5ZwsSk9mx5qZ1zkbR2r7SkVUc?= =?us-ascii?Q?xcYxCKo7MZsicRIyGp5It9WXRZHvm3iQvMeYjTMz8vegOM+CaU+Rq0xjkp2c?= =?us-ascii?Q?towQjXyige0FiVEYRWYqjVpHnxPA5rhE0iIVwyH2drBFfSOknrJk7ft751hh?= =?us-ascii?Q?LrCTkX36xxY0na9wfU72NPLpq0xw65P2TSAN7cVOppfYWfB/TnNrc+9XKQhb?= =?us-ascii?Q?NIJG1BzDmSuzlo4s4dCcwQf7EN5t5vn1Csf9TI8yMZWh7phXC8LGeCeli0wu?= =?us-ascii?Q?iC+YLhbHrsb6BscQNyzIxoQQLtVy0Kvbf4uOcHo3Vq/cdiZDL7ZL1JjebtqW?= =?us-ascii?Q?HKy4q8pebzlm00oV4FA6q09TkkBqL95lwplHRfcXHGRUVkek3KO6V8JSj8hl?= =?us-ascii?Q?SMFdEQkbQRYe0kwrZtb2iu2Y+Be40OpE27UVJPRcvoYCwCWMWH92BtaBXBE+?= =?us-ascii?Q?9sz07S0dVWX7xjHk26/9+3JIh3NzeUCF8/qRVpTSyuCAh3ya3e2HVcHP2hML?= =?us-ascii?Q?GX+yttkvqx7YFLbhEzCgUqJBcmTsNeg1GKEDQIn04edO+IUuw87rBpZSYRBs?= =?us-ascii?Q?wCokJgJcgp42r4yYGd3XMddDxZ8xXcaAna6G10nAUrQrEQBvfBUup9JfB9ap?= =?us-ascii?Q?WJWehQmHGXwdW0hsMM/7UYbxbNeaEwbmvgwsu0MGidO8C6fPnr+USem+Pfwx?= =?us-ascii?Q?Pec8kHzF3PqBB0bcnLiOvcM+K2Z9fOfWXWKqYqWOtv3fHJtRH0WOb2dRjAP1?= =?us-ascii?Q?CJm2AFMn?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW3PR11MB4570.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 37a6fe45-247b-4c9c-d88a-08d8c499ff0b X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jan 2021 21:08:15.9966 (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: 8W/f8p9GY5vVKZcmyrkRYowOB4h1wCK+xVkTC4JqvfZ5UeQ/5HRCIZJh9L+eLDe9e+e/S9NaJK5paEfMs56MkQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1696 Return-Path: aiden.park@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Ray, You are absolutely right. This patch does not have the adjust/recovery pat= h. The reasons we have the initial values here are 1. Without default memory type, the EFI memory service look for an usable = conventional memory region calculated with the minimal memory size 64KB. Th= is patch will increase the minimal memory size condition to 1.3MB. 2. The default memory type PCD values are enough for UefiPayload memory se= rvice 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 platform= DSC if necessary 4. UefiPayload is using EmuVariableNvMode by default 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 mini= mal memory size > -----Original Message----- > From: Ni, Ray > Sent: Thursday, January 28, 2021 7:45 PM > To: devel@edk2.groups.io; Park, Aiden ; Dong, Guo > ; Ma, Maurice > Subject: RE: [edk2-devel] [PATCH] UefiPayloadPkg: Update EFI Memory Serv= ice > conditions >=20 > The EDKII UEFI bios flow is: > 1. platform PEI creates a default memory type information HOB 2. DXE COR= E > reserves the memory according to the HOB for allocation 3. BDS checks wh= ether > 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 P= EI loads > the NV variable to create the memory type information HOB >=20 > But this patch only creates a default HOB and don't provides a mechanism= to > consume the NV and create the HOB. >=20 > > -----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 region > > for EFI Memory Service from the ResourceDescriptor Hob. > > This patch does not allow legacy memory region for the Memory Service > > 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 t= o 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)B= ase, > Size); > > DEBUG ((DEBUG_INFO , "buildhob: base =3D 0x%lx, size =3D 0x%lx, typ= e =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), PcdGet32 > > (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