Skip to content

Commit cbf367d

Browse files
Rorie ReyesVasily Gorbik
authored andcommitted
s390/vfio-ap: Notify userspace that guest's AP config changed when mdev removed
The guest's AP configuration is cleared when the mdev is removed, so userspace must be notified that the AP configuration has changed. To this end, this patch: * Removes call to 'signal_guest_ap_cfg_changed()' function from the 'vfio_ap_mdev_unset_kvm()' function because it has no affect given it is called after the mdev fd is closed. * Adds call to 'signal_guest_ap_cfg_changed()' function to the 'vfio_ap_mdev_request()' function to notify userspace that the guest's AP configuration has changed before signaling the request to remove the mdev. Minor change - Fixed an indentation issue in function 'signal_guest_ap_cfg_changed()' Fixes: 07d8904 ("s390/vfio-ap: Signal eventfd when guest AP configuration is changed") Signed-off-by: Rorie Reyes <[email protected]> Reviewed-by: Anthony Krowiak <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vasily Gorbik <[email protected]>
1 parent c94bff6 commit cbf367d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

drivers/s390/crypto/vfio_ap_ops.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -652,8 +652,8 @@ static void vfio_ap_matrix_init(struct ap_config_info *info,
652652

653653
static void signal_guest_ap_cfg_changed(struct ap_matrix_mdev *matrix_mdev)
654654
{
655-
if (matrix_mdev->cfg_chg_trigger)
656-
eventfd_signal(matrix_mdev->cfg_chg_trigger);
655+
if (matrix_mdev->cfg_chg_trigger)
656+
eventfd_signal(matrix_mdev->cfg_chg_trigger);
657657
}
658658

659659
static void vfio_ap_mdev_update_guest_apcb(struct ap_matrix_mdev *matrix_mdev)
@@ -1870,7 +1870,6 @@ static void vfio_ap_mdev_unset_kvm(struct ap_matrix_mdev *matrix_mdev)
18701870
get_update_locks_for_kvm(kvm);
18711871

18721872
kvm_arch_crypto_clear_masks(kvm);
1873-
signal_guest_ap_cfg_changed(matrix_mdev);
18741873
vfio_ap_mdev_reset_queues(matrix_mdev);
18751874
kvm_put_kvm(kvm);
18761875
matrix_mdev->kvm = NULL;
@@ -2057,6 +2056,13 @@ static void vfio_ap_mdev_request(struct vfio_device *vdev, unsigned int count)
20572056

20582057
matrix_mdev = container_of(vdev, struct ap_matrix_mdev, vdev);
20592058

2059+
get_update_locks_for_mdev(matrix_mdev);
2060+
2061+
if (matrix_mdev->kvm) {
2062+
kvm_arch_crypto_clear_masks(matrix_mdev->kvm);
2063+
signal_guest_ap_cfg_changed(matrix_mdev);
2064+
}
2065+
20602066
if (matrix_mdev->req_trigger) {
20612067
if (!(count % 10))
20622068
dev_notice_ratelimited(dev,
@@ -2068,6 +2074,8 @@ static void vfio_ap_mdev_request(struct vfio_device *vdev, unsigned int count)
20682074
dev_notice(dev,
20692075
"No device request registered, blocked until released by user\n");
20702076
}
2077+
2078+
release_update_locks_for_mdev(matrix_mdev);
20712079
}
20722080

20732081
static int vfio_ap_mdev_get_device_info(unsigned long arg)

0 commit comments

Comments
 (0)