Re: [kvm-unit-tests RFC 2/2] lib: s390x: css: Name inline assembly arguments and clean them up

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 22, 2024 at 09:43:44AM +0200, Nico Boehr wrote:
> Quoting Janosch Frank (2024-02-01 15:23:56)
> [...]
> > diff --git a/lib/s390x/css.h b/lib/s390x/css.h
> > index 504b3f14..e4311124 100644
> > --- a/lib/s390x/css.h
> > +++ b/lib/s390x/css.h
> [...]
> > @@ -167,11 +167,11 @@ static inline int msch(unsigned long schid, struct schib *addr)
> >         int cc;
> >  
> >         asm volatile(
> > -               "       msch    0(%3)\n"
> > -               "       ipm     %0\n"
> > -               "       srl     %0,28"
> > -               : "=d" (cc)
> > -               : "d" (reg1), "m" (*addr), "a" (addr)
> > +               "       msch    0(%[addr])\n"
> > +               "       ipm     %[cc]\n"
> > +               "       srl     %[cc],28"
> > +               : [cc] "=d" (cc)
> > +               : "d" (reg1), [addr] "a" (addr)
> 
> I think there was a reason why the "m"(*addr) was here. Either add it back
> or add a memory clobber.

It is there to tell the compiler that the memory contents at *addr are used
as input. Without that, and only the "a" contraint, the compiler is free to
discard any potential previous writes to *addr.

The best solution here would be to use the Q constraint (memory reference
with short displacement and without index register) for the second operand
address of msch. Or simply copy the current implementation from the kernel
(drivers/s390/cio/ioasm.c).




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux