On 8/31/20 9:01 PM, Ard Biesheuvel wrote:
On Mon, 31 Aug 2020 at 19:37, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Closes: #52
The no-map property of the /reserved-memory DT node is used by Linux to signal that a memory region shall not be mapped and that speculative access shall not be permitted.
The memory map returned by GetMemoryMap() does not have a flag corresponding to no-map. So the closest thing we can do is not to include no-map reserved memory into the map returned by GetMemoryMap().
Dear Ard,
thanks for reviewing.
This violates the UEFI spec, which stipulates that the memory map describes all memory, no matter how it is used. It also interferes with the heuristics we use in Linux to decide which memory attributes to use when the code gets mapped explicitly (i.e., by a driver), which is permitted in the context of the /reserved-memory node (the no-map attribute applies to the linear map, but the region may still be mapped for other reasons). Note that an omitted region cannot carry EFI_MEMORY_WC/WT/WB attributes either.
Do you have an example of a no-map /reserved-memory node used in Linux?
So a better approach would be to mandate that these regions are listed in the EFI memory map as EFI reserved regions, with appropriate memory attributes. (Note that on ARM, regions that are really memory rather than MMIO registers, and that are expected to be used with unaligned accesses and/or DC ZVA instructions must be mapped as memory, and so the default of EFI_MEMORY_UC is not appropriate)
It is unclear to me which memory attributes you regard as appropriate.
Best regards
Heinrich
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
source/chapter2-uefi.rst | 4 ++++ source/references.rst | 4 ++++ 2 files changed, 8 insertions(+)
diff --git a/source/chapter2-uefi.rst b/source/chapter2-uefi.rst index 2add2de..1e57164 100644 --- a/source/chapter2-uefi.rst +++ b/source/chapter2-uefi.rst @@ -74,6 +74,10 @@ that virtual addresses must equal physical addresses.
The default RAM allocated attribute must be EFI_MEMORY_WB.
+Reserved memory with property no-map [RESMEM]_ in the /reserved-memory +device-tree node shall not be included in the memory map returned by +GetMemoryMap().
Configuration Tables
diff --git a/source/references.rst b/source/references.rst index 1eb0509..2434137 100644 --- a/source/references.rst +++ b/source/references.rst @@ -16,6 +16,10 @@ https://static.docs.arm.com/den0022/c/DEN0022C_Power_State_Coordination_Interface.pdf`_ 30 January 2015, `Arm Limited http://arm.com`_
+.. [RESMEM] `Reserved memory regions
- https://www.kernel.org/doc/Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt`_,
- 21 July 2020, Linux kernel
.. [SBBR] `Arm Server Base Boot Requirements specification Issue B (v1.0) https://static.docs.arm.com/den0044/b/DEN0044B_Server_Base_Boot_Requirements.pdf`_ 8 March 2016, `Arm Limited http://arm.com`_ -- 2.28.0
boot-architecture mailing list boot-architecture@lists.linaro.org https://lists.linaro.org/mailman/listinfo/boot-architecture