Skip to contentSkip to conversation

scsi: ufs: Fix interrupt error message for shared interrupts

PATCH Applied Adrian Hunter 3 participants 5 messages Aug 11, 2020 – Aug 18, 2020 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 scsi: ufs: Fix interrupt error message for shared interrupts

The interrupt might be shared, in which case it is not an error for the interrupt handler to be called when the interrupt status is zero, so don't print the message unless there was enabled interrupt status.

Fixes 9333d77573485 ("scsi: ufs: Fix irq return code")
---
 drivers/scsi/ufs/ufshcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +1 -1
index cdcf56679b41..bb2543010af9 100644
@@ -5994,7 +5994,7 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba)
 		intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS);
 	} while (intr_status && --retries);
 
-	if (retval == IRQ_NONE) {
+	if (enabled_intr_status && retval == IRQ_NONE) {
 		dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x\n",
 					__func__, intr_status);
 		ufshcd_dump_regs(hba, 0, UFSHCI_REG_SPACE_SIZE, "host_regs: ");
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 2/2 scsi: ufs: Improve interrupt handling for shared interrupts

For shared interrupts, the interrupt status might be zero, so check that first.

---
 drivers/scsi/ufs/ufshcd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/ufs/ufshcd.c +3 -3
index bb2543010af9..c315420e69e8 100644
@@ -5969,7 +5969,7 @@ static irqreturn_t ufshcd_sl_intr(struct ufs_hba *hba, u32 intr_status)
  */
 static irqreturn_t ufshcd_intr(int irq, void *__hba)
 {
-	u32 intr_status, enabled_intr_status;
+	u32 intr_status, enabled_intr_status = 0;
 	irqreturn_t retval = IRQ_NONE;
 	struct ufs_hba *hba = __hba;
 	int retries = hba->nutrs;
@@ -5983,7 +5983,7 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba)
 	 * read, make sure we handle them by checking the interrupt status
 	 * again in a loop until we process all of the reqs before returning.
 	 */
-	do {
+	while (intr_status && retries--) {
 		enabled_intr_status =
 			intr_status & ufshcd_readl(hba, REG_INTERRUPT_ENABLE);
 		if (intr_status)
@@ -5992,7 +5992,7 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba)
 			retval |= ufshcd_sl_intr(hba, enabled_intr_status);
 
 		intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS);
-	} while (intr_status && --retries);
+	}
 
 	if (enabled_intr_status && retval == IRQ_NONE) {
 		dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x\n",
Signature · 1 line
2.17.1
#4 lore raw
In reply to Adrian Hunter
Quoted 3 lines · Adrian Hunter

The interrupt might be shared, in which case it is not an error for the interrupt handler to be called when the interrupt status is zero, so don't print the message unless there was enabled interrupt status.

Applied to 5.9/scsi-fixes, thanks!

[1/2] scsi: ufs: Fix interrupt error message for shared interrupts

      https://git.kernel.org/mkp/scsi/c/6337f58cec03
[2/2] scsi: ufs: Improve interrupt handling for shared interrupts
      https://git.kernel.org/mkp/scsi/c/127d5f7c4b65
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering