powerpc/msi: Fix deassociation of MSI descriptors
authorMarc Zyngier <maz@kernel.org>
Sat, 17 Dec 2022 10:46:44 +0000 (10:46 +0000)
committerMarc Zyngier <maz@kernel.org>
Sat, 17 Dec 2022 10:58:48 +0000 (10:58 +0000)
Since 2f2940d16823 ("genirq/msi: Remove filter from
msi_free_descs_free_range()"), the core MSI code relies on the
msi_desc->irq field to have been cleared before the descriptor
can be freed, as it indicates that there is no association with
a device anymore.

The irq domain code provides this guarantee, and so does s390,
which is one of the two architectures not using irq domains for
MSIs.

Powerpc, however, is missing this particular requirements,
leading in a splat and leaked MSI descriptors.

Adding the now required irq reset to the handful of powerpc backends
that implement MSIs fixes that particular problem.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/70dab88e-6119-0c12-7c6a-61bcbe239f66@roeck-us.net
arch/powerpc/platforms/4xx/hsta_msi.c
arch/powerpc/platforms/cell/axon_msi.c
arch/powerpc/platforms/pasemi/msi.c
arch/powerpc/sysdev/fsl_msi.c
arch/powerpc/sysdev/mpic_u3msi.c

index d4f7fff1fc8718b27be467880202c206a3037adb..e11b57a62b0543bd503ae7af0d24dcc2deeba713 100644 (file)
@@ -115,6 +115,7 @@ static void hsta_teardown_msi_irqs(struct pci_dev *dev)
                msi_bitmap_free_hwirqs(&ppc4xx_hsta_msi.bmp, irq, 1);
                pr_debug("%s: Teardown IRQ %u (index %u)\n", __func__,
                         entry->irq, irq);
+               entry->irq = 0;
        }
 }
 
index 5b012abca773d03fc6d1c728f3aa5112c4550107..0c11aad896c7932e9ed80522cd8e8bc63c0700c3 100644 (file)
@@ -289,6 +289,7 @@ static void axon_msi_teardown_msi_irqs(struct pci_dev *dev)
        msi_for_each_desc(entry, &dev->dev, MSI_DESC_ASSOCIATED) {
                irq_set_msi_desc(entry->irq, NULL);
                irq_dispose_mapping(entry->irq);
+               entry->irq = 0;
        }
 }
 
index dc1846660005c0c3b2e403a0f7c730847e803048..166c97fff16d2f0baa5d06439d37e250431696af 100644 (file)
@@ -66,6 +66,7 @@ static void pasemi_msi_teardown_msi_irqs(struct pci_dev *pdev)
                hwirq = virq_to_hw(entry->irq);
                irq_set_msi_desc(entry->irq, NULL);
                irq_dispose_mapping(entry->irq);
+               entry->irq = 0;
                msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap, hwirq, ALLOC_CHUNK);
        }
 }
index 73c2d70706c0add48ea9553fec807c6953cb5a7d..57978a44d55b691ac2c5ed9bff726fe3ff409974 100644 (file)
@@ -132,6 +132,7 @@ static void fsl_teardown_msi_irqs(struct pci_dev *pdev)
                msi_data = irq_get_chip_data(entry->irq);
                irq_set_msi_desc(entry->irq, NULL);
                irq_dispose_mapping(entry->irq);
+               entry->irq = 0;
                msi_bitmap_free_hwirqs(&msi_data->bitmap, hwirq, 1);
        }
 }
index 1d8cfdfdf115ec284f3b615d48dff21d5fdef414..492cb03c0b623581f9165fcef8d1e99d38fd5c89 100644 (file)
@@ -108,6 +108,7 @@ static void u3msi_teardown_msi_irqs(struct pci_dev *pdev)
                hwirq = virq_to_hw(entry->irq);
                irq_set_msi_desc(entry->irq, NULL);
                irq_dispose_mapping(entry->irq);
+               entry->irq = 0;
                msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap, hwirq, 1);
        }
 }