public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* DRAFT: [PATCH v1 0/8] RiscV64 Support In UPL
@ 2023-05-11  7:08 Dhaval Sharma
  2023-05-11  7:08 ` [PATCH v1 1/8] UefiPayloadPkg: Remove FP Init from UPL entry Dhaval Sharma
  0 siblings, 1 reply; 4+ messages in thread
From: Dhaval Sharma @ 2023-05-11  7:08 UTC (permalink / raw)
  To: devel

This patchset contains modifications required in UPL boot flow to
enable RiscV64 support. Squashing earlier series of patches
related to arch specific removal from UPL boot path to this release such
that all chnages can be viewed in the entirety.
1. Add required infra to support RiscV64
2. New UPL proposal supports multiple Archs and accordingly ABI
   is also different. This is a proposal to accomodate these changes.
   This patch adds a hook to parse RiscV64 specific IN params and extract
   FDT from the same.
3. Take FDT received from BL and parse it to create required HOBs that
   are later consumed by UPL.
4. Add FirmwareContext structure which is specific to RV and used by RV
   CPU driver.
5. Add required modifications to extrace DxeFv from overall UPL FD.
6. Add required RV drivers to boot to UEFI Shell

P.S. This patch is review only at this point as it is tested in a limited
fashion for RV to get to early debug logs from FDT described serial device.
It will require modifications to work on other Archs.

Branch https://github.com/rivosinc/edk2/tree/upl-rv64-enable-compilation-v1

Dhaval Sharma (8):
  UefiPayloadPkg: Remove FP Init from UPL entry
  UefiPayloadPkg: Move INT prog outside common flow
  UefiPayloadPkg: Basic Infra To Enable RV64 UPL Support
  UefiPayloadPkg: Update input params as per latest UPL spec
  UefiPayloadPkg: Hook to parse IN params as per UPL spec
  UefiPayloadPkg: Add FirmwareContext for RV64
  UefiPayloadPkg: Find DxeFV and create required FV HOB
  UefiPayloadPkg: Add RV64 driver to boot to UEFI Shell

 UefiPayloadPkg/UefiPayloadPkg.dsc                              |   2 +-
 UefiPayloadPkg/{UefiPayloadPkg.dsc => UefiPayloadPkgRV64.dsc}  | 448 +++-----------
 UefiPayloadPkg/UefiPayloadPkgRV64.fdf                          | 325 ++++++++++
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf      |  12 +-
 UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c             |   9 +
 UefiPayloadPkg/UefiPayloadEntry/Ia32/Ia32FdtParserLib.c        |  33 ++
 UefiPayloadPkg/UefiPayloadEntry/{X64 => RiscV64}/DxeLoadFunc.c |  62 +-
 UefiPayloadPkg/UefiPayloadEntry/RiscV64/Rv64FdtParserLib.c     | 625 ++++++++++++++++++++
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c        |  29 +-
 UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c              |   9 +
 UefiPayloadPkg/UefiPayloadEntry/X64/X64FdtParserLib.c          |  33 ++
 11 files changed, 1166 insertions(+), 421 deletions(-)
 copy UefiPayloadPkg/{UefiPayloadPkg.dsc => UefiPayloadPkgRV64.dsc} (63%)
 create mode 100644 UefiPayloadPkg/UefiPayloadPkgRV64.fdf
 create mode 100644 UefiPayloadPkg/UefiPayloadEntry/Ia32/Ia32FdtParserLib.c
 copy UefiPayloadPkg/UefiPayloadEntry/{X64 => RiscV64}/DxeLoadFunc.c (51%)
 create mode 100644 UefiPayloadPkg/UefiPayloadEntry/RiscV64/Rv64FdtParserLib.c
 create mode 100644 UefiPayloadPkg/UefiPayloadEntry/X64/X64FdtParserLib.c

-- 
2.34.1


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

* [PATCH v1 1/8] UefiPayloadPkg: Remove FP Init from UPL entry
  2023-05-11  7:08 DRAFT: [PATCH v1 0/8] RiscV64 Support In UPL Dhaval Sharma
@ 2023-05-11  7:08 ` Dhaval Sharma
  2023-05-11  9:19   ` Guo, Gua
  0 siblings, 1 reply; 4+ messages in thread
From: Dhaval Sharma @ 2023-05-11  7:08 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@...>
Reviewed-by: James Lu <james.lu@...>
---

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 61a9f01ec9e7..921a38555e21 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 f8939efe70db..8aff00142971 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
@@ -473,9 +473,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.34.1


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

* DRAFT: [PATCH v1 0/8] RiscV64 Support In UPL
@ 2023-05-11  7:12 Dhaval Sharma
  0 siblings, 0 replies; 4+ messages in thread
From: Dhaval Sharma @ 2023-05-11  7:12 UTC (permalink / raw)
  To: devel

This patchset contains modifications required in UPL boot flow to
enable RiscV64 support. Squashing earlier series of patches
related to arch specific removal from UPL boot path to this release such
that all chnages can be viewed in the entirety.
1. Add required infra to support RiscV64
2. New UPL proposal supports multiple Archs and accordingly ABI
   is also different. This is a proposal to accomodate these changes.
   This patch adds a hook to parse RiscV64 specific IN params and extract
   FDT from the same.
3. Take FDT received from BL and parse it to create required HOBs that
   are later consumed by UPL.
4. Add FirmwareContext structure which is specific to RV and used by RV
   CPU driver.
5. Add required modifications to extrace DxeFv from overall UPL FD.
6. Add required RV drivers to boot to UEFI Shell

P.S. This patch is review only at this point as it is tested in a limited
fashion for RV to get to early debug logs from FDT described serial device.
It will require modifications to work on other Archs.

Branch https://github.com/rivosinc/edk2/tree/upl-rv64-enable-compilation-v1

Dhaval Sharma (8):
  UefiPayloadPkg: Remove FP Init from UPL entry
  UefiPayloadPkg: Move INT prog outside common flow
  UefiPayloadPkg: Basic Infra To Enable RV64 UPL Support
  UefiPayloadPkg: Update input params as per latest UPL spec
  UefiPayloadPkg: Hook to parse IN params as per UPL spec
  UefiPayloadPkg: Add FirmwareContext for RV64
  UefiPayloadPkg: Find DxeFV and create required FV HOB
  UefiPayloadPkg: Add RV64 driver to boot to UEFI Shell

 UefiPayloadPkg/UefiPayloadPkg.dsc                              |   2 +-
 UefiPayloadPkg/{UefiPayloadPkg.dsc => UefiPayloadPkgRV64.dsc}  | 448 +++-----------
 UefiPayloadPkg/UefiPayloadPkgRV64.fdf                          | 325 ++++++++++
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf      |  12 +-
 UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c             |   9 +
 UefiPayloadPkg/UefiPayloadEntry/Ia32/Ia32FdtParserLib.c        |  33 ++
 UefiPayloadPkg/UefiPayloadEntry/{X64 => RiscV64}/DxeLoadFunc.c |  62 +-
 UefiPayloadPkg/UefiPayloadEntry/RiscV64/Rv64FdtParserLib.c     | 625 ++++++++++++++++++++
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c        |  29 +-
 UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c              |   9 +
 UefiPayloadPkg/UefiPayloadEntry/X64/X64FdtParserLib.c          |  33 ++
 11 files changed, 1166 insertions(+), 421 deletions(-)
 copy UefiPayloadPkg/{UefiPayloadPkg.dsc => UefiPayloadPkgRV64.dsc} (63%)
 create mode 100644 UefiPayloadPkg/UefiPayloadPkgRV64.fdf
 create mode 100644 UefiPayloadPkg/UefiPayloadEntry/Ia32/Ia32FdtParserLib.c
 copy UefiPayloadPkg/UefiPayloadEntry/{X64 => RiscV64}/DxeLoadFunc.c (51%)
 create mode 100644 UefiPayloadPkg/UefiPayloadEntry/RiscV64/Rv64FdtParserLib.c
 create mode 100644 UefiPayloadPkg/UefiPayloadEntry/X64/X64FdtParserLib.c

-- 
2.34.1


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

* Re: [PATCH v1 1/8] UefiPayloadPkg: Remove FP Init from UPL entry
  2023-05-11  7:08 ` [PATCH v1 1/8] UefiPayloadPkg: Remove FP Init from UPL entry Dhaval Sharma
@ 2023-05-11  9:19   ` Guo, Gua
  0 siblings, 0 replies; 4+ messages in thread
From: Guo, Gua @ 2023-05-11  9:19 UTC (permalink / raw)
  To: Dhaval Sharma, devel@edk2.groups.io
  Cc: Dong, Guo, Ni, Ray, Rhodes, Sean, Lu, James

@Dhaval Sharma I give some feedbacks on the PR.
URL: https://github.com/tianocore/edk2/pull/4367
I think we can discuss it on the PR. And currently Edk2 code freeze so the change need to hold on until UPL spec 1.0 publish and Edk2 code freeze unlock (2023/05/26).

Thanks,
Gua

-----Original Message-----
From: Dhaval Sharma <dhaval@rivosinc.com> 
Sent: Thursday, May 11, 2023 3:09 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: [PATCH v1 1/8] 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@...>
Reviewed-by: James Lu <james.lu@...>
---

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 61a9f01ec9e7..921a38555e21 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 f8939efe70db..8aff00142971 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
@@ -473,9 +473,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.34.1


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

end of thread, other threads:[~2023-05-11  9:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-11  7:08 DRAFT: [PATCH v1 0/8] RiscV64 Support In UPL Dhaval Sharma
2023-05-11  7:08 ` [PATCH v1 1/8] UefiPayloadPkg: Remove FP Init from UPL entry Dhaval Sharma
2023-05-11  9:19   ` Guo, Gua
  -- strict thread matches above, loose matches on Subject: below --
2023-05-11  7:12 DRAFT: [PATCH v1 0/8] RiscV64 Support In UPL Dhaval Sharma

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