Commit fb6d5c1d authored by Qing Zhang's avatar Qing Zhang Committed by Huacai Chen

kasan: Add (pmd|pud)_init for LoongArch zero_(pud|p4d)_populate process

LoongArch populates pmd/pud with invalid_pmd_table/invalid_pud_table in
pagetable_init, So pmd_init/pud_init(p) is required, define them as __weak
in mm/kasan/init.c, like mm/sparse-vmemmap.c.
Reviewed-by: default avatarAndrey Konovalov <andreyknvl@gmail.com>
Signed-off-by: default avatarQing Zhang <zhangqing@loongson.cn>
Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
parent 9b04c764
...@@ -139,6 +139,10 @@ static int __ref zero_pmd_populate(pud_t *pud, unsigned long addr, ...@@ -139,6 +139,10 @@ static int __ref zero_pmd_populate(pud_t *pud, unsigned long addr,
return 0; return 0;
} }
void __weak __meminit pmd_init(void *addr)
{
}
static int __ref zero_pud_populate(p4d_t *p4d, unsigned long addr, static int __ref zero_pud_populate(p4d_t *p4d, unsigned long addr,
unsigned long end) unsigned long end)
{ {
...@@ -166,8 +170,9 @@ static int __ref zero_pud_populate(p4d_t *p4d, unsigned long addr, ...@@ -166,8 +170,9 @@ static int __ref zero_pud_populate(p4d_t *p4d, unsigned long addr,
if (!p) if (!p)
return -ENOMEM; return -ENOMEM;
} else { } else {
pud_populate(&init_mm, pud, p = early_alloc(PAGE_SIZE, NUMA_NO_NODE);
early_alloc(PAGE_SIZE, NUMA_NO_NODE)); pmd_init(p);
pud_populate(&init_mm, pud, p);
} }
} }
zero_pmd_populate(pud, addr, next); zero_pmd_populate(pud, addr, next);
...@@ -176,6 +181,10 @@ static int __ref zero_pud_populate(p4d_t *p4d, unsigned long addr, ...@@ -176,6 +181,10 @@ static int __ref zero_pud_populate(p4d_t *p4d, unsigned long addr,
return 0; return 0;
} }
void __weak __meminit pud_init(void *addr)
{
}
static int __ref zero_p4d_populate(pgd_t *pgd, unsigned long addr, static int __ref zero_p4d_populate(pgd_t *pgd, unsigned long addr,
unsigned long end) unsigned long end)
{ {
...@@ -207,8 +216,9 @@ static int __ref zero_p4d_populate(pgd_t *pgd, unsigned long addr, ...@@ -207,8 +216,9 @@ static int __ref zero_p4d_populate(pgd_t *pgd, unsigned long addr,
if (!p) if (!p)
return -ENOMEM; return -ENOMEM;
} else { } else {
p4d_populate(&init_mm, p4d, p = early_alloc(PAGE_SIZE, NUMA_NO_NODE);
early_alloc(PAGE_SIZE, NUMA_NO_NODE)); pud_init(p);
p4d_populate(&init_mm, p4d, p);
} }
} }
zero_pud_populate(p4d, addr, next); zero_pud_populate(p4d, addr, next);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment