From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=104.47.2.85; helo=eur01-db5-obe.outbound.protection.outlook.com; envelope-from=udit.kumar@nxp.com; receiver=edk2-devel@lists.01.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0085.outbound.protection.outlook.com [104.47.2.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2486422280C23 for ; Tue, 26 Dec 2017 23:32:13 -0800 (PST) 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=8YZI2zjDa2uYGtQcrxAa4ksYBZ7iFjV0ruFfv9vKoKE=; b=Co9t/TGRHLIU8VgYcC+AvaIx+OVYW8X648yUxLcUhxV20oD3GxgnxpiAgLdEZwYXvfbpZPg+jQmxd6TxQu67zwQtDgV9Q0ktZdbEnmNAIfmoEXJ+fJjw1rkOzbQ0BHELaKi+NF20qEDcZNyEjHB46+9uHdhRXgEoFfIVppukr1Y= Received: from AM6PR0402MB3334.eurprd04.prod.outlook.com (52.133.18.151) by AM6PR0402MB3334.eurprd04.prod.outlook.com (52.133.18.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.14; Wed, 27 Dec 2017 07:37:05 +0000 Received: from AM6PR0402MB3334.eurprd04.prod.outlook.com ([fe80::a5fd:3b4c:2300:b2bf]) by AM6PR0402MB3334.eurprd04.prod.outlook.com ([fe80::a5fd:3b4c:2300:b2bf%13]) with mapi id 15.20.0345.017; Wed, 27 Dec 2017 07:37:05 +0000 From: Udit Kumar To: Vladimir Olovyannikov , Ard Biesheuvel , "edk2-devel@lists.01.org" CC: "leif.lindholm@linaro.org" Thread-Topic: [edk2] [PATCH 5/7] ArmPlatformPkg/MemoryInitPeiLib: don't reserve primary FV in memory Thread-Index: AQHTae9v1E4tJtPA+kW/n7yJvYSDyqNWU8KAgACdXAA= Date: Wed, 27 Dec 2017 07:37:05 +0000 Message-ID: References: <20171130152453.19205-1-ard.biesheuvel@linaro.org> <20171130152453.19205-6-ard.biesheuvel@linaro.org> <7bd00d4b1fa918286d61e069fc68f6bd@mail.gmail.com> In-Reply-To: <7bd00d4b1fa918286d61e069fc68f6bd@mail.gmail.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; AM6PR0402MB3334; 7:ojxPCvP+eEcq6n2BXPGMYl0o4H8uyonDbfG8+C+Pr4WXeRRSbWewwYlM2pJA2cxWK7m0WL3NGafsVtC/9oOng4GpoO56NQJFg9hIbLFJOO17UxDvaCBAtVHcFOprSzaShFgl8pcME7j7P1oriDp+1ygMw5jfUPT7sdVQO54/Iyu/9H37GHb/WmMxg2udkaDIpwTezEzHAJc6NPC03Chi+dcfErDaE9RIo1f9JMGZyazQ9ERiSDFjgElPiZz+0m4F x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: b2e4b2c1-5a47-45a6-0aa0-08d54cfca0f9 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(48565401081)(2017052603307)(7153060); SRVR:AM6PR0402MB3334; x-ms-traffictypediagnostic: AM6PR0402MB3334: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(189930954265078)(185117386973197)(162533806227266)(45079756050767); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231023)(944501075)(6055026)(6041268)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM6PR0402MB3334; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0402MB3334; x-forefront-prvs: 0534947130 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(39380400002)(346002)(366004)(396003)(13464003)(189003)(199004)(2501003)(2900100001)(4326008)(5250100002)(25786009)(8936002)(97736004)(3280700002)(3660700001)(305945005)(966005)(53936002)(106356001)(6306002)(66066001)(74316002)(68736007)(105586002)(2906002)(6246003)(9686003)(5660300001)(33656002)(7696005)(99286004)(7736002)(45080400002)(81156014)(229853002)(478600001)(76176011)(3846002)(6116002)(8676002)(55016002)(102836004)(59450400001)(53546011)(110136005)(86362001)(6506007)(316002)(2950100002)(14454004)(81166006)(6436002)(575784001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0402MB3334; H:AM6PR0402MB3334.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: aq/JNQxX46GI/GO0tW2PVlOkllaBuCtKyfN/RfaKBIiSyJQSDLQTKof0y1lWlY9ZwEa5ihuK/kifPIIKuz5rEQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b2e4b2c1-5a47-45a6-0aa0-08d54cfca0f9 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Dec 2017 07:37:05.7844 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0402MB3334 Subject: Re: [PATCH 5/7] ArmPlatformPkg/MemoryInitPeiLib: don't reserve primary FV in memory X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Dec 2017 07:32:15 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Vladimir How re-allocation or say drivers are dispatched on your system.=20 Could you check addresses, where FV is kept and where this is getting dispa= tched=20 Thx=20 Udit > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Vladimir Olovyannikov > Sent: Wednesday, December 27, 2017 3:22 AM > To: Ard Biesheuvel ; edk2-devel@lists.01.org > Cc: leif.lindholm@linaro.org > Subject: Re: [edk2] [PATCH 5/7] ArmPlatformPkg/MemoryInitPeiLib: don't > reserve primary FV in memory >=20 > Hi Ard, Meenakshi, >=20 > I am having a problem I cannot explain the reason for, with this commit o= n > an ARM64 platform. >=20 > ArmPlatformPkg/MemoryInitPeiLib: don't reserve primary FV in memory >=20 > Now that PrePi no longer exposes its internal code via special HOBs, > we can remove the special handling of the primary FV, which needed to > be reserved so that DXE core could call into the PE/COFF and LZMA > libraries in the PrePi module. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Udit Kumar > Signed-off-by: Meenakshi Aggarwal > [ardb: updated commit log] > Signed-off-by: Ard Biesheuvel > Reviewed-by: Leif Lindholm >=20 > If a Shell is built "as is" from the source tree, there are no issues. > However, if I slightly modify Shell.c like in the following patch: >=20 > diff --git a/ShellPkg/Application/Shell/Shell.c > b/ShellPkg/Application/Shell/Shell.c > index 577e17311bea..bbbdde8ced96 100644 > --- a/ShellPkg/Application/Shell/Shell.c > +++ b/ShellPkg/Application/Shell/Shell.c > @@ -339,6 +339,11 @@ UefiMain ( > EFI_HANDLE ConInHandle; > EFI_SIMPLE_TEXT_INPUT_PROTOCOL *OldConIn; > SPLIT_LIST *Split; > + CHAR16 *DelayStr; > + CHAR16 *NoMapStr; > + UINTN DelayVarSize; > + UINTN NoMapVarSize; > + BOOLEAN SilentStart; >=20 > if (PcdGet8(PcdShellSupportLevel) > 3) { > return (EFI_UNSUPPORTED); > @@ -360,6 +365,7 @@ UefiMain ( > ShellInfoObject.PageBreakEnabled =3D > PcdGetBool(PcdShellPageBreakDefault); > ShellInfoObject.ViewingSettings.InsertMode =3D > PcdGetBool(PcdShellInsertModeDefault); > ShellInfoObject.LogScreenCount =3D PcdGet8 > (PcdShellScreenLogCount ); > + SilentStart =3D FALSE; >=20 > // > // verify we dont allow for spec violation @@ -452,6 +458,21 @@ UefiMa= in > ( > goto FreeResources; > } >=20 > + if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.Delay) { > + // Command line has priority over the variable > + Status =3D ShellFindEnvVarInList(L"startupdelay", &DelayStr, > &DelayVarSize, NULL); > + if (!EFI_ERROR (Status)) { > + ShellInfoObject.ShellInitSettings.Delay =3D ShellStrToUintn > (DelayStr); > + } > + } > + > + if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoMap) { > + Status =3D ShellFindEnvVarInList(L"silentstart", &NoMapStr, > &NoMapVarSize, NULL); > + if (!EFI_ERROR (Status)) { > + SilentStart =3D (BOOLEAN)ShellStrToUintn (NoMapStr); > + } > + } > + > // > // If shell support level is >=3D 1 create the mappings and paths > // > @@ -492,7 +513,7 @@ UefiMain ( > // > // Display the version > // > - if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoVersion) { > + if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoVersion && > !SilentStart) { > ShellPrintHiiEx ( > 0, > gST->ConOut->Mode->CursorRow, @@ -529,7 +550,7 @@ UefiMain ( > // > // Display the mapping > // > - if (PcdGet8(PcdShellSupportLevel) >=3D 2 && > !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoMap) { > + if (PcdGet8(PcdShellSupportLevel) >=3D 2 && > !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoMap && !SilentStart) { > Status =3D RunCommand(L"map"); > ASSERT_EFI_ERROR(Status); > } >=20 > Shell fails to load. > Here is an excerpt from the debug log: >=20 > add-symbol-file > /uefi/Build/StingrayPkg/DEBUG_GCC5/AARCH64/ShellPkg/Application/Shell/ > Shel > l/DEBUG/Shell.dll 0x88480000 > Loading driver at 0x0008847F000 EntryPoint=3D0x00088480000 Shell.efi > InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 8D095118 > ProtectUefiImageCommon - 0x8D08ED40 > - 0x000000008847F000 - 0x0000000000152000 > SetUefiImageMemoryAttributes - 0x000000008847F000 - > 0x0000000000001000 > (0x0000000000004008) > SetUefiImageMemoryAttributes - 0x0000000088480000 - > 0x00000000000E6000 > (0x0000000000020008) > SetUefiImageMemoryAttributes - 0x0000000088566000 - > 0x000000000006B000 > (0x0000000000004008) > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8D088920 > InstallProtocolInterface: 752F3136-4E16-4FDC-A22A-E5F46812F4CA 8C71AF98 > InstallProtocolInterface: 6302D008-7F9B-4F30-87AC-60C9FEF5DA4E 88566710 > --- Blank lines ----- > 3h > --- Blank lines ----- >=20 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8C0A1B18 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B > A3ABE6B398 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8C0A1B18 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B > A3ABE6B398 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8C0A1B18 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B > A3ABE6B398 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8C0A1B18 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B > A3ABE6B398 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8C0A1B18 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8C0A1B18 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8C0A1E18 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8C0A1B18 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8C0A1E18 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8C0A1B18 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8C0A1E18 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8C0A1B18 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8C0A1E18 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8C0A1B18 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8C0A1E18 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8C0A1B18 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8C0A1E18 > InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 8C0A1B18 > ASSERT [DxeCore] > /uefi/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c(3 > 00) > : ((BOOLEAN)(0=3D=3D1)) >=20 > Here 387477C2-69C7-11D2-8E39-00A0C969723B GUID is > gEfiSimpleTextOutProtocolGuid. >=20 > And there is no way to do source-level debug because FV image cannot be > found in memory at the given location. > As soon as I revert this commit > (8ae5fc182941cf9ff7a222eb0a484088a0db8e2e), everything gets back to > normal. > Could you please explain me what I am doing wrong? >=20 > Thank you, > Vladimir >=20 > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ar= d > Biesheuvel > Sent: Thursday, November 30, 2017 7:25 AM > To: edk2-devel@lists.01.org > Cc: leif.lindholm@linaro.org; Ard Biesheuvel > Subject: [edk2] [PATCH 5/7] ArmPlatformPkg/MemoryInitPeiLib: don't reserv= e > primary FV in memory >=20 > From: Meenakshi Aggarwal >=20 > Now that PrePi no longer exposes its internal code via special HOBs, we c= an > remove the special handling of the primary FV, which needed to be reserve= d > so that DXE core could call into the PE/COFF and LZMA libraries in the Pr= ePi > module. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Udit Kumar > Signed-off-by: Meenakshi Aggarwal > [ardb: updated commit log] > Signed-off-by: Ard Biesheuvel > --- > ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c | 69 -------------------= - > 1 file changed, 69 deletions(-) >=20 > diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c > b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c > index 2feb11f21d5d..d03214b5df66 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->ResourceAttribute; > - ResourceLength =3D NextHob.ResourceDescriptor->ResourceLength; > - ResourceTop =3D NextHob.ResourceDescriptor->PhysicalStart + > ResourceLength; > - > - if (PcdGet64 (PcdFdBaseAddress) =3D=3D > NextHob.ResourceDescriptor->PhysicalStart) { > - if (SystemMemoryTop =3D=3D FdTop) { > - NextHob.ResourceDescriptor->ResourceAttribute =3D > ResourceAttributes & ~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(PcdFdSize); > - NextHob.ResourceDescriptor->ResourceLength -=3D > PcdGet32(PcdFdSize); > - } > - } 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 > -- > 2.11.0 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://emea01.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Flist= s. > 01.org%2Fmailman%2Flistinfo%2Fedk2- > devel&data=3D02%7C01%7Cudit.kumar%40nxp.com%7Ca75148c0714749bda72 > d08d54caaf73b%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6364 > 99219600898902&sdata=3DnmhLohXfQGCJE3F%2FDan1YPZCcgbCZ6yyxcZsdZ71h > P8%3D&reserved=3D0 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://emea01.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Flist= s. > 01.org%2Fmailman%2Flistinfo%2Fedk2- > devel&data=3D02%7C01%7Cudit.kumar%40nxp.com%7Ca75148c0714749bda72 > d08d54caaf73b%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6364 > 99219600898902&sdata=3DnmhLohXfQGCJE3F%2FDan1YPZCcgbCZ6yyxcZsdZ71h > P8%3D&reserved=3D0