Re: [kvm-unit-tests PATCH v3 7/7] s390x: Add test for STFLE interpretive execution (format-0)

Nico Boehr
2024-10-10T08:27:27Z

Quoting Nina Schoetterl-Glausch (2024-09-02 16:24:53)
> On Tue, 2024-08-27 at 16:08 +0200, Nico Boehr wrote:
> > Quoting Nina Schoetterl-Glausch (2024-06-20 16:17:00)
> > [...]
> > > diff --git a/lib/s390x/asm/facility.h b/lib/s390x/asm/facility.h
> > > index a66fe56a..2bad05c5 100644
> > > --- a/lib/s390x/asm/facility.h
> > > +++ b/lib/s390x/asm/facility.h
> > > @@ -27,12 +27,20 @@ static inline void stfl(void)
> > > asm volatile(" stfl 0(0)\n" : : : "memory");
> > > }
> > >
> > > -static inline void stfle(uint64_t *fac, unsigned int nb_doublewords)
> > > +static inline unsigned int stfle(uint64_t *fac, unsigned int nb_doublewords)
> >
> > Why unsigned int?
>
> The return value is 1-256, the size of the type is a bit arbitrary I suppose.
>
> >
> > [...]
> > > diff --git a/s390x/snippets/c/stfle.c b/s390x/snippets/c/stfle.c
> > > new file mode 100644
> > > index 00000000..eb024a6a
> > > --- /dev/null
> > > +++ b/s390x/snippets/c/stfle.c
> > [...]
> > > +int main(void)
> > > +{
> > > + const unsigned int max_fac_len = 8;
> > > + uint64_t res[max_fac_len + 1];
> > > +
> > > + res[0] = max_fac_len - 1;
> > > + asm volatile ( "lg 0,%[len]\n"
> > > + " stfle %[fac]\n"
> > > + " stg 0,%[len]\n"
> > > + : [fac] "=QS"(*(uint64_t(*)[max_fac_len])&res[1]),

Nina, do you mind sending a new version where we have the constraints
simplified, e.g. with just a memory clobber?