Skip to content

Commit 7107822

Browse files
Tony KrowiakVasily Gorbik
authored andcommitted
s390/vfio-ap: fix kernel doc and signature of group notifier functions
The vfio_ap device driver registers a group notifier function to handle the VFIO_GROUP_NOTIFY_SET_KVM event signalling the KVM pointer has been set or cleared. There are two helper functions invoked by the handler function: One called when the KVM pointer has been set, and the other when the pointer is cleared. The kernel doc for both of these functions contains a comment introduced by commit 0cc00c8 (s390/vfio-ap: fix circular lockdep when setting/clearing crypto masks) that is no longer valid. This patch removes this comment from the kernel doc of each helper function. Commit 86956e7 (s390/vfio-ap: replace open coded locks for VFIO_GROUP_NOTIFY_SET_KVM notification) added a parameter to the signature of the helper function that handles the event indicating the KVM pointer has been cleared. The parameter added was the KVM pointer itself. One of the function's primary purposes is to clear the KVM pointer from the ap_matrix_mdev instance in which it is stored. Since the callers of this function derive the KVM pointer passed to the function from the ap_matrix_mdev object itself, it is completely unnecessary to include this parameter in the function's signature since it can simply be retrieved from the ap_matrix_mdev object which is also passed in. This patch removes the KVM pointer from the function's signature. Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
1 parent ed0192b commit 7107822

1 file changed

Lines changed: 5 additions & 19 deletions

File tree

drivers/s390/crypto/vfio_ap_ops.c

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,13 +1189,6 @@ static const struct attribute_group *vfio_ap_mdev_attr_groups[] = {
11891189
* @matrix_mdev: a mediated matrix device
11901190
* @kvm: reference to KVM instance
11911191
*
1192-
* Note: The matrix_dev->lock must be taken prior to calling
1193-
* this function; however, the lock will be temporarily released while the
1194-
* guest's AP configuration is set to avoid a potential lockdep splat.
1195-
* The kvm->lock is taken to set the guest's AP configuration which, under
1196-
* certain circumstances, will result in a circular lock dependency if this is
1197-
* done under the @matrix_mdev->lock.
1198-
*
11991192
* Return: 0 if no other mediated matrix device has a reference to @kvm;
12001193
* otherwise, returns an -EPERM.
12011194
*/
@@ -1269,18 +1262,11 @@ static int vfio_ap_mdev_iommu_notifier(struct notifier_block *nb,
12691262
* by @matrix_mdev.
12701263
*
12711264
* @matrix_mdev: a matrix mediated device
1272-
* @kvm: the pointer to the kvm structure being unset.
1273-
*
1274-
* Note: The matrix_dev->lock must be taken prior to calling
1275-
* this function; however, the lock will be temporarily released while the
1276-
* guest's AP configuration is cleared to avoid a potential lockdep splat.
1277-
* The kvm->lock is taken to clear the guest's AP configuration which, under
1278-
* certain circumstances, will result in a circular lock dependency if this is
1279-
* done under the @matrix_mdev->lock.
12801265
*/
1281-
static void vfio_ap_mdev_unset_kvm(struct ap_matrix_mdev *matrix_mdev,
1282-
struct kvm *kvm)
1266+
static void vfio_ap_mdev_unset_kvm(struct ap_matrix_mdev *matrix_mdev)
12831267
{
1268+
struct kvm *kvm = matrix_mdev->kvm;
1269+
12841270
if (kvm && kvm->arch.crypto.crycbd) {
12851271
down_write(&kvm->arch.crypto.pqap_hook_rwsem);
12861272
kvm->arch.crypto.pqap_hook = NULL;
@@ -1311,7 +1297,7 @@ static int vfio_ap_mdev_group_notifier(struct notifier_block *nb,
13111297
matrix_mdev = container_of(nb, struct ap_matrix_mdev, group_notifier);
13121298

13131299
if (!data)
1314-
vfio_ap_mdev_unset_kvm(matrix_mdev, matrix_mdev->kvm);
1300+
vfio_ap_mdev_unset_kvm(matrix_mdev);
13151301
else if (vfio_ap_mdev_set_kvm(matrix_mdev, data))
13161302
notify_rc = NOTIFY_DONE;
13171303

@@ -1448,7 +1434,7 @@ static void vfio_ap_mdev_close_device(struct vfio_device *vdev)
14481434
&matrix_mdev->iommu_notifier);
14491435
vfio_unregister_notifier(vdev->dev, VFIO_GROUP_NOTIFY,
14501436
&matrix_mdev->group_notifier);
1451-
vfio_ap_mdev_unset_kvm(matrix_mdev, matrix_mdev->kvm);
1437+
vfio_ap_mdev_unset_kvm(matrix_mdev);
14521438
}
14531439

14541440
static int vfio_ap_mdev_get_device_info(unsigned long arg)

0 commit comments

Comments
 (0)