]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
vfio/pci: Use never-managed version of pci_intx()
authorPhilipp Stanner <pstanner@redhat.com>
Mon, 9 Dec 2024 13:06:28 +0000 (14:06 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Sat, 18 Jan 2025 20:38:48 +0000 (14:38 -0600)
pci_intx() is a hybrid function which can sometimes be managed through
devres. To remove this hybrid nature from pci_intx(), it is necessary to
port users to either an always-managed or a never-managed version.

vfio enables its PCI device with pci_enable_device(). Thus, it needs the
never-managed version.

Replace pci_intx() with pci_intx_unmanaged().

Link: https://lore.kernel.org/r/20241209130632.132074-8-pstanner@redhat.com
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/pci/vfio_pci_core.c
drivers/vfio/pci/vfio_pci_intrs.c

index 1ab58da9f38a6eae6077cbb88efb1d667215efee..90240c8d51aaaba289193384b81a4265a14aa444 100644 (file)
@@ -498,7 +498,7 @@ int vfio_pci_core_enable(struct vfio_pci_core_device *vdev)
                if (vfio_pci_nointx(pdev)) {
                        pci_info(pdev, "Masking broken INTx support\n");
                        vdev->nointx = true;
-                       pci_intx(pdev, 0);
+                       pci_intx_unmanaged(pdev, 0);
                } else
                        vdev->pci_2_3 = pci_intx_mask_supported(pdev);
        }
index 8382c583433565f9cecbed9fefbd0cbbcbcc809f..40abb0b937a2757129932f543f7cb82a6fce7ee6 100644 (file)
@@ -118,7 +118,7 @@ static bool __vfio_pci_intx_mask(struct vfio_pci_core_device *vdev)
         */
        if (unlikely(!is_intx(vdev))) {
                if (vdev->pci_2_3)
-                       pci_intx(pdev, 0);
+                       pci_intx_unmanaged(pdev, 0);
                goto out_unlock;
        }
 
@@ -132,7 +132,7 @@ static bool __vfio_pci_intx_mask(struct vfio_pci_core_device *vdev)
                 * mask, not just when something is pending.
                 */
                if (vdev->pci_2_3)
-                       pci_intx(pdev, 0);
+                       pci_intx_unmanaged(pdev, 0);
                else
                        disable_irq_nosync(pdev->irq);
 
@@ -178,7 +178,7 @@ static int vfio_pci_intx_unmask_handler(void *opaque, void *data)
         */
        if (unlikely(!is_intx(vdev))) {
                if (vdev->pci_2_3)
-                       pci_intx(pdev, 1);
+                       pci_intx_unmanaged(pdev, 1);
                goto out_unlock;
        }
 
@@ -296,7 +296,7 @@ static int vfio_intx_enable(struct vfio_pci_core_device *vdev,
         */
        ctx->masked = vdev->virq_disabled;
        if (vdev->pci_2_3) {
-               pci_intx(pdev, !ctx->masked);
+               pci_intx_unmanaged(pdev, !ctx->masked);
                irqflags = IRQF_SHARED;
        } else {
                irqflags = ctx->masked ? IRQF_NO_AUTOEN : 0;
@@ -569,7 +569,7 @@ static void vfio_msi_disable(struct vfio_pci_core_device *vdev, bool msix)
         * via their shutdown paths.  Restore for NoINTx devices.
         */
        if (vdev->nointx)
-               pci_intx(pdev, 0);
+               pci_intx_unmanaged(pdev, 0);
 
        vdev->irq_type = VFIO_PCI_NUM_IRQS;
 }