From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web09.4977.1611891921505679306 for ; Thu, 28 Jan 2021 19:45:21 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=rOJHpsu9; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: ray.ni@intel.com) IronPort-SDR: 2NQG2B1hGhVI2ZY01ZU+wEIlQjO+M1TZRJF3EZvSaa9qX1aOBUul06ErIeflQSEcE6psEyy9l1 F7yrb9VFQC8A== X-IronPort-AV: E=McAfee;i="6000,8403,9878"; a="177795631" X-IronPort-AV: E=Sophos;i="5.79,384,1602572400"; d="scan'208";a="177795631" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jan 2021 19:45:20 -0800 IronPort-SDR: 0iMSiWmmidgJdPivIPOip2UGDelHU3OqHtFcJXeXP0+43Ys1KnFdvDba72Pfn0ibuFZgjkOlMP Or9Zi1/qveew== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,384,1602572400"; d="scan'208";a="403766407" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by fmsmga004.fm.intel.com with ESMTP; 28 Jan 2021 19:45:20 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 28 Jan 2021 19:45:20 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Thu, 28 Jan 2021 19:45:20 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.102) 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; Thu, 28 Jan 2021 19:45:20 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E+syp1mjTSV+k+7B3xKMklBr/4fVFCZ02Lby1Qod+YD5mu4Xg1XKznDaxUS4rGR9EWj2fu5IEpzxIL9oZYsnOEW1Qej8Jf4JM97X5yReDhdJ+2ukUDsHK5W/3MC3tUcQI7RGamxyOOM+XQVkQxsYebXUYiLbRoH2cMvPPfrkRnoEr38mDZ0Ikgof9mFkzZ1Tk2wEYlb7QYifhIdb0+pawN1UudnZWRUnCSpq53Oct8SOkT/UL89dXYmriupOsQzP4u/fyUCrYuLMTjCliLmluflGRZT+eOyc8u9jv4VsWoEfPXJERDfw/2X2SRCUOydT3NsH+27t+0D6KXFcleEvgg== 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=GkpNtIMHCWM0IeTKLjjdTgP7kIoYCKteAkA8VS7spcA=; b=A3jAmJTY2EQTVeI5VIEIiug+U2V4DK451S/5FRsuzvddvkaCMtQnxfgo9PfKoX958HcZsPQPJcHwHCk4PvfLvxT9gHvq+IHWp46NchIJK1fbswJH/6Nq5ZRlIJDu9T55ko96AjSGY6zjLpsckVADHLtyNqi8esvsdhA2KN09nh9p7lf2GXfrfBCA5Bv9+fs4x+AY8XSsxsQZ2XPqRMnR/La4mto2hhz/KhKAWVzsK9Nms0L5nkq5HpRj0pdbtpz7ZznHlfaLG0qzflimXgPCy7aL4A3gza3UZr7iK+xE3n60E2FryCacp84gcs5mAD4JlUwyIlSSwirrb1yuStbB3Q== 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=GkpNtIMHCWM0IeTKLjjdTgP7kIoYCKteAkA8VS7spcA=; b=rOJHpsu9IGEHPkrA9BITpyHUNhWPWYkMDkHN0TUuYoThWrE5rBeL/1zUv5OFRHvMuuuH8VSe/jilRzzoaocHJxxQ25z4pFa1dsGJECxIIwa1Nnll+Iezs+JeUJXGkMq+WIsMOAGhNpS4yZO1AGkNWRRStiUyVN5Ee5VOTKa+VHU= Received: from CO1PR11MB4930.namprd11.prod.outlook.com (2603:10b6:303:9b::11) by MWHPR11MB1839.namprd11.prod.outlook.com (2603:10b6:300:10e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.16; Fri, 29 Jan 2021 03:45:18 +0000 Received: from CO1PR11MB4930.namprd11.prod.outlook.com ([fe80::8d64:91ed:c259:e95]) by CO1PR11MB4930.namprd11.prod.outlook.com ([fe80::8d64:91ed:c259:e95%6]) with mapi id 15.20.3805.016; Fri, 29 Jan 2021 03:45:18 +0000 From: "Ni, Ray" To: "devel@edk2.groups.io" , "Park, Aiden" , "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: AQHW9eJtEXcHBFetO0qPq78UlEtYO6o99J9w Date: Fri, 29 Jan 2021 03:45:18 +0000 Message-ID: References: <20210129015937.1983-1-aiden.park@intel.com> In-Reply-To: <20210129015937.1983-1-aiden.park@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-reaction: no-action dlp-product: dlpe-windows 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: [124.77.195.36] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2119b689-3fc7-4406-3815-08d8c4084c17 x-ms-traffictypediagnostic: MWHPR11MB1839: 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: 1O8BIKMjjRBmkAtxhmcHTWgIUUhn5KZMDk0USP+rkZNvZX2oCcEI2iqKIBGUfBS4xij4iYvmumx75sNotZUGV3MbBXuspCB0qlGMAEK/PFnauek7EXJKH+4JCyLyRS2oRc438JmoIl2bA7iKryrEQVbotGfiO+BI6JnpDCM7EzIObBaOfkwl3WkfeXg+noFtbcQ7unBmnLT1XVhbZ7lTJq+1UsXNH0FyWwlKyqkA4hHRYgJzwSOL5BbSAD6fqZeVQyB0Q76VTHhxKIrilnR9tuajx48ImwXkBsDP99kqJI7ZKR+1CUQiMVd2CCNC8ZVEk+Et/hX6vY79bV5bVC78C05bZVFCxjmKgIKbSLNA6ABuhG/8ErSIdVNrVDy+NLsExY8cyAjRW+kzX/vOvVK29khpmPN/6tplqHnGCHqIeRP8LsO3rNd2qtIp07jLpRJJoescOjvGObBLP3a8MTz1KsvyUYH6d1EwHNWDel6gWaf9TYk+kgPVuqT9Tpo2XS1pPBPjuCZV3Rqh/DUhO6zRcmPDGk8YYJ811BGvjDq9RMDr+GqD4SA9YXxmD1yXvjeH7OG9y0NIZQIDWhEyj4ZKJb9DVBriblvBRxJf3azNCxU= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR11MB4930.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(39860400002)(396003)(366004)(376002)(346002)(66476007)(478600001)(66556008)(66446008)(64756008)(26005)(83380400001)(316002)(76116006)(6506007)(53546011)(110136005)(2906002)(66946007)(186003)(966005)(8936002)(71200400001)(86362001)(6636002)(7696005)(15650500001)(5660300002)(52536014)(55016002)(33656002)(8676002)(9686003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?HFgE6viYSpbnYM/wAjTj2tCiUHzxtzwyPadhCqBM6Cs9lETPAocmQVGkBqmx?= =?us-ascii?Q?aq7KVEts8tjewSek4P96uVxT+2kBCmKMI50vKKeNknWj3h8LNqFdQB+zQr1U?= =?us-ascii?Q?pRnlN5a8pXcg0atQbYJP84aHwbg4FfalffE+rcSzXkGeQa6RoEb/wRY92J31?= =?us-ascii?Q?28B30mK9Me/P5LVJSpsSPYzwss/bZOGpkeY2KlvRHlC1YHbwLOwZ/QwUfmLd?= =?us-ascii?Q?4q0INnoGNh7NbhBst7Bs4r888+CFFDN1rhmiC+b2TjWyXskIWI8Qg7yzrL8f?= =?us-ascii?Q?7+KcRS1c/eI6thFgUYaiTvBACiuMzNdBUreN6mNBY4NinXZ0VfvR8lATR8dh?= =?us-ascii?Q?6r+kvLqbgl1yp8Af413rhF6dVNsBH5D0tFgqqUx59yFY4qY647uVOi8UwXc6?= =?us-ascii?Q?mwhUvj9a6YVQXw4Gz5bJALhzjCPzDx5XsgQ8NfK1mmPVi1EevAM9ZeeL3gq6?= =?us-ascii?Q?ooJtwDcv0C5A3xGIDvIaMcYujGBITuaWabjWpgTxiwVk1gGhxNEHYv+0IWdK?= =?us-ascii?Q?1Lh5lbu5Cl+Q6uN/EKS7IM7F0TFW3pv+kQpjaEnj6qrTjjP82xYGbcTI8CC0?= =?us-ascii?Q?XBy+OhDCSNYI8AD35uAYE4mNd54rmf3VCtY16Qj4ykD6YmT53Bd8I7urxz0Z?= =?us-ascii?Q?gGQ+fKXIc8EYEBbFOA4WGwKX0gvCUVSwZB6HkMiDK7UnaUjyQOjNrtYuz5Rq?= =?us-ascii?Q?eGgVqY56BOZ36iWGsWsiv5laZE1eFiQFoPC6LHSTtmZg2F3k9DFh0ZQ/7gAF?= =?us-ascii?Q?STPUOtxfZv9REqMmt4d5v3QFMP3thhDj8IujhDr4MVnBR37RFYKs3TnYBK9e?= =?us-ascii?Q?FeiUEA6b21qw1rf3dCukbDsn4oV5QtGA+7AkQXRrxWy2RVTU/HFUwnGmU0TP?= =?us-ascii?Q?Bhg6GqCHxIy6Aw2Hd8/cRalWS+VQgESlaispVYIPopX1CJO+27Hdab+KwpjL?= =?us-ascii?Q?dTXyrt8TCuX4SLEUSmao/dnNVXI4NG2Ewmc2wqlatz5LUSbjyu+MIhrM9wHo?= =?us-ascii?Q?0UlpyBtOu+2R0plMXxX/2x05SbSKCV9O7RQOZyWdKifBH5yf2L0HtzZ8Xt3L?= =?us-ascii?Q?lsj4DxdM?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4930.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2119b689-3fc7-4406-3815-08d8c4084c17 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jan 2021 03:45:18.7142 (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: G2xT2OKBuJnKCdQfPpLiDwVmY4/2bmAot6Rb17HMx2Bmh1lPB33TYRU+7bfVgHxpx7tI3c2g3AL5nCNfAJ75aw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1839 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable The EDKII UEFI bios flow is: 1. platform PEI creates a default memory type information HOB 2. DXE CORE reserves the memory according to the HOB for allocation 3. BDS checks whether the pre-reserved memory meets the needs and saves th= e 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 mechanism t= o consume the NV and create the HOB. > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Park, Aid= en > 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 >=20 > From: Aiden Park >=20 > 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. >=20 > Signed-off-by: Aiden Park > --- > .../UefiPayloadEntry/UefiPayloadEntry.c | 20 +++++++++++++++++++ > .../UefiPayloadEntry/UefiPayloadEntry.inf | 5 +++++ > 2 files changed, 25 insertions(+) >=20 > diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPa= yloadPkg/UefiPayloadEntry/UefiPayloadEntry.c > index 805f5448d9..d2e6f962cd 100644 > --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c > +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c > @@ -6,6 +6,16 @@ > **/ >=20 > #include "UefiPayloadEntry.h" > +#include > + > +EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] =3D { > + { EfiACPIReclaimMemory, FixedPcdGet32 (PcdMemoryTypeEfiACPIReclaimM= emory) }, > + { EfiACPIMemoryNVS, FixedPcdGet32 (PcdMemoryTypeEfiACPIMemoryNV= S) }, > + { EfiReservedMemoryType, FixedPcdGet32 (PcdMemoryTypeEfiReservedMemo= ryType) }, > + { EfiRuntimeServicesData, FixedPcdGet32 (PcdMemoryTypeEfiRuntimeServi= cesData) }, > + { EfiRuntimeServicesCode, FixedPcdGet32 (PcdMemoryTypeEfiRuntimeServi= cesCode) }, > + { EfiMaxMemoryType, 0 } > +}; >=20 > /** > 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; > + } >=20 > BuildResourceDescriptorHob (Type, Attribue, (EFI_PHYSICAL_ADDRESS)Bas= e, Size); > DEBUG ((DEBUG_INFO , "buildhob: base =3D 0x%lx, size =3D 0x%lx, type = = =3D 0x%x\n", Base, Size, Type)); > @@ -315,6 +328,13 @@ BuildGenericHob ( > UINT8 PhysicalAddressBits; > EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute; >=20 > + // > + // Create Memory Type Information HOB > + // > + BuildGuidDataHob (&gEfiMemoryTypeInformationGuid, > + mDefaultMemoryTypeInformation, > + sizeof (mDefaultMemoryTypeInformation)); > + > // The UEFI payload FV > BuildMemoryAllocationHob (PcdGet32 (PcdPayloadFdMemBase), PcdGet32 (P= cdPayloadFdMemSize), EfiBootServicesData); >=20 > diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/Uefi= PayloadPkg/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 >=20 > gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOME= TIMES_CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy ## SOME= TIMES_CONSUMES > -- > 2.20.1 >=20 >=20 >=20 >=20 >=20