mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 20:50:53 +07:00
xtensa: handle memmap kernel option
This option is useful for reserving memory regions for secondary cores in AMP configurations. Implement the following memmap variants: - memmap=nn[KMG]@ss[KMG]: force usage of a specific region of memory; - memmap=nn[KMG]$ss[KMG]: mark specified memory as reserved; - memmap=nn[KMG]: set end of memory. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
This commit is contained in:
parent
6232791833
commit
06bd2824f7
@ -507,6 +507,7 @@ void __init setup_arch(char **cmdline_p)
|
||||
__pa(&_Level6InterruptVector_text_end), 0);
|
||||
#endif
|
||||
|
||||
parse_early_param();
|
||||
bootmem_init();
|
||||
|
||||
unflatten_and_copy_device_tree();
|
||||
|
@ -332,3 +332,53 @@ void free_initmem(void)
|
||||
{
|
||||
free_initmem_default(-1);
|
||||
}
|
||||
|
||||
static void __init parse_memmap_one(char *p)
|
||||
{
|
||||
char *oldp;
|
||||
unsigned long start_at, mem_size;
|
||||
|
||||
if (!p)
|
||||
return;
|
||||
|
||||
oldp = p;
|
||||
mem_size = memparse(p, &p);
|
||||
if (p == oldp)
|
||||
return;
|
||||
|
||||
switch (*p) {
|
||||
case '@':
|
||||
start_at = memparse(p + 1, &p);
|
||||
add_sysmem_bank(start_at, start_at + mem_size);
|
||||
break;
|
||||
|
||||
case '$':
|
||||
start_at = memparse(p + 1, &p);
|
||||
mem_reserve(start_at, start_at + mem_size, 0);
|
||||
break;
|
||||
|
||||
case 0:
|
||||
mem_reserve(mem_size, 0, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
pr_warn("Unrecognized memmap syntax: %s\n", p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int __init parse_memmap_opt(char *str)
|
||||
{
|
||||
while (str) {
|
||||
char *k = strchr(str, ',');
|
||||
|
||||
if (k)
|
||||
*k++ = 0;
|
||||
|
||||
parse_memmap_one(str);
|
||||
str = k;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
early_param("memmap", parse_memmap_opt);
|
||||
|
Loading…
Reference in New Issue
Block a user