Re: [kvm-unit-tests PATCH v4 4/6] s390x: Add library functions for exiting from snippet

Nico Boehr
2024-10-18T10:56:19Z

Quoting Janosch Frank (2024-10-18 10:02:37)
[...]
> > +static inline uint64_t snippet_get_force_exit_value(struct vm *vm)
> > +{
> > + struct kvm_s390_sie_block *sblk = vm->sblk;
> > +
> > + assert(snippet_is_force_exit_value(vm));
> > +
> > + return vm->save_area.guest.grs[sblk_ip_as_diag(sblk).r_1];
> > +}
>
> The cpu address parameter for 9C is 16 bit.
> While we could make it 64 bit for snippets I don't see a reason to do
> so. The 16 bits are enough to indicate something to the host which can
> then go and fetch memory for more data.

Mh, how exactly would you "fetch memory"? That requires knowledge on where
things are in guest memory which can be painful to figure out from the
host.

I've found it useful to be able to pass a pointer from guest to host. Maybe
a diag500 is the better option? gr2 contains the cookie which is a 64-bit
value - see Linux' Documentation/virt/kvm/s390/s390-diag.rst.

P.S. Did I miss the part in the docs where the 16-bit restriction of 9c is
documented or is it missing?