summaryrefslogtreecommitdiff
path: root/include/cpu_func.h
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2025-03-14 09:31:36 -0600
committerTom Rini <trini@konsulko.com>2025-03-14 09:31:36 -0600
commit973c366ce68d9a99e16bcbce3941a1c52492c097 (patch)
tree4551686cc38c7e419c833ebfeaf6bd6843124691 /include/cpu_func.h
parentbbfabe290138d76e78e0dac28fec93c32e3964eb (diff)
parentfb553201b67aededdc794f3a0880e386771cbd58 (diff)
Merge tag 'mmu-next-14032025' of https://source.denx.de/u-boot/custodians/u-boot-tpm into next
Up to now we configure the entire memory space for U-Boot as RWX. For modern architectures and security requirements, it's better to map the memory properly. This pull request adds basics support for mapping the U-Boot binary with proper (RO, RW, RW^X) memory permissions on aarch64 right after we relocate U-Boot in the top of DRAM. It's worrth noting that the linker script annotations are only added for the aarch64 architecture. We can, in the future, try to unify the linker -- at least for the architectures that have enough in common and expand this
Diffstat (limited to 'include/cpu_func.h')
-rw-r--r--include/cpu_func.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/cpu_func.h b/include/cpu_func.h
index 7e81c4364a7..70a41ead3f7 100644
--- a/include/cpu_func.h
+++ b/include/cpu_func.h
@@ -69,6 +69,23 @@ void flush_dcache_range(unsigned long start, unsigned long stop);
void invalidate_dcache_range(unsigned long start, unsigned long stop);
void invalidate_dcache_all(void);
void invalidate_icache_all(void);
+
+enum pgprot_attrs {
+ MMU_ATTR_RO,
+ MMU_ATTR_RX,
+ MMU_ATTR_RW,
+};
+
+/** pgprot_set_attrs() - Set page table permissions
+ *
+ * @addr: Physical address start
+ * @size: size of memory to change
+ * @perm: New permissions
+ *
+ * Return: 0 on success, error otherwise.
+ **/
+int pgprot_set_attrs(phys_addr_t addr, size_t size, enum pgprot_attrs perm);
+
/**
* noncached_init() - Initialize non-cached memory region
*