From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-x22a.google.com (mail-io0-x22a.google.com [IPv6:2607:f8b0:4001:c06::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E189E21D046AB for ; Tue, 19 Sep 2017 05:45:10 -0700 (PDT) Received: by mail-io0-x22a.google.com with SMTP id v36so9689586ioi.1 for ; Tue, 19 Sep 2017 05:48:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=sBoIcYfDp1QUNsmomjjxckRrKUUimxOPAu68L2MSXYk=; b=UGEPYMnaD1clXieILNctDGU9ojUAs6uRo1V5Oihz/+jh3jUSlrvH8ra0aK69ZZTyIY zQEUwghCPULJa9KMtDtYzQvCNdYhlcUrxZ8qVi5JCLRrmtF+kcWHd/0w5JprHsp6ievA cEqVaR1kGYLr0+Y9Xd9Z4csnmDWCX4GZd/n20= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=sBoIcYfDp1QUNsmomjjxckRrKUUimxOPAu68L2MSXYk=; b=lac3+/N5aVoEbdJitc3mUD1Rm8JkU7jtZ5h2/s1Zw+IITZiq6vlqKl1h3S32Hr3+tE 5q3ig+bI7mCfZ9UswlXX7eaeyTpOJir4Wj3jfDS6dSDZ8YezQhKRPSUjT74lD/jARFJu cpSQjF9IirRm8C3STjjVw0D8f51SUw2oxhNWvtjIPxXCQAiA4WReimnONHZJyGP6M46s Yu79R3X2fH0uXbFqBmR17IGrklQeeSSB+R9JlFyrJdR0o3A293p3bbhnNTc7ve/1CKI2 D4Bwtu5q/+WfpT5zc45ACB4CTEXUztxzNQUfkjuM/jM+PJ0DMwZmXY+BPirkO3KixwAu Zmjw== X-Gm-Message-State: AHPjjUjKrF3s2o7JY1WJDHmhNvkPmej1kPf0dvwSXp9QiAjheWtZDd97 tXF0ngnSWOqiNBTDbnwo3n4BIZYqLmNMCvyAMSLVyQ== X-Google-Smtp-Source: AOwi7QCJc/aAeayrWh+u62Mlw/lpys7sjk/YXSNJ53KSyCXl9om/UScE19ghVpxXhDoMZz32N5x/Rzf4Bcyo+XDLpG4= X-Received: by 10.107.15.141 with SMTP id 13mr1537259iop.141.1505825294622; Tue, 19 Sep 2017 05:48:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.152.18 with HTTP; Tue, 19 Sep 2017 05:48:13 -0700 (PDT) In-Reply-To: References: <1505485954-24345-1-git-send-email-meenakshi.aggarwal@nxp.com> <1505824329-32532-1-git-send-email-meenakshi.aggarwal@nxp.com> From: Ard Biesheuvel Date: Tue, 19 Sep 2017 05:48:13 -0700 Message-ID: To: Sakar Arora Cc: Meenakshi Aggarwal , "edk2-devel@lists.01.org" , "leif.lindholm@linaro.org" 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 12:45:11 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On 19 September 2017 at 01:07, Sakar Arora wrote: > 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. Yes. But why does this matter after the entire payload has been decompressed into memory already? > 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 Me= enakshi Aggarwal > Sent: Tuesday, September 19, 2017 6:02 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 > > 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/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; > > // 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 (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); > > -- > 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 conf= idential and may also be privileged. If you are not the intended recipient,= please notify the sender immediately and do not disclose the contents to a= ny other person, use it for any purpose, or store or copy the information i= n any medium. Thank you.