From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0065.outbound.protection.outlook.com [104.47.0.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7E04A21CEB104 for ; Tue, 19 Sep 2017 03:07:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=LdT1Lsgs8gy9KOaebiilGW6Py/YKA2QkdN81ecTliFI=; b=qmhZZe/jmsxxOZt0/EDQWcpqfxEReAycHOD1F8rMNw3uxybqHUQS4by8blo2yNHerL5y1bOkfgrAZ+mrYx2IpMaDCdWPCEPixGUQUClHs+B8eMu2LDh+a2QCGz3eg+/T/eDZeNVtScf6nrLtAwtj3o4wPCoKt26LCdkNlGrMzI8= Received: from AM6PR0402MB3334.eurprd04.prod.outlook.com (52.133.18.151) by AM6PR0402MB3480.eurprd04.prod.outlook.com (52.133.19.141) 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 10:10:54 +0000 Received: from AM6PR0402MB3334.eurprd04.prod.outlook.com ([fe80::4d05:6a0c:bcca:93be]) by AM6PR0402MB3334.eurprd04.prod.outlook.com ([fe80::4d05:6a0c:bcca:93be%13]) with mapi id 15.20.0056.016; Tue, 19 Sep 2017 10:10:53 +0000 From: Udit Kumar To: Sakar Arora , 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: AQHTMRKizTdBt8YK50CCBP5JRh+41aK72m+AgAAhYGA= Date: Tue, 19 Sep 2017 10:10:53 +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: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=udit.kumar@nxp.com; x-originating-ip: [192.88.169.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM6PR0402MB3480; 6:j9ylnFAEPQbLoNTe5+j2B8D8XaP5LM/Ft3J8wRH2ni7yRiPORr7tX9yY+vRC3WFVEJi1zEOXglrIh0A4qAjVWE9b47/1TuBTER+5t4WHE/3CCSR1q9xPAxFviKVSr52/OsOmcHHkpgNYHa1IrQug9elo5wtb/3N92WnYr4UCsGG4ztS6RCOMSfeTYEpmer7Tu0x3vVbD6/uMVuWQjho1j0qRTeBm8ZW1iyKLZ/A0nz7/lM6cSp6bNYlxt5v+ZNqkC97fc6zfpHerNNgYvWRJ9Y/uIyoaemyvI0kyn0dlUsisBnzZV6vFirrI+hQRL1trnTtFeiJQb60igDSj2kJtmg==; 5:0EgMx8xNEUAMJkjr45BvWSbjN+nogObf3rVW4+rodOOrVZpv7u2YfrmO/gWsAusnlR2QoCvW3UaDY0tbikDUO57Hy+yWZI9SbuEw3KHNpCtfMEjKuoSVDvQO9kVzU+Xfz0n1thw9VgDtkwR66QrV5Q==; 24:YX/xWpILx4e8AgIYnd2xgWaxCC770lWeOzE1pRDpddC/e1FMIPCPiGMOXHdWIdMqTLvHch7BJftHKNVdnpy2SnzIjB1MZuyTc0vVJhUZzhA=; 7:w5TtOR5mDLkLl30koy94yvmCGW70QfUiNLeEst+79Z0jn3yV3f95ZJIaXGjv1ILXYw/h89/dhEqeuP4ZK28BgDLRm7+lC2NeQj4PIcKTyhQXpyJb4osgHDvZ+hMpGa4a7Uw7pDht9/fdt2YgCZrk9+JFiPcGUfUFGEy7T6ZhgmYJF3y8dety6k2tLFkfVoQ8pUw8rdczE9uZrYPsvCEGciw4tdImVgQobo/4EeamuT0= x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(39860400002)(377454003)(189002)(199003)(13464003)(7736002)(74316002)(3846002)(102836003)(6116002)(105586002)(86362001)(305945005)(7696004)(66066001)(8676002)(50986999)(5660300001)(33656002)(2900100001)(81166006)(81156014)(8936002)(101416001)(54356999)(76176999)(97736004)(478600001)(6306002)(9686003)(229853002)(55016002)(53936002)(3660700001)(68736007)(316002)(110136005)(53546010)(966005)(6246003)(14454004)(6506006)(106356001)(6436002)(2950100002)(2501003)(5890100001)(2201001)(25786009)(189998001)(2906002)(99286003)(3280700002)(5250100002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0402MB3480; H:AM6PR0402MB3334.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; x-ms-office365-filtering-correlation-id: 644428e8-bbaa-4980-3210-08d4ff46b64b x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:AM6PR0402MB3480; x-ms-traffictypediagnostic: AM6PR0402MB3480: 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)(5005006)(8121501046)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(3002001)(6055026)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123555025)(20161123560025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM6PR0402MB3480; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM6PR0402MB3480; x-forefront-prvs: 04359FAD81 received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Sep 2017 10:10:53.6319 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0402MB3480 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 10:07:53 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks Sakar,=20 I am wondering, how we can add this memory before OS, please suggest.=20 I guess, we cannot add in HobList when we are in DXE or BDS. Regards Udit=20 > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Sa= kar > Arora > Sent: Tuesday, September 19, 2017 1:37 PM > To: Meenakshi Aggarwal ; edk2- > devel@lists.01.org; leif.lindholm@linaro.org; ard.biesheuvel@linaro.org > Subject: Re: [edk2] [PATCH v2] PeiLib : Inform UEFI memory to Linux >=20 > This change will create the possibility for memory space holding the UEFI= image > to be over-written by the DXE core code, since this space will then be av= ailable > for allocation. Any such change, if required, should be done just before = booting > the OS. >=20 > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Meenakshi Aggarwal > Sent: Tuesday, September 19, 2017 6:02 PM > To: edk2-devel@lists.01.org; leif.lindholm@linaro.org; > ard.biesheuvel@linaro.org > Subject: [edk2] [PATCH v2] PeiLib : Inform UEFI memory to Linux >=20 > While creating Hob list, ArmPlatformPkg is hiding UEFI memory. > whereas this memory can be used by OS. >=20 > This patch, allows OS to use UEFI code area. >=20 > 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(-) >=20 > diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c > b/ArmPlatformPkg/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; >=20 > // Get Virtual Memory Map from the Platform Library @@ -121,71 +117,6 = @@ > MemoryPeim ( > ); > } >=20 > - // > - // 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_PHYSICAL_ADDRESS)PcdGet32 (PcdFdSize); > - > - // EDK2 does not have the concept of boot firmware copied into DRAM. T= o > avoid the DXE > - // core to overwrite this area we must mark the region with the attrib= ute 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_SYSTEM_MEMORY) && > - (PcdGet64 (PcdFdBaseAddress) >=3D NextHob.ResourceDescriptor- > >PhysicalStart) && > - (FdTop <=3D NextHob.ResourceDescriptor->PhysicalStart + > NextHob.ResourceDescriptor->ResourceLength)) > - { > - ResourceAttributes =3D NextHob.ResourceDescriptor->ResourceAttri= bute; > - ResourceLength =3D NextHob.ResourceDescriptor->ResourceLength; > - ResourceTop =3D NextHob.ResourceDescriptor->PhysicalStart + > ResourceLength; > - > - if (PcdGet64 (PcdFdBaseAddress) =3D=3D NextHob.ResourceDescripto= r- > >PhysicalStart) { > - if (SystemMemoryTop =3D=3D FdTop) { > - NextHob.ResourceDescriptor->ResourceAttribute =3D ResourceAt= tributes > & ~EFI_RESOURCE_ATTRIBUTE_PRESENT; > - } else { > - // Create the System Memory HOB for the firmware with the no= n- > 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(PcdF= dSize); > - NextHob.ResourceDescriptor->ResourceLength -=3D PcdGet32(Pcd= FdSize); > - } > - } 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)); > - > - // Update the HOB > - NextHob.ResourceDescriptor->ResourceLength =3D PcdGet64 > (PcdFdBaseAddress) - NextHob.ResourceDescriptor->PhysicalStart; > - > - // If there is some memory available on the top of the FD then= create a > HOB > - if (FdTop < NextHob.ResourceDescriptor->PhysicalStart + > ResourceLength) { > - // Create the System Memory HOB for the remaining region (to= p 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); >=20 > -- > 1.9.1 >=20 > _______________________________________________ > 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 > confidential and may also be privileged. If you are not the intended reci= pient, > please 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. > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel