* [PATCH v3] powerpc/inst: add PPC_TLBILX_LPID
@ 2023-08-03 18:33 Nick Desaulniers
2023-08-03 18:47 ` Christophe Leroy
2023-08-23 11:55 ` Michael Ellerman
0 siblings, 2 replies; 4+ messages in thread
From: Nick Desaulniers @ 2023-08-03 18:33 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin, Christophe Leroy,
Nathan Chancellor, Tom Rix
Cc: linuxppc-dev, linux-kernel, kvm, llvm, kernel test robot,
Nick Desaulniers
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 [0]
Link: https://github.com/llvm/llvm-project-release-prs/commit/0af7e5e54a8c7ac665773ac1ada328713e8338f5 [1]
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>
---
Changes in v3:
- left comment @ https://github.com/linuxppc/issues/issues/350#issuecomment-1664417212
- restore PPC_RAW_TLBILX previous definition
- fix comment style
- Link to v2: https://lore.kernel.org/r/20230803-ppc_tlbilxlpid-v2-1-211ffa1df194@google.com
Changes in v2:
- add 2 missing tabs to PPC_RAW_TLBILX_LPID
- Link to v1: https://lore.kernel.org/r/20230803-ppc_tlbilxlpid-v1-1-84a1bc5cf963@google.com
---
arch/powerpc/include/asm/ppc-opcode.h | 2 ++
arch/powerpc/kvm/e500mc.c | 11 ++++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index ef6972aa33b9..005601243dda 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -397,6 +397,7 @@
#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))
@@ -616,6 +617,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 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))
diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
index d58df71ace58..7c09c000c330 100644
--- a/arch/powerpc/kvm/e500mc.c
+++ b/arch/powerpc/kvm/e500mc.c
@@ -16,10 +16,11 @@
#include <linux/miscdevice.h>
#include <linux/module.h>
-#include <asm/reg.h>
#include <asm/cputable.h>
-#include <asm/kvm_ppc.h>
#include <asm/dbell.h>
+#include <asm/kvm_ppc.h>
+#include <asm/ppc-opcode.h>
+#include <asm/reg.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);
}
---
base-commit: 7bafbd4027ae86572f308c4ddf93120c90126332
change-id: 20230803-ppc_tlbilxlpid-cfdbf4fd4f7f
Best regards,
--
Nick Desaulniers <ndesaulniers@google.com>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3] powerpc/inst: add PPC_TLBILX_LPID
2023-08-03 18:33 [PATCH v3] powerpc/inst: add PPC_TLBILX_LPID Nick Desaulniers
@ 2023-08-03 18:47 ` Christophe Leroy
2023-08-03 18:48 ` Nick Desaulniers
2023-08-23 11:55 ` Michael Ellerman
1 sibling, 1 reply; 4+ messages in thread
From: Christophe Leroy @ 2023-08-03 18:47 UTC (permalink / raw)
To: Nick Desaulniers, Michael Ellerman, Nicholas Piggin,
Nathan Chancellor, Tom Rix
Cc: linuxppc-dev, linux-kernel, kvm, llvm, kernel test robot
Le 03/08/2023 à 20:33, Nick Desaulniers a écrit :
> 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 [0]
> Link: https://github.com/llvm/llvm-project-release-prs/commit/0af7e5e54a8c7ac665773ac1ada328713e8338f5 [1]
> 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>
Not sure why you changed the order of #includes , nevertheless
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> Changes in v3:
> - left comment @ https://github.com/linuxppc/issues/issues/350#issuecomment-1664417212
> - restore PPC_RAW_TLBILX previous definition
> - fix comment style
> - Link to v2: https://lore.kernel.org/r/20230803-ppc_tlbilxlpid-v2-1-211ffa1df194@google.com
>
> Changes in v2:
> - add 2 missing tabs to PPC_RAW_TLBILX_LPID
> - Link to v1: https://lore.kernel.org/r/20230803-ppc_tlbilxlpid-v1-1-84a1bc5cf963@google.com
> ---
> arch/powerpc/include/asm/ppc-opcode.h | 2 ++
> arch/powerpc/kvm/e500mc.c | 11 ++++++++---
> 2 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
> index ef6972aa33b9..005601243dda 100644
> --- a/arch/powerpc/include/asm/ppc-opcode.h
> +++ b/arch/powerpc/include/asm/ppc-opcode.h
> @@ -397,6 +397,7 @@
> #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))
> @@ -616,6 +617,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 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))
> diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
> index d58df71ace58..7c09c000c330 100644
> --- a/arch/powerpc/kvm/e500mc.c
> +++ b/arch/powerpc/kvm/e500mc.c
> @@ -16,10 +16,11 @@
> #include <linux/miscdevice.h>
> #include <linux/module.h>
>
> -#include <asm/reg.h>
> #include <asm/cputable.h>
> -#include <asm/kvm_ppc.h>
> #include <asm/dbell.h>
> +#include <asm/kvm_ppc.h>
> +#include <asm/ppc-opcode.h>
> +#include <asm/reg.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);
> }
>
> ---
> base-commit: 7bafbd4027ae86572f308c4ddf93120c90126332
> change-id: 20230803-ppc_tlbilxlpid-cfdbf4fd4f7f
>
> Best regards,
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] powerpc/inst: add PPC_TLBILX_LPID
2023-08-03 18:47 ` Christophe Leroy
@ 2023-08-03 18:48 ` Nick Desaulniers
0 siblings, 0 replies; 4+ messages in thread
From: Nick Desaulniers @ 2023-08-03 18:48 UTC (permalink / raw)
To: Christophe Leroy
Cc: Michael Ellerman, Nicholas Piggin, Nathan Chancellor, Tom Rix,
linuxppc-dev, linux-kernel, kvm, llvm, kernel test robot
On Thu, Aug 3, 2023 at 11:47 AM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
>
>
>
> Le 03/08/2023 à 20:33, Nick Desaulniers a écrit :
> > 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 [0]
> > Link: https://github.com/llvm/llvm-project-release-prs/commit/0af7e5e54a8c7ac665773ac1ada328713e8338f5 [1]
> > 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>
>
> Not sure why you changed the order of #includes , nevertheless
Habit to sort; can drop if maintaining git blame is more important
than cleaning that up.
>
> Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>
> > ---
> > Changes in v3:
> > - left comment @ https://github.com/linuxppc/issues/issues/350#issuecomment-1664417212
> > - restore PPC_RAW_TLBILX previous definition
> > - fix comment style
> > - Link to v2: https://lore.kernel.org/r/20230803-ppc_tlbilxlpid-v2-1-211ffa1df194@google.com
> >
> > Changes in v2:
> > - add 2 missing tabs to PPC_RAW_TLBILX_LPID
> > - Link to v1: https://lore.kernel.org/r/20230803-ppc_tlbilxlpid-v1-1-84a1bc5cf963@google.com
> > ---
> > arch/powerpc/include/asm/ppc-opcode.h | 2 ++
> > arch/powerpc/kvm/e500mc.c | 11 ++++++++---
> > 2 files changed, 10 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
> > index ef6972aa33b9..005601243dda 100644
> > --- a/arch/powerpc/include/asm/ppc-opcode.h
> > +++ b/arch/powerpc/include/asm/ppc-opcode.h
> > @@ -397,6 +397,7 @@
> > #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))
> > @@ -616,6 +617,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 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))
> > diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
> > index d58df71ace58..7c09c000c330 100644
> > --- a/arch/powerpc/kvm/e500mc.c
> > +++ b/arch/powerpc/kvm/e500mc.c
> > @@ -16,10 +16,11 @@
> > #include <linux/miscdevice.h>
> > #include <linux/module.h>
> >
> > -#include <asm/reg.h>
> > #include <asm/cputable.h>
> > -#include <asm/kvm_ppc.h>
> > #include <asm/dbell.h>
> > +#include <asm/kvm_ppc.h>
> > +#include <asm/ppc-opcode.h>
> > +#include <asm/reg.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);
> > }
> >
> > ---
> > base-commit: 7bafbd4027ae86572f308c4ddf93120c90126332
> > change-id: 20230803-ppc_tlbilxlpid-cfdbf4fd4f7f
> >
> > Best regards,
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] powerpc/inst: add PPC_TLBILX_LPID
2023-08-03 18:33 [PATCH v3] powerpc/inst: add PPC_TLBILX_LPID Nick Desaulniers
2023-08-03 18:47 ` Christophe Leroy
@ 2023-08-23 11:55 ` Michael Ellerman
1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2023-08-23 11:55 UTC (permalink / raw)
To: Nicholas Piggin, Christophe Leroy, Nathan Chancellor, Tom Rix,
Nick Desaulniers
Cc: linuxppc-dev, linux-kernel, kvm, llvm, kernel test robot
On Thu, 03 Aug 2023 11:33:52 -0700, Nick Desaulniers wrote:
> 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.
>
>
> [...]
Applied to powerpc/next.
[1/1] powerpc/inst: add PPC_TLBILX_LPID
https://git.kernel.org/powerpc/c/ae7936d232d862e5b8311180036281ffe93735b8
cheers
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-23 12:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-03 18:33 [PATCH v3] powerpc/inst: add PPC_TLBILX_LPID Nick Desaulniers
2023-08-03 18:47 ` Christophe Leroy
2023-08-03 18:48 ` Nick Desaulniers
2023-08-23 11:55 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).