From: Mark Rutland Date: Thu, 8 Sep 2016 12:55:34 +0000 (+0100) Subject: arm64: sysreg: allow write_sysreg to use XZR X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7aff4a2dd3db4e519c636f43aa863078e3b30d0f;p=linux-beck.git arm64: sysreg: allow write_sysreg to use XZR Currently write_sysreg has to allocate a temporary register to write zero to a system register, which is unfortunate given that the MSR instruction accepts XZR as an operand. Allow XZR to be used when appropriate by fiddling with the assembly constraints. Cc: Catalin Marinas Cc: Marc Zyngier Cc: Suzuki K Poulose Reviewed-by: Robin Murphy Signed-off-by: Mark Rutland Signed-off-by: Will Deacon --- diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h index cc06794b7346..39fed2e56e98 100644 --- a/arch/arm64/include/asm/sysreg.h +++ b/arch/arm64/include/asm/sysreg.h @@ -273,10 +273,14 @@ static inline void config_sctlr_el1(u32 clear, u32 set) __val; \ }) +/* + * The "Z" constraint normally means a zero immediate, but when combined with + * the "%x0" template means XZR. + */ #define write_sysreg(v, r) do { \ u64 __val = (u64)v; \ - asm volatile("msr " __stringify(r) ", %0" \ - : : "r" (__val)); \ + asm volatile("msr " __stringify(r) ", %x0" \ + : : "rZ" (__val)); \ } while (0) #endif