Re: [PATCH] powerpc: fix inline asm constraints for dcbz

From: Segher Boessenkool
Date: Fri Aug 09 2019 - 18:11:28 EST


On Fri, Aug 09, 2019 at 10:12:56PM +0200, Arnd Bergmann wrote:
> @@ -106,7 +106,7 @@ static inline u##size name(const volatile u##size
> __iomem *addr) \
> { \
> u##size ret; \
> __asm__ __volatile__("sync;"#insn" %0,%y1;twi 0,%0,0;isync" \
> - : "=r" (ret) : "Z" (*addr) : "memory"); \
> + : "=r" (ret) : "m" (*addr) : "memory"); \
> return ret; \
> }

That will no longer compile something like
u8 *p;
u16 x = in_le16(p + 12);
(you'll get something like "invalid %y value, try using the 'Z' constraint").

So then you remove the %y, but that makes you get something like
sync;lhbrx 3,12(3);twi 0,3,0;isync
which is completely wrong.


Segher