Skip to content

Commit 39c8275

Browse files
mrutland-armwilldeacon
authored andcommitted
arm64: uaccess: permit __smp_store_release() to use zero register
Currently the asm constraints for __smp_store_release() require that the value is placed in a "real" GPR (i.e. one other than [XW]ZR or SP). This means that for cases such as: __smp_store_release(ptr, 0) ... the compiler has to move '0' into "real" GPR, e.g. mov xN, #0 stlr xN, [<addr>] This is unfortunate, as using the zero register would require fewer instructions and save a "real" GPR for other usage, allowing the compiler to generate: stlr xzr, [<addr>] Modify the asm constaints for __smp_store_release() to permit the use of the zero register for the value. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Robin Murphy <[email protected]> Cc: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent e5cacb5 commit 39c8275

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

arch/arm64/include/asm/barrier.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,25 +131,25 @@ do { \
131131
case 1: \
132132
asm volatile ("stlrb %w1, %0" \
133133
: "=Q" (*__p) \
134-
: "r" (*(__u8 *)__u.__c) \
134+
: "rZ" (*(__u8 *)__u.__c) \
135135
: "memory"); \
136136
break; \
137137
case 2: \
138138
asm volatile ("stlrh %w1, %0" \
139139
: "=Q" (*__p) \
140-
: "r" (*(__u16 *)__u.__c) \
140+
: "rZ" (*(__u16 *)__u.__c) \
141141
: "memory"); \
142142
break; \
143143
case 4: \
144144
asm volatile ("stlr %w1, %0" \
145145
: "=Q" (*__p) \
146-
: "r" (*(__u32 *)__u.__c) \
146+
: "rZ" (*(__u32 *)__u.__c) \
147147
: "memory"); \
148148
break; \
149149
case 8: \
150-
asm volatile ("stlr %1, %0" \
150+
asm volatile ("stlr %x1, %0" \
151151
: "=Q" (*__p) \
152-
: "r" (*(__u64 *)__u.__c) \
152+
: "rZ" (*(__u64 *)__u.__c) \
153153
: "memory"); \
154154
break; \
155155
} \

0 commit comments

Comments
 (0)