cxl/mbox: Allow for IRQ_NONE case in the isr
authorDavidlohr Bueso <dave@stgolabs.net>
Mon, 12 Jun 2023 18:10:32 +0000 (11:10 -0700)
committerDan Williams <dan.j.williams@intel.com>
Sun, 25 Jun 2023 21:54:51 +0000 (14:54 -0700)
For cases when the mailbox background operation is not complete,
do not "handle" the interrupt, as it was not from this device.
And furthermore there are no racy scenarios such as the hw being
out of sync with the driver and starting a new background op
behind its back.

Reported-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Fixes: ccadf1310fb (cxl/mbox: Add background cmd handling machinery)
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20230612181038.14421-2-dave@stgolabs.net
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/pci.c

index a78e40e6d0e0fd1374e9da5b1f088f6ce3324809..4b2575502f495a106ead6969f8ad85502e0c9d2c 100644 (file)
@@ -118,9 +118,11 @@ static irqreturn_t cxl_pci_mbox_irq(int irq, void *id)
        struct cxl_dev_id *dev_id = id;
        struct cxl_dev_state *cxlds = dev_id->cxlds;
 
+       if (!cxl_mbox_background_complete(cxlds))
+               return IRQ_NONE;
+
        /* short-circuit the wait in __cxl_pci_mbox_send_cmd() */
-       if (cxl_mbox_background_complete(cxlds))
-               rcuwait_wake_up(&cxlds->mbox_wait);
+       rcuwait_wake_up(&cxlds->mbox_wait);
 
        return IRQ_HANDLED;
 }