From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0087.outbound.protection.outlook.com [104.47.1.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 B2F4D21CEB11A for ; Tue, 19 Sep 2017 04:17:46 -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=m75e23A0hXqwUThoKCbILVsXxvwwul+WDlva+MGCzHw=; b=PXzdip9rYtqIT5ftrqfNBBOm9eK3GqWmKYhLyVSsqdYMIsFDinFq0Fak1WAQ1NNGP6P0XPIiYm/ylnfz9YYbtuAJuz6x7cbHEEJNPnWObhUU42qXRMJk8XXnxXSPPChcHz7X4zYBxxhPVCxgzAaHyTQOxGF/NH+NXF/zXCAU/VQ= Received: from DB6PR08MB2645.eurprd08.prod.outlook.com (10.175.234.153) by DB6PR08MB2760.eurprd08.prod.outlook.com (10.170.222.139) 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 11:20:48 +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 11:20:48 +0000 From: Sakar Arora To: Udit Kumar , 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: AQHTMRKkhNgF6hCyWUCBq6hOscU7a6K7185wgAAlM4CAABHeIA== Date: Tue, 19 Sep 2017 11:20:48 +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=Sakar.Arora@arm.com; x-originating-ip: [217.140.105.40] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR08MB2760; 6:PNmvqwA17TeP9F1T7U/7mM/mVQKXuvtfc8vB3wvtZ5VvzFbOimF7s6oCXXLr41c3/2Adjz+ylFNXV+eRizMIxGaAcOlEt56S8VMVVFA8tX5TiqVCxa+Xp0rixAD+Q0TA/tikFSnFYjVxHX/gkR1F5Sxhqqn1eLuWwLqWOdu0uUtkbVLFWLceVJB3+J5KB/2qzKtN10y32BFDLr9sBp2Jd84gQ572qa874SBkfFZq63GnFGCMF6BT/zmjyB5De29p6iyGn1ZpiEWiYFblpbQlvpUOHClTaZW+tSNm2NwOgmc7zyKttDgchyNU3Wk830jccrVoEqkIKr5+jjlinxzcdQ==; 5:iLZiX2Dh5DzqoD0d+b613t7lHVQnt3LcU6QX9fyWcylIyI9vT+vHdYYnezKjSv0otsCbcxBeRvi4nfP+Jf4EfG56TNnPMdXxNoak0UKWVnFdcAg3f1+ai4YWI3NxyLHHdHqoHIcKssP2MmkXF+mZLw==; 24:lo4saBnq5mhKSAgNrHPgIR/WFeFXeV7ITv08uSdpQd1GF+zkHw7iNaY8uCd1HkoxI8tBj1ZoOXZ0ICIN4fDg7f/6lgDP5a44PS8MZrSWCLI=; 7:O0Qq+8myDxzhj2UML3h53f27Ux1yJPwItP9mU6H1wb74GWJAJ2RSt2cFSrwgBo8Jj09Q+3oMUv1kqkWnf/dkbDAPWYHmIsICP1DCmRDKhCA6YH5/RSbNJPWchC+jjnZAsdwpKI2KWyvCnfkH/y0EIeouWvBHvgfg9Qox6jzr2cFvbRCr/w4S7J3Nz2zCMv/zwGmn+NTxZtnWejHju3+flWqELRkoGAJfG66y4hglsCo= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: e1cccd41-cef8-47de-1253-08d4ff507a7b 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:DB6PR08MB2760; x-ms-traffictypediagnostic: DB6PR08MB2760: x-exchange-antispam-report-test: UriScan:(180628864354917)(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)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6041248)(20161123555025)(20161123560025)(20161123558100)(20161123564025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR08MB2760; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR08MB2760; x-forefront-prvs: 04359FAD81 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(39860400002)(346002)(377454003)(199003)(13464003)(40434004)(189002)(74316002)(5660300001)(81166006)(81156014)(6306002)(14454004)(9686003)(8676002)(66066001)(189998001)(72206003)(966005)(86362001)(305945005)(110136005)(7736002)(478600001)(7696004)(2950100002)(2900100001)(25786009)(97736004)(6506006)(68736007)(5250100002)(2501003)(8936002)(93886005)(53546010)(229853002)(33656002)(6116002)(102836003)(3846002)(6436002)(2906002)(2201001)(8656003)(106356001)(105586002)(55016002)(99286003)(53936002)(3280700002)(316002)(3660700001)(76176999)(6246003)(54356999)(5890100001)(50986999)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR08MB2760; H:DB6PR08MB2645.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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 11:20:48.2810 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2760 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 11:17:47 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable You could use the DXE services method gDS->AddMemorySpace to add this memor= y space to the global gMemoryMap. This is the memory map linux efi stub rea= ds to get information about all the available system memory. Thanks, Sakar -----Original Message----- From: Udit Kumar [mailto:udit.kumar@nxp.com] Sent: Tuesday, September 19, 2017 3:41 PM To: Sakar Arora ; Meenakshi Aggarwal ; edk2-devel@lists.01.org; leif.lindholm@linaro.org; ard.biesheu= vel@linaro.org Subject: RE: [edk2] [PATCH v2] PeiLib : Inform UEFI memory to Linux Thanks Sakar, I am wondering, how we can add this memory before OS, please suggest. I guess, we cannot add in HobList when we are in DXE or BDS. Regards Udit > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Sakar 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 > > 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 available for allocation. Any such change, if required, > should be done just before booting the OS. > > -----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 > > 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/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; > > // 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_PHYSICAL_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 > attribute 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); > > -- > 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 > confidential and may also be privileged. If you are not the intended > recipient, 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 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.