Message ID | 56f6eebc9c5c1196038d17c09a5ef1f245e1167c.1644588937.git.christophe.leroy@csgroup.eu (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | powerpc/64: Rewrite loading of AMR_KUAP_BLOCKED in assembly | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/github-powerpc_ppctests | success | Successfully ran 8 jobs. |
snowpatch_ozlabs/github-powerpc_selftests | success | Successfully ran 8 jobs. |
snowpatch_ozlabs/github-powerpc_sparse | success | Successfully ran 4 jobs. |
snowpatch_ozlabs/github-powerpc_kernel_qemu | fail | boot (ppc64le_guest_defconfig, pseries+p8+tcg, pseries+p9+tcg, qemu-system-ppc64, ppc64le-rootfs.... failed at step Run qemu-pseries+p9+tcg with korg-5.5.0 build kernel. |
snowpatch_ozlabs/github-powerpc_clang | success | Successfully ran 7 jobs. |
diff --git a/arch/powerpc/include/asm/book3s/64/kup.h b/arch/powerpc/include/asm/book3s/64/kup.h index 54cf46808157..35c017ba29e1 100644 --- a/arch/powerpc/include/asm/book3s/64/kup.h +++ b/arch/powerpc/include/asm/book3s/64/kup.h @@ -338,6 +338,10 @@ static __always_inline void set_kuap(unsigned long value) * before and after the move to AMR. See table 6 on page 1134. */ isync(); + + if (__builtin_constant_p(value) && value == 0xfcffffffffffffff) + asm("li %0, %1 ; rotldi %0, %0, 48" : "=r"(value) : "i"(0xfffffffffffffcff)); + mtspr(SPRN_AMR, value); isync(); }
Constant loading of AMR_KUAP_BLOCKED takes 5 instructions: c000000000016a40: 4c 00 01 2c isync c000000000016a44: 3d 20 fc ff lis r9,-769 c000000000016a48: 61 29 ff ff ori r9,r9,65535 c000000000016a4c: 79 29 07 c6 rldicr r9,r9,32,31 c000000000016a50: 65 29 ff ff oris r9,r9,65535 c000000000016a54: 61 29 ff ff ori r9,r9,65535 c000000000016a58: 7d 3d 03 a6 mtamr r9 c000000000016a5c: 4c 00 01 2c isync Until GCC is fixed, implement it in assembly using 2 instructions: c000000000016a50: 4c 00 01 2c isync c000000000016a54: 39 20 fc ff li r9,-769 c000000000016a58: 79 29 80 02 rotldi r9,r9,48 c000000000016a5c: 7d 3d 03 a6 mtamr r9 c000000000016a60: 4c 00 01 2c isync With this change a ppc64_defconfig build is reduced by 15 kbytes. Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94395 Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> --- arch/powerpc/include/asm/book3s/64/kup.h | 4 ++++ 1 file changed, 4 insertions(+)