]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
vfio: remove dead notifier code
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 7 Apr 2026 17:59:34 +0000 (19:59 +0200)
committerAlex Williamson <alex@shazbot.org>
Fri, 10 Apr 2026 19:32:25 +0000 (13:32 -0600)
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>
Documentation/arch/s390/vfio-ap.rst
drivers/vfio/group.c
drivers/vfio/vfio.h
drivers/vfio/vfio_iommu_type1.c

index eba1991fbdba5f70a342ca1abbe4cd7452f9c4da..ac0c07f76ddd7bfae9ce0d4364001de5bcf46a89 100644 (file)
@@ -431,17 +431,14 @@ matrix device.
 * callback interfaces
 
   open_device:
-    The vfio_ap driver uses this callback to register a
-    VFIO_GROUP_NOTIFY_SET_KVM notifier callback function for the matrix mdev
-    devices. The open_device callback is invoked by userspace to connect the
-    VFIO iommu group for the matrix mdev device to the MDEV bus. Access to the
-    KVM structure used to configure the KVM guest is provided via this callback.
-    The KVM structure, is used to configure the guest's access to the AP matrix
-    defined via the vfio_ap mediated device's sysfs attribute files.
+    the open_device callback is invoked by userspace to connect the
+    VFIO iommu group for the matrix mdev device to the MDEV bus.  The
+    callback retrieves the KVM structure used to configure the KVM guest
+    and configures the guest's access to the AP matrix defined via the
+    vfio_ap mediated device's sysfs attribute files.
 
   close_device:
-    unregisters the VFIO_GROUP_NOTIFY_SET_KVM notifier callback function for the
-    matrix mdev device and deconfigures the guest's AP matrix.
+    this callback deconfigures the guest's AP matrix.
 
   ioctl:
     this callback handles the VFIO_DEVICE_GET_INFO and VFIO_DEVICE_RESET ioctls
@@ -449,9 +446,8 @@ matrix device.
 
 Configure the guest's AP resources
 ----------------------------------
-Configuring the AP resources for a KVM guest will be performed when the
-VFIO_GROUP_NOTIFY_SET_KVM notifier callback is invoked. The notifier
-function is called when userspace connects to KVM. The guest's AP resources are
+Configuring the AP resources for a KVM guest will be performed at the
+time of ``open_device`` and ``close_device``. The guest's AP resources are
 configured via its APCB by:
 
 * Setting the bits in the APM corresponding to the APIDs assigned to the
index d4a53f8c5be000195bde507803d9c300518f0192..b2299e5bc6df348cd6308e7322dc358980dbd03d 100644 (file)
@@ -461,7 +461,6 @@ static int vfio_group_fops_release(struct inode *inode, struct file *filep)
         * Device FDs hold a group file reference, therefore the group release
         * is only called when there are no open devices.
         */
-       WARN_ON(group->notifier.head);
        if (group->container)
                vfio_group_detach_container(group);
        if (group->iommufd) {
@@ -546,7 +545,6 @@ static struct vfio_group *vfio_group_alloc(struct iommu_group *iommu_group,
        /* put in vfio_group_release() */
        iommu_group_ref_get(iommu_group);
        group->type = type;
-       BLOCKING_INIT_NOTIFIER_HEAD(&group->notifier);
 
        return group;
 }
@@ -725,7 +723,6 @@ void vfio_device_remove_group(struct vfio_device *device)
         * properly hold the group reference.
         */
        WARN_ON(!list_empty(&group->device_list));
-       WARN_ON(group->notifier.head);
 
        /*
         * Revoke all users of group->iommu_group. At this point we know there
index 50128da18bcaf95f44f933018a59c1450f4d0d07..0854f3fa1a22083b620e882be32d3d3a30a49fcb 100644 (file)
@@ -90,7 +90,6 @@ struct vfio_group {
        struct mutex                    group_lock;
        struct kvm                      *kvm;
        struct file                     *opened_file;
-       struct blocking_notifier_head   notifier;
        struct iommufd_ctx              *iommufd;
        spinlock_t                      kvm_ref_lock;
        unsigned int                    cdev_device_open_cnt;
index 03cefdf99a4a4a6510f75c0d5ca06c955ff9d014..c8151ba54de33a848803adf2c2fc53a721ef7048 100644 (file)
@@ -36,7 +36,6 @@
 #include <linux/uaccess.h>
 #include <linux/vfio.h>
 #include <linux/workqueue.h>
-#include <linux/notifier.h>
 #include <linux/mm_inline.h>
 #include <linux/overflow.h>
 #include "vfio.h"