linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: Use swapper_pg_dir instead of init_mm->pgd
@ 2022-10-09 17:31 Christophe Leroy
  2024-03-16 11:55 ` Christophe Leroy
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe Leroy @ 2022-10-09 17:31 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin; +Cc: linuxppc-dev, linux-kernel

init_mm->pgd is always swapper_pg_dir[] which is known
at build time.

Directly use the later instead of loading it from init_mm
struct at every time.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/include/asm/pgtable.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index 283f40d05a4d..f6843e6294d9 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -48,6 +48,9 @@ struct mm_struct;
 /* Keep these as a macros to avoid include dependency mess */
 #define pte_page(x)		pfn_to_page(pte_pfn(x))
 #define mk_pte(page, pgprot)	pfn_pte(page_to_pfn(page), (pgprot))
+
+#define pgd_offset_k(address)		pgd_offset_pgd(swapper_pg_dir, (address))
+
 /*
  * Select all bits except the pfn
  */
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] powerpc: Use swapper_pg_dir instead of init_mm->pgd
  2022-10-09 17:31 [PATCH] powerpc: Use swapper_pg_dir instead of init_mm->pgd Christophe Leroy
@ 2024-03-16 11:55 ` Christophe Leroy
  0 siblings, 0 replies; 2+ messages in thread
From: Christophe Leroy @ 2024-03-16 11:55 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin; +Cc: linuxppc-dev, linux-kernel



Le 09/10/2022 à 19:31, Christophe Leroy a écrit :
> init_mm->pgd is always swapper_pg_dir[] which is known
> at build time.
> 
> Directly use the later instead of loading it from init_mm
> struct at every time.
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>

Dropping this patch after feedback from Michael:

no other arches do it. (swapper_pg_dir)

It would also make us the only arch other than ia64 (which is old and
probably going to get removed soon) defining pgd_offset_k().


> ---
>   arch/powerpc/include/asm/pgtable.h | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
> index 283f40d05a4d..f6843e6294d9 100644
> --- a/arch/powerpc/include/asm/pgtable.h
> +++ b/arch/powerpc/include/asm/pgtable.h
> @@ -48,6 +48,9 @@ struct mm_struct;
>   /* Keep these as a macros to avoid include dependency mess */
>   #define pte_page(x)		pfn_to_page(pte_pfn(x))
>   #define mk_pte(page, pgprot)	pfn_pte(page_to_pfn(page), (pgprot))
> +
> +#define pgd_offset_k(address)		pgd_offset_pgd(swapper_pg_dir, (address))
> +
>   /*
>    * Select all bits except the pfn
>    */

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-16 11:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-09 17:31 [PATCH] powerpc: Use swapper_pg_dir instead of init_mm->pgd Christophe Leroy
2024-03-16 11:55 ` Christophe Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).