From 2c3523e421ceb84cddc6c8b6026ecf0ff6b5a984 Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Wed, 8 Jul 2020 21:34:02 -0700 Subject: [PATCH] mmu: add virtual memory Kconfigs Specify the virtual address range for kernel mappings. Signed-off-by: Andrew Boie --- arch/Kconfig | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/arch/Kconfig b/arch/Kconfig index d473262e5c..a2d3ac5154 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -519,6 +519,45 @@ config SRAM_REGION_PERMISSIONS If not enabled, all SRAM mappings will allow supervisor mode to read, write, and execute. User mode support requires this. +config KERNEL_VM_BASE + hex "Base virtual address for the kernel" + depends on MMU + default 0xFFFF800000000000 if 64BIT + default 0xC0000000 + help + Define the base virtual memory address for the core kernel. There will + be a permemant mapping of all RAM starting at this virtual address, + with any unused space up to the KERNEL_VM_LIMIT available for memory + mappings. This denotes the start of the RAM mapping and may not be + the base address of the kernel itself, but the offset of the kernel here + will be the same as the offset from the beginning of physical memory + where it was loaded. + + The value here must have similar alignment to the base physical address, + such that the same page tables can be mapped to the top-level paging + structure entries for the virtual and physical address. + + It is valid to set this to SRAM_BASE_ADDRESS, in which case RAM will + be identity-mapped. Otherwise, the SRAM and KERNEL_VM regions must + not overlap. + + The default for 64-bit presumes a 48-bit canonical address space. + +config KERNEL_VM_LIMIT + hex "Upper bound on kernel address space" + depends on MMU + default 0xFFFFFFFFFFFFFFFF if 64BIT + default 0xFFFFFFFF + help + Inclusive upper bound on the virtual memory area reserved for the kernel. + No mappings will be made past this point. Constraining this helps control + how much memory is used for page tables. + + The area defined by KERNEL_VM_BASE to KERNEL_VM_LIMIT must have enough + room to map system RAM, plus any driver mappings. Further mappings + may be made at runtime depending on configuration options (such as + memory-mapping stacks, VDSO pages, etc). + config MEMORY_PROTECTION bool help