]> git.baikalelectronics.ru Git - kernel.git/commitdiff
pci_irq_vector() can't be used in atomic context any longer. This conflicts
authorThomas Gleixner <tglx@linutronix.de>
Fri, 29 Apr 2022 13:54:24 +0000 (15:54 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 1 May 2022 16:02:23 +0000 (17:02 +0100)
with the usage of this function in nic_mbx_intr_handler().

Cache the Linux interrupt numbers in struct nicpf and use that cache in the
interrupt handler to select the mailbox.

Fixes: 124f240c5c47 ("genirq/msi: Convert to new functions")
Reported-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Sunil Goutham <sgoutham@marvell.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org
Cc: stable@vger.kernel.org
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2041772
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/thunder/nic_main.c

index f2f1ce81fd9ccd8a365be7ab649070291db62818..0ec65ec634df57c39f7d8dde8a8f30d4c4551b53 100644 (file)
@@ -59,7 +59,7 @@ struct nicpf {
 
        /* MSI-X */
        u8                      num_vec;
-       bool                    irq_allocated[NIC_PF_MSIX_VECTORS];
+       unsigned int            irq_allocated[NIC_PF_MSIX_VECTORS];
        char                    irq_name[NIC_PF_MSIX_VECTORS][20];
 };
 
@@ -1150,7 +1150,7 @@ static irqreturn_t nic_mbx_intr_handler(int irq, void *nic_irq)
        u64 intr;
        u8  vf;
 
-       if (irq == pci_irq_vector(nic->pdev, NIC_PF_INTR_ID_MBOX0))
+       if (irq == nic->irq_allocated[NIC_PF_INTR_ID_MBOX0])
                mbx = 0;
        else
                mbx = 1;
@@ -1176,14 +1176,14 @@ static void nic_free_all_interrupts(struct nicpf *nic)
 
        for (irq = 0; irq < nic->num_vec; irq++) {
                if (nic->irq_allocated[irq])
-                       free_irq(pci_irq_vector(nic->pdev, irq), nic);
-               nic->irq_allocated[irq] = false;
+                       free_irq(nic->irq_allocated[irq], nic);
+               nic->irq_allocated[irq] = 0;
        }
 }
 
 static int nic_register_interrupts(struct nicpf *nic)
 {
-       int i, ret;
+       int i, ret, irq;
        nic->num_vec = pci_msix_vec_count(nic->pdev);
 
        /* Enable MSI-X */
@@ -1201,13 +1201,13 @@ static int nic_register_interrupts(struct nicpf *nic)
                sprintf(nic->irq_name[i],
                        "NICPF Mbox%d", (i - NIC_PF_INTR_ID_MBOX0));
 
-               ret = request_irq(pci_irq_vector(nic->pdev, i),
-                                 nic_mbx_intr_handler, 0,
+               irq = pci_irq_vector(nic->pdev, i);
+               ret = request_irq(irq, nic_mbx_intr_handler, 0,
                                  nic->irq_name[i], nic);
                if (ret)
                        goto fail;
 
-               nic->irq_allocated[i] = true;
+               nic->irq_allocated[i] = irq;
        }
 
        /* Enable mailbox interrupt */