lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 1 Jun 2022 14:55:13 -0400
From:   "Jason J. Herne" <jjherne@...ux.ibm.com>
To:     Tony Krowiak <akrowiak@...ux.ibm.com>, linux-s390@...r.kernel.org,
        linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Cc:     freude@...ux.ibm.com, borntraeger@...ibm.com, cohuck@...hat.com,
        mjrosato@...ux.ibm.com, pasic@...ux.ibm.com,
        alex.williamson@...hat.com, kwankhede@...dia.com,
        fiuczy@...ux.ibm.com
Subject: Re: [PATCH v19 13/20] s390/vfio-ap: hot plug/unplug of AP devices
 when probed/removed

On 4/4/22 18:10, Tony Krowiak wrote:
> When an AP queue device is probed or removed, if the mediated device is
> attached to a KVM guest, the mediated device's adapter, domain and
> control domain bitmaps must be filtered to update the guest's APCB and if
> any changes are detected, the guest's APCB must then be hot plugged into
> the guest to reflect those changes to the guest.
> 
> Signed-off-by: Tony Krowiak <akrowiak@...ux.ibm.com>
> ---
>   drivers/s390/crypto/vfio_ap_ops.c | 23 +++++++++++++++++------
>   1 file changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
> index 47f808122ed2..ec5f37d726ec 100644
> --- a/drivers/s390/crypto/vfio_ap_ops.c
> +++ b/drivers/s390/crypto/vfio_ap_ops.c
> @@ -1752,9 +1752,11 @@ int vfio_ap_mdev_probe_queue(struct ap_device *apdev)
>   		vfio_ap_mdev_link_queue(matrix_mdev, q);
>   		memset(apm_delta, 0, sizeof(apm_delta));
>   		set_bit_inv(AP_QID_CARD(q->apqn), apm_delta);
> -		vfio_ap_mdev_filter_matrix(apm_delta,
> -					   matrix_mdev->matrix.aqm,
> -					   matrix_mdev);
> +
> +		if (vfio_ap_mdev_filter_matrix(apm_delta,
> +					       matrix_mdev->matrix.aqm,
> +					       matrix_mdev))
> +			vfio_ap_mdev_update_guest_apcb(matrix_mdev);
>   	}
>   	dev_set_drvdata(&apdev->device, q);
>   	release_update_locks_for_mdev(matrix_mdev);
> @@ -1764,7 +1766,7 @@ int vfio_ap_mdev_probe_queue(struct ap_device *apdev)
>   
>   void vfio_ap_mdev_remove_queue(struct ap_device *apdev)
>   {
> -	unsigned long apid;
> +	unsigned long apid, apqi;
>   	struct vfio_ap_queue *q;
>   	struct ap_matrix_mdev *matrix_mdev;
>   
> @@ -1776,8 +1778,17 @@ void vfio_ap_mdev_remove_queue(struct ap_device *apdev)
>   		vfio_ap_unlink_queue_fr_mdev(q);
>   
>   		apid = AP_QID_CARD(q->apqn);
> -		if (test_bit_inv(apid, q->matrix_mdev->shadow_apcb.apm))
> -			clear_bit_inv(apid, q->matrix_mdev->shadow_apcb.apm);
> +		apqi = AP_QID_QUEUE(q->apqn);
> +
> +		/*
> +		 * If the queue is assigned to the guest's APCB, then remove
> +		 * the adapter's APID from the APCB and hot it into the guest.
> +		 */
> +		if (test_bit_inv(apid, matrix_mdev->shadow_apcb.apm) &&
> +		    test_bit_inv(apqi, matrix_mdev->shadow_apcb.aqm)) {
> +			clear_bit_inv(apid, matrix_mdev->shadow_apcb.apm);
> +			vfio_ap_mdev_update_guest_apcb(matrix_mdev);
> +		}
>   	}
>   
>   	vfio_ap_mdev_reset_queue(q, 1);

Also seems sane.

Reviewed-by: Jason J. Herne <jjherne@...ux.ibm.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ