powerpc/8xx: Simplify pte_update() with 16k pages
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Wed, 28 Sep 2022 06:29:00 +0000 (08:29 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 24 Nov 2022 12:31:48 +0000 (23:31 +1100)
commitf2c45962cc618c12f69fd46e6ebc20b9cd7f15ac
treeccc57436676a37c28cea738aba2bc7cb9fccccf4
parent4e87bd14e501030619d1bad29b3ec1f947f84fc4
powerpc/8xx: Simplify pte_update() with 16k pages

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>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/65f76300de07091a59a042a3db2d0ce9b939a05c.1664346532.git.christophe.leroy@csgroup.eu
arch/powerpc/include/asm/nohash/32/pgtable.h