All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	naveen.n.rao@linux.vnet.ibm.com, jniethe5@gmail.com
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v1 10/12] powerpc/lib/feature-fixups: Use PPC_RAW_xxx() macros
Date: Tue, 15 Jun 2021 11:48:49 +1000	[thread overview]
Message-ID: <874kdzvqwu.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <e79cd8e111ca13bf8c61a384bac365aa7e207647.1621506159.git.christophe.leroy@csgroup.eu>

Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> diff --git a/arch/powerpc/lib/feature-fixups.c b/arch/powerpc/lib/feature-fixups.c
> index fe26f2fa0f3f..f0fc521b82ae 100644
> --- a/arch/powerpc/lib/feature-fixups.c
> +++ b/arch/powerpc/lib/feature-fixups.c
> @@ -180,32 +180,31 @@ static void do_stf_exit_barrier_fixups(enum stf_barrier_type types)
>  	start = PTRRELOC(&__start___stf_exit_barrier_fixup);
>  	end = PTRRELOC(&__stop___stf_exit_barrier_fixup);
>  
> -	instrs[0] = 0x60000000; /* nop */
> -	instrs[1] = 0x60000000; /* nop */
> -	instrs[2] = 0x60000000; /* nop */
> -	instrs[3] = 0x60000000; /* nop */
> -	instrs[4] = 0x60000000; /* nop */
> -	instrs[5] = 0x60000000; /* nop */
> +	instrs[0] = PPC_RAW_NOP();
> +	instrs[1] = PPC_RAW_NOP();
> +	instrs[2] = PPC_RAW_NOP();
> +	instrs[3] = PPC_RAW_NOP();
> +	instrs[4] = PPC_RAW_NOP();
> +	instrs[5] = PPC_RAW_NOP();
>  
>  	i = 0;
>  	if (types & STF_BARRIER_FALLBACK || types & STF_BARRIER_SYNC_ORI) {
>  		if (cpu_has_feature(CPU_FTR_HVMODE)) {
> -			instrs[i++] = 0x7db14ba6; /* mtspr 0x131, r13 (HSPRG1) */
> -			instrs[i++] = 0x7db04aa6; /* mfspr r13, 0x130 (HSPRG0) */
> +			instrs[i++] = PPC_RAW_MTSPR(SPRN_HSPRG1, _R13);
> +			instrs[i++] = PPC_RAW_MFSPR(_R13, SPRN_HSPRG0);
>  		} else {
> -			instrs[i++] = 0x7db243a6; /* mtsprg 2,r13	*/
> -			instrs[i++] = 0x7db142a6; /* mfsprg r13,1    */
> +			instrs[i++] = PPC_RAW_MTSPR(SPRN_SPRG2, _R13);
> +			instrs[i++] = PPC_RAW_MFSPR(_R13, SPRN_SPRG1);
>  	        }
> -		instrs[i++] = 0x7c0004ac; /* hwsync		*/
> -		instrs[i++] = 0xe9ad0000; /* ld r13,0(r13)	*/
...
> +		instrs[i++] = PPC_RAW_LD(_R10, _R13, 0);

This conversion was wrong, r13 became r10.

I fixed it up.

cheers

WARNING: multiple messages have this Message-ID (diff)
From: Michael Ellerman <mpe@ellerman.id.au>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	naveen.n.rao@linux.vnet.ibm.com, jniethe5@gmail.com
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 10/12] powerpc/lib/feature-fixups: Use PPC_RAW_xxx() macros
Date: Tue, 15 Jun 2021 11:48:49 +1000	[thread overview]
Message-ID: <874kdzvqwu.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <e79cd8e111ca13bf8c61a384bac365aa7e207647.1621506159.git.christophe.leroy@csgroup.eu>

Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> diff --git a/arch/powerpc/lib/feature-fixups.c b/arch/powerpc/lib/feature-fixups.c
> index fe26f2fa0f3f..f0fc521b82ae 100644
> --- a/arch/powerpc/lib/feature-fixups.c
> +++ b/arch/powerpc/lib/feature-fixups.c
> @@ -180,32 +180,31 @@ static void do_stf_exit_barrier_fixups(enum stf_barrier_type types)
>  	start = PTRRELOC(&__start___stf_exit_barrier_fixup);
>  	end = PTRRELOC(&__stop___stf_exit_barrier_fixup);
>  
> -	instrs[0] = 0x60000000; /* nop */
> -	instrs[1] = 0x60000000; /* nop */
> -	instrs[2] = 0x60000000; /* nop */
> -	instrs[3] = 0x60000000; /* nop */
> -	instrs[4] = 0x60000000; /* nop */
> -	instrs[5] = 0x60000000; /* nop */
> +	instrs[0] = PPC_RAW_NOP();
> +	instrs[1] = PPC_RAW_NOP();
> +	instrs[2] = PPC_RAW_NOP();
> +	instrs[3] = PPC_RAW_NOP();
> +	instrs[4] = PPC_RAW_NOP();
> +	instrs[5] = PPC_RAW_NOP();
>  
>  	i = 0;
>  	if (types & STF_BARRIER_FALLBACK || types & STF_BARRIER_SYNC_ORI) {
>  		if (cpu_has_feature(CPU_FTR_HVMODE)) {
> -			instrs[i++] = 0x7db14ba6; /* mtspr 0x131, r13 (HSPRG1) */
> -			instrs[i++] = 0x7db04aa6; /* mfspr r13, 0x130 (HSPRG0) */
> +			instrs[i++] = PPC_RAW_MTSPR(SPRN_HSPRG1, _R13);
> +			instrs[i++] = PPC_RAW_MFSPR(_R13, SPRN_HSPRG0);
>  		} else {
> -			instrs[i++] = 0x7db243a6; /* mtsprg 2,r13	*/
> -			instrs[i++] = 0x7db142a6; /* mfsprg r13,1    */
> +			instrs[i++] = PPC_RAW_MTSPR(SPRN_SPRG2, _R13);
> +			instrs[i++] = PPC_RAW_MFSPR(_R13, SPRN_SPRG1);
>  	        }
> -		instrs[i++] = 0x7c0004ac; /* hwsync		*/
> -		instrs[i++] = 0xe9ad0000; /* ld r13,0(r13)	*/
...
> +		instrs[i++] = PPC_RAW_LD(_R10, _R13, 0);

This conversion was wrong, r13 became r10.

I fixed it up.

cheers

  reply	other threads:[~2021-06-15  2:23 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20 10:23 [PATCH v1 01/12] powerpc: Rework PPC_RAW_xxx() macros for prefixed instructions Christophe Leroy
2021-05-20 10:23 ` Christophe Leroy
2021-05-20 10:23 ` [PATCH v1 02/12] powerpc/opcodes: Add shorter macros for registers for use with PPC_RAW_xx() Christophe Leroy
2021-05-20 10:23   ` Christophe Leroy
2021-05-20 10:23 ` [PATCH v1 03/12] powerpc/lib/code-patching: Use PPC_RAW_() macros Christophe Leroy
2021-05-20 10:23   ` Christophe Leroy
2021-05-20 10:23 ` [PATCH v1 04/12] powerpc/signal: Use PPC_RAW_xx() macros Christophe Leroy
2021-05-20 10:23   ` Christophe Leroy
2021-05-20 10:23 ` [PATCH v1 05/12] powerpc/modules: " Christophe Leroy
2021-05-20 10:23   ` Christophe Leroy
2021-05-20 10:23 ` [PATCH v1 06/12] powerpc/security: Use PPC_RAW_BLR() and PPC_RAW_NOP() Christophe Leroy
2021-05-20 10:23   ` Christophe Leroy
2021-05-20 10:23 ` [PATCH v1 07/12] powerpc/ftrace: Use PPC_RAW_MFLR() " Christophe Leroy
2021-05-20 10:23   ` Christophe Leroy
2021-05-20 10:23 ` [PATCH v1 08/12] powerpc/ebpf64: Use PPC_RAW_MFLR() Christophe Leroy
2021-05-20 10:23   ` Christophe Leroy
2021-05-20 10:23 ` [PATCH v1 09/12] powerpc/ebpf32: Use _Rx macros instead of __REG_Rx ones Christophe Leroy
2021-05-20 10:23   ` Christophe Leroy
2021-05-20 10:23 ` [PATCH v1 10/12] powerpc/lib/feature-fixups: Use PPC_RAW_xxx() macros Christophe Leroy
2021-05-20 10:23   ` Christophe Leroy
2021-06-15  1:48   ` Michael Ellerman [this message]
2021-06-15  1:48     ` Michael Ellerman
2021-05-20 10:23 ` [PATCH v1 11/12] powerpc/traps: Start using PPC_RAW_xx() macros Christophe Leroy
2021-05-20 10:23   ` Christophe Leroy
2021-05-20 10:23 ` [PATCH v1 12/12] powerpc: Replace PPC_INST_NOP by PPC_RAW_NOP() Christophe Leroy
2021-05-20 10:23   ` Christophe Leroy
2021-05-20 10:51   ` David Laight
2021-06-18  3:51 ` [PATCH v1 01/12] powerpc: Rework PPC_RAW_xxx() macros for prefixed instructions 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=874kdzvqwu.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=benh@kernel.crashing.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=jniethe5@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.