Re: [PATCH v2 7/7] KVM: s390: enable MSA9 keywrapping functions depending on cpu model

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

 



On 24.04.19 13:56, Christian Borntraeger wrote:
> Instead of adding a new machine option to disable/enable the keywrapping
> options of pckmo (like for AES and DEA) we can now use the CPU model to
> decide. As ECC is also wrapped with the AES key we need that to be
> enabled.
> 
> Signed-off-by: Christian Borntraeger <borntraeger@xxxxxxxxxx>
> ---
>  arch/s390/include/asm/kvm_host.h |  1 +
>  arch/s390/kvm/kvm-s390.c         | 30 +++++++++++++++++++++++++++++-
>  arch/s390/kvm/vsie.c             |  5 ++++-
>  3 files changed, 34 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
> index c47e22bba87f..e224246ff93c 100644
> --- a/arch/s390/include/asm/kvm_host.h
> +++ b/arch/s390/include/asm/kvm_host.h
> @@ -278,6 +278,7 @@ struct kvm_s390_sie_block {
>  #define ECD_HOSTREGMGMT	0x20000000
>  #define ECD_MEF		0x08000000
>  #define ECD_ETOKENF	0x02000000
> +#define ECD_ECC		0x00200000
>  	__u32	ecd;			/* 0x01c8 */
>  	__u8	reserved1cc[18];	/* 0x01cc */
>  	__u64	pp;			/* 0x01de */
> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> index 38ca8324a91a..403746fcc16e 100644
> --- a/arch/s390/kvm/kvm-s390.c
> +++ b/arch/s390/kvm/kvm-s390.c
> @@ -2890,6 +2890,28 @@ void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
>  	vcpu->arch.enabled_gmap = vcpu->arch.gmap;
>  }
>  
> +static bool kvm_has_pckmo_subfunc(struct kvm *kvm, unsigned long nr)
> +{
> +	if (test_bit_inv(nr, (unsigned long *)&kvm->arch.model.subfuncs.pckmo) &&
> +	    test_bit_inv(nr, (unsigned long *)&kvm_s390_available_subfunc.pckmo))
> +		return true;
> +	return false;
> +}
> +
> +static bool kvm_has_pckmo_ecc(struct kvm *kvm)
> +{
> +	/*
> +	 * Any of the ecc pckmo functions as well as the AES wrapping
> +	 * value need to be present to enable ECC wrapping
> +	 */

The comment is slightly confusing as aes is checked by the caller. I
would have expected the check here. Not sure if splitting up handling,
rephrasing the comment or simply leaving it as is is better.

Reviewed-by: David Hildenbrand <david@xxxxxxxxxx>

-- 

Thanks,

David / dhildenb



[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