linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Nick Desaulniers <ndesaulniers@google.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	Nathan Chancellor <nathan@kernel.org>, Tom Rix <trix@redhat.com>
Cc: "llvm@lists.linux.dev" <llvm@lists.linux.dev>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v2] powerpc/inst: add PPC_TLBILX_LPID
Date: Thu, 3 Aug 2023 18:02:08 +0000	[thread overview]
Message-ID: <eb73a052-7841-16ac-b01a-40a11dce34e5@csgroup.eu> (raw)
In-Reply-To: <20230803-ppc_tlbilxlpid-v2-1-211ffa1df194@google.com>



Le 03/08/2023 à 19: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.

Can you mention that patch in https://github.com/linuxppc/issues/issues/350

> 
> 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 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 |  4 +++-
>   arch/powerpc/kvm/e500mc.c             | 10 +++++++---
>   2 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
> index ef6972aa33b9..f37d8d8cbec6 100644
> --- a/arch/powerpc/include/asm/ppc-opcode.h
> +++ b/arch/powerpc/include/asm/ppc-opcode.h
> @@ -397,7 +397,8 @@
>   #define PPC_RAW_RFCI			(0x4c000066)
>   #define PPC_RAW_RFDI			(0x4c00004e)
>   #define PPC_RAW_RFMCI			(0x4c00004c)
> -#define PPC_RAW_TLBILX(t, a, b)		(0x7c000024 | __PPC_T_TLB(t) | 	__PPC_RA0(a) | __PPC_RB(b))
> +#define PPC_RAW_TLBILX_LPID		(0x7c000024)
> +#define PPC_RAW_TLBILX(t, a, b)		(PPC_RAW_TLBILX_LPID | __PPC_T_TLB(t) | __PPC_RA0(a) | __PPC_RB(b))

Can we avoid changing PPC_RAW_TLBILX to minimise the churn and minimise 
the churn when we remove PPC_RAW_TLBILX_LPID in two years.

>   #define PPC_RAW_WAIT_v203		(0x7c00007c)
>   #define PPC_RAW_WAIT(w, p)		(0x7c00003c | __PPC_WC(w) | __PPC_PL(p))
>   #define PPC_RAW_TLBIE(lp, a)		(0x7c000264 | ___PPC_RB(a) | ___PPC_RS(lp))
> @@ -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..dc054b8b5032 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,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
> +	 */

I think that's the networking subsystem comments style.
Other parts of kernel have /* on its own empty line and the text starts 
following line.

> +	asm volatile (PPC_TLBILX_LPID);
>   	mtspr(SPRN_MAS5, 0);
>   	local_irq_restore(flags);
>   }
> 
> ---
> base-commit: 7bafbd4027ae86572f308c4ddf93120c90126332
> change-id: 20230803-ppc_tlbilxlpid-cfdbf4fd4f7f
> 
> Best regards,


Christophe

      reply	other threads:[~2023-08-03 18:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-03 17:33 [PATCH v2] powerpc/inst: add PPC_TLBILX_LPID Nick Desaulniers
2023-08-03 18:02 ` Christophe Leroy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eb73a052-7841-16ac-b01a-40a11dce34e5@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=mpe@ellerman.id.au \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=npiggin@gmail.com \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).