From mboxrd@z Thu Jan 1 00:00:00 1970 Subject: Re: [edk2-devel] [edk2][PATCH V3 1/1] ArmPlatformPkg/PrePeiCore: Explicitly invoke constructor for SEC phase To: Thomas Abraham ,devel@edk2.groups.io From: "Rohit Mathew" X-Originating-Location: Cambridge, England, GB (217.140.99.251) X-Originating-Platform: Windows Chrome 103 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Mon, 18 Jul 2022 11:11:13 -0700 References: <94dcbbe0-dd1f-6e92-fa44-ff5895d8e75c@arm.com> In-Reply-To: <94dcbbe0-dd1f-6e92-fa44-ff5895d8e75c@arm.com> Message-ID: <17823.1658167873475486381@groups.io> Content-Type: multipart/alternative; boundary="qwpqAdmvbuCbHJlN9q6L" --qwpqAdmvbuCbHJlN9q6L Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi Team, Gentle reminder for this patch. Regards, Rohit On Wed, Jul 6, 2022 at 03:20 PM, Thomas Abraham wrote: >=20 > On 06/07/2022 14:42, Rohit Mathew wrote: >=20 >> Invoke the constructor in the SEC phase to call into initialization >> functions associated with libraries linked with this particular module. >> For instance, PrePeiCore's CEntryPoint function calls DebugLib library's >> print API before the library is initialized. This change is essential >> to initialize uart for SEC phase. >>=20 >> Signed-off-by: Rohit Mathew >> --- >> ArmPlatformPkg/PrePeiCore/PrePeiCore.h | 11 ++++++++++- >> ArmPlatformPkg/PrePeiCore/PrePeiCore.c | 6 +++++- >> 2 files changed, 15 insertions(+), 2 deletions(-) >>=20 >> Changes since V1: >> - Rebased on top of latest master branch. >> - Addressed comments from Ard. >>=20 >> Changes since V2: >> - Rebased on top of latest master branch. >>=20 >> Link to github branch for the patch - >> https://github.com/rohit-arm/edk2/tree/sec_constructor_issue >>=20 >> diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCore.h >> b/ArmPlatformPkg/PrePeiCore/PrePeiCore.h >> index 0345dd7bdd2a..b752c4b9e617 100644 >> --- a/ArmPlatformPkg/PrePeiCore/PrePeiCore.h >> +++ b/ArmPlatformPkg/PrePeiCore/PrePeiCore.h >> @@ -1,7 +1,7 @@ >> /** @file >> Main file supporting the transition to PEI Core in Normal World for >> Versatile Express >>=20 >> - Copyright (c) 2011, ARM Limited. All rights reserved. >> + Copyright (c) 2011 - 2022, ARM Limited. All rights reserved. >>=20 >> SPDX-License-Identifier: BSD-2-Clause-Patent >>=20 >> @@ -73,4 +73,13 @@ PeiCommonExceptionEntry ( >> IN UINTN LR >> ); >>=20 >> +/* >> + * Constructor for SEC phase >> + */ >> +VOID >> +EFIAPI >> +ProcessLibraryConstructorList ( >> + VOID >> + ); >> + >> #endif >> diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c >> b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c >> index 6dd9bcdea24f..9654866f0c13 100644 >> --- a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c >> +++ b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c >> @@ -1,7 +1,7 @@ >> /** @file >> Main file supporting the transition to PEI Core in Normal World for >> Versatile Express >>=20 >> - Copyright (c) 2011-2014, ARM Limited. All rights reserved. >> + Copyright (c) 2011 - 2022, ARM Limited. All rights reserved. >>=20 >> SPDX-License-Identifier: BSD-2-Clause-Patent >>=20 >> @@ -86,6 +86,10 @@ CEntryPoint ( >> ArmEnableVFP (); >> } >>=20 >> + // Explicitly invoke the library constructor to resolve any library >> + // dependency. >> + ProcessLibraryConstructorList(); >> + >> // Note: The MMU will be enabled by MemoryPeim. Only the primary core wi= ll >> have the MMU on. >>=20 >> // If not primary Jump to Secondary Main >=20 > Reviewed-by: Thomas Abraham > Tested-by: Thomas Abraham >=20 > Thanks. --qwpqAdmvbuCbHJlN9q6L Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi = Team,

Gentle reminder for this patch.

Regards,
R= ohit

On Wed, Jul 6, 2022 at 03:20 PM, Thomas Abraham wrot= e:
On 06/07/2022 14:42, Rohit Mathew wrote:
Invoke the constructor in the SEC phase to call into initializa= tion
functions associated with libraries linked with this particular m= odule.
For instance, PrePeiCore's CEntryPoint function calls DebugLib = library's
print API before the library is initialized. This change is = essential
to initialize uart for SEC phase.

Signed-off-by: = Rohit Mathew <rohit.mathew@arm.com>
---
ArmPlatformPkg/PreP= eiCore/PrePeiCore.h | 11 ++++++++++-
ArmPlatformPkg/PrePeiCore/PrePeiC= ore.c | 6 +++++-
2 files changed, 15 insertions(+), 2 deletions(-)

Changes since V1:
- Rebased on top of latest master branch.- Addressed comments from Ard.

Changes since V2:
- Rebas= ed on top of latest master branch.

Link to github branch for the= patch -
https://github.com/rohit-arm= /edk2/tree/sec_constructor_issue

diff --git a/ArmPlatformPkg= /PrePeiCore/PrePeiCore.h b/ArmPlatformPkg/PrePeiCore/PrePeiCore.h
inde= x 0345dd7bdd2a..b752c4b9e617 100644
--- a/ArmPlatformPkg/PrePeiCore/Pr= ePeiCore.h
+++ b/ArmPlatformPkg/PrePeiCore/PrePeiCore.h
@@ -1,7 += 1,7 @@
/** @file
Main file supporting the transition to PEI Core = in Normal World for Versatile Express

- Copyright (c) 2011, ARM = Limited. All rights reserved.
+ Copyright (c) 2011 - 2022, ARM Limited= . All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Pat= ent

@@ -73,4 +73,13 @@ PeiCommonExceptionEntry (
IN UINTN L= R
);

+/*
+ * Constructor for SEC phase
+ */
= +VOID
+EFIAPI
+ProcessLibraryConstructorList (
+ VOID
+= );
+
#endif
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCo= re.c b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c
index 6dd9bcdea24f..9654= 866f0c13 100644
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c
+++ = b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c
@@ -1,7 +1,7 @@
/** @fil= e
Main file supporting the transition to PEI Core in Normal World for = Versatile Express

- Copyright (c) 2011-2014, ARM Limited. All ri= ghts reserved.
+ Copyright (c) 2011 - 2022, ARM Limited. All rights re= served.

SPDX-License-Identifier: BSD-2-Clause-Patent

= @@ -86,6 +86,10 @@ CEntryPoint (
ArmEnableVFP ();
}

+ = // Explicitly invoke the library constructor to resolve any library
+ = // dependency.
+ ProcessLibraryConstructorList();
+
// Note:= The MMU will be enabled by MemoryPeim. Only the primary core will have the= MMU on.

// If not primary Jump to Secondary Main
Reviewed-by: Thomas Abraham <thomas.abraham@arm.com>
Tested-by: = Thomas Abraham <thomas.abraham@arm.com>

Thanks. --qwpqAdmvbuCbHJlN9q6L--