From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0049.outbound.protection.outlook.com [104.47.1.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8C2F02095BB65 for ; Wed, 20 Sep 2017 22:56:44 -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=CnOyDbvG4rQty1amvHmUyfKOih/9HZQVsNbyZ0JqBS4=; b=uErhpMOR2UdTqKXPm8vUeqlB/02A27LNm2gWej7Czhk75RWsTQQ6nbObcU5dHnWabdCigPkVzMgd7J7010D0mySx6Y51wKkFoxzoGfFNdaSIzl+ewwEe1fdC/nWttoTJLx/DBZdTqVOAft8SB04nvG+YERYGum1J+KSzGpZiUT0= Received: from AM6PR0402MB3334.eurprd04.prod.outlook.com (52.133.18.151) by AM6PR0402MB3336.eurprd04.prod.outlook.com (52.133.18.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Thu, 21 Sep 2017 05:59:48 +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.0077.011; Thu, 21 Sep 2017 05:59:47 +0000 From: Udit Kumar To: "Gao, Liming" , 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+41aK93+0AgAD6WgA= Date: Thu, 21 Sep 2017 05:59:47 +0000 Message-ID: References: <1505485954-24345-1-git-send-email-meenakshi.aggarwal@nxp.com> <1505824329-32532-1-git-send-email-meenakshi.aggarwal@nxp.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E15B38E@SHSMSX152.ccr.corp.intel.com> In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E15B38E@SHSMSX152.ccr.corp.intel.com> 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; AM6PR0402MB3336; 6:46T08k8iExbZ6rjaDi0GGpIVp+I8px4VZiSc5kG7ykJDKybgNmFhBi2mX7c7mRxfSGMhjiPpawHu7fyjwcaGS6L2y7zXXXO+2D1elAd4Q8Ct6kUEpJIScULiWT5fGarRyK4sqzs8o3Xw2BXyuzrr98mFdBBpBysM+PSt/XFDRhOdkJbLfQ6GoaZS9OxxVVC++kyBUDZ3wOchQULgNdUQWqbS61w+s0F9TPZiWdYLDGt5hMNht/KKWQKbjp8qcU7XzKu/YgFHSjxUWJvYqtXjI9FpmsxaQqw2NegwFcaLfUhkcVQiGphmIZ9NfZM88Y3cyRJubYswmea2jAQ5jMLmxw==; 5:kCu99mpdYYg66G28MapSUAYL/aGbIyOZsYQFWRI3xGWXFPAuPgnFQ7mhRxQAc5cD7DArA5MrJ51sAk8YiJQ2asyx6HM+GAOTF2B3J2tZYMoakbXLJnCEXFq+DlKNwJ+KYtJ9MPIJeNqp+IQSoIwKxQ==; 24:5hdwTyGI2lthZDEWaQQoRg5C7pb0RkoZ2r11a1cd7VU4oIvQhPq7zVIR8cml9gbcSy+8/fte38OWPyyco07uug2zqq5nCbzfwp5IcIFuVBs=; 7:rFJWCLUROiMBwz/JgqLYtHisxw+59vV1qsOGEi0NEG0h8LztS7zocSyDjHfRsqmfgpK9ch8i4KTL4uU0NnuCTVq2df/OXgW7X78YeAZw8CORYOApbbeWw4oZpVFsExVUsuTpdHG8fStIjAiZ4lKVZfbeVZL5w2oWzPT5O8X7vRNr6MMRqWdmpYTuS3ZwK620JtEXsxt52qOn8Pejs/3ueO6IyzeyIwqfv577CfivoYg= x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(346002)(376002)(377454003)(199003)(189002)(13464003)(97736004)(229853002)(3846002)(110136005)(6436002)(6506006)(9686003)(25786009)(2900100001)(6246003)(189998001)(478600001)(53936002)(966005)(6116002)(6306002)(55016002)(66066001)(102836003)(2501003)(99286003)(2950100002)(14454004)(53546010)(2906002)(2201001)(81156014)(86362001)(5660300001)(8936002)(106356001)(105586002)(81166006)(3280700002)(5250100002)(68736007)(74316002)(7696004)(3660700001)(33656002)(8676002)(316002)(54356999)(50986999)(101416001)(76176999)(7736002)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0402MB3336; H:AM6PR0402MB3334.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; x-ms-office365-filtering-correlation-id: 27699013-fa48-4a8b-fc96-08d500b5f737 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:AM6PR0402MB3336; x-ms-traffictypediagnostic: AM6PR0402MB3336: 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)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6041248)(20161123560025)(20161123558100)(20161123562025)(20161123564025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM6PR0402MB3336; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM6PR0402MB3336; x-forefront-prvs: 04371797A5 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: 21 Sep 2017 05:59:47.8577 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0402MB3336 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: Thu, 21 Sep 2017 05:56:45 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Liming >So, for this case, I suggest to > create memory hob instead of resource hob with non present memory attribu= te. ARM package is already creating a memory HoB for the same. Thanks Udit > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ga= o, > Liming > Sent: Wednesday, September 20, 2017 8:29 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 > To reserve the memory resource in boot phase and open them for OS phase, > after 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 = phase, > 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 memory attribu= te. >=20 > Thanks > Liming > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > > Meenakshi Aggarwal > > Sent: Tuesday, September 19, 2017 8:32 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->ResourceAtt= ribute; > > - ResourceLength =3D NextHob.ResourceDescriptor->ResourceLength; > > - ResourceTop =3D NextHob.ResourceDescriptor->PhysicalStart + > ResourceLength; > > - > > - if (PcdGet64 (PcdFdBaseAddress) =3D=3D NextHob.ResourceDescrip= tor- > >PhysicalStart) { > > - if (SystemMemoryTop =3D=3D FdTop) { > > - NextHob.ResourceDescriptor->ResourceAttribute =3D Resource= Attributes > & ~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(Pc= dFdSize); > > - NextHob.ResourceDescriptor->ResourceLength -=3D > PcdGet32(PcdFdSize); > > - } > > - } 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)); > > - > > - // Update the HOB > > - NextHob.ResourceDescriptor->ResourceLength =3D PcdGet64 > (PcdFdBaseAddress) - > > NextHob.ResourceDescriptor->PhysicalStart; > > - > > - // If there is some memory available on the top of the FD th= en create a > HOB > > - if (FdTop < NextHob.ResourceDescriptor->PhysicalStart + > ResourceLength) { > > - // 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 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel