On 2022/1/14 17:16, Zhuling wrote:
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4O31I?from=project-issue CVE: NA
Add "!" in memmap parameter, use memmap(memmap=nn[KMG]!ss[KMG]) reserve memory for pmem which register persistent memory in arm64.
Signed-off-by: Zhuling zhuling8@huawei.com
Documentation/admin-guide/kernel-parameters.txt | 9 +++++++-- arch/arm64/mm/init.c | 8 ++++++++ 2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 64be32b..1953570 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -2829,10 +2829,15 @@ will be eaten.
memmap=nn[KMG]!ss[KMG]
[KNL,X86] Mark specific memory as protected.
[KNL,X86,ARM64] Mark specific memory as protected. Region of memory to be used, from ss to ss+nn.
The memory region may be marked as e820 type 12 (0xc)
[X86]The memory region may be marked as e820 type 12 (0xc) and is NVDIMM or ADR memory.
[ARM64]Reserve memory for persistent storage when the kernel
restart or update. the data in PMEM will not be lost and can
be loaded faster
Example:
memmap=100K!0x1a0000000
说明只支持1个,不支持多个配置
memmap=<size>%<offset>-<oldtype>+<newtype> [KNL,ACPI] Convert memory within the specified region diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 6ebfabd..b9eb312 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -56,6 +56,8 @@ s64 memstart_addr __ro_after_init = -1; EXPORT_SYMBOL(memstart_addr);
+phys_addr_t start_at, mem_size;
为什么要加这个;全局的会覆盖函数内的声明;
- #ifdef CONFIG_PIN_MEMORY struct resource pin_memory_resource = { .name = "Pin memory",
@@ -111,6 +113,8 @@ static void __init reserve_pin_memory_res(void) */ phys_addr_t arm64_dma_phys_limit __ro_after_init;
+static unsigned long long pmem_size, pmem_start;
可以用u64
- #ifndef CONFIG_KEXEC_CORE static void __init reserve_crashkernel(void) {
@@ -442,6 +446,10 @@ static int __init parse_memmap_one(char *p) start_at = memparse(p + 1, &p); memblock_reserve(start_at, mem_size); memblock_mark_memmap(start_at, mem_size);
- } else if (*p == '!') {
start_at = memparse(p+1, &p);
pmem_start = start_at;
} else pr_info("Unrecognized memmap option, please check the parameter.\n");pmem_size = mem_size;