feat(mm): add check on address width before mapping a page
NWd and SWd can be configured with different PA ranges.
Currently Hafnium have hardcoded a 39-bit address space.
It is possible that the NWd wants to share a buffer with the SWd in an
address range beyond SWd PA limit.
In theory this should be safely handled by the architecture, that
expects:
- an address size fault if the OA of a translation is wider
than the configured TCR_ELx.{I}PS;
- a translation fault if the IA is wider of the TCR_ELx.TnSZ
Nevertheless the debug of such failure would be tricky, hence adding a
check on the address width of each page before it's mapped should
prevent it.
Change-Id: I53d99eb099c91ff349c0e08aa1e3601b78154ffe
Signed-off-by: Federico Recanati <federico.recanati@arm.com>
diff --git a/inc/hf/arch/mm.h b/inc/hf/arch/mm.h
index ef64dd3..b629e8b 100644
--- a/inc/hf/arch/mm.h
+++ b/inc/hf/arch/mm.h
@@ -174,3 +174,8 @@
* by a given architecture, after page table writes.
*/
void arch_mm_sync_table_writes(void);
+
+/**
+ * Returns the maximum supported PA Range in bits.
+ */
+uint32_t arch_mm_get_pa_range(void);