public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Paul Mackerras <paulus@samba.org>
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 2/3] powerpc/ppc-opcode: Define and use PPC_RAW_TRAP() and PPC_RAW_TW()
Date: Wed, 03 Aug 2022 13:36:34 +0530	[thread overview]
Message-ID: <1659513939.dxqqwb8mat.naveen@linux.ibm.com> (raw)
In-Reply-To: <52c7e522e56a38e3ff0363906919445920005a8f.1657205708.git.christophe.leroy@csgroup.eu>

Christophe Leroy wrote:
> Add and use PPC_RAW_TRAP() instead of opencoding.
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
>  arch/powerpc/include/asm/ppc-opcode.h | 2 ++
>  arch/powerpc/include/asm/probes.h     | 3 ++-
>  arch/powerpc/xmon/xmon.c              | 2 +-
>  3 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
> index 89beabf5325c..5527a955fb4a 100644
> --- a/arch/powerpc/include/asm/ppc-opcode.h
> +++ b/arch/powerpc/include/asm/ppc-opcode.h
> @@ -581,6 +581,8 @@
>  
>  #define PPC_RAW_BRANCH(offset)		(0x48000000 | PPC_LI(offset))
>  #define PPC_RAW_BL(offset)		(0x48000001 | PPC_LI(offset))
> +#define PPC_RAW_TW(t0, a, b)		(0x7f000008 | ___PPC_RS(t0) | ___PPC_RA(a) | ___PPC_RB(b))

Shouldn't that be 0x7c000008 ?

- Naveen


> +#define PPC_RAW_TRAP()			PPC_RAW_TW(31, 0, 0)
>  
>  /* Deal with instructions that older assemblers aren't aware of */
>  #define	PPC_BCCTR_FLUSH		stringify_in_c(.long PPC_INST_BCCTR_FLUSH)
> diff --git a/arch/powerpc/include/asm/probes.h b/arch/powerpc/include/asm/probes.h
> index 00634e3145e7..e77a2ed7d938 100644
> --- a/arch/powerpc/include/asm/probes.h
> +++ b/arch/powerpc/include/asm/probes.h
> @@ -9,8 +9,9 @@
>   */
>  #include <linux/types.h>
>  #include <asm/disassemble.h>
> +#include <asm/ppc-opcode.h>
>  
> -#define BREAKPOINT_INSTRUCTION	0x7fe00008	/* trap */
> +#define BREAKPOINT_INSTRUCTION	PPC_RAW_TRAP()	/* trap */
>  
>  /* Trap definitions per ISA */
>  #define IS_TW(instr)		(((instr) & 0xfc0007fe) == 0x7c000008)
> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> index f80c714f1d49..26ef3388c24c 100644
> --- a/arch/powerpc/xmon/xmon.c
> +++ b/arch/powerpc/xmon/xmon.c
> @@ -116,7 +116,7 @@ struct bpt {
>  static struct bpt bpts[NBPTS];
>  static struct bpt dabr[HBP_NUM_MAX];
>  static struct bpt *iabr;
> -static unsigned bpinstr = 0x7fe00008;	/* trap */
> +static unsigned int bpinstr = PPC_RAW_TRAP();
>  
>  #define BP_NUM(bp)	((bp) - bpts + 1)
>  
> -- 
> 2.36.1
> 
> 
> 

  reply	other threads:[~2022-08-03  8:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-07 14:55 [PATCH 1/3] powerpc/probes: Remove ppc_opcode_t Christophe Leroy
2022-07-07 14:55 ` [PATCH 2/3] powerpc/ppc-opcode: Define and use PPC_RAW_TRAP() and PPC_RAW_TW() Christophe Leroy
2022-08-03  8:06   ` Naveen N. Rao [this message]
2022-08-03 10:38     ` Michael Ellerman
2022-07-07 14:55 ` [PATCH 3/3] powerpc/ppc-opcode: Define and use PPC_RAW_SETB() Christophe Leroy
2022-07-29 13:02 ` [PATCH 1/3] powerpc/probes: Remove ppc_opcode_t Michael Ellerman

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=1659513939.dxqqwb8mat.naveen@linux.ibm.com \
    --to=naveen.n.rao@linux.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    /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