From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20087.outbound.protection.outlook.com [40.107.2.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6B6B921CEB0F9 for ; Tue, 19 Sep 2017 01:04:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=fxqZHpsxbgyJ8P0rBthroyEWg4zxCJX5xJDT4YfoL6g=; b=E+OVGKF2UD+9ldvPg1s/t0VUX1JBkR9pXx6fhDwGGCTazlKXe3I7mlmiCnH4uM+lM6hnJB5wrbENg+NCAP0XiluYzoI69GeiBXK5gbNmazygoLW4izHCOLYZPDnVcY+3Q7R0fRJ+8T16soe71CXeePwQssbuKT/RzHb+7maA3Tk= Received: from DB6PR08MB2645.eurprd08.prod.outlook.com (10.175.234.153) by DB6PR08MB2693.eurprd08.prod.outlook.com (10.175.235.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11; Tue, 19 Sep 2017 08:07:09 +0000 Received: from DB6PR08MB2645.eurprd08.prod.outlook.com ([fe80::b153:bb0d:ce8d:bebe]) by DB6PR08MB2645.eurprd08.prod.outlook.com ([fe80::b153:bb0d:ce8d:bebe%13]) with mapi id 15.20.0056.016; Tue, 19 Sep 2017 08:07:09 +0000 From: Sakar Arora To: Meenakshi Aggarwal , "edk2-devel@lists.01.org" , "leif.lindholm@linaro.org" , "ard.biesheuvel@linaro.org" Thread-Topic: [edk2] [PATCH v2] PeiLib : Inform UEFI memory to Linux Thread-Index: AQHTMRKkhNgF6hCyWUCBq6hOscU7a6K7185w Date: Tue, 19 Sep 2017 08:07:09 +0000 Message-ID: References: <1505485954-24345-1-git-send-email-meenakshi.aggarwal@nxp.com> <1505824329-32532-1-git-send-email-meenakshi.aggarwal@nxp.com> In-Reply-To: <1505824329-32532-1-git-send-email-meenakshi.aggarwal@nxp.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Sakar.Arora@arm.com; x-originating-ip: [217.140.105.40] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR08MB2693; 6:+jhcA7KzOExOCh5lJrxaqjZg7Lw5mqXqG39H2KQTlO7BESUVIUQnBdfah4q/xz8hG+ydqNyaviksBkGnkTXFlvKsfPdKQ0+0H+gsivQ1K2kskwgE5F0IZ/5HboP9g7fdHa+iLEbLnFhqD7knNHw8AaUKnSwetYcry9qcvoNjoZgSGoAqF4LVCAowennynePiQ+EWXwVKS9T0/exM7lp4t3QSYBuWuGibgqGK5FzlG1XEbG2KBkh8TiJknCZQ9bBxoC3jWNPVmeWOySIqBYlC7z+FcUPtIzXo8nm2827mCCkGhDCE/NLP8C7fIAXwOwvpEch5Rar5gSpIIes7ZfKb9w==; 5:EnKuJz0DIOFciR7gguiTZubz49Ao1+OQYB9lvoaQjUNAEz/uQo8ulvN7T9Q8PotGX7kMa92c018tAosAMN3Jg/B5vOdIsZjxFmowpPo4CfVe5hqmTlDXrJvd7klPlSY1wjgnfLPsCrX8utAW5AP9vQ==; 24:Evt6Lrr/9k/k8TqUlTcTaPPuKcUkWJATpICBdaKkLeo2Stn3pnM6xzxps91oxq06K2fzcnbi+eAHMXjbAAD3vL3FvULrF9A2ccIiccVZ+uE=; 7:5o0YSu5z09smNICjfstL/Y09mMCFRQVmBnN8YmNUvRz5pkxD9CUqlX2rLpOU8OWun109TL7jQKCrTJA148yKcCYpPswtZ4/sz7Ftnfe6ZK8Wij9gngSNkdA/D7vwVcQo/7rS1W1JOiqQVWM9DsZL1con6tl79RA9/4qMlzEIgipNWweo7r1KM/CIPC+CRZY+Fj4jVK3Fcma4GUizNvnxUw43xwmv03osJ5NWByDTGzM= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: bcb2654b-ca78-4eb3-57e2-08d4ff356cfa x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DB6PR08MB2693; x-ms-traffictypediagnostic: DB6PR08MB2693: x-exchange-antispam-report-test: UriScan:(185117386973197)(162533806227266); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(100000703101)(100105400095)(3002001)(10201501046)(6055026)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123564025)(20161123558100)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR08MB2693; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR08MB2693; x-forefront-prvs: 04359FAD81 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(40434004)(189002)(377454003)(199003)(13464003)(105586002)(316002)(2201001)(14454004)(106356001)(81166006)(8676002)(81156014)(2906002)(8936002)(3280700002)(3660700001)(2950100002)(68736007)(6436002)(6116002)(6506006)(86362001)(102836003)(229853002)(6246003)(3846002)(53546010)(7736002)(110136005)(74316002)(305945005)(66066001)(5250100002)(2501003)(5890100001)(9686003)(189998001)(2900100001)(97736004)(99286003)(55016002)(6306002)(53936002)(33656002)(5660300001)(54356999)(50986999)(76176999)(25786009)(7696004)(8656003)(101416001)(478600001)(966005)(72206003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR08MB2693; H:DB6PR08MB2645.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Sep 2017 08:07:09.1840 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2693 Subject: Re: [PATCH v2] PeiLib : Inform UEFI memory to Linux X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Sep 2017 08:04:08 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable This change will create the possibility for memory space holding the UEFI i= mage to be over-written by the DXE core code, since this space will then be= available for allocation. Any such change, if required, should be done jus= t before booting the OS. -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Meen= akshi Aggarwal Sent: Tuesday, September 19, 2017 6:02 PM To: edk2-devel@lists.01.org; leif.lindholm@linaro.org; ard.biesheuvel@linar= o.org Subject: [edk2] [PATCH v2] PeiLib : Inform UEFI memory to Linux While creating Hob list, ArmPlatformPkg is hiding UEFI memory. whereas this memory can be used by OS. This patch, allows OS to use UEFI code area. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Udit Kumar Signed-off-by: Meenakshi Aggarwal --- ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c | 69 ---------------------= ---- 1 file changed, 69 deletions(-) diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c b/ArmPlatformP= kg/MemoryInitPei/MemoryInitPeiLib.c index 2feb11f..d03214b 100644 --- a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c +++ b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c @@ -70,11 +70,7 @@ MemoryPeim ( { ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable; EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes; - UINT64 ResourceLength; EFI_PEI_HOB_POINTERS NextHob; - EFI_PHYSICAL_ADDRESS FdTop; - EFI_PHYSICAL_ADDRESS SystemMemoryTop; - EFI_PHYSICAL_ADDRESS ResourceTop; BOOLEAN Found; // Get Virtual Memory Map from the Platform Library @@ -121,71 +117,6 @@= MemoryPeim ( ); } - // - // Reserved the memory space occupied by the firmware volume - // - - SystemMemoryTop =3D (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdSystemMemoryBase)= + (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdSystemMemorySize); - FdTop =3D (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdFdBaseAddress) + (EFI_PHYSI= CAL_ADDRESS)PcdGet32 (PcdFdSize); - - // EDK2 does not have the concept of boot firmware copied into DRAM. To = avoid the DXE - // core to overwrite this area we must mark the region with the attribut= e non-present - if ((PcdGet64 (PcdFdBaseAddress) >=3D PcdGet64 (PcdSystemMemoryBase)) &&= (FdTop <=3D SystemMemoryTop)) { - Found =3D FALSE; - - // Search for System Memory Hob that contains the firmware - NextHob.Raw =3D GetHobList (); - while ((NextHob.Raw =3D GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, = NextHob.Raw)) !=3D NULL) { - if ((NextHob.ResourceDescriptor->ResourceType =3D=3D EFI_RESOURCE_SY= STEM_MEMORY) && - (PcdGet64 (PcdFdBaseAddress) >=3D NextHob.ResourceDescriptor->Ph= ysicalStart) && - (FdTop <=3D NextHob.ResourceDescriptor->PhysicalStart + NextHob.= ResourceDescriptor->ResourceLength)) - { - ResourceAttributes =3D NextHob.ResourceDescriptor->ResourceAttribu= te; - ResourceLength =3D NextHob.ResourceDescriptor->ResourceLength; - ResourceTop =3D NextHob.ResourceDescriptor->PhysicalStart + Resour= ceLength; - - if (PcdGet64 (PcdFdBaseAddress) =3D=3D NextHob.ResourceDescriptor-= >PhysicalStart) { - if (SystemMemoryTop =3D=3D FdTop) { - NextHob.ResourceDescriptor->ResourceAttribute =3D ResourceAttr= ibutes & ~EFI_RESOURCE_ATTRIBUTE_PRESENT; - } else { - // Create the System Memory HOB for the firmware with the non-= present attribute - BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY, - ResourceAttributes & ~EFI_RESOURCE= _ATTRIBUTE_PRESENT, - PcdGet64 (PcdFdBaseAddress), - PcdGet32 (PcdFdSize)); - - // Top of the FD is system memory available for UEFI - NextHob.ResourceDescriptor->PhysicalStart +=3D PcdGet32(PcdFdS= ize); - NextHob.ResourceDescriptor->ResourceLength -=3D PcdGet32(PcdFd= Size); - } - } else { - // Create the System Memory HOB for the firmware with the non-pr= esent attribute - BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY, - ResourceAttributes & ~EFI_RESOURCE_A= TTRIBUTE_PRESENT, - PcdGet64 (PcdFdBaseAddress), - PcdGet32 (PcdFdSize)); - - // Update the HOB - NextHob.ResourceDescriptor->ResourceLength =3D PcdGet64 (PcdFdBa= seAddress) - NextHob.ResourceDescriptor->PhysicalStart; - - // If there is some memory available on the top of the FD then c= reate a HOB - if (FdTop < NextHob.ResourceDescriptor->PhysicalStart + Resource= Length) { - // Create the System Memory HOB for the remaining region (top = of the FD) - BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY, - ResourceAttributes, - FdTop, - ResourceTop - FdTop); - } - } - Found =3D TRUE; - break; - } - NextHob.Raw =3D GET_NEXT_HOB (NextHob); - } - - ASSERT(Found); - } - // Build Memory Allocation Hob InitMmu (MemoryTable); -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.