Re: [kvm-unit-tests PATCH 4/6] lib: s390x: sie: Improve validity handling and make it vm specific

Nico Boehr
2022-08-02T07:23:57Z

Quoting Janosch Frank (2022-07-29 10:26:31)
> The current library doesn't support running multiple vms at once as it
> stores the validity once and not per vm. Let's move the validity
> handling into the vm and introduce a new function to retrieve the vir.
>
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>

Reviewed-by: Nico Boehr <nrb@linux.ibm.com>

One tiny suggestion below.

[...]
> diff --git a/lib/s390x/sie.c b/lib/s390x/sie.c
> index 00aff713..c3a53ad6 100644
> --- a/lib/s390x/sie.c
> +++ b/lib/s390x/sie.c
> @@ -15,19 +15,21 @@
> #include <libcflat.h>
> #include <alloc_page.h>
>
> -static bool validity_expected;
> -static uint16_t vir; /* Validity interception reason */
> -
> -void sie_expect_validity(void)
> +void sie_expect_validity(struct vm *vm)
> {
> - validity_expected = true;
> - vir = 0;
> + vm->validity_expected = true;
> }
>
> -void sie_check_validity(uint16_t vir_exp)
> +uint16_t sie_get_validity(struct vm *vm)
> {
> + return vm->sblk->ipb >> 16;
> +}

Since one should only call this function when we had a validity, maybe add:

assert (vm->sblk->icptcode == ICPT_VALIDITY);