-
Notifications
You must be signed in to change notification settings - Fork 15
tlbilxlpid -> error: invalid instruction #1891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We should use |
|
ah, |
diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
index d58df71ace58..f3d32e250b08 100644
--- a/arch/powerpc/kvm/e500mc.c
+++ b/arch/powerpc/kvm/e500mc.c
@@ -92,7 +92,12 @@ 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));
+// https://github.com/ClangBuiltLinux/linux/issues/1891
+#if defined(CONFIG_CC_IS_CLANG) && CONFIG_CLANG_VERSION < 180000
+ asm (".long 0x7c000024");
+#else
asm volatile("tlbilxlpid");
+#endif
mtspr(SPRN_MAS5, 0);
local_irq_restore(flags);
} is the tentative patch. |
@mpe Looking at include/asm/dcr-native.h, do you have a preference between the above vs just changing the existing asm statement to use |
The usual solution is to define the value in |
@mpe thoughts on: diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index ef6972aa33b9..d84473db7c02 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -616,6 +616,7 @@
#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() PPC_TLBILX(0, 0, 0)
#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))
diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
index d58df71ace58..96ea8507d8a3 100644
--- a/arch/powerpc/kvm/e500mc.c
+++ b/arch/powerpc/kvm/e500mc.c
@@ -20,6 +20,7 @@
#include <asm/cputable.h>
#include <asm/kvm_ppc.h>
#include <asm/dbell.h>
+#include <asm/opcode.h>
#include "booke.h"
#include "e500.h"
@@ -92,7 +93,10 @@ 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
+ */
+ PPC_TLBILX_LPID();
mtspr(SPRN_MAS5, 0);
local_irq_restore(flags);
} |
or does that need to be |
The brackets on the macro aren't needed because it takes no params, see eg. |
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/linux#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]
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]
via https://lore.kernel.org/llvm/[email protected]/
it looks like:
produces:
for
--target=powerpc-linux-gnu
. I wonder if clang is missing support for this instruction (or perhaps it's an alias to something that clang does understand).Reported upstream: llvm/llvm-project#64080
The text was updated successfully, but these errors were encountered: