Skip to contentSkip to conversation

arm64: PCI: Introduce pcibios_free_irq() helper function

PATCH Superseded Yajun Deng 3 participants 4 messages Aug 25, 2021 arm64

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yajun Deng

author
#0 lore raw

PATCH 1/1 arm64: PCI: Introduce pcibios_free_irq() helper function

Introduce pcibios_free_irq() to free irq in pci_device_probe() and pci_device_remove() that in drivers/pci/pci-driver.c.

---
 arch/arm64/kernel/pci.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
arch/arm64/kernel/pci.c +9 -1
index 1006ed2d7c60..40da5aff4548 100644
@@ -25,10 +25,18 @@
 int pcibios_alloc_irq(struct pci_dev *dev)
 {
 	if (!acpi_disabled)
-		acpi_pci_irq_enable(dev);
+		return acpi_pci_irq_enable(dev);
 
 	return 0;
 }
+
+void pcibios_free_irq(struct pci_dev *dev)
+{
+	if (!acpi_disabled)
+		acpi_pci_irq_disable(dev);
+
+}
+
 #endif
 
 /*
Signature · 1 line
2.32.0
maintainer
#1 lore raw

[+Lorenzo]

Quoted 2 lines · Yajun Deng

Introduce pcibios_free_irq() to free irq in pci_device_probe() and pci_device_remove() that in drivers/pci/pci-driver.c.

Please can you describe the problem you're solving?

Quoted 10 lines
---
 arch/arm64/kernel/pci.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
arch/arm64/kernel/pci.c +0 -0
index 1006ed2d7c60..40da5aff4548 100644

arch/arm64/kernel/pci.c line 28

Quoted 5 lines
arch/arm64/kernel/pci.c +1 -1
@@ -25,10 +25,18 @@
 int pcibios_alloc_irq(struct pci_dev *dev)
 {
 	if (!acpi_disabled)
-		acpi_pci_irq_enable(dev);
+		return acpi_pci_irq_enable(dev);

This means we'll now fail device probe if we can't enable the GSI. Is that a problem?

Will

#2 lore raw
Quoted 9 lines · Will Deacon

[+Lorenzo]

Quoted 2 lines · Yajun Deng

Introduce pcibios_free_irq() to free irq in pci_device_probe() and pci_device_remove() that in drivers/pci/pci-driver.c.

Please can you describe the problem you're solving?

pcibios_alloc_irq() will be called in pci_device_probe(), but there hasn't pcibios_free_irq() in arm64 architecture correspond it. pcibios_free_irq() is an empty function in drivers/pci/pci-driver.c.So pcibios_alloc_irq() and pcibios_free_irq() don't correspond.

Quoted 5 lines
Quoted 5 lines

---
arch/arm64/kernel/pci.c | 10 +++++++++-

1 file changed, 9 insertions(+), 1 deletion(-)
Quoted 14 lines

arch/arm64/kernel/pci.c line 28

Quoted 10 lines
arch/arm64/kernel/pci.c +1 -1
index 1006ed2d7c60..40da5aff4548 100644
@@ -25,10 +25,18 @@
 int pcibios_alloc_irq(struct pci_dev *dev)
 {
 if (!acpi_disabled)
- acpi_pci_irq_enable(dev);
+ return acpi_pci_irq_enable(dev);

This means we'll now fail device probe if we can't enable the GSI. Is that a problem?

Oh, It would be better that hasn't return.

Quoted 1 line

Will

#3 lore raw
In reply to Yajun Deng
Quoted 2 lines · Yajun Deng

Introduce pcibios_free_irq() to free irq in pci_device_probe() and pci_device_remove() that in drivers/pci/pci-driver.c.

Add a rationale - it is just code inspection or you are fixing a bug ?

Quoted 10 lines
---
 arch/arm64/kernel/pci.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
arch/arm64/kernel/pci.c +0 -0
index 1006ed2d7c60..40da5aff4548 100644

arch/arm64/kernel/pci.c line 28

Quoted 5 lines
arch/arm64/kernel/pci.c +1 -1
@@ -25,10 +25,18 @@
 int pcibios_alloc_irq(struct pci_dev *dev)
 {
 	if (!acpi_disabled)
-		acpi_pci_irq_enable(dev);
+		return acpi_pci_irq_enable(dev);

This is an unrelated change and it is potentially introducing regressions. I need to page in the reasons why on arm64 we had to resort to pcibios_alloc_irq() (probe ordering IIRC) - in the meanwhile this function stays as it is.

arch/arm64/kernel/pci.c line 38

Quoted 9 lines
arch/arm64/kernel/pci.c +7 -0
 	return 0;
 }
+
+void pcibios_free_irq(struct pci_dev *dev)
+{
+	if (!acpi_disabled)
+		acpi_pci_irq_disable(dev);
+
+}

Adding pcibios_free_irq() makes sense and I believe it is a genuine "fix".

Please add any information in the commit log that explains the run-time condition you are fixing.

Thanks,
Lorenzo