* [PATCH v3 0/2] Upl remove arch spec initialization
@ 2023-03-09 10:37 Dhaval Sharma
2023-03-09 10:37 ` [PATCH v3 1/2] UefiPayloadPkg: Remove FP Init from UPL entry Dhaval Sharma
2023-03-09 10:37 ` [PATCH v3 2/2] UefiPayloadPkg: Move INT prog outside common flow Dhaval Sharma
0 siblings, 2 replies; 4+ messages in thread
From: Dhaval Sharma @ 2023-03-09 10:37 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.
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] 4+ messages in thread
* [PATCH v3 1/2] UefiPayloadPkg: Remove FP Init from UPL entry
2023-03-09 10:37 [PATCH v3 0/2] Upl remove arch spec initialization Dhaval Sharma
@ 2023-03-09 10:37 ` Dhaval Sharma
2023-03-09 10:37 ` [PATCH v3 2/2] UefiPayloadPkg: Move INT prog outside common flow Dhaval Sharma
1 sibling, 0 replies; 4+ messages in thread
From: Dhaval Sharma @ 2023-03-09 10:37 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>
---
Notes:
v3:
- Added FP initialization to X64 path as well
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] 4+ messages in thread
* [PATCH v3 2/2] UefiPayloadPkg: Move INT prog outside common flow
2023-03-09 10:37 [PATCH v3 0/2] Upl remove arch spec initialization Dhaval Sharma
2023-03-09 10:37 ` [PATCH v3 1/2] UefiPayloadPkg: Remove FP Init from UPL entry Dhaval Sharma
@ 2023-03-09 10:37 ` Dhaval Sharma
2023-03-09 11:48 ` Guo, Gua
1 sibling, 1 reply; 4+ messages in thread
From: Dhaval Sharma @ 2023-03-09 10:37 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>
---
Notes:
v3:
- Added legacy INT intialization to X64 path as well
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] 4+ messages in thread
* Re: [PATCH v3 2/2] UefiPayloadPkg: Move INT prog outside common flow
2023-03-09 10:37 ` [PATCH v3 2/2] UefiPayloadPkg: Move INT prog outside common flow Dhaval Sharma
@ 2023-03-09 11:48 ` Guo, Gua
0 siblings, 0 replies; 4+ messages in thread
From: Guo, Gua @ 2023-03-09 11:48 UTC (permalink / raw)
To: Dhaval Sharma, devel@edk2.groups.io
Cc: Dong, Guo, Ni, Ray, Sean Rhodes, Lu, James
Reviewed-by: Gua Guo <gua.guo@intel.com>
-----Original Message-----
From: Dhaval Sharma <dhaval@rivosinc.com>
Sent: Thursday, March 9, 2023 6:37 PM
To: devel@edk2.groups.io
Cc: Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Sean Rhodes <sean@starlabs.systems>; Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>
Subject: [PATCH v3 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>
---
Notes:
v3:
- Added legacy INT intialization to X64 path as well
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] 4+ messages in thread
end of thread, other threads:[~2023-03-09 11:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-09 10:37 [PATCH v3 0/2] Upl remove arch spec initialization Dhaval Sharma
2023-03-09 10:37 ` [PATCH v3 1/2] UefiPayloadPkg: Remove FP Init from UPL entry Dhaval Sharma
2023-03-09 10:37 ` [PATCH v3 2/2] UefiPayloadPkg: Move INT prog outside common flow Dhaval Sharma
2023-03-09 11:48 ` Guo, Gua
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox