From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CD66321ECCB15 for ; Wed, 20 Sep 2017 07:56:17 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP; 20 Sep 2017 07:59:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,421,1500966000"; d="scan'208";a="154062478" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga006.fm.intel.com with ESMTP; 20 Sep 2017 07:59:23 -0700 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 20 Sep 2017 07:59:23 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX125.amr.corp.intel.com (10.18.125.40) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 20 Sep 2017 07:59:22 -0700 Received: from shsmsx152.ccr.corp.intel.com ([169.254.6.93]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.159]) with mapi id 14.03.0319.002; Wed, 20 Sep 2017 22:59:20 +0800 From: "Gao, Liming" 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: AQHTMRKrT91MkNbMDkCRxidCtOyuHKK93sPw Date: Wed, 20 Sep 2017 14:59:20 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E15B38E@SHSMSX152.ccr.corp.intel.com> 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: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 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: Wed, 20 Sep 2017 14:56:18 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable To reserve the memory resource in boot phase and open them for OS phase, af= ter create system resource hob, we can create memory allocation hob to take= some range in PEI phase. Then, these ranges will not be allocated in DXE p= hase, but they will still be reported in UEFI memory map. So, for this case= , I suggest to create memory hob instead of resource hob with non present m= emory attribute.=20 Thanks Liming > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Me= enakshi Aggarwal > Sent: Tuesday, September 19, 2017 8:32 PM > To: edk2-devel@lists.01.org; leif.lindholm@linaro.org; ard.biesheuvel@lin= aro.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/ArmPlatfor= mPkg/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 (PcdSystemMemoryBas= e) + (EFI_PHYSICAL_ADDRESS)PcdGet64 > (PcdSystemMemorySize); > - FdTop =3D (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdFdBaseAddress) + (EFI_PHY= SICAL_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 + NextHo= b.ResourceDescriptor->ResourceLength)) > - { > - ResourceAttributes =3D NextHob.ResourceDescriptor->ResourceAttri= bute; > - ResourceLength =3D NextHob.ResourceDescriptor->ResourceLength; > - ResourceTop =3D NextHob.ResourceDescriptor->PhysicalStart + Reso= urceLength; > - > - 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_RESOUR= CE_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 (PcdFd= BaseAddress) - > NextHob.ResourceDescriptor->PhysicalStart; > - > - // If there is some memory available on the top of the FD then= create a HOB > - if (FdTop < NextHob.ResourceDescriptor->PhysicalStart + Resour= ceLength) { > - // 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