public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v4 0/2] Upl remove arch spec initialization
@ 2023-03-15 12:19 Dhaval Sharma
  2023-03-15 12:19 ` [PATCH v4 1/2] UefiPayloadPkg: Remove FP Init from UPL entry Dhaval Sharma
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Dhaval Sharma @ 2023-03-15 12:19 UTC (permalink / raw)
  To: devel

Looking at adding support for Risc-V for UPL. In the process realised
there are several initialisation sequences which need not be part of
common UPL entry flow. The flow should be agnostic to both BL and Arch
with required hooks provided along the boot path. This patch set
addresses 2 such instances related to 8259 interrupt and FP programming.
To be on a safer side for now just moving this init to arch folders.
branch: https://github.com/rivosinc/edk2/tree/upl-remove-arch-spec-init-v4

Dhaval Sharma (2):
  UefiPayloadPkg: Remove FP Init from UPL entry
  UefiPayloadPkg: Move INT prog outside common flow

 UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c      | 9 +++++++++
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c | 9 ---------
 UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c       | 9 +++++++++
 3 files changed, 18 insertions(+), 9 deletions(-)

-- 
2.40.0.rc0.57.g454dfcbddf


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v4 1/2] UefiPayloadPkg: Remove FP Init from UPL entry
  2023-03-15 12:19 [PATCH v4 0/2] Upl remove arch spec initialization Dhaval Sharma
@ 2023-03-15 12:19 ` Dhaval Sharma
  2023-05-01  1:19   ` [edk2-devel] " Lu, James
  2023-03-15 12:19 ` [PATCH v4 2/2] UefiPayloadPkg: Move INT prog outside common flow Dhaval Sharma
  2023-03-26 17:12 ` [edk2-devel] [PATCH v4 0/2] Upl remove arch spec initialization Dhaval Sharma
  2 siblings, 1 reply; 6+ messages in thread
From: Dhaval Sharma @ 2023-03-15 12:19 UTC (permalink / raw)
  To: devel; +Cc: Guo Dong, Ray Ni, Sean Rhodes, James Lu, Gua Guo

According to UPL spec BL should initialize FP init meaning UPL
does not need to initialize it. Besides this is arch specific init
and needs to be moved out of UPL common flow. In order to not break
current BL implementations, for now just moving the init to later
point of time but for both x32 and x64 eventually this should be
removed once BL impelement this logic.

Test: Verified booting  UEFI shell on coreboot on qemu.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>

Reviewed-by: Gua Guo <gua.guo@intel.com>
---

Notes:
    v3:
    - Added FP initialization to X64 path as well
    v4:
    - Updated reviewed-by tag

 UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c      | 3 +++
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c | 3 ---
 UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c       | 3 +++
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c b/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
index c66e56aee15a..9d2bfb2fa654 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
@@ -268,6 +268,9 @@ HandOffToDxeCore (
   UINT32                   Index;
   X64_IDT_TABLE            *IdtTableForX64;
 
+  // Initialize floating point operating environment to be compliant with UEFI spec.
+  InitializeFloatingPointUnits ();
+
   //
   // Clear page 0 and mark it as allocated if NULL pointer detection is enabled.
   //
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
index 46ee27c905e9..07f4c1d29686 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
@@ -470,9 +470,6 @@ _ModuleEntryPoint (
     PrintHob (mHobList);
     );
 
-  // Initialize floating point operating environment to be compliant with UEFI spec.
-  InitializeFloatingPointUnits ();
-
   // Build HOB based on information from Bootloader
   Status = BuildHobs (BootloaderParameter, &DxeFv);
   ASSERT_EFI_ERROR (Status);
diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c b/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c
index 346e3feb0459..84a6112ce64a 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c
@@ -40,6 +40,9 @@ HandOffToDxeCore (
   VOID   *GhcbBase;
   UINTN  GhcbSize;
 
+  // Initialize floating point operating environment to be compliant with UEFI spec.
+  InitializeFloatingPointUnits ();
+
   //
   // Clear page 0 and mark it as allocated if NULL pointer detection is enabled.
   //
-- 
2.40.0.rc0.57.g454dfcbddf


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v4 2/2] UefiPayloadPkg: Move INT prog outside common flow
  2023-03-15 12:19 [PATCH v4 0/2] Upl remove arch spec initialization Dhaval Sharma
  2023-03-15 12:19 ` [PATCH v4 1/2] UefiPayloadPkg: Remove FP Init from UPL entry Dhaval Sharma
@ 2023-03-15 12:19 ` Dhaval Sharma
  2023-05-01  1:19   ` [edk2-devel] " Lu, James
  2023-03-26 17:12 ` [edk2-devel] [PATCH v4 0/2] Upl remove arch spec initialization Dhaval Sharma
  2 siblings, 1 reply; 6+ messages in thread
From: Dhaval Sharma @ 2023-03-15 12:19 UTC (permalink / raw)
  To: devel; +Cc: Guo Dong, Ray Ni, Sean Rhodes, James Lu, Gua Guo

8259 is very arch specific programming. It needs to be moved out to
the respective arch flow. Added in both x64 and x32 paths

Test: Able to boot UEFI shell with Coreboot Tianocore payload on
x86 qemu

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>

Reviewed-by: Gua Guo <gua.guo@intel.com>
---

Notes:
    v3:
    - Added legacy INT intialization to X64 path as well
    v4:
    - Updated reviewed-by tag

 UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c      | 6 ++++++
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c | 6 ------
 UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c       | 6 ++++++
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c b/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
index 9d2bfb2fa654..d41e5024b4a1 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
@@ -271,6 +271,12 @@ HandOffToDxeCore (
   // Initialize floating point operating environment to be compliant with UEFI spec.
   InitializeFloatingPointUnits ();
 
+  //
+  // Mask off all legacy 8259 interrupt sources
+  //
+  IoWrite8 (LEGACY_8259_MASK_REGISTER_MASTER, 0xFF);
+  IoWrite8 (LEGACY_8259_MASK_REGISTER_SLAVE, 0xFF);
+
   //
   // Clear page 0 and mark it as allocated if NULL pointer detection is enabled.
   //
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
index 07f4c1d29686..45127689a24b 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
@@ -478,12 +478,6 @@ _ModuleEntryPoint (
   Status = UniversalLoadDxeCore (DxeFv, &DxeCoreEntryPoint);
   ASSERT_EFI_ERROR (Status);
 
-  //
-  // Mask off all legacy 8259 interrupt sources
-  //
-  IoWrite8 (LEGACY_8259_MASK_REGISTER_MASTER, 0xFF);
-  IoWrite8 (LEGACY_8259_MASK_REGISTER_SLAVE, 0xFF);
-
   Hob.HandoffInformationTable = (EFI_HOB_HANDOFF_INFO_TABLE *)GetFirstHob (EFI_HOB_TYPE_HANDOFF);
   HandOffToDxeCore (DxeCoreEntryPoint, Hob);
 
diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c b/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c
index 84a6112ce64a..1dfb7459e85a 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c
@@ -43,6 +43,12 @@ HandOffToDxeCore (
   // Initialize floating point operating environment to be compliant with UEFI spec.
   InitializeFloatingPointUnits ();
 
+  //
+  // Mask off all legacy 8259 interrupt sources
+  //
+  IoWrite8 (LEGACY_8259_MASK_REGISTER_MASTER, 0xFF);
+  IoWrite8 (LEGACY_8259_MASK_REGISTER_SLAVE, 0xFF);
+
   //
   // Clear page 0 and mark it as allocated if NULL pointer detection is enabled.
   //
-- 
2.40.0.rc0.57.g454dfcbddf


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] [PATCH v4 0/2] Upl remove arch spec initialization
  2023-03-15 12:19 [PATCH v4 0/2] Upl remove arch spec initialization Dhaval Sharma
  2023-03-15 12:19 ` [PATCH v4 1/2] UefiPayloadPkg: Remove FP Init from UPL entry Dhaval Sharma
  2023-03-15 12:19 ` [PATCH v4 2/2] UefiPayloadPkg: Move INT prog outside common flow Dhaval Sharma
@ 2023-03-26 17:12 ` Dhaval Sharma
  2 siblings, 0 replies; 6+ messages in thread
From: Dhaval Sharma @ 2023-03-26 17:12 UTC (permalink / raw)
  To: Dhaval Sharma, devel

[-- Attachment #1: Type: text/plain, Size: 121 bytes --]

Can I please get review comments on this patchset? If all well, I hope to get it merged based on feedback.
Thanks!
=D

[-- Attachment #2: Type: text/html, Size: 129 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] [PATCH v4 1/2] UefiPayloadPkg: Remove FP Init from UPL entry
  2023-03-15 12:19 ` [PATCH v4 1/2] UefiPayloadPkg: Remove FP Init from UPL entry Dhaval Sharma
@ 2023-05-01  1:19   ` Lu, James
  0 siblings, 0 replies; 6+ messages in thread
From: Lu, James @ 2023-05-01  1:19 UTC (permalink / raw)
  To: devel@edk2.groups.io, dhaval@rivosinc.com
  Cc: Dong, Guo, Ni, Ray, Rhodes, Sean, Guo, Gua

Reviewed-by: James Lu <james.lu@intel.com>


Thanks,
James

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Dhaval Sharma
Sent: Wednesday, March 15, 2023 8:19 PM
To: devel@edk2.groups.io
Cc: Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>
Subject: [edk2-devel] [PATCH v4 1/2] UefiPayloadPkg: Remove FP Init from UPL entry

According to UPL spec BL should initialize FP init meaning UPL does not need to initialize it. Besides this is arch specific init and needs to be moved out of UPL common flow. In order to not break current BL implementations, for now just moving the init to later point of time but for both x32 and x64 eventually this should be removed once BL impelement this logic.

Test: Verified booting  UEFI shell on coreboot on qemu.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>

Reviewed-by: Gua Guo <gua.guo@intel.com>
---

Notes:
    v3:
    - Added FP initialization to X64 path as well
    v4:
    - Updated reviewed-by tag

 UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c      | 3 +++
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c | 3 ---
 UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c       | 3 +++
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c b/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
index c66e56aee15a..9d2bfb2fa654 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
@@ -268,6 +268,9 @@ HandOffToDxeCore (
   UINT32                   Index;
   X64_IDT_TABLE            *IdtTableForX64;
 
+  // Initialize floating point operating environment to be compliant with UEFI spec.
+  InitializeFloatingPointUnits ();
+
   //
   // Clear page 0 and mark it as allocated if NULL pointer detection is enabled.
   //
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
index 46ee27c905e9..07f4c1d29686 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
@@ -470,9 +470,6 @@ _ModuleEntryPoint (
     PrintHob (mHobList);
     );
 
-  // Initialize floating point operating environment to be compliant with UEFI spec.
-  InitializeFloatingPointUnits ();
-
   // Build HOB based on information from Bootloader
   Status = BuildHobs (BootloaderParameter, &DxeFv);
   ASSERT_EFI_ERROR (Status);
diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c b/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c
index 346e3feb0459..84a6112ce64a 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c
@@ -40,6 +40,9 @@ HandOffToDxeCore (
   VOID   *GhcbBase;
   UINTN  GhcbSize;
 
+  // Initialize floating point operating environment to be compliant with UEFI spec.
+  InitializeFloatingPointUnits ();
+
   //
   // Clear page 0 and mark it as allocated if NULL pointer detection is enabled.
   //
--
2.40.0.rc0.57.g454dfcbddf







^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] [PATCH v4 2/2] UefiPayloadPkg: Move INT prog outside common flow
  2023-03-15 12:19 ` [PATCH v4 2/2] UefiPayloadPkg: Move INT prog outside common flow Dhaval Sharma
@ 2023-05-01  1:19   ` Lu, James
  0 siblings, 0 replies; 6+ messages in thread
From: Lu, James @ 2023-05-01  1:19 UTC (permalink / raw)
  To: devel@edk2.groups.io, dhaval@rivosinc.com
  Cc: Dong, Guo, Ni, Ray, Rhodes, Sean, Guo, Gua

Reviewed-by: James Lu <james.lu@intel.com>


Thanks,
James

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Dhaval Sharma
Sent: Wednesday, March 15, 2023 8:19 PM
To: devel@edk2.groups.io
Cc: Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>
Subject: [edk2-devel] [PATCH v4 2/2] UefiPayloadPkg: Move INT prog outside common flow

8259 is very arch specific programming. It needs to be moved out to the respective arch flow. Added in both x64 and x32 paths

Test: Able to boot UEFI shell with Coreboot Tianocore payload on
x86 qemu

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>

Reviewed-by: Gua Guo <gua.guo@intel.com>
---

Notes:
    v3:
    - Added legacy INT intialization to X64 path as well
    v4:
    - Updated reviewed-by tag

 UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c      | 6 ++++++
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c | 6 ------
 UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c       | 6 ++++++
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c b/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
index 9d2bfb2fa654..d41e5024b4a1 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
@@ -271,6 +271,12 @@ HandOffToDxeCore (
   // Initialize floating point operating environment to be compliant with UEFI spec.
   InitializeFloatingPointUnits ();
 
+  //
+  // Mask off all legacy 8259 interrupt sources  //
+  IoWrite8 (LEGACY_8259_MASK_REGISTER_MASTER, 0xFF);
+  IoWrite8 (LEGACY_8259_MASK_REGISTER_SLAVE, 0xFF);
+
   //
   // Clear page 0 and mark it as allocated if NULL pointer detection is enabled.
   //
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
index 07f4c1d29686..45127689a24b 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
@@ -478,12 +478,6 @@ _ModuleEntryPoint (
   Status = UniversalLoadDxeCore (DxeFv, &DxeCoreEntryPoint);
   ASSERT_EFI_ERROR (Status);
 
-  //
-  // Mask off all legacy 8259 interrupt sources
-  //
-  IoWrite8 (LEGACY_8259_MASK_REGISTER_MASTER, 0xFF);
-  IoWrite8 (LEGACY_8259_MASK_REGISTER_SLAVE, 0xFF);
-
   Hob.HandoffInformationTable = (EFI_HOB_HANDOFF_INFO_TABLE *)GetFirstHob (EFI_HOB_TYPE_HANDOFF);
   HandOffToDxeCore (DxeCoreEntryPoint, Hob);
 
diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c b/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c
index 84a6112ce64a..1dfb7459e85a 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c
@@ -43,6 +43,12 @@ HandOffToDxeCore (
   // Initialize floating point operating environment to be compliant with UEFI spec.
   InitializeFloatingPointUnits ();
 
+  //
+  // Mask off all legacy 8259 interrupt sources  //
+  IoWrite8 (LEGACY_8259_MASK_REGISTER_MASTER, 0xFF);
+  IoWrite8 (LEGACY_8259_MASK_REGISTER_SLAVE, 0xFF);
+
   //
   // Clear page 0 and mark it as allocated if NULL pointer detection is enabled.
   //
--
2.40.0.rc0.57.g454dfcbddf







^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-05-01  1:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-15 12:19 [PATCH v4 0/2] Upl remove arch spec initialization Dhaval Sharma
2023-03-15 12:19 ` [PATCH v4 1/2] UefiPayloadPkg: Remove FP Init from UPL entry Dhaval Sharma
2023-05-01  1:19   ` [edk2-devel] " Lu, James
2023-03-15 12:19 ` [PATCH v4 2/2] UefiPayloadPkg: Move INT prog outside common flow Dhaval Sharma
2023-05-01  1:19   ` [edk2-devel] " Lu, James
2023-03-26 17:12 ` [edk2-devel] [PATCH v4 0/2] Upl remove arch spec initialization Dhaval Sharma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox