Skip to content

Commit 3c443ec

Browse files
bonziniawilliam
authored andcommitted
vfio: remove dead notifier code
group->notifier is dead code. VFIO initializes it and checks it for emptiness on teardown, but nobody ever registers on it or triggers it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Anthony Krowiak <akrowiak@linux.ibm.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20260407175934.1602711-1-pbonzini@redhat.com Signed-off-by: Alex Williamson <alex@shazbot.org>
1 parent 7487d8d commit 3c443ec

4 files changed

Lines changed: 8 additions & 17 deletions

File tree

Documentation/arch/s390/vfio-ap.rst

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -431,27 +431,23 @@ matrix device.
431431
* callback interfaces
432432

433433
open_device:
434-
The vfio_ap driver uses this callback to register a
435-
VFIO_GROUP_NOTIFY_SET_KVM notifier callback function for the matrix mdev
436-
devices. The open_device callback is invoked by userspace to connect the
437-
VFIO iommu group for the matrix mdev device to the MDEV bus. Access to the
438-
KVM structure used to configure the KVM guest is provided via this callback.
439-
The KVM structure, is used to configure the guest's access to the AP matrix
440-
defined via the vfio_ap mediated device's sysfs attribute files.
434+
the open_device callback is invoked by userspace to connect the
435+
VFIO iommu group for the matrix mdev device to the MDEV bus. The
436+
callback retrieves the KVM structure used to configure the KVM guest
437+
and configures the guest's access to the AP matrix defined via the
438+
vfio_ap mediated device's sysfs attribute files.
441439

442440
close_device:
443-
unregisters the VFIO_GROUP_NOTIFY_SET_KVM notifier callback function for the
444-
matrix mdev device and deconfigures the guest's AP matrix.
441+
this callback deconfigures the guest's AP matrix.
445442

446443
ioctl:
447444
this callback handles the VFIO_DEVICE_GET_INFO and VFIO_DEVICE_RESET ioctls
448445
defined by the vfio framework.
449446

450447
Configure the guest's AP resources
451448
----------------------------------
452-
Configuring the AP resources for a KVM guest will be performed when the
453-
VFIO_GROUP_NOTIFY_SET_KVM notifier callback is invoked. The notifier
454-
function is called when userspace connects to KVM. The guest's AP resources are
449+
Configuring the AP resources for a KVM guest will be performed at the
450+
time of ``open_device`` and ``close_device``. The guest's AP resources are
455451
configured via its APCB by:
456452

457453
* Setting the bits in the APM corresponding to the APIDs assigned to the

drivers/vfio/group.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,6 @@ static int vfio_group_fops_release(struct inode *inode, struct file *filep)
461461
* Device FDs hold a group file reference, therefore the group release
462462
* is only called when there are no open devices.
463463
*/
464-
WARN_ON(group->notifier.head);
465464
if (group->container)
466465
vfio_group_detach_container(group);
467466
if (group->iommufd) {
@@ -546,7 +545,6 @@ static struct vfio_group *vfio_group_alloc(struct iommu_group *iommu_group,
546545
/* put in vfio_group_release() */
547546
iommu_group_ref_get(iommu_group);
548547
group->type = type;
549-
BLOCKING_INIT_NOTIFIER_HEAD(&group->notifier);
550548

551549
return group;
552550
}
@@ -725,7 +723,6 @@ void vfio_device_remove_group(struct vfio_device *device)
725723
* properly hold the group reference.
726724
*/
727725
WARN_ON(!list_empty(&group->device_list));
728-
WARN_ON(group->notifier.head);
729726

730727
/*
731728
* Revoke all users of group->iommu_group. At this point we know there

drivers/vfio/vfio.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ struct vfio_group {
9090
struct mutex group_lock;
9191
struct kvm *kvm;
9292
struct file *opened_file;
93-
struct blocking_notifier_head notifier;
9493
struct iommufd_ctx *iommufd;
9594
spinlock_t kvm_ref_lock;
9695
unsigned int cdev_device_open_cnt;

drivers/vfio/vfio_iommu_type1.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include <linux/uaccess.h>
3737
#include <linux/vfio.h>
3838
#include <linux/workqueue.h>
39-
#include <linux/notifier.h>
4039
#include <linux/mm_inline.h>
4140
#include <linux/overflow.h>
4241
#include "vfio.h"

0 commit comments

Comments
 (0)