]> git.itanic.dy.fi Git - linux-stable/commitdiff
powerpc/inst: add PPC_TLBILX_LPID
authorNick Desaulniers <ndesaulniers@google.com>
Thu, 3 Aug 2023 18:33:52 +0000 (11:33 -0700)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 16 Aug 2023 13:54:48 +0000 (23:54 +1000)
Clang didn't recognize the instruction tlbilxlpid. This was fixed in
clang-18 [0] then backported to clang-17 [1].  To support clang-16 and
older, rather than using that instruction bare in inline asm, add it to
ppc-opcode.h and use that macro as is done elsewhere for other
instructions.

Link: https://github.com/ClangBuiltLinux/linux/issues/1891
Link: https://github.com/llvm/llvm-project/issues/64080
Link: https://github.com/llvm/llvm-project/commit/53648ac1d0c953ae6d008864dd2eddb437a92468
Link: https://github.com/llvm/llvm-project-release-prs/commit/0af7e5e54a8c7ac665773ac1ada328713e8338f5
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/llvm/202307211945.TSPcyOhh-lkp@intel.com/
Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230803-ppc_tlbilxlpid-v3-1-ca84739bfd73@google.com
arch/powerpc/include/asm/ppc-opcode.h
arch/powerpc/kvm/e500mc.c

index ef6972aa33b92ace1658405427397304576c2107..005601243dda4d26113862adf1b19a833f99c409 100644 (file)
 #define PPC_RAW_RFCI                   (0x4c000066)
 #define PPC_RAW_RFDI                   (0x4c00004e)
 #define PPC_RAW_RFMCI                  (0x4c00004c)
+#define PPC_RAW_TLBILX_LPID            (0x7c000024)
 #define PPC_RAW_TLBILX(t, a, b)                (0x7c000024 | __PPC_T_TLB(t) |  __PPC_RA0(a) | __PPC_RB(b))
 #define PPC_RAW_WAIT_v203              (0x7c00007c)
 #define PPC_RAW_WAIT(w, p)             (0x7c00003c | __PPC_WC(w) | __PPC_PL(p))
 #define PPC_TLBILX(t, a, b)    stringify_in_c(.long PPC_RAW_TLBILX(t, a, b))
 #define PPC_TLBILX_ALL(a, b)   PPC_TLBILX(0, a, b)
 #define PPC_TLBILX_PID(a, b)   PPC_TLBILX(1, a, b)
+#define PPC_TLBILX_LPID                stringify_in_c(.long PPC_RAW_TLBILX_LPID)
 #define PPC_TLBILX_VA(a, b)    PPC_TLBILX(3, a, b)
 #define PPC_WAIT_v203          stringify_in_c(.long PPC_RAW_WAIT_v203)
 #define PPC_WAIT(w, p)         stringify_in_c(.long PPC_RAW_WAIT(w, p))
index d58df71ace584f01af318faf0efbb0cac2bb624a..e476e107a932b6ba58e7ebcca48b8563b2290924 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/cputable.h>
 #include <asm/kvm_ppc.h>
 #include <asm/dbell.h>
+#include <asm/ppc-opcode.h>
 
 #include "booke.h"
 #include "e500.h"
@@ -92,7 +93,11 @@ void kvmppc_e500_tlbil_all(struct kvmppc_vcpu_e500 *vcpu_e500)
 
        local_irq_save(flags);
        mtspr(SPRN_MAS5, MAS5_SGS | get_lpid(&vcpu_e500->vcpu));
-       asm volatile("tlbilxlpid");
+       /*
+        * clang-17 and older could not assemble tlbilxlpid.
+        * https://github.com/ClangBuiltLinux/linux/issues/1891
+        */
+       asm volatile (PPC_TLBILX_LPID);
        mtspr(SPRN_MAS5, 0);
        local_irq_restore(flags);
 }