Skip to content

Commit ae7936d

Browse files
nickdesaulniersmpe
authored andcommitted
powerpc/inst: add PPC_TLBILX_LPID
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: ClangBuiltLinux#1891 Link: llvm/llvm-project#64080 Link: llvm/llvm-project@53648ac [0] Link: llvm/llvm-project-release-prs@0af7e5e [1] Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/llvm/[email protected]/ Suggested-by: Michael Ellerman <[email protected]> Signed-off-by: Nick Desaulniers <[email protected]> Reviewed-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent 0e1cd3d commit ae7936d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

arch/powerpc/include/asm/ppc-opcode.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@
397397
#define PPC_RAW_RFCI (0x4c000066)
398398
#define PPC_RAW_RFDI (0x4c00004e)
399399
#define PPC_RAW_RFMCI (0x4c00004c)
400+
#define PPC_RAW_TLBILX_LPID (0x7c000024)
400401
#define PPC_RAW_TLBILX(t, a, b) (0x7c000024 | __PPC_T_TLB(t) | __PPC_RA0(a) | __PPC_RB(b))
401402
#define PPC_RAW_WAIT_v203 (0x7c00007c)
402403
#define PPC_RAW_WAIT(w, p) (0x7c00003c | __PPC_WC(w) | __PPC_PL(p))
@@ -616,6 +617,7 @@
616617
#define PPC_TLBILX(t, a, b) stringify_in_c(.long PPC_RAW_TLBILX(t, a, b))
617618
#define PPC_TLBILX_ALL(a, b) PPC_TLBILX(0, a, b)
618619
#define PPC_TLBILX_PID(a, b) PPC_TLBILX(1, a, b)
620+
#define PPC_TLBILX_LPID stringify_in_c(.long PPC_RAW_TLBILX_LPID)
619621
#define PPC_TLBILX_VA(a, b) PPC_TLBILX(3, a, b)
620622
#define PPC_WAIT_v203 stringify_in_c(.long PPC_RAW_WAIT_v203)
621623
#define PPC_WAIT(w, p) stringify_in_c(.long PPC_RAW_WAIT(w, p))

arch/powerpc/kvm/e500mc.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <asm/cputable.h>
2121
#include <asm/kvm_ppc.h>
2222
#include <asm/dbell.h>
23+
#include <asm/ppc-opcode.h>
2324

2425
#include "booke.h"
2526
#include "e500.h"
@@ -92,7 +93,11 @@ void kvmppc_e500_tlbil_all(struct kvmppc_vcpu_e500 *vcpu_e500)
9293

9394
local_irq_save(flags);
9495
mtspr(SPRN_MAS5, MAS5_SGS | get_lpid(&vcpu_e500->vcpu));
95-
asm volatile("tlbilxlpid");
96+
/*
97+
* clang-17 and older could not assemble tlbilxlpid.
98+
* https://github.com/ClangBuiltLinux/linux/issues/1891
99+
*/
100+
asm volatile (PPC_TLBILX_LPID);
96101
mtspr(SPRN_MAS5, 0);
97102
local_irq_restore(flags);
98103
}

0 commit comments

Comments
 (0)