OpenSBI now marks PMP regions with "no-map" attribute.
So, remove the workaround and add the ReservedMemory only
when no-map is set so that it follows DT spec.

Cc: Ard Biesheuvel <ardb+tianoc...@kernel.org>
Cc: Jiewen Yao <jiewen....@intel.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Cc: Gerd Hoffmann <kra...@redhat.com>
Cc: Andrei Warkentin <andrei.warken...@intel.com>

Signed-off-by: Sunil V L <suni...@ventanamicro.com>
---
 OvmfPkg/RiscVVirt/Sec/Memory.c | 34 +++++++++++++---------------------
 1 file changed, 13 insertions(+), 21 deletions(-)

diff --git a/OvmfPkg/RiscVVirt/Sec/Memory.c b/OvmfPkg/RiscVVirt/Sec/Memory.c
index aad71ee5dcbb..164b33cd258f 100644
--- a/OvmfPkg/RiscVVirt/Sec/Memory.c
+++ b/OvmfPkg/RiscVVirt/Sec/Memory.c
@@ -141,22 +141,6 @@ GetNumCells (
 
 /** Mark reserved memory ranges in the EFI memory map
 
-  The M-mode firmware ranges should not be used by the
-  EDK2/OS. These ranges are passed via device tree using reserved
-  memory nodes. Parse the DT and mark those ranges as of
-  type EfiReservedMemoryType.
-
-  NOTE: Device Tree spec section 3.5.4 says reserved memory regions
-  without no-map property should be installed as EfiBootServicesData.
-  As per UEFI spec, memory of type EfiBootServicesData can be used
-  by the OS after ExitBootServices().
-  This is not an issue for DT since OS can parse the DT also along
-  with EFI memory map and avoid using these ranges. But with ACPI,
-  there is no such mechanisms possible.
-  Since EDK2 needs to support both DT and ACPI, we are deviating
-  from the DT spec and marking all reserved memory ranges as
-  EfiReservedMemoryType itself irrespective of no-map.
-
   @param FdtPointer Pointer to FDT
 
 **/
@@ -228,11 +212,19 @@ AddReservedMemoryMap (
           Size
           ));
 
-        BuildMemoryAllocationHob (
-          Addr,
-          Size,
-          EfiReservedMemoryType
-          );
+        if (fdt_getprop (FdtPointer, SubNode, "no-map", &Len)) {
+          BuildMemoryAllocationHob (
+            Addr,
+            Size,
+            EfiReservedMemoryType
+            );
+        } else {
+          BuildMemoryAllocationHob (
+            Addr,
+            Size,
+            EfiBootServicesData
+            );
+        }
       }
     }
   }
-- 
2.39.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106969): https://edk2.groups.io/g/devel/message/106969
Mute This Topic: https://groups.io/mt/100198972/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to