lkml.org 
[lkml]   [2020]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] parisc: fix map_pages() to actually populate upper directory
> The commit d96885e277b5 ("parisc: use pgtable-nopXd instead of
> 4level-fixup") converted PA-RISC to use folded page tables, but it missed
> the conversion of pgd_populate() to pud_populate() in maps_pages()
> function. This caused the upper page table directory to remain empty and
> the system would crash as a result.
>
> Using pud_populate() that actually populates the page table instead of
> dummy pgd_populate() fixes the issue.
> ...
> diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
> index ddca8287d43b..354cf060b67f 100644
> --- a/arch/parisc/mm/init.c
> +++ b/arch/parisc/mm/init.c
> @@ -401,7 +401,7 @@ static void __init map_pages(unsigned long start_vaddr,
> pmd = (pmd_t *) __pa(pmd);
> }
>
> - pgd_populate(NULL, pg_dir, __va(pmd));
> + pud_populate(NULL, (pud_t *)pg_dir, __va(pmd));
> #endif

Wouldn't the untested patch below be more clean?

Helge

diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index ddca8287d43b..73de58f31f5f 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -387,6 +387,8 @@ static void __init map_pages(unsigned long start_vaddr,
#if PTRS_PER_PMD == 1
pmd = (pmd_t *)__pa(pg_dir);
#else
+ p4d_t *p4d;
+ pud_t *pud;
pmd = (pmd_t *)pgd_address(*pg_dir);

/*
@@ -401,7 +403,9 @@ static void __init map_pages(unsigned long start_vaddr,
pmd = (pmd_t *) __pa(pmd);
}

- pgd_populate(NULL, pg_dir, __va(pmd));
+ p4d = p4d_offset(pg_dir, vaddr);
+ pud = pud_offset(p4d, vaddr);
+ pud_populate(NULL, pud, __va(pmd));
#endif
pg_dir++;
\
 
 \ /
  Last update: 2020-01-09 07:52    [W:0.049 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site