* [PATCH] powerpc/8xx: Simplify pte_update() with 16k pages
@ 2022-09-28 6:29 Christophe Leroy
2022-11-30 9:23 ` Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Christophe Leroy @ 2022-09-28 6:29 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin; +Cc: linuxppc-dev, linux-kernel
While looking at code generated for code patching, I saw that
pte_clear generated:
2d8: 38 a0 00 00 li r5,0
2dc: 38 e0 10 00 li r7,4096
2e0: 39 00 20 00 li r8,8192
2e4: 39 40 30 00 li r10,12288
2e8: 90 a9 00 00 stw r5,0(r9)
2ec: 90 e9 00 04 stw r7,4(r9)
2f0: 91 09 00 08 stw r8,8(r9)
2f4: 91 49 00 0c stw r10,12(r9)
With 16k pages, only the first entry is used by the kernel, so no need
to adapt the address of other entries. Only duplicate the first entry
for hardware.
Now it is:
2cc: 39 40 00 00 li r10,0
2d0: 91 49 00 00 stw r10,0(r9)
2d4: 91 49 00 04 stw r10,4(r9)
2d8: 91 49 00 08 stw r10,8(r9)
2dc: 91 49 00 0c stw r10,12(r9)
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/include/asm/nohash/32/pgtable.h | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/nohash/32/pgtable.h b/arch/powerpc/include/asm/nohash/32/pgtable.h
index 9091e4904a6b..981e414bdeef 100644
--- a/arch/powerpc/include/asm/nohash/32/pgtable.h
+++ b/arch/powerpc/include/asm/nohash/32/pgtable.h
@@ -256,8 +256,14 @@ static inline pte_basic_t pte_update(struct mm_struct *mm, unsigned long addr, p
num = number_of_cells_per_pte(pmd, new, huge);
- for (i = 0; i < num; i++, entry++, new += SZ_4K)
- *entry = new;
+ for (i = 0; i < num; i += PAGE_SIZE / SZ_4K, new += PAGE_SIZE) {
+ *entry++ = new;
+ if (IS_ENABLED(CONFIG_PPC_16K_PAGES) && num != 1) {
+ *entry++ = new;
+ *entry++ = new;
+ *entry++ = new;
+ }
+ }
return old;
}
--
2.37.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] powerpc/8xx: Simplify pte_update() with 16k pages
2022-09-28 6:29 [PATCH] powerpc/8xx: Simplify pte_update() with 16k pages Christophe Leroy
@ 2022-11-30 9:23 ` Michael Ellerman
0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2022-11-30 9:23 UTC (permalink / raw)
To: Nicholas Piggin, Christophe Leroy, Michael Ellerman
Cc: linuxppc-dev, linux-kernel
On Wed, 28 Sep 2022 08:29:00 +0200, Christophe Leroy wrote:
> While looking at code generated for code patching, I saw that
> pte_clear generated:
>
> 2d8: 38 a0 00 00 li r5,0
> 2dc: 38 e0 10 00 li r7,4096
> 2e0: 39 00 20 00 li r8,8192
> 2e4: 39 40 30 00 li r10,12288
> 2e8: 90 a9 00 00 stw r5,0(r9)
> 2ec: 90 e9 00 04 stw r7,4(r9)
> 2f0: 91 09 00 08 stw r8,8(r9)
> 2f4: 91 49 00 0c stw r10,12(r9)
>
> [...]
Applied to powerpc/next.
[1/1] powerpc/8xx: Simplify pte_update() with 16k pages
https://git.kernel.org/powerpc/c/f2c45962cc618c12f69fd46e6ebc20b9cd7f15ac
cheers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-30 9:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-28 6:29 [PATCH] powerpc/8xx: Simplify pte_update() with 16k pages Christophe Leroy
2022-11-30 9:23 ` Michael Ellerman
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).