Skip to contentSkip to conversation

PCI: dwc: Make the MSI domain naming explicit

PATCH Applied Shawn Lin 4 participants 7 messages Sep 30 – Oct 17

Subsystems (4)
lore
Share & tools
lore

Shawn Lin

author
#0 lore raw

cover PCI: dwc: Make the MSI domain naming explicit

I was looking into whether the DWC core provides a common INTx irq domain registration and handling flow, as several glue drivers owning a legacy interrupt controller copy-paste the same code (get the "legacy-interrupt-controller" child node, create a linear domain with a one-line .map callback, install a chained handler).

The DWC core has no INTx equivalent at all: dw_pcie_allocate_domains() looks like it could be that helper at first glance, but it only creates the MSI parent irq domain (msi_create_parent_irq_domain() with DOMAIN_BUS_PCI_MSI). Likewise, struct dw_pcie_rp::irq_domain only serves the MSI parent domain.

So make the naming explicit:

patch 1 renames dw_pcie_allocate_domains() to
dw_pcie_allocate_msi_domains().

patch 2 renames struct dw_pcie_rp::irq_domain to ::msi_irq_domain.

Shawn Lin (2):
PCI: dwc: Rename dw_pcie_allocate_domains to
dw_pcie_allocate_msi_domains
PCI: dwc: Rename pp->irq_domain to pp->msi_irq_domain

 drivers/pci/controller/dwc/pci-dra7xx.c           |  2 +-
 drivers/pci/controller/dwc/pci-keystone.c         |  4 ++--
 drivers/pci/controller/dwc/pcie-designware-host.c | 14 +++++++-------
 drivers/pci/controller/dwc/pcie-designware.h      |  6 +++---
 4 files changed, 13 insertions(+), 13 deletions(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/2 PCI: dwc: Rename dw_pcie_allocate_domains to dw_pcie_allocate_msi_domains

Rename dw_pcie_allocate_domains() to dw_pcie_allocate_msi_domains() so that the name says what it allocates and cannot be mistaken for a generic domain allocator.

---

 drivers/pci/controller/dwc/pci-keystone.c         | 2 +-
 drivers/pci/controller/dwc/pcie-designware-host.c | 6 +++---
 drivers/pci/controller/dwc/pcie-designware.h      | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/pci/controller/dwc/pci-keystone.c +1 -1
index b8e3032..c35f3f4 100644
@@ -309,7 +309,7 @@ static int ks_pcie_msi_host_init(struct dw_pcie_rp *pp)
 	dw_pcie_writel_dbi(pci, PCI_BASE_ADDRESS_0, ks_pcie->app.start);
 
 	pp->msi_irq_chip = &ks_pcie_msi_irq_chip;
-	return dw_pcie_allocate_domains(pp);
+	return dw_pcie_allocate_msi_domains(pp);
 }
 
 static void ks_pcie_handle_intx_irq(struct keystone_pcie *ks_pcie,
drivers/pci/controller/dwc/pcie-designware-host.c +3 -3
index f5a38e6..7fb165c 100644
@@ -207,7 +207,7 @@ static const struct irq_domain_ops dw_pcie_msi_domain_ops = {
 	.free	= dw_pcie_irq_domain_free,
 };
 
-int dw_pcie_allocate_domains(struct dw_pcie_rp *pp)
+int dw_pcie_allocate_msi_domains(struct dw_pcie_rp *pp)
 {
 	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
 	struct irq_domain_info info = {
@@ -225,7 +225,7 @@ int dw_pcie_allocate_domains(struct dw_pcie_rp *pp)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(dw_pcie_allocate_domains);
+EXPORT_SYMBOL_GPL(dw_pcie_allocate_msi_domains);
 
 void dw_pcie_free_msi(struct dw_pcie_rp *pp)
 {
@@ -342,7 +342,7 @@ int dw_pcie_msi_host_init(struct dw_pcie_rp *pp)
 
 	pp->msi_irq_chip = &dw_pci_msi_bottom_irq_chip;
 
-	ret = dw_pcie_allocate_domains(pp);
+	ret = dw_pcie_allocate_msi_domains(pp);
 	if (ret)
 		return ret;
 
drivers/pci/controller/dwc/pcie-designware.h +2 -2
index a53ac27..22e8f95 100644
@@ -869,7 +869,7 @@ void dw_pcie_free_msi(struct dw_pcie_rp *pp);
 int dw_pcie_setup_rc(struct dw_pcie_rp *pp);
 int dw_pcie_host_init(struct dw_pcie_rp *pp);
 void dw_pcie_host_deinit(struct dw_pcie_rp *pp);
-int dw_pcie_allocate_domains(struct dw_pcie_rp *pp);
+int dw_pcie_allocate_msi_domains(struct dw_pcie_rp *pp);
 void __iomem *dw_pcie_own_conf_map_bus(struct pci_bus *bus, unsigned int devfn,
 				       int where);
 #else
@@ -910,7 +910,7 @@ static inline void dw_pcie_host_deinit(struct dw_pcie_rp *pp)
 {
 }
 
-static inline int dw_pcie_allocate_domains(struct dw_pcie_rp *pp)
+static inline int dw_pcie_allocate_msi_domains(struct dw_pcie_rp *pp)
 {
 	return 0;
 }
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH 1/2] PCI: dwc: Rename dw_pcie_allocate_domains to dw_pcie_allocate_msi_domains

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines

Rename dw_pcie_allocate_domains() to dw_pcie_allocate_msi_domains() so that the name says what it allocates and cannot be mistaken for a generic domain allocator.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
author
#3 lore raw

PATCH 2/2 PCI: dwc: Rename pp->irq_domain to pp->msi_irq_domain

In reply to Shawn Lin

pp->irq_domain is exclusively the MSI parent irq domain: it is created by dw_pcie_allocate_msi_domains() with msi_create_parent_irq_domain() and is only used to resolve the MSI child virqs in dw_handle_msi_irq() and in the keystone and dra7xx MSI handlers. The name gives no hint about that, in the same way dw_pcie_allocate_domains() did not say that it was only about MSI.

Rename it to pp->msi_irq_domain, matching the previous rename.

Cc Vignesh Raghavendra <[email protected]>

---

 drivers/pci/controller/dwc/pci-dra7xx.c           | 2 +-
 drivers/pci/controller/dwc/pci-keystone.c         | 2 +-
 drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++----
 drivers/pci/controller/dwc/pcie-designware.h      | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)
drivers/pci/controller/dwc/pci-dra7xx.c +1 -1
index 3460a83..0d56fd5 100644
@@ -213,7 +213,7 @@ static int dra7xx_pcie_handle_msi(struct dw_pcie_rp *pp, int index)
 
 	pos = find_first_bit(&val, MAX_MSI_IRQS_PER_CTRL);
 	while (pos != MAX_MSI_IRQS_PER_CTRL) {
-		generic_handle_domain_irq(pp->irq_domain,
+		generic_handle_domain_irq(pp->msi_irq_domain,
 					  (index * MAX_MSI_IRQS_PER_CTRL) + pos);
 		pos++;
 		pos = find_next_bit(&val, MAX_MSI_IRQS_PER_CTRL, pos);
drivers/pci/controller/dwc/pci-keystone.c +1 -1
index c35f3f4..388a97c 100644
@@ -633,7 +633,7 @@ static void ks_pcie_msi_irq_handler(struct irq_desc *desc)
 
 		vector = offset + (pos << 3);
 		dev_dbg(dev, "irq: bit %d, vector %d\n", pos, vector);
-		generic_handle_domain_irq(pp->irq_domain, vector);
+		generic_handle_domain_irq(pp->msi_irq_domain, vector);
 	}
 
 	chained_irq_exit(chip, desc);
drivers/pci/controller/dwc/pcie-designware-host.c +4 -4
index 7fb165c..0bf9a59 100644
@@ -82,7 +82,7 @@ void dw_handle_msi_irq(struct dw_pcie_rp *pp)
 			continue;
 
 		for_each_set_bit(pos, &status, MAX_MSI_IRQS_PER_CTRL)
-			generic_handle_demux_domain_irq(pp->irq_domain, irq_off + pos);
+			generic_handle_demux_domain_irq(pp->msi_irq_domain, irq_off + pos);
 	}
 }
 
@@ -217,8 +217,8 @@ int dw_pcie_allocate_msi_domains(struct dw_pcie_rp *pp)
 		.host_data	= pp,
 	};
 
-	pp->irq_domain = msi_create_parent_irq_domain(&info, &dw_pcie_msi_parent_ops);
-	if (!pp->irq_domain) {
+	pp->msi_irq_domain = msi_create_parent_irq_domain(&info, &dw_pcie_msi_parent_ops);
+	if (!pp->msi_irq_domain) {
 		dev_err(pci->dev, "Failed to create IRQ domain\n");
 		return -ENOMEM;
 	}
@@ -236,7 +236,7 @@ void dw_pcie_free_msi(struct dw_pcie_rp *pp)
 			irq_set_chained_handler_and_data(pp->msi_irq[ctrl], NULL, NULL);
 	}
 
-	irq_domain_remove(pp->irq_domain);
+	irq_domain_remove(pp->msi_irq_domain);
 }
 EXPORT_SYMBOL_GPL(dw_pcie_free_msi);
 
drivers/pci/controller/dwc/pcie-designware.h +1 -1
index 22e8f95..f2fdc29 100644
@@ -454,7 +454,7 @@ struct dw_pcie_rp {
 	int			irq;
 	const struct dw_pcie_host_ops *ops;
 	int			msi_irq[MAX_MSI_CTRLS];
-	struct irq_domain	*irq_domain;
+	struct irq_domain	*msi_irq_domain;
 	dma_addr_t		msi_data;
 	struct irq_chip		*msi_irq_chip;
 	u32			num_vectors;
Signature · 1 line
2.7.4
maintainer Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] PCI: dwc: Rename pp->irq_domain to pp->msi_irq_domain

Quoted 7 lines · Shawn Lin

pp->irq_domain is exclusively the MSI parent irq domain: it is created by dw_pcie_allocate_msi_domains() with msi_create_parent_irq_domain() and is only used to resolve the MSI child virqs in dw_handle_msi_irq() and in the keystone and dra7xx MSI handlers. The name gives no hint about that, in the same way dw_pcie_allocate_domains() did not say that it was only about MSI.

Quoted 6 lines

Rename it to pp->msi_irq_domain, matching the previous rename.

Cc Vignesh Raghavendra <[email protected]>

---

Hmm for some reason I dont see this on the lore:

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

Quoted 78 lines
 drivers/pci/controller/dwc/pci-dra7xx.c           | 2 +-
 drivers/pci/controller/dwc/pci-keystone.c         | 2 +-
 drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++----
 drivers/pci/controller/dwc/pcie-designware.h      | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)
drivers/pci/controller/dwc/pci-dra7xx.c +1 -1
index 3460a83..0d56fd5 100644
@@ -213,7 +213,7 @@ static int dra7xx_pcie_handle_msi(struct dw_pcie_rp *pp, int index)
 
 	pos = find_first_bit(&val, MAX_MSI_IRQS_PER_CTRL);
 	while (pos != MAX_MSI_IRQS_PER_CTRL) {
-		generic_handle_domain_irq(pp->irq_domain,
+		generic_handle_domain_irq(pp->msi_irq_domain,
 					  (index * MAX_MSI_IRQS_PER_CTRL) + pos);
 		pos++;
 		pos = find_next_bit(&val, MAX_MSI_IRQS_PER_CTRL, pos);
drivers/pci/controller/dwc/pci-keystone.c +1 -1
index c35f3f4..388a97c 100644
@@ -633,7 +633,7 @@ static void ks_pcie_msi_irq_handler(struct irq_desc *desc)
 
 		vector = offset + (pos << 3);
 		dev_dbg(dev, "irq: bit %d, vector %d\n", pos, vector);
-		generic_handle_domain_irq(pp->irq_domain, vector);
+		generic_handle_domain_irq(pp->msi_irq_domain, vector);
 	}
 
 	chained_irq_exit(chip, desc);
drivers/pci/controller/dwc/pcie-designware-host.c +4 -4
index 7fb165c..0bf9a59 100644
@@ -82,7 +82,7 @@ void dw_handle_msi_irq(struct dw_pcie_rp *pp)
 			continue;
 
 		for_each_set_bit(pos, &status, MAX_MSI_IRQS_PER_CTRL)
-			generic_handle_demux_domain_irq(pp->irq_domain, irq_off + pos);
+			generic_handle_demux_domain_irq(pp->msi_irq_domain, irq_off + pos);
 	}
 }
 
@@ -217,8 +217,8 @@ int dw_pcie_allocate_msi_domains(struct dw_pcie_rp *pp)
 		.host_data	= pp,
 	};
 
-	pp->irq_domain = msi_create_parent_irq_domain(&info, &dw_pcie_msi_parent_ops);
-	if (!pp->irq_domain) {
+	pp->msi_irq_domain = msi_create_parent_irq_domain(&info, &dw_pcie_msi_parent_ops);
+	if (!pp->msi_irq_domain) {
 		dev_err(pci->dev, "Failed to create IRQ domain\n");
 		return -ENOMEM;
 	}
@@ -236,7 +236,7 @@ void dw_pcie_free_msi(struct dw_pcie_rp *pp)
 			irq_set_chained_handler_and_data(pp->msi_irq[ctrl], NULL, NULL);
 	}
 
-	irq_domain_remove(pp->irq_domain);
+	irq_domain_remove(pp->msi_irq_domain);
 }
 EXPORT_SYMBOL_GPL(dw_pcie_free_msi);
 
drivers/pci/controller/dwc/pcie-designware.h +1 -1
index 22e8f95..f2fdc29 100644
@@ -454,7 +454,7 @@ struct dw_pcie_rp {
 	int			irq;
 	const struct dw_pcie_host_ops *ops;
 	int			msi_irq[MAX_MSI_CTRLS];
-	struct irq_domain	*irq_domain;
+	struct irq_domain	*msi_irq_domain;
 	dma_addr_t		msi_data;
 	struct irq_chip		*msi_irq_chip;
 	u32			num_vectors;
Signature · 3 lines
Regards
Vignesh
https://ti.com/opensource
#5 lore raw

Re: [PATCH 2/2] PCI: dwc: Rename pp->irq_domain to pp->msi_irq_domain

In reply to Shawn Lin
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 11 lines

pp->irq_domain is exclusively the MSI parent irq domain: it is created by dw_pcie_allocate_msi_domains() with msi_create_parent_irq_domain() and is only used to resolve the MSI child virqs in dw_handle_msi_irq() and in the keystone and dra7xx MSI handlers. The name gives no hint about that, in the same way dw_pcie_allocate_domains() did not say that it was only about MSI.

Rename it to pp->msi_irq_domain, matching the previous rename.

Cc Vignesh Raghavendra <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
maintainer Applied
#6 lore raw
In reply to Shawn Lin
Quoted 9 lines · Shawn Lin

PCI: dwc: Make the MSI domain naming explicit

I was looking into whether the DWC core provides a common INTx irq domain registration and handling flow, as several glue drivers owning a legacy interrupt controller copy-paste the same code (get the "legacy-interrupt-controller" child node, create a linear domain with a one-line .map callback, install a chained handler).

[...]

Applied, thanks!

[1/2] PCI: dwc: Rename dw_pcie_allocate_domains to dw_pcie_allocate_msi_domains

      commit: e078e64169b1da85c057092e2b2c673b21e08647
[2/2] PCI: dwc: Rename pp->irq_domain to pp->msi_irq_domain
      commit: 315ba6800480eb49fa0c37085c808fc6f2f9dcd6

Best regards,

Signature · 1 line
மணிவண்ணன் சதாசிவம்