diff options
author | Sunil V L <sunilvl@ventanamicro.com> | 2023-07-17 14:21:15 +0530 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-07-21 05:56:55 +0000 |
commit | 7427dd3fc0288a96704b4f98336d7f3ad0cd52ac (patch) | |
tree | f66c66d2f20032bea6963d840285190c3bd15715 | |
parent | c6b512962e92ae54a895bdfd2147abaf2c9e3e22 (diff) | |
download | edk2-7427dd3fc0288a96704b4f98336d7f3ad0cd52ac.tar.gz edk2-7427dd3fc0288a96704b4f98336d7f3ad0cd52ac.tar.bz2 edk2-7427dd3fc0288a96704b4f98336d7f3ad0cd52ac.zip |
OvmfPkg/RiscVVirt: Check "no-map" and mark EfiReservedMemoryType
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+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Andrei Warkentin <andrei.warkentin@intel.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Ranbir Singh <rsingh@ventanamicro.com>
-rw-r--r-- | OvmfPkg/RiscVVirt/Sec/Memory.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/OvmfPkg/RiscVVirt/Sec/Memory.c b/OvmfPkg/RiscVVirt/Sec/Memory.c index aad71ee5dc..7c6d920bd2 100644 --- a/OvmfPkg/RiscVVirt/Sec/Memory.c +++ b/OvmfPkg/RiscVVirt/Sec/Memory.c @@ -141,21 +141,10 @@ 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.
+ * As per DT spec v0.4 Section 3.5.4,
+ * "Reserved regions with the no-map property must be listed in the
+ * memory map with type EfiReservedMemoryType. All other reserved
+ * regions must be listed with type EfiBootServicesData."
@param FdtPointer Pointer to FDT
@@ -228,11 +217,19 @@ AddReservedMemoryMap ( Size
));
- BuildMemoryAllocationHob (
- Addr,
- Size,
- EfiReservedMemoryType
- );
+ if (fdt_getprop (FdtPointer, SubNode, "no-map", &Len)) {
+ BuildMemoryAllocationHob (
+ Addr,
+ Size,
+ EfiReservedMemoryType
+ );
+ } else {
+ BuildMemoryAllocationHob (
+ Addr,
+ Size,
+ EfiBootServicesData
+ );
+ }
}
}
}
|