Skip to contentSkip to conversation

PCI/MSI: Check MSI_FLAG_PCI_MSI_MASK_PARENT in cond_[startup|shutdown]_parent()

PATCH In review Inochi Amaoto 5 participants 9 messages Aug 27, 2025 – Sep 1, 2025

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

PATCH 1/1 PCI/MSI: Check MSI_FLAG_PCI_MSI_MASK_PARENT in cond_[startup|shutdown]_parent()

For msi controller that only supports MSI_FLAG_PCI_MSI_MASK_PARENT, the newly added callback irq_startup() and irq_shutdown() for pci_msi[x]_templete will not unmask/mask the interrupt when startup/ shutdown the interrupt. This will prevent the interrupt from being enabled/disabled normally.

Add the missing check for MSI_FLAG_PCI_MSI_MASK_PARENT in the cond_[startup|shutdown]_parent(). So the interrupt can be normally unmasked/masked if it does not support MSI_FLAG_PCI_MSI_MASK_PARENT.

---
 drivers/pci/msi/irqdomain.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/pci/msi/irqdomain.c +5 -0
index e0a800f918e8..b11b7f63f0d6 100644
@@ -154,6 +154,8 @@ static void cond_shutdown_parent(struct irq_data *data)
 
 	if (unlikely(info->flags & MSI_FLAG_PCI_MSI_STARTUP_PARENT))
 		irq_chip_shutdown_parent(data);
+	else if (unlikely(info->flags & MSI_FLAG_PCI_MSI_MASK_PARENT))
+		irq_chip_mask_parent(data);
 }
 
 static unsigned int cond_startup_parent(struct irq_data *data)
@@ -162,6 +164,9 @@ static unsigned int cond_startup_parent(struct irq_data *data)
 
 	if (unlikely(info->flags & MSI_FLAG_PCI_MSI_STARTUP_PARENT))
 		return irq_chip_startup_parent(data);
+	else if (unlikely(info->flags & MSI_FLAG_PCI_MSI_MASK_PARENT))
+		irq_chip_unmask_parent(data);
+
 	return 0;
 }
 

--
2.51.0

maintainer Tested-by on v1 1/1
#1 lore raw
Quoted 33 lines · Inochi Amaoto

For msi controller that only supports MSI_FLAG_PCI_MSI_MASK_PARENT, the newly added callback irq_startup() and irq_shutdown() for pci_msi[x]_templete will not unmask/mask the interrupt when startup/ shutdown the interrupt. This will prevent the interrupt from being enabled/disabled normally.

Add the missing check for MSI_FLAG_PCI_MSI_MASK_PARENT in the cond_[startup|shutdown]_parent(). So the interrupt can be normally unmasked/masked if it does not support MSI_FLAG_PCI_MSI_MASK_PARENT.

---
  drivers/pci/msi/irqdomain.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/pci/msi/irqdomain.c +2 -0
index e0a800f918e8..b11b7f63f0d6 100644
@@ -154,6 +154,8 @@ static void cond_shutdown_parent(struct irq_data *data)
 
  	if (unlikely(info->flags & MSI_FLAG_PCI_MSI_STARTUP_PARENT))
  		irq_chip_shutdown_parent(data);
+	else if (unlikely(info->flags & MSI_FLAG_PCI_MSI_MASK_PARENT))
+		irq_chip_mask_parent(data);
  }
 
  static unsigned int cond_startup_parent(struct irq_data *data)

drivers/pci/msi/irqdomain.c static unsigned int cond_startup_parent(struct irq_data *data) · line 171

Quoted 8 lines
drivers/pci/msi/irqdomain.c +3 -0
@@ -162,6 +164,9 @@ static unsigned int cond_startup_parent(struct irq_data *data)
 
  	if (unlikely(info->flags & MSI_FLAG_PCI_MSI_STARTUP_PARENT))
  		return irq_chip_startup_parent(data);
+	else if (unlikely(info->flags & MSI_FLAG_PCI_MSI_MASK_PARENT))
+		irq_chip_unmask_parent(data);
+
  	return 0;
  }

FWIW, this also fixes a boot regression for Tegra124 Jetson TK1.

Thanks!
Jon

Signature · 1 line
nvpublic
Acked-by on v1 1/1
#2 lore raw
In reply to Inochi Amaoto
Quoted 5 lines · Inochi Amaoto

For msi controller that only supports MSI_FLAG_PCI_MSI_MASK_PARENT, the newly added callback irq_startup() and irq_shutdown() for pci_msi[x]_templete will not unmask/mask the interrupt when startup/ shutdown the interrupt. This will prevent the interrupt from being enabled/disabled normally.

s/templete/template/

AFAICS cond_startup_parent() is used by pci_irq_startup_msi() and pci_irq_startup_msix() in pci_msi_template; cond_shutdown_parent() is used by pci_irq_shutdown_msi() and pci_irq_shutdown_msix() in pci_msix_template.

Quoted 7 lines

Add the missing check for MSI_FLAG_PCI_MSI_MASK_PARENT in the cond_[startup|shutdown]_parent(). So the interrupt can be normally unmasked/masked if it does not support MSI_FLAG_PCI_MSI_MASK_PARENT.

Fixes 54f45a30c0d0 ("PCI/MSI: Add startup/shutdown for per device domains")

I guess there are several other reporters and reports that could be added here. Up to you whether to add them.

Quoted 2 lines
Quoted 30 lines
---
 drivers/pci/msi/irqdomain.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/pci/msi/irqdomain.c +5 -1
index e0a800f918e8..b11b7f63f0d6 100644
@@ -154,6 +154,8 @@ static void cond_shutdown_parent(struct irq_data *data)
 
 	if (unlikely(info->flags & MSI_FLAG_PCI_MSI_STARTUP_PARENT))
 		irq_chip_shutdown_parent(data);
+	else if (unlikely(info->flags & MSI_FLAG_PCI_MSI_MASK_PARENT))
+		irq_chip_mask_parent(data);
 }
 
 static unsigned int cond_startup_parent(struct irq_data *data)
@@ -162,6 +164,9 @@ static unsigned int cond_startup_parent(struct irq_data *data)
 
 	if (unlikely(info->flags & MSI_FLAG_PCI_MSI_STARTUP_PARENT))
 		return irq_chip_startup_parent(data);
+	else if (unlikely(info->flags & MSI_FLAG_PCI_MSI_MASK_PARENT))
+		irq_chip_unmask_parent(data);
+
 	return 0;
 }
 
--

2.51.0

#3 lore raw
Quoted 7 lines · Bjorn Helgaas
Quoted 5 lines · Inochi Amaoto

For msi controller that only supports MSI_FLAG_PCI_MSI_MASK_PARENT, the newly added callback irq_startup() and irq_shutdown() for pci_msi[x]_templete will not unmask/mask the interrupt when startup/ shutdown the interrupt. This will prevent the interrupt from being enabled/disabled normally.

Quoted 8 lines

s/templete/template/

AFAICS cond_startup_parent() is used by pci_irq_startup_msi() and pci_irq_startup_msix() in pci_msi_template; cond_shutdown_parent() is used by pci_irq_shutdown_msi() and pci_irq_shutdown_msix() in pci_msix_template.

cond_startup_parent() is used by pci_irq_startup_msi() in pci_msi_template and pci_irq_startup_msix() in pci_msix_template; cond_shutdown_parent() is used by pci_irq_shutdown_msi() in pci_msi_template and pci_irq_shutdown_msix() in pci_msix_template.

Quoted 11 lines
Quoted 7 lines

Add the missing check for MSI_FLAG_PCI_MSI_MASK_PARENT in the cond_[startup|shutdown]_parent(). So the interrupt can be normally unmasked/masked if it does not support MSI_FLAG_PCI_MSI_MASK_PARENT.

Fixes 54f45a30c0d0 ("PCI/MSI: Add startup/shutdown for per device domains")

I guess there are several other reporters and reports that could be added here. Up to you whether to add them.

Yeah, there are some missing tag from the original post, as this patch is already submitted. I will add it in v2.

Quoted 35 lines
Quoted 2 lines
Quoted 30 lines
---
 drivers/pci/msi/irqdomain.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/pci/msi/irqdomain.c +5 -1
index e0a800f918e8..b11b7f63f0d6 100644
@@ -154,6 +154,8 @@ static void cond_shutdown_parent(struct irq_data *data)
 
 	if (unlikely(info->flags & MSI_FLAG_PCI_MSI_STARTUP_PARENT))
 		irq_chip_shutdown_parent(data);
+	else if (unlikely(info->flags & MSI_FLAG_PCI_MSI_MASK_PARENT))
+		irq_chip_mask_parent(data);
 }
 
 static unsigned int cond_startup_parent(struct irq_data *data)
@@ -162,6 +164,9 @@ static unsigned int cond_startup_parent(struct irq_data *data)
 
 	if (unlikely(info->flags & MSI_FLAG_PCI_MSI_STARTUP_PARENT))
 		return irq_chip_startup_parent(data);
+	else if (unlikely(info->flags & MSI_FLAG_PCI_MSI_MASK_PARENT))
+		irq_chip_unmask_parent(data);
+
 	return 0;
 }
 
--

2.51.0

#4 lore raw
Quoted 15 lines · Inochi Amaoto
Quoted 7 lines · Bjorn Helgaas
Quoted 5 lines · Inochi Amaoto

For msi controller that only supports MSI_FLAG_PCI_MSI_MASK_PARENT, the newly added callback irq_startup() and irq_shutdown() for pci_msi[x]_templete will not unmask/mask the interrupt when startup/ shutdown the interrupt. This will prevent the interrupt from being enabled/disabled normally.

Quoted 6 lines

s/templete/template/

AFAICS cond_startup_parent() is used by pci_irq_startup_msi() and pci_irq_startup_msix() in pci_msi_template; cond_shutdown_parent() is used by pci_irq_shutdown_msi() and pci_irq_shutdown_msix() in pci_msix_template.

Quoted 4 lines

cond_startup_parent() is used by pci_irq_startup_msi() in pci_msi_template and pci_irq_startup_msix() in pci_msix_template; cond_shutdown_parent() is used by pci_irq_shutdown_msi() in pci_msi_template and pci_irq_shutdown_msix() in pci_msix_template.

Right, I really screwed that up when I noticed the "*_template" structure names and added them to my description.

#5 lore raw

PATCH 1/1 PCI/MSI: Check MSI_FLAG_PCI_MSI_MASK_PARENT in cond_[startup|shutdown]_parent()

In reply to Inochi Amaoto
Quoted 9 lines · Nathan Chancellor
Quoted 4 lines · Inochi Amaoto

OK, I guess I know why: I have missed one condition for startup.

Could you test the following patch? If worked, I will send it as a fix.

Yes, that appears to resolve the issue on one system. I cannot test the other at the moment since it is under load.

I have built on top of Linux next-20250826 tag and the qemu-arm64 boot test pass and LTP smoke test also pass.

Quoted 2 lines

--
Linaro LKFT
https://lkft.linaro.org

Tested-by on v1 1/1
#6 lore raw
In reply to Inochi Amaoto
Quoted 9 lines · Inochi Amaoto

For msi controller that only supports MSI_FLAG_PCI_MSI_MASK_PARENT, the newly added callback irq_startup() and irq_shutdown() for pci_msi[x]_templete will not unmask/mask the interrupt when startup/ shutdown the interrupt. This will prevent the interrupt from being enabled/disabled normally.

Add the missing check for MSI_FLAG_PCI_MSI_MASK_PARENT in the cond_[startup|shutdown]_parent(). So the interrupt can be normally unmasked/masked if it does not support MSI_FLAG_PCI_MSI_MASK_PARENT.

This is causing multiple platforms to fail to boot in -next, it'd be great if we could get it merged to fix them.

#7 lore raw

[cc->to: Thomas]

Quoted 7 lines · Mark Brown
Quoted 6 lines · Inochi Amaoto

For msi controller that only supports MSI_FLAG_PCI_MSI_MASK_PARENT, the newly added callback irq_startup() and irq_shutdown() for pci_msi[x]_templete will not unmask/mask the interrupt when startup/ shutdown the interrupt. This will prevent the interrupt from being enabled/disabled normally.

Quoted 8 lines
Quoted 3 lines

Add the missing check for MSI_FLAG_PCI_MSI_MASK_PARENT in the cond_[startup|shutdown]_parent(). So the interrupt can be normally unmasked/masked if it does not support MSI_FLAG_PCI_MSI_MASK_PARENT.

This is causing multiple platforms to fail to boot in -next, it'd be great if we could get it merged to fix them.

It looks like you merged 54f45a30c0d0 ("PCI/MSI: Add startup/shutdown for per device domains"), Thomas. I assume you'll merge this fix too?

Let me know if you'd prefer that I take it. Looks like a candidate for v6.17.

Bjorn

#8 lore raw
Quoted 16 lines · Bjorn Helgaas

[cc->to: Thomas]

Quoted 13 lines · Mark Brown
Quoted 9 lines · Inochi Amaoto

For msi controller that only supports MSI_FLAG_PCI_MSI_MASK_PARENT, the newly added callback irq_startup() and irq_shutdown() for pci_msi[x]_templete will not unmask/mask the interrupt when startup/ shutdown the interrupt. This will prevent the interrupt from being enabled/disabled normally.

Add the missing check for MSI_FLAG_PCI_MSI_MASK_PARENT in the cond_[startup|shutdown]_parent(). So the interrupt can be normally unmasked/masked if it does not support MSI_FLAG_PCI_MSI_MASK_PARENT.

Quoted 8 lines
Quoted 2 lines

This is causing multiple platforms to fail to boot in -next, it'd be great if we could get it merged to fix them.

It looks like you merged 54f45a30c0d0 ("PCI/MSI: Add startup/shutdown for per device domains"), Thomas. I assume you'll merge this fix too?

Let me know if you'd prefer that I take it. Looks like a candidate for v6.17.

Oops, looks like there's a v2:

https://lore.kernel.org/r/[email protected]