intel / FdtBusPkg

Device Tree-based Platform Device Driver Development for Tiano UEFI
https://wiki.riseproject.dev/display/HOME/EDK2_00_03+-+FdtBusDxe+support
11 stars 1 forks source link

Upstream tech debt: HighMemDxe is not actually needed in OVMF RISC-V #80

Open andreiw opened 7 months ago

andreiw commented 7 months ago

The RISC-V Sec code processes all the "memory" devices in Memory.c, so HighMemDxe code does absolutely nothing.

To test HighMemDxe, this is what I do:

--- a/OvmfPkg/RiscVVirt/Sec/Memory.c
+++ b/OvmfPkg/RiscVVirt/Sec/Memory.c
@@ -253,6 +253,7 @@ MemoryPeimInitialization (
   INT32                       Node, Prev;
   INT32                       Len;
   VOID                        *FdtPointer;
+  BOOLEAN                     Once = TRUE;

   FirmwareContext = NULL;
   GetFirmwareContextPointer (&FirmwareContext);
@@ -285,18 +286,21 @@ MemoryPeimInitialization (
         CurBase = fdt64_to_cpu (ReadUnaligned64 (RegProp));
         CurSize = fdt64_to_cpu (ReadUnaligned64 (RegProp + 1));

-        DEBUG ((
-          DEBUG_INFO,
-          "%a: System RAM @ 0x%lx - 0x%lx\n",
-          __func__,
-          CurBase,
-          CurBase + CurSize - 1
-          ));
+        if (Once) {
+          DEBUG ((
+            DEBUG_INFO,
+            "%a: System RAM @ 0x%lx - 0x%lx\n",
+            __func__,
+            CurBase,
+            CurBase + CurSize - 1
+            ));

-        InitializeRamRegions (
-          CurBase,
-          CurSize
-          );
+          InitializeRamRegions (
+            CurBase,
+            CurSize
+            );
+          Once = FALSE;
+        }
       } else {
         DEBUG ((
           DEBUG_ERROR,
andreiw commented 6 months ago

https://github.com/intel/FdtBusPkg/blob/main/Docs/ovmf-patches/0001-OvmfPkg-RiscVVirt-change-for-testing-HighMemDxe.patch