[PATCH v3 1/6] powerpc/nohash: Refactor update of BDI2000 pointers in switch_mmu_context()

2021-06-03 Thread Christophe Leroy
Instead of duplicating the update of BDI2000 pointers in
set_context(), do it directly from switch_mmu_context().

Signed-off-by: Christophe Leroy 
---
v3: Do it only for nohash platforms, book3s/32 will have its own as part of 
converting switch_mmu_context() to C.
---
 arch/powerpc/kernel/head_40x.S   | 14 --
 arch/powerpc/kernel/head_44x.S   | 16 
 arch/powerpc/kernel/head_8xx.S   |  7 ---
 arch/powerpc/kernel/head_book3s_32.S |  6 --
 arch/powerpc/kernel/head_fsl_booke.S | 16 
 arch/powerpc/mm/nohash/8xx.c |  6 --
 arch/powerpc/mm/nohash/mmu_context.c |  8 
 arch/powerpc/mm/nohash/tlb_low.S |  8 
 8 files changed, 8 insertions(+), 73 deletions(-)

diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S
index e1360b88b6cb..7ef1bbc23bed 100644
--- a/arch/powerpc/kernel/head_40x.S
+++ b/arch/powerpc/kernel/head_40x.S
@@ -703,14 +703,6 @@ _GLOBAL(abort)
 mtspr   SPRN_DBCR0,r13
 
 _GLOBAL(set_context)
-
-#ifdef CONFIG_BDI_SWITCH
-   /* Context switch the PTE pointer for the Abatron BDI2000.
-* The PGDIR is the second parameter.
-*/
-   lis r5, abatron_pteptrs@ha
-   stw r4, abatron_pteptrs@l + 0x4(r5)
-#endif
sync
mtspr   SPRN_PID,r3
isync   /* Need an isync to flush shadow */
@@ -731,9 +723,3 @@ EXPORT_SYMBOL(empty_zero_page)
.globl  swapper_pg_dir
 swapper_pg_dir:
.space  PGD_TABLE_SIZE
-
-/* Room for two PTE pointers, usually the kernel and current user pointers
- * to their respective root page table.
- */
-abatron_pteptrs:
-   .space  8
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index 5c106ac36626..57509d90e409 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -781,15 +781,6 @@ _GLOBAL(__fixup_440A_mcheck)
blr
 
 _GLOBAL(set_context)
-
-#ifdef CONFIG_BDI_SWITCH
-   /* Context switch the PTE pointer for the Abatron BDI2000.
-* The PGDIR is the second parameter.
-*/
-   lis r5, abatron_pteptrs@h
-   ori r5, r5, abatron_pteptrs@l
-   stw r4, 0x4(r5)
-#endif
mtspr   SPRN_PID,r3
isync   /* Force context change */
blr
@@ -1259,13 +1250,6 @@ EXPORT_SYMBOL(empty_zero_page)
 swapper_pg_dir:
.space  PGD_TABLE_SIZE
 
-/*
- * Room for two PTE pointers, usually the kernel and current user pointers
- * to their respective root page table.
- */
-abatron_pteptrs:
-   .space  8
-
 #ifdef CONFIG_SMP
.align  12
 temp_boot_stack:
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index 7d445e4342c0..817df9fe7fb3 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -804,10 +804,3 @@ EXPORT_SYMBOL(empty_zero_page)
.globl  swapper_pg_dir
 swapper_pg_dir:
.space  PGD_TABLE_SIZE
-
-/* Room for two PTE table pointers, usually the kernel and current user
- * pointer to their respective root page table (pgdir).
- */
-   .globl  abatron_pteptrs
-abatron_pteptrs:
-   .space  8
diff --git a/arch/powerpc/kernel/head_book3s_32.S 
b/arch/powerpc/kernel/head_book3s_32.S
index 326262030279..32c27dac9b80 100644
--- a/arch/powerpc/kernel/head_book3s_32.S
+++ b/arch/powerpc/kernel/head_book3s_32.S
@@ -1282,9 +1282,3 @@ EXPORT_SYMBOL(empty_zero_page)
.globl  swapper_pg_dir
 swapper_pg_dir:
.space  PGD_TABLE_SIZE
-
-/* Room for two PTE pointers, usually the kernel and current user pointers
- * to their respective root page table.
- */
-abatron_pteptrs:
-   .space  8
diff --git a/arch/powerpc/kernel/head_fsl_booke.S 
b/arch/powerpc/kernel/head_fsl_booke.S
index a1a5c3f10dc4..590f34cc5bb2 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -986,15 +986,6 @@ _GLOBAL(abort)
isync
 
 _GLOBAL(set_context)
-
-#ifdef CONFIG_BDI_SWITCH
-   /* Context switch the PTE pointer for the Abatron BDI2000.
-* The PGDIR is the second parameter.
-*/
-   lis r5, abatron_pteptrs@h
-   ori r5, r5, abatron_pteptrs@l
-   stw r4, 0x4(r5)
-#endif
mtspr   SPRN_PID,r3
isync   /* Force context change */
blr
@@ -1242,10 +1233,3 @@ EXPORT_SYMBOL(empty_zero_page)
.globl  swapper_pg_dir
 swapper_pg_dir:
.space  PGD_TABLE_SIZE
-
-/*
- * Room for two PTE pointers, usually the kernel and current user pointers
- * to their respective root page table.
- */
-abatron_pteptrs:
-   .space  8
diff --git a/arch/powerpc/mm/nohash/8xx.c b/arch/powerpc/mm/nohash/8xx.c
index 71bfdbedacee..f749acba5473 100644
--- a/arch/powerpc/mm/nohash/8xx.c
+++ b/arch/powerpc/mm/nohash/8xx.c
@@ -224,12 +224,6 @@ void set_context(unsigned long id, pgd_t *pgd)
 {
s16 offset = (s16)(__pa(swapper_pg_dir));
 
-   /* Context switch the PTE pointe

Re: [PATCH v3 1/6] powerpc/nohash: Refactor update of BDI2000 pointers in switch_mmu_context()

2021-06-17 Thread Michael Ellerman
On Thu, 3 Jun 2021 09:29:02 + (UTC), Christophe Leroy wrote:
> Instead of duplicating the update of BDI2000 pointers in
> set_context(), do it directly from switch_mmu_context().

Applied to powerpc/next.

[1/6] powerpc/nohash: Refactor update of BDI2000 pointers in 
switch_mmu_context()
  https://git.kernel.org/powerpc/c/25910260ff69fa0c37e26541aac4e8f978e1f17f
[2/6] powerpc/nohash: Convert set_context() to C
  https://git.kernel.org/powerpc/c/a56ab7c7290f5922363d1ee11bbafc4da2b9bf51
[3/6] powerpc/nohash: Remove CONFIG_SMP #ifdefery in mmu_context.h
  https://git.kernel.org/powerpc/c/c13066e53aabd8f268f051d267270765e10343aa
[4/6] powerpc/nohash: Remove DEBUG_MAP_CONSISTENCY
  https://git.kernel.org/powerpc/c/dac3db1edf8b4c75859f07789f577322f2a51e3a
[5/6] powerpc/nohash: Remove DEBUG_CLAMP_LAST_CONTEXT
  https://git.kernel.org/powerpc/c/a36c0faf3dbc429d5ddcb941afe38dd6fe6c5901
[6/6] powerpc/nohash: Remove DEBUG_HARDER
  https://git.kernel.org/powerpc/c/e2c043163d44f7b3a9e65d9161af72b647b18451

cheers