riscv: Add support for mem=
PATCH 1/1 riscv: Add support for mem=
From: Jan Kiszka <[email protected]>
This sets a memory limit provided via mem= on the command line, analogously to many other architectures.
Signed-off-by Jan Kiszka <[email protected]>
--- arch/riscv/mm/init.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
arch/riscv/mm/init.c +18 -0
@@ -488,8 +488,26 @@ static inline void setup_vm_final(void) }#endif /* CONFIG_MMU */ +static phys_addr_t memory_limit =PHYS_ADDR_MAX ; + +/* +* Limit the memory size that was specified via FDT. +*/ +static int __init early_mem (char *p) +{ +if (!p) +return 1 ; + + memory_limit =memparse (p, &p) &PAGE_MASK ; +pr_notice ("Memory limited to %lldMB\n" , memory_limit >>20 ); + +return 0 ; +} +early_param ("mem" , early_mem); +void __init paging_init (void ) { +memblock_enforce_memory_limit (memory_limit);setup_vm_final ();memblocks_present ();sparse_init ();
Signature · 6 lines
2.16.4 -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux