public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] arm64: sysreg: Fix use of XZR in write_sysreg_s
@ 2016-10-17 17:20 Will Deacon
  2016-10-17 18:19 ` Mark Rutland
  0 siblings, 1 reply; 2+ messages in thread
From: Will Deacon @ 2016-10-17 17:20 UTC (permalink / raw)
  To: linux-arm-kernel

Commit 8a71f0c656e0 ("arm64: sysreg: replace open-coded mrs_s/msr_s with
{read,write}_sysreg_s") introduced a write_sysreg_s macro for writing
to system registers that are not supported by binutils.

Unfortunately, this was implemented with the wrong template (%0 vs %x0),
so in the case that we are writing a constant 0, we will generate
invalid instruction syntax and bail with a cryptic assembler error:

  | Error: constant expression required

This patch fixes the template.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm64/include/asm/sysreg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
index e8d46e8e6079..6c80b3699cb8 100644
--- a/arch/arm64/include/asm/sysreg.h
+++ b/arch/arm64/include/asm/sysreg.h
@@ -286,7 +286,7 @@ asm(
 
 #define write_sysreg_s(v, r) do {					\
 	u64 __val = (u64)v;						\
-	asm volatile("msr_s " __stringify(r) ", %0" : : "rZ" (__val));	\
+	asm volatile("msr_s " __stringify(r) ", %x0" : : "rZ" (__val));	\
 } while (0)
 
 static inline void config_sctlr_el1(u32 clear, u32 set)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] arm64: sysreg: Fix use of XZR in write_sysreg_s
  2016-10-17 17:20 [PATCH] arm64: sysreg: Fix use of XZR in write_sysreg_s Will Deacon
@ 2016-10-17 18:19 ` Mark Rutland
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Rutland @ 2016-10-17 18:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 17, 2016 at 06:20:59PM +0100, Will Deacon wrote:
> Commit 8a71f0c656e0 ("arm64: sysreg: replace open-coded mrs_s/msr_s with
> {read,write}_sysreg_s") introduced a write_sysreg_s macro for writing
> to system registers that are not supported by binutils.
> 
> Unfortunately, this was implemented with the wrong template (%0 vs %x0),
> so in the case that we are writing a constant 0, we will generate
> invalid instruction syntax and bail with a cryptic assembler error:
> 
>   | Error: constant expression required
> 
> This patch fixes the template.
> 
> Signed-off-by: Will Deacon <will.deacon@arm.com>

Whoops; I should've spotted that in review. FWIW:

Acked-by: Mark Rutland <mark.rutland@arm.com>

Thanks,
Mark.

> ---
>  arch/arm64/include/asm/sysreg.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
> index e8d46e8e6079..6c80b3699cb8 100644
> --- a/arch/arm64/include/asm/sysreg.h
> +++ b/arch/arm64/include/asm/sysreg.h
> @@ -286,7 +286,7 @@ asm(
>  
>  #define write_sysreg_s(v, r) do {					\
>  	u64 __val = (u64)v;						\
> -	asm volatile("msr_s " __stringify(r) ", %0" : : "rZ" (__val));	\
> +	asm volatile("msr_s " __stringify(r) ", %x0" : : "rZ" (__val));	\
>  } while (0)
>  
>  static inline void config_sctlr_el1(u32 clear, u32 set)
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-17 18:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-17 17:20 [PATCH] arm64: sysreg: Fix use of XZR in write_sysreg_s Will Deacon
2016-10-17 18:19 ` Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox