Re: [PATCH v2 10/12] of/irq: Make of_msi_map_rid() PCI bus agnostic

2020-06-30 Thread Rob Herring
On Fri, Jun 19, 2020 at 2:20 AM Lorenzo Pieralisi
 wrote:
>
> There is nothing PCI bus specific in the of_msi_map_rid()
> implementation other than the requester ID tag for the input
> ID space. Rename requester ID to a more generic ID so that
> the translation code can be used by all busses that require
> input/output ID translations.
>
> No functional change intended.
>
> Signed-off-by: Lorenzo Pieralisi 
> Cc: Bjorn Helgaas 
> Cc: Rob Herring 
> Cc: Marc Zyngier 
> ---
>  drivers/of/irq.c   | 28 ++--
>  drivers/pci/msi.c  |  2 +-
>  include/linux/of_irq.h |  8 
>  3 files changed, 19 insertions(+), 19 deletions(-)

Reviewed-by: Rob Herring 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH v2 10/12] of/irq: Make of_msi_map_rid() PCI bus agnostic

2020-06-19 Thread Lorenzo Pieralisi
There is nothing PCI bus specific in the of_msi_map_rid()
implementation other than the requester ID tag for the input
ID space. Rename requester ID to a more generic ID so that
the translation code can be used by all busses that require
input/output ID translations.

No functional change intended.

Signed-off-by: Lorenzo Pieralisi 
Cc: Bjorn Helgaas 
Cc: Rob Herring 
Cc: Marc Zyngier 
---
 drivers/of/irq.c   | 28 ++--
 drivers/pci/msi.c  |  2 +-
 include/linux/of_irq.h |  8 
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 1005e4f349ef..25d17b8a1a1a 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -576,43 +576,43 @@ void __init of_irq_init(const struct of_device_id 
*matches)
}
 }
 
-static u32 __of_msi_map_rid(struct device *dev, struct device_node **np,
-   u32 rid_in)
+static u32 __of_msi_map_id(struct device *dev, struct device_node **np,
+   u32 id_in)
 {
struct device *parent_dev;
-   u32 rid_out = rid_in;
+   u32 id_out = id_in;
 
/*
 * Walk up the device parent links looking for one with a
 * "msi-map" property.
 */
for (parent_dev = dev; parent_dev; parent_dev = parent_dev->parent)
-   if (!of_map_id(parent_dev->of_node, rid_in, "msi-map",
-   "msi-map-mask", np, _out))
+   if (!of_map_id(parent_dev->of_node, id_in, "msi-map",
+   "msi-map-mask", np, _out))
break;
-   return rid_out;
+   return id_out;
 }
 
 /**
- * of_msi_map_rid - Map a MSI requester ID for a device.
+ * of_msi_map_id - Map a MSI ID for a device.
  * @dev: device for which the mapping is to be done.
  * @msi_np: device node of the expected msi controller.
- * @rid_in: unmapped MSI requester ID for the device.
+ * @id_in: unmapped MSI ID for the device.
  *
  * Walk up the device hierarchy looking for devices with a "msi-map"
- * property.  If found, apply the mapping to @rid_in.
+ * property.  If found, apply the mapping to @id_in.
  *
- * Returns the mapped MSI requester ID.
+ * Returns the mapped MSI ID.
  */
-u32 of_msi_map_rid(struct device *dev, struct device_node *msi_np, u32 rid_in)
+u32 of_msi_map_id(struct device *dev, struct device_node *msi_np, u32 id_in)
 {
-   return __of_msi_map_rid(dev, _np, rid_in);
+   return __of_msi_map_id(dev, _np, id_in);
 }
 
 /**
  * of_msi_map_get_device_domain - Use msi-map to find the relevant MSI domain
  * @dev: device for which the mapping is to be done.
- * @rid: Requester ID for the device.
+ * @id: Device ID.
  * @bus_token: Bus token
  *
  * Walk up the device hierarchy looking for devices with a "msi-map"
@@ -625,7 +625,7 @@ struct irq_domain *of_msi_map_get_device_domain(struct 
device *dev, u32 id,
 {
struct device_node *np = NULL;
 
-   __of_msi_map_rid(dev, , id);
+   __of_msi_map_id(dev, , id);
return irq_find_matching_host(np, bus_token);
 }
 
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index b4bfe0b03b2d..19aeadb22f11 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1535,7 +1535,7 @@ u32 pci_msi_domain_get_msi_rid(struct irq_domain *domain, 
struct pci_dev *pdev)
pci_for_each_dma_alias(pdev, get_msi_id_cb, );
 
of_node = irq_domain_get_of_node(domain);
-   rid = of_node ? of_msi_map_rid(>dev, of_node, rid) :
+   rid = of_node ? of_msi_map_id(>dev, of_node, rid) :
iort_msi_map_id(>dev, rid);
 
return rid;
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index 7142a3722758..e8b78139f78c 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -55,7 +55,7 @@ extern struct irq_domain *of_msi_map_get_device_domain(struct 
device *dev,
u32 id,
u32 bus_token);
 extern void of_msi_configure(struct device *dev, struct device_node *np);
-u32 of_msi_map_rid(struct device *dev, struct device_node *msi_np, u32 rid_in);
+u32 of_msi_map_id(struct device *dev, struct device_node *msi_np, u32 id_in);
 #else
 static inline int of_irq_count(struct device_node *dev)
 {
@@ -93,10 +93,10 @@ static inline struct irq_domain 
*of_msi_map_get_device_domain(struct device *dev
 static inline void of_msi_configure(struct device *dev, struct device_node *np)
 {
 }
-static inline u32 of_msi_map_rid(struct device *dev,
-struct device_node *msi_np, u32 rid_in)
+static inline u32 of_msi_map_id(struct device *dev,
+struct device_node *msi_np, u32 id_in)
 {
-   return rid_in;
+   return id_in;
 }
 #endif
 
-- 
2.26.1

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu