Skip to contentSkip to conversation

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

PATCH Superseded Inochi Amaoto 1 participant 2 messages Aug 27, 2025 PCI

v1 of 2 Superseded Latest is v2 →

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]_tamplete 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.

---
Change from v1:
- https://lore.kernel.org/all/[email protected]/
1. Apply Tested-by, Reported-by and Tested-by from original post [1].
2. update mistake in the comments.

[1] https://lore.kernel.org/regressions/aK4O7Hl8NCVEMznB@monster/

---
 drivers/pci/msi/irqdomain.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/pci/msi/irqdomain.c +5 -0
index 50ccac32f4cf..cbdc83c064d4 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

#1 lore raw
Quoted 57 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]_tamplete 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.

---
Change from v1:
- https://lore.kernel.org/all/[email protected]/
1. Apply Tested-by, Reported-by and Tested-by from original post [1].
2. update mistake in the comments.

[1] https://lore.kernel.org/regressions/aK4O7Hl8NCVEMznB@monster/

---
 drivers/pci/msi/irqdomain.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/pci/msi/irqdomain.c +5 -1
index 50ccac32f4cf..cbdc83c064d4 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;
 }
 
--
Quoted 2 lines

2.51.0

Please ignore this version, I generate this with wrong parameters I will send a right v2.

Regards,
Inochi