Re: [kvm-unit-tests PATCH v3 3/7] s390x: Add sie_is_pv

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

 



On Thu, 20 Jun 2024 16:16:56 +0200
Nina Schoetterl-Glausch <nsg@xxxxxxxxxxxxx> wrote:

> Add a function to check if a guest VM is currently running protected.
> 
> Signed-off-by: Nina Schoetterl-Glausch <nsg@xxxxxxxxxxxxx>

Reviewed-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>

> ---
>  lib/s390x/sie.h | 6 ++++++
>  lib/s390x/sie.c | 4 ++--
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/s390x/sie.h b/lib/s390x/sie.h
> index c1724cf2..53cd767f 100644
> --- a/lib/s390x/sie.h
> +++ b/lib/s390x/sie.h
> @@ -281,6 +281,12 @@ void sie_expect_validity(struct vm *vm);
>  uint16_t sie_get_validity(struct vm *vm);
>  void sie_check_validity(struct vm *vm, uint16_t vir_exp);
>  void sie_handle_validity(struct vm *vm);
> +
> +static inline bool sie_is_pv(struct vm *vm)
> +{
> +	return vm->sblk->sdf == 2;
> +}
> +
>  void sie_guest_sca_create(struct vm *vm);
>  void sie_guest_create(struct vm *vm, uint64_t guest_mem, uint64_t guest_mem_len);
>  void sie_guest_destroy(struct vm *vm);
> diff --git a/lib/s390x/sie.c b/lib/s390x/sie.c
> index 40936bd2..0fa915cf 100644
> --- a/lib/s390x/sie.c
> +++ b/lib/s390x/sie.c
> @@ -59,7 +59,7 @@ void sie(struct vm *vm)
>  	/* When a pgm int code is set, we'll never enter SIE below. */
>  	assert(!read_pgm_int_code());
>  
> -	if (vm->sblk->sdf == 2)
> +	if (sie_is_pv(vm))
>  		memcpy(vm->sblk->pv_grregs, vm->save_area.guest.grs,
>  		       sizeof(vm->save_area.guest.grs));
>  
> @@ -98,7 +98,7 @@ void sie(struct vm *vm)
>  	/* restore the old CR 13 */
>  	lctlg(13, old_cr13);
>  
> -	if (vm->sblk->sdf == 2)
> +	if (sie_is_pv(vm))
>  		memcpy(vm->save_area.guest.grs, vm->sblk->pv_grregs,
>  		       sizeof(vm->save_area.guest.grs));
>  }





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux