Skip to contentSkip to conversation

qla2xxx: Handle the INTx not connected while passing through

PATCH Applied Shivaprasad G Bhat 5 participants 8 messages May 15 – Aug 7

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qla2xxx: Handle the INTx not connected while passing through

The PCI_INTERRUPT_PIN reports if the device supports the INTx. However, when the device is assigned to a guest via vfio, the PCI_INTERRUPT_PIN is set to 0(i.e none) if the line is not connected and|or the platform cannot route the interrupt.

In such cases, the guest PCI_INTERRUPT_PIN is 0 and the port number becomes -1(255, uint8_t underflow) for qla[25|27|28]xx and qla2031 devices. The flt_region_nvram is never set, and subsequently the lun detection fails. Below warnings show the NVRAM configuration failure.

[]-0073:1: Inconsistent NVRAM checksum=0xffffffc0 id=HCAM version=0x100. []-0074:1: Falling back to functioning (yet invalid -- WWPN) defaults. []-0076:1: NVRAM configuration failed.

The patch handles the case, and sets the port_no to devfn like its done everywhere else.

Reference: commit 2bd42b03ab6b ("vfio/pci: Virtualize zero INTx PIN if no pdev->irq")

---
 drivers/scsi/qla2xxx/qla_os.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +10 -5
index 72b1c28e4dae..a8d6a0a021f4 100644
@@ -2803,11 +2803,16 @@ qla2x00_set_isp_flags(struct qla_hw_data *ha)
 	else {
 		/* Get adapter physical port no from interrupt pin register. */
 		pci_read_config_byte(ha->pdev, PCI_INTERRUPT_PIN, &ha->port_no);
-		if (IS_QLA25XX(ha) || IS_QLA2031(ha) ||
-		    IS_QLA27XX(ha) || IS_QLA28XX(ha))
-			ha->port_no--;
-		else
-			ha->port_no = !(ha->port_no & 1);
+		if (ha->port_no == 0) {
+			/* None of INT[A|B|C|D], may be virtualized by vfio */
+			ha->port_no = PCI_FUNC(ha->pdev->devfn);
+		} else {
+			if (IS_QLA25XX(ha) || IS_QLA2031(ha) ||
+			    IS_QLA27XX(ha) || IS_QLA28XX(ha))
+				ha->port_no--;
+			else
+				ha->port_no = !(ha->port_no & 1);
+		}
 	}
 
 	ql_dbg_pci(ql_dbg_init, ha->pdev, 0x000b,
#1 lore raw

PATCH 1/1 qla2xxx: Handle the INTx not connected while passing through

Hi Shiva,

I have tested this patch and can confirm it resolves the issue. Could you please add the following tags to the patch in v2:

Thanks,
Priya A

-------- Forwarded Message --------
Subject: [PATCH] [SCSI] qla2xxx: Handle the INTx not connected while passing through
Date: Fri, 15 May 2026 13:45:18 +0000
From: Shivaprasad G Bhat <[email protected]>
To: [email protected], [email protected], [email protected], [email protected]
CC: [email protected], [email protected], [email protected], [email protected], [email protected]

The PCI_INTERRUPT_PIN reports if the device supports the INTx. However, when the device is assigned to a guest via vfio, the PCI_INTERRUPT_PIN is set to 0(i.e none) if the line is not connected and|or the platform cannot route the interrupt.

In such cases, the guest PCI_INTERRUPT_PIN is 0 and the port number becomes -1(255, uint8_t underflow) for qla[25|27|28]xx and qla2031 devices. The flt_region_nvram is never set, and subsequently the lun detection fails. Below warnings show the NVRAM configuration failure.

[]-0073:1: Inconsistent NVRAM checksum=0xffffffc0 id=HCAM version=0x100. []-0074:1: Falling back to functioning (yet invalid -- WWPN) defaults. []-0076:1: NVRAM configuration failed.

The patch handles the case, and sets the port_no to devfn like its done everywhere else.

Reference: commit 2bd42b03ab6b ("vfio/pci: Virtualize zero INTx PIN if no pdev->irq")

---
drivers/scsi/qla2xxx/qla_os.c | 15 ++++++++++-----

1 file changed, 10 insertions(+), 5 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +0 -0
index 72b1c28e4dae..a8d6a0a021f4 100644
@@ -2803,11 +2803,16 @@ qla2x00_set_isp_flags(struct qla_hw_data *ha)

else {
/* Get adapter physical port no from interrupt pin register. */ pci_read_config_byte(ha->pdev, PCI_INTERRUPT_PIN, &ha->port_no);
- if (IS_QLA25XX(ha) || IS_QLA2031(ha) ||
- IS_QLA27XX(ha) || IS_QLA28XX(ha))
- ha->port_no--;
- else
- ha->port_no = !(ha->port_no & 1);
+ if (ha->port_no == 0) {
+ /* None of INT[A|B|C|D], may be virtualized by vfio */
+ ha->port_no = PCI_FUNC(ha->pdev->devfn);
+ } else {
+ if (IS_QLA25XX(ha) || IS_QLA2031(ha) ||
+ IS_QLA27XX(ha) || IS_QLA28XX(ha))
+ ha->port_no--;
+ else
+ ha->port_no = !(ha->port_no & 1);
+ }
}
ql_dbg_pci(ql_dbg_init, ha->pdev, 0x000b,

#2 lore raw
In reply to Shivaprasad G Bhat
Quoted 11 lines · Shivaprasad G Bhat

The PCI_INTERRUPT_PIN reports if the device supports the INTx. However, when the device is assigned to a guest via vfio, the PCI_INTERRUPT_PIN is set to 0(i.e none) if the line is not connected and|or the platform cannot route the interrupt.

In such cases, the guest PCI_INTERRUPT_PIN is 0 and the port number becomes -1(255, uint8_t underflow) for qla[25|27|28]xx and qla2031 devices. The flt_region_nvram is never set, and subsequently the lun detection fails. Below warnings show the NVRAM configuration failure.

Quoted 6 lines

[]-0073:1: Inconsistent NVRAM checksum=0xffffffc0 id=HCAM version=0x100. []-0074:1: Falling back to functioning (yet invalid -- WWPN) defaults. []-0076:1: NVRAM configuration failed.

The patch handles the case, and sets the port_no to devfn like its done everywhere else.

Any update on this? do you have any comments/concerns that should be addressed

Maddy

Quoted 34 lines

Reference: commit 2bd42b03ab6b ("vfio/pci: Virtualize zero INTx PIN if no pdev->irq")

---
  drivers/scsi/qla2xxx/qla_os.c |   15 ++++++++++-----
  1 file changed, 10 insertions(+), 5 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +10 -5
index 72b1c28e4dae..a8d6a0a021f4 100644
@@ -2803,11 +2803,16 @@ qla2x00_set_isp_flags(struct qla_hw_data *ha)
  	else {
  		/* Get adapter physical port no from interrupt pin register. */
  		pci_read_config_byte(ha->pdev, PCI_INTERRUPT_PIN, &ha->port_no);
-		if (IS_QLA25XX(ha) || IS_QLA2031(ha) ||
-		    IS_QLA27XX(ha) || IS_QLA28XX(ha))
-			ha->port_no--;
-		else
-			ha->port_no = !(ha->port_no & 1);
+		if (ha->port_no == 0) {
+			/* None of INT[A|B|C|D], may be virtualized by vfio */
+			ha->port_no = PCI_FUNC(ha->pdev->devfn);
+		} else {
+			if (IS_QLA25XX(ha) || IS_QLA2031(ha) ||
+			    IS_QLA27XX(ha) || IS_QLA28XX(ha))
+				ha->port_no--;
+			else
+				ha->port_no = !(ha->port_no & 1);
+		}
  	}
 
  	ql_dbg_pci(ql_dbg_init, ha->pdev, 0x000b,
#3 lore raw
Quoted 13 lines · Madhavan Srinivasan
Quoted 11 lines · Shivaprasad G Bhat

The PCI_INTERRUPT_PIN reports if the device supports the INTx. However, when the device is assigned to a guest via vfio, the PCI_INTERRUPT_PIN is set to 0(i.e none) if the line is not connected and|or the platform cannot route the interrupt.

In such cases, the guest PCI_INTERRUPT_PIN is 0 and the port number becomes -1(255, uint8_t underflow) for qla[25|27|28]xx and qla2031 devices. The flt_region_nvram is never set, and subsequently the lun detection fails. Below warnings show the NVRAM configuration failure.

Quoted 9 lines
Quoted 6 lines

  []-0073:1: Inconsistent NVRAM checksum=0xffffffc0 id=HCAM version=0x100. []-0074:1: Falling back to functioning (yet invalid -- WWPN) defaults. []-0076:1: NVRAM configuration failed.

The patch handles the case, and sets the port_no to devfn like its done everywhere else.

Any update on this? do you have any comments/concerns that should be addressed

Hi Maddy,

Priya has tested this already. I have requested Kyle to help with reviewing this patch.

Meanwhile, would request Nilesh, James or Martin to provide feedback, if any.

Thanks,

Shivaprasad

Quoted 35 lines

Maddy

Quoted 33 lines

Reference: commit 2bd42b03ab6b ("vfio/pci: Virtualize zero INTx PIN if no pdev->irq")

---
  drivers/scsi/qla2xxx/qla_os.c |   15 ++++++++++-----

  1 file changed, 10 insertions(+), 5 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +10 -5
index 72b1c28e4dae..a8d6a0a021f4 100644
@@ -2803,11 +2803,16 @@ qla2x00_set_isp_flags(struct qla_hw_data *ha)
       else {
           /* Get adapter physical port no from interrupt pin register. */
           pci_read_config_byte(ha->pdev, PCI_INTERRUPT_PIN, &ha->port_no);
-        if (IS_QLA25XX(ha) || IS_QLA2031(ha) ||
-            IS_QLA27XX(ha) || IS_QLA28XX(ha))
-            ha->port_no--;
-        else
-            ha->port_no = !(ha->port_no & 1);
+        if (ha->port_no == 0) {
+            /* None of INT[A|B|C|D], may be virtualized by vfio */
+            ha->port_no = PCI_FUNC(ha->pdev->devfn);
+        } else {
+            if (IS_QLA25XX(ha) || IS_QLA2031(ha) ||
+                IS_QLA27XX(ha) || IS_QLA28XX(ha))
+                ha->port_no--;
+            else
+                ha->port_no = !(ha->port_no & 1);
+        }
       }
         ql_dbg_pci(ql_dbg_init, ha->pdev, 0x000b,
 
Reviewed-by on v1 1/1
#4 lore raw
In reply to Shivaprasad G Bhat
Quoted 15 lines

The PCI_INTERRUPT_PIN reports if the device supports the INTx. However, when the device is assigned to a guest via vfio, the PCI_INTERRUPT_PIN is set to 0(i.e none) if the line is not connected and|or the platform cannot route the interrupt.

In such cases, the guest PCI_INTERRUPT_PIN is 0 and the port number becomes -1(255, uint8_t underflow) for qla[25|27|28]xx and qla2031 devices. The flt_region_nvram is never set, and subsequently the lun detection fails. Below warnings show the NVRAM configuration failure.

[]-0073:1: Inconsistent NVRAM checksum=0xffffffc0 id=HCAM version=0x100. []-0074:1: Falling back to functioning (yet invalid -- WWPN) defaults. []-0076:1: NVRAM configuration failed.

Quoted 5 lines

The patch handles the case, and sets the port_no to devfn like its done everywhere else.

Reference: commit 2bd42b03ab6b ("vfio/pci: Virtualize zero INTx PIN if no pdev->irq")

Hi Shiva,
Your changes look reasonable and fix a known bug.

#5 lore raw
In reply to Shivaprasad G Bhat
Quoted 5 lines · Shivaprasad G Bhat

The PCI_INTERRUPT_PIN reports if the device supports the INTx. However, when the device is assigned to a guest via vfio, the PCI_INTERRUPT_PIN is set to 0(i.e none) if the line is not connected and|or the platform cannot route the interrupt.

Quoted 7 lines

In such cases, the guest PCI_INTERRUPT_PIN is 0 and the port number becomes -1(255, uint8_t underflow) for qla[25|27|28]xx and qla2031 devices. The flt_region_nvram is never set, and subsequently the lun detection fails. Below warnings show the NVRAM configuration failure.

[...]

Applied to 7.3/scsi-queue, thanks!

[1/1] qla2xxx: Handle the INTx not connected while passing through

      https://git.kernel.org/mkp/scsi/c/7268e509b43a
Signature · 1 line
Martin K. Petersen
#6 lore raw

Hi Martin,

Quoted 13 lines · Martin K. Petersen
Quoted 11 lines · Shivaprasad G Bhat

The PCI_INTERRUPT_PIN reports if the device supports the INTx. However, when the device is assigned to a guest via vfio, the PCI_INTERRUPT_PIN is set to 0(i.e none) if the line is not connected and|or the platform cannot route the interrupt.

In such cases, the guest PCI_INTERRUPT_PIN is 0 and the port number becomes -1(255, uint8_t underflow) for qla[25|27|28]xx and qla2031 devices. The flt_region_nvram is never set, and subsequently the lun detection fails. Below warnings show the NVRAM configuration failure.

Quoted 3 lines
Quoted 1 line

[...]

Applied to 7.3/scsi-queue, thanks!

Thanks for pulling the patch. Would it possible to get this fix into 7.2 stream as well?

Regards,
Shivaprasad
</snip>

#7 lore raw

Shivaprasad,

Quoted 2 lines

Thanks for pulling the patch. Would it possible to get this fix into 7.2 stream as well?

Due to conflicting with the large qla2xxx update this cycle, I deemed it best to leave it in 7.3. But you can post a stable backport request once Linus has merged the SCSI tree.

Signature · 1 line
Martin K. Petersen