[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <f937b6c6-e655-cf8a-c00b-22bdc2b98093@linux.ibm.com>
Date: Thu, 12 Jul 2018 16:37:11 +0200
From: Tony Krowiak <akrowiak@...ux.ibm.com>
To: Halil Pasic <pasic@...ux.ibm.com>,
Tony Krowiak <akrowiak@...ux.vnet.ibm.com>,
linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Cc: freude@...ibm.com, schwidefsky@...ibm.com,
heiko.carstens@...ibm.com, borntraeger@...ibm.com,
cohuck@...hat.com, kwankhede@...dia.com,
bjsdjshi@...ux.vnet.ibm.com, pbonzini@...hat.com,
alex.williamson@...hat.com, pmorel@...ux.vnet.ibm.com,
alifm@...ux.vnet.ibm.com, mjrosato@...ux.vnet.ibm.com,
jjherne@...ux.vnet.ibm.com, thuth@...hat.com,
pasic@...ux.vnet.ibm.com, berrange@...hat.com,
fiuczy@...ux.vnet.ibm.com, buendgen@...ibm.com
Subject: Re: [PATCH v6 15/21] s390: vfio-ap: configure the guest's AP matrix
On 07/12/2018 03:28 PM, Halil Pasic wrote:
>
>
> On 06/29/2018 11:11 PM, Tony Krowiak wrote:
>> From: Tony Krowiak <akrowiak@...ux.ibm.com>
>>
>> Configures the AP adapters, usage domains and control domains for the
>
> [..]
>
>> +static inline void kvm_ap_clear_crycb_masks(struct ap_matrix_mdev
>> *matrix_mdev)
>> +{
>> + memset(&matrix_mdev->kvm->arch.crypto.crycb->apcb0, 0,
>> + sizeof(matrix_mdev->kvm->arch.crypto.crycb->apcb0));
>> + memset(&matrix_mdev->kvm->arch.crypto.crycb->apcb1, 0,
>> + sizeof(matrix_mdev->kvm->arch.crypto.crycb->apcb1));
>> +}
>> +
>> +static void kvm_ap_set_crycb_masks(struct ap_matrix_mdev *matrix_mdev)
>> +{
>> + int nbytes;
>> + unsigned long *apm, *aqm, *adm;
>> +
>> + kvm_ap_clear_crycb_masks(matrix_mdev);
>> +
>> + apm = kvm_ap_get_crycb_apm(matrix_mdev);
>> + aqm = kvm_ap_get_crycb_aqm(matrix_mdev);
>> + adm = kvm_ap_get_crycb_adm(matrix_mdev);
>> +
>> + nbytes = KVM_AP_MASK_BYTES(matrix_mdev->matrix.apm_max + 1);
>> + memcpy(apm, matrix_mdev->matrix.apm, nbytes);
>> +
>> + nbytes = KVM_AP_MASK_BYTES(matrix_mdev->matrix.aqm_max + 1);
>> + memcpy(aqm, matrix_mdev->matrix.aqm, nbytes);
>> +
>> + /*
>> + * Merge the AQM and ADM since the ADM is a superset of the
>> + * AQM by agreed-upon convention.
>> + */
>> + bitmap_or(adm, matrix_mdev->matrix.adm, matrix_mdev->matrix.aqm,
>> + matrix_mdev->matrix.adm_max + 1);
>> +}
>> +
>
> [..]
>
>> +
>> +static int kvm_ap_configure_matrix(struct ap_matrix_mdev *matrix_mdev)
>> +{
>> + int ret = 0;
>> +
>> + mutex_lock(&matrix_mdev->kvm->lock);
>> +
>> + ret = kvm_ap_validate_queue_sharing(matrix_mdev);
>> + if (ret)
>> + goto done;
>> +
>> + kvm_ap_set_crycb_masks(matrix_mdev);
>> +
>> +done:
>> + mutex_unlock(&matrix_mdev->kvm->lock);
>> +
>> + return ret;
>> +}
>> +
>> +void kvm_ap_deconfigure_matrix(struct ap_matrix_mdev *matrix_mdev)
>> +{
>> + mutex_lock(&matrix_mdev->kvm->lock);
>> + kvm_ap_clear_crycb_masks(matrix_mdev);
>
> The guest may be running at this point of time, or?
>
> I think you need our safe update operation that we used to use for the
> initial set too, but then somebody was like it ain't necessary because
> we don't support hotplug (yet).
I agree.
>
>
>
> Regards,
> Halil
>
>> + mutex_unlock(&matrix_mdev->kvm->lock);
>> +}
>> +
Powered by blists - more mailing lists