of/irq: Misc msi-parent handling fixes/clean-ups
Subsystems (7)
Lorenzo Pieralisi
maintainerv4 cover of/irq: Misc msi-parent handling fixes/clean-ups
This is series is a follow up to [1] - with additional patches that are addressing Rob's feedback (pcie-layerscape-gen4 was removed from the kernel, Yay !) and other bits and bobs I noticed while staring at the code.
Patch (1) is a fix and technically we would like to get it in v6.18 please.
Patch (4) is compile-tested only, I can not run it on HW, I do not have it, Scott, Ray please test it if you can.
v3 -> v4:
- Addressed Rob's review
- Added trailers
- Rebased against v6.18-rc2
v2 -> v3:
- Added additional patch to export of_msi_xlate()
- Addressed review feedback
v3: https://lore.kernel.org/lkml/[email protected]/
v2: https://lore.kernel.org/lkml/[email protected]/
v1: https://lore.kernel.org/lkml/[email protected]/
[1] https://lore.kernel.org/lkml/[email protected]/
Lorenzo Pieralisi (5):
of/irq: Add msi-parent check to of_msi_xlate() of/irq: Fix OF node refcount in of_msi_get_domain() of/irq: Export of_msi_xlate() for module usage
PCI: iproc: Implement MSI controller node detection with
of_msi_xlate()
irqchip/gic-its: Rework platform MSI deviceID detection
drivers/irqchip/irq-gic-its-msi-parent.c | 91 ++++++------------------ drivers/of/irq.c | 44 ++++++++++-- drivers/pci/controller/pcie-iproc.c | 22 ++---- 3 files changed, 68 insertions(+), 89 deletions(-)
Signature · 1 line
2.50.1
Lorenzo Pieralisi
maintainerPATCH v4 1/5 of/irq: Add msi-parent check to of_msi_xlate()
In some legacy platforms the MSI controller for a PCI host bridge is identified by an msi-parent property whose phandle points at an MSI controller node with no #msi-cells property, that implicitly means #msi-cells == 0.
For such platforms, mapping a device ID and retrieving the MSI controller node becomes simply a matter of checking whether in the device hierarchy there is an msi-parent property pointing at an MSI controller node with such characteristics.
Add a helper function to of_msi_xlate() to check the msi-parent property in addition to msi-map and retrieve the MSI controller node (with a 1:1 ID deviceID-IN<->deviceID-OUT mapping) to provide support for deviceID mapping and MSI controller node retrieval for such platforms.
--- drivers/of/irq.c | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-)
drivers/of/irq.c +36 -3
@@ -671,6 +671,36 @@ void __init of_irq_init(const struct of_device_id *matches) } } +static int of_check_msi_parent (struct device_node *dev_node,struct device_node **msi_node) +{ +struct of_phandle_args msi_spec; +int ret; + +/* +* An msi-parent phandle with a missing or == 0 #msi-cells +* property identifies a 1:1 ID translation mapping. +* +* Set the msi controller node if the firmware matches this +* condition. +*/ + ret =of_parse_phandle_with_optional_args (dev_node,"msi-parent" ,"#msi-cells" , +0 , &msi_spec); +if (ret) +return ret; + +if ((*msi_node && *msi_node != msi_spec.np) || msi_spec.args_count !=0 ) + ret = -EINVAL ; + +if (!ret) { +/* Return with a node reference held */ + *msi_node = msi_spec.np; +return 0 ; + } +of_node_put (msi_spec.np); + +return ret; +} +/** * of_msi_xlate - map a MSI ID and find relevant MSI controller node * @dev: device for which the mapping is to be done.
@@ -678,7 +708,7 @@ void __init of_irq_init(const struct of_device_id *matches)* @id_in: Device ID. * * Walk up the device hierarchy looking for devices with a "msi-map" -* property. If found, apply the mapping to @id_in. +* or "msi-parent" property. If found, apply the mapping to @id_in. * If @msi_np points to a non-NULL device node pointer, only entries targeting * that node will be matched; if it points to a NULL value, it will receive the * device node of the first matching target phandle, with a reference held.
@@ -692,12 +722,15 @@ u32 of_msi_xlate(struct device *dev, struct device_node **msi_np, u32 id_in)/* * Walk up the device parent links looking for one with a -* "msi-map" property. +* "msi-map" or an "msi-parent" property. */ -for (parent_dev = dev; parent_dev; parent_dev = parent_dev->parent) +for (parent_dev = dev; parent_dev; parent_dev = parent_dev->parent) {if (!of_map_id (parent_dev->of_node, id_in,"msi-map" ,"msi-map-mask" , msi_np, &id_out))break ; +if (!of_check_msi_parent (parent_dev->of_node, msi_np)) +break ; + }return id_out; }
Signature · 1 line
2.50.1
Lorenzo Pieralisi
maintainerPATCH v4 2/5 of/irq: Fix OF node refcount in of_msi_get_domain()
In reply to Lorenzo PieralisiIn of_msi_get_domain() if the iterator loop stops early because an irq_domain match is detected, an of_node_put() on the iterator node is needed to keep the OF node refcount in sync.
Add it.
--- drivers/of/irq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/of/irq.c +3 -1
@@ -774,8 +774,10 @@ struct irq_domain *of_msi_get_domain(struct device *dev,of_for_each_phandle (&it, err, np,"msi-parent" ,"#msi-cells" ,0 ) { d =irq_find_matching_host (it.node, token); -if (d) +if (d) { +of_node_put (it.node);return d; + } }return NULL ;
Signature · 1 line
2.50.1
Lorenzo Pieralisi
maintainerPATCH v4 3/5 of/irq: Export of_msi_xlate() for module usage
In reply to Lorenzo Pieralisiof_msi_xlate() is required by drivers that can be configured as modular, export the symbol.
--- drivers/of/irq.c | 1 + 1 file changed, 1 insertion(+)
drivers/of/irq.c +1 -0
@@ -733,6 +733,7 @@ u32 of_msi_xlate(struct device *dev, struct device_node **msi_np, u32 id_in) }return id_out; } +EXPORT_SYMBOL_GPL (of_msi_xlate);/** * of_msi_map_get_device_domain - Use msi-map to find the relevant MSI domain
Signature · 1 line
2.50.1
Re: [PATCH v4 3/5] of/irq: Export of_msi_xlate() for module usage
Quoted 9 lines · Lorenzo Pieralisi
of_msi_xlate()is required by drivers that can be configured as modular, export the symbol.Signed-off-by Lorenzo Pieralisi <[email protected]>Reviewed-by Frank Li <[email protected]>Cc Rob Herring <[email protected]>--- drivers/of/irq.c | 1 + 1 file changed, 1 insertion(+)
I guess just iproc needs this, so:
Lorenzo Pieralisi
maintainerPATCH v4 4/5 PCI: iproc: Implement MSI controller node detection with of_msi_xlate()
In reply to Lorenzo PieralisiThe functionality implemented in the iproc driver in order to detect an OF MSI controller node is now fully implemented in of_msi_xlate().
Replace the current msi-map/msi-parent parsing code with of_msi_xlate().
Since of_msi_xlate() is also a deviceID mapping API, pass in a fictitious 0 as deviceID - the driver only requires detecting the OF MSI controller node not the deviceID mapping per-se (of_msi_xlate() return value is ignored for the same reason).
--- drivers/pci/controller/pcie-iproc.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-)
drivers/pci/controller/pcie-iproc.c +5 -17
@@ -17,6 +17,7 @@#include <linux/irqchip/arm-gic-v3.h> #include <linux/platform_device.h> #include <linux/of_address.h> +#include <linux/of_irq.h> #include <linux/of_pci.h> #include <linux/of_platform.h> #include <linux/phy/phy.h>
@@ -1337,29 +1338,16 @@ static int iproc_pcie_msi_steer(struct iproc_pcie *pcie,static int iproc_pcie_msi_enable (struct iproc_pcie *pcie) { -struct device_node *msi_node; +struct device_node *msi_node =NULL ;int ret;/* * Either the "msi-parent" or the "msi-map" phandle needs to exist * for us to obtain the MSI node. */ - - msi_node =of_parse_phandle (pcie->dev->of_node,"msi-parent" ,0 ); -if (!msi_node) { -const __be32 *msi_map =NULL ; -int len; -u32 phandle; - - msi_map =of_get_property (pcie->dev->of_node,"msi-map" , &len); -if (!msi_map) -return -ENODEV ; - - phandle =be32_to_cpup (msi_map +1 ); - msi_node =of_find_node_by_phandle (phandle); -if (!msi_node) -return -ENODEV ; - } +of_msi_xlate (pcie->dev, &msi_node,0 ); +if (!msi_node) +return -ENODEV ;/* * Certain revisions of the iProc PCIe controller require additional
Signature · 1 line
2.50.1
Re: [PATCH v4 4/5] PCI: iproc: Implement MSI controller node detection with of_msi_xlate()
Quoted 10 lines · Lorenzo Pieralisi
The functionality implemented in the iproc driver in order to detect an OF MSI controller node is now fully implemented in
of_msi_xlate().Replace the current msi-map/msi-parent parsing code with
of_msi_xlate().Since
of_msi_xlate()is also a deviceID mapping API, pass in a fictitious 0 as deviceID - the driver only requires detecting the OF MSI controller node not the deviceID mapping per-se (of_msi_xlate()return value is ignored for the same reason).
Quoted 8 lines
Signed-off-by Lorenzo Pieralisi <[email protected]>Reviewed-by Frank Li <[email protected]>Cc Scott Branden <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Rob Herring <[email protected]>Cc Ray Jui <[email protected]>Cc Manivannan Sadhasivam <[email protected]>Cc "Krzysztof Wilczyński" <[email protected]>
I assume this is material for Rob or Thomas?
Quoted 53 lines
--- drivers/pci/controller/pcie-iproc.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-)drivers/pci/controller/pcie-iproc.c +5
-17@@ -17,6 +17,7 @@#include <linux/irqchip/arm-gic-v3.h> #include <linux/platform_device.h> #include <linux/of_address.h> +#include <linux/of_irq.h> #include <linux/of_pci.h> #include <linux/of_platform.h> #include <linux/phy/phy.h> @@ -1337,29 +1338,16 @@ static int iproc_pcie_msi_steer(struct iproc_pcie *pcie,static int iproc_pcie_msi_enable (struct iproc_pcie *pcie) { -struct device_node *msi_node; +struct device_node *msi_node =NULL ;int ret;/* * Either the "msi-parent" or the "msi-map" phandle needs to exist * for us to obtain the MSI node. */ - - msi_node =of_parse_phandle (pcie->dev->of_node,"msi-parent" ,0 ); -if (!msi_node) { -const __be32 *msi_map =NULL ; -int len; -u32 phandle; - - msi_map =of_get_property (pcie->dev->of_node,"msi-map" , &len); -if (!msi_map) -return -ENODEV ; - - phandle =be32_to_cpup (msi_map +1 ); - msi_node =of_find_node_by_phandle (phandle); -if (!msi_node) -return -ENODEV ; - } +of_msi_xlate (pcie->dev, &msi_node,0 ); +if (!msi_node) +return -ENODEV ;/* * Certain revisions of the iProc PCIe controller require additional Signature · 1 line
2.50.1
[tip: irq/msi] PCI: iproc: Implement MSI controller node detection with of_msi_xlate()
In reply to Lorenzo PieralisiThe following commit has been merged into the irq/msi branch of tip:
The following commit has been merged into the irq/msi branch of tip:
Commit-ID: 4f32612f6a4e5a9b1344aebf856aa1a1581a426d Gitweb: https://git.kernel.org/tip/4f32612f6a4e5a9b1344aebf856aa1a1581a426d Author: Lorenzo Pieralisi <[email protected]> AuthorDate: Tue, 21 Oct 2025 14:41:02 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Sat, 22 Nov 2025 17:09:03 +01:00
PCI: iproc: Implement MSI controller node detection with of_msi_xlate()
The functionality implemented in the iproc driver in order to detect an OF MSI controller node is now fully implemented in of_msi_xlate().
Replace the current msi-map/msi-parent parsing code with of_msi_xlate().
Since of_msi_xlate() is also a deviceID mapping API, pass in a fictitious 0 as deviceID - the driver only requires detecting the OF MSI controller node not the deviceID mapping per-se (of_msi_xlate() return value is ignored for the same reason).
--- drivers/pci/controller/pcie-iproc.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-)
drivers/pci/controller/pcie-iproc.c +5 -17
@@ -17,6 +17,7 @@#include <linux/irqchip/arm-gic-v3.h> #include <linux/platform_device.h> #include <linux/of_address.h> +#include <linux/of_irq.h> #include <linux/of_pci.h> #include <linux/of_platform.h> #include <linux/phy/phy.h>
@@ -1337,29 +1338,16 @@ static int iproc_pcie_msi_steer(struct iproc_pcie *pcie,static int iproc_pcie_msi_enable (struct iproc_pcie *pcie) { -struct device_node *msi_node; +struct device_node *msi_node =NULL ;int ret;/* * Either the "msi-parent" or the "msi-map" phandle needs to exist * for us to obtain the MSI node. */ - - msi_node =of_parse_phandle (pcie->dev->of_node,"msi-parent" ,0 ); -if (!msi_node) { -const __be32 *msi_map =NULL ; -int len; -u32 phandle; - - msi_map =of_get_property (pcie->dev->of_node,"msi-map" , &len); -if (!msi_map) -return -ENODEV ; - - phandle =be32_to_cpup (msi_map +1 ); - msi_node =of_find_node_by_phandle (phandle); -if (!msi_node) -return -ENODEV ; - } +of_msi_xlate (pcie->dev, &msi_node,0 ); +if (!msi_node) +return -ENODEV ;/* * Certain revisions of the iProc PCIe controller require additional
Lorenzo Pieralisi
maintainerPATCH v4 5/5 irqchip/gic-its: Rework platform MSI deviceID detection
In reply to Lorenzo PieralisiCurrent code retrieving platform devices MSI devID in the GIC ITS MSI parent helpers suffers from some minor issues:
- It leaks a struct device_node reference
- It is duplicated between GICv3 and GICv5 for no good reason
- It does not use the OF phandle iterator code that simplifies the msi-parent property parsing
Consolidate GIC v3 and v5 deviceID retrieval in a function that addresses the full set of issues in one go by merging GIC v3 and v5 code and converting the msi-parent parsing loop to the more modern OF phandle iterator API, fixing the struct device_node reference leak in the process.
--- drivers/irqchip/irq-gic-its-msi-parent.c | 91 ++++++------------------ 1 file changed, 23 insertions(+), 68 deletions(-)
drivers/irqchip/irq-gic-its-msi-parent.c +23 -68
@@ -142,83 +142,38 @@ static int its_v5_pci_msi_prepare(struct irq_domain *domain, struct device *dev,#define its_v5_pci_msi_prepare NULL#endif /* !CONFIG_PCI_MSI */ -static int of_pmsi_get_dev_id (struct irq_domain *domain,struct device *dev, -u32 *dev_id) +static int of_pmsi_get_msi_info (struct irq_domain *domain,struct device *dev,u32 *dev_id, +phys_addr_t *pa) { -int ret, index =0 ; +struct of_phandle_iterator it; +int ret;/* Suck the DeviceID out of the msi-parent property */ -do { -struct of_phandle_args args; +of_for_each_phandle (&it, ret, dev->of_node,"msi-parent" ,"#msi-cells" ,-1 ) { +/* GICv5 ITS domain matches the MSI controller node parent */ + struct device_node *np __free(device_node) = pa ? of_get_parent(it.node) + :of_node_get (it.node); - ret =of_parse_phandle_with_args (dev->of_node, -"msi-parent" ,"#msi-cells" , - index, &args); -if (args.np ==irq_domain_get_of_node (domain)) { -if (WARN_ON (args.args_count !=1 )) -return -EINVAL ; - *dev_id = args.args[0 ]; -break ; - } - index++; - }while (!ret); +if (np ==irq_domain_get_of_node (domain)) { +u32 args; -if (ret) { -struct device_node *np =NULL ; +if (WARN_ON (of_phandle_iterator_args (&it, &args,1 ) !=1 )) + ret = -EINVAL ; - ret =of_map_id (dev->of_node, dev->id,"msi-map" ,"msi-map-mask" , &np, dev_id); -if (np) -of_node_put (np); - } +if (!ret && pa) + ret =its_translate_frame_address (it.node, pa); -return ret; -} +if (!ret) + *dev_id = args; -static int of_v5_pmsi_get_msi_info (struct irq_domain *domain,struct device *dev, -u32 *dev_id,phys_addr_t *pa) -{ -int ret, index =0 ; -/* -* Retrieve the DeviceID and the ITS translate frame node pointer -* out of the msi-parent property. -*/ -do { -struct of_phandle_args args; - - ret =of_parse_phandle_with_args (dev->of_node, -"msi-parent" ,"#msi-cells" , - index, &args); -if (ret) -break ; -/* -* The IRQ domain fwnode is the msi controller parent -* in GICv5 (where the msi controller nodes are the -* ITS translate frames). -*/ -if (args.np->parent ==irq_domain_get_of_node (domain)) { -if (WARN_ON (args.args_count !=1 )) -return -EINVAL ; - *dev_id = args.args[0 ]; - - ret =its_translate_frame_address (args.np, pa); -if (ret) -return -ENODEV ; -break ; - } - index++; - }while (!ret); - -if (ret) { -struct device_node *np =NULL ; - - ret =of_map_id (dev->of_node, dev->id,"msi-map" ,"msi-map-mask" , &np, dev_id); -if (np) { - ret =its_translate_frame_address (np, pa); -of_node_put (np); +of_node_put (it.node); +return ret; } } -return ret; + struct device_node *msi_ctrl __free(device_node) = NULL; + +return of_map_id (dev->of_node, dev->id,"msi-map" ,"msi-map-mask" , &msi_ctrl, dev_id); }int __weak iort_pmsi_get_dev_id (struct device *dev,u32 *dev_id)
@@ -234,7 +189,7 @@ static int its_pmsi_prepare(struct irq_domain *domain, struct device *dev,int ret;if (dev->of_node) - ret =of_pmsi_get_dev_id (domain->parent, dev, &dev_id); + ret =of_pmsi_get_msi_info (domain->parent, dev, &dev_id,NULL );else ret =iort_pmsi_get_dev_id (dev, &dev_id);if (ret)
@@ -262,7 +217,7 @@ static int its_v5_pmsi_prepare(struct irq_domain *domain, struct device *dev,if (!dev->of_node)return -ENODEV ; - ret =of_v5_pmsi_get_msi_info (domain->parent, dev, &dev_id, &pa); + ret =of_pmsi_get_msi_info (domain->parent, dev, &dev_id, &pa);if (ret)return ret;
Signature · 1 line
2.50.1
Re: [PATCH v4 5/5] irqchip/gic-its: Rework platform MSI deviceID detection
Quoted 21 lines · Lorenzo Pieralisi
Current code retrieving platform devices MSI devID in the GIC ITS MSI parent helpers suffers from some minor issues:
- It leaks a struct
device_nodereference
- It is duplicated between GICv3 and GICv5 for no good reason
- It does not use the OF phandle iterator code that simplifies the msi-parent property parsingConsolidate GIC v3 and v5 deviceID retrieval in a function that addresses the full set of issues in one go by merging GIC v3 and v5 code and converting the msi-parent parsing loop to the more modern OF phandle iterator API, fixing the struct
device_nodereference leak in the process.Signed-off-by Lorenzo Pieralisi <[email protected]>Reviewed-by Frank Li <[email protected]>Cc Sascha Bischoff <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Rob Herring <[email protected]>Cc Frank Li <[email protected]>Cc Marc Zyngier <[email protected]>
Quoted 3 lines
--- drivers/irqchip/irq-gic-its-msi-parent.c | 91 ++++++------------------ 1 file changed, 23 insertions(+), 68 deletions(-)
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
[tip: irq/msi] irqchip/gic-its: Rework platform MSI deviceID detection
In reply to Lorenzo PieralisiThe following commit has been merged into the irq/msi branch of tip:
The following commit has been merged into the irq/msi branch of tip:
Commit-ID: 9c1fbc56ca0a98113e75dcc5030103a02eff8897 Gitweb: https://git.kernel.org/tip/9c1fbc56ca0a98113e75dcc5030103a02eff8897 Author: Lorenzo Pieralisi <[email protected]> AuthorDate: Tue, 21 Oct 2025 14:41:03 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Sat, 22 Nov 2025 17:09:03 +01:00
irqchip/gic-its: Rework platform MSI deviceID detection
Current code retrieving platform devices MSI devID in the GIC ITS MSI parent helpers suffers from some minor issues:
- It leaks a struct device_node reference
- It is duplicated between GICv3 and GICv5 for no good reason
- It does not use the OF phandle iterator code that simplifies the msi-parent property parsing
Consolidate GIC v3 and v5 deviceID retrieval in a function that addresses the full set of issues in one go by merging GIC v3 and v5 code and converting the msi-parent parsing loop to the more modern OF phandle iterator API, fixing the struct device_node reference leak in the process.
--- drivers/irqchip/irq-gic-its-msi-parent.c | 91 +++++------------------ 1 file changed, 23 insertions(+), 68 deletions(-)
drivers/irqchip/irq-gic-its-msi-parent.c +23 -68
@@ -142,83 +142,38 @@ static int its_v5_pci_msi_prepare(struct irq_domain *domain, struct device *dev,#define its_v5_pci_msi_prepare NULL#endif /* !CONFIG_PCI_MSI */ -static int of_pmsi_get_dev_id (struct irq_domain *domain,struct device *dev, -u32 *dev_id) +static int of_pmsi_get_msi_info (struct irq_domain *domain,struct device *dev,u32 *dev_id, +phys_addr_t *pa) { -int ret, index =0 ; +struct of_phandle_iterator it; +int ret;/* Suck the DeviceID out of the msi-parent property */ -do { -struct of_phandle_args args; - - ret =of_parse_phandle_with_args (dev->of_node, -"msi-parent" ,"#msi-cells" , - index, &args); -if (args.np ==irq_domain_get_of_node (domain)) { -if (WARN_ON (args.args_count !=1 )) -return -EINVAL ; - *dev_id = args.args[0 ]; -break ; - } - index++; - }while (!ret); - -if (ret) { -struct device_node *np =NULL ; +of_for_each_phandle (&it, ret, dev->of_node,"msi-parent" ,"#msi-cells" ,-1 ) { +/* GICv5 ITS domain matches the MSI controller node parent */ + struct device_node *np __free(device_node) = pa ? of_get_parent(it.node) + :of_node_get (it.node); - ret =of_map_id (dev->of_node, dev->id,"msi-map" ,"msi-map-mask" , &np, dev_id); -if (np) -of_node_put (np); - } +if (np ==irq_domain_get_of_node (domain)) { +u32 args; -return ret; -} +if (WARN_ON (of_phandle_iterator_args (&it, &args,1 ) !=1 )) + ret = -EINVAL ; -static int of_v5_pmsi_get_msi_info (struct irq_domain *domain,struct device *dev, -u32 *dev_id,phys_addr_t *pa) -{ -int ret, index =0 ; -/* -* Retrieve the DeviceID and the ITS translate frame node pointer -* out of the msi-parent property. -*/ -do { -struct of_phandle_args args; - - ret =of_parse_phandle_with_args (dev->of_node, -"msi-parent" ,"#msi-cells" , - index, &args); -if (ret) -break ; -/* -* The IRQ domain fwnode is the msi controller parent -* in GICv5 (where the msi controller nodes are the -* ITS translate frames). -*/ -if (args.np->parent ==irq_domain_get_of_node (domain)) { -if (WARN_ON (args.args_count !=1 )) -return -EINVAL ; - *dev_id = args.args[0 ]; - - ret =its_translate_frame_address (args.np, pa); -if (ret) -return -ENODEV ; -break ; - } - index++; - }while (!ret); +if (!ret && pa) + ret =its_translate_frame_address (it.node, pa); -if (ret) { -struct device_node *np =NULL ; +if (!ret) + *dev_id = args; - ret =of_map_id (dev->of_node, dev->id,"msi-map" ,"msi-map-mask" , &np, dev_id); -if (np) { - ret =its_translate_frame_address (np, pa); -of_node_put (np); +of_node_put (it.node); +return ret; } } -return ret; + struct device_node *msi_ctrl __free(device_node) = NULL; + +return of_map_id (dev->of_node, dev->id,"msi-map" ,"msi-map-mask" , &msi_ctrl, dev_id); }int __weak iort_pmsi_get_dev_id (struct device *dev,u32 *dev_id)
@@ -234,7 +189,7 @@ static int its_pmsi_prepare(struct irq_domain *domain, struct device *dev,int ret;if (dev->of_node) - ret =of_pmsi_get_dev_id (domain->parent, dev, &dev_id); + ret =of_pmsi_get_msi_info (domain->parent, dev, &dev_id,NULL );else ret =iort_pmsi_get_dev_id (dev, &dev_id);if (ret)
@@ -262,7 +217,7 @@ static int its_v5_pmsi_prepare(struct irq_domain *domain, struct device *dev,if (!dev->of_node)return -ENODEV ; - ret =of_v5_pmsi_get_msi_info (domain->parent, dev, &dev_id, &pa); + ret =of_pmsi_get_msi_info (domain->parent, dev, &dev_id, &pa);if (ret)return ret;
Rob Herring
maintainerQuoted 35 lines · Lorenzo Pieralisi
This is series is a follow up to [1] - with additional patches that are addressing Rob's feedback (pcie-layerscape-gen4 was removed from the kernel, Yay !) and other bits and bobs I noticed while staring at the code.
Patch (1) is a fix and technically we would like to get it in v6.18 please.
Patch (4) is compile-tested only, I can not run it on HW, I do not have it, Scott, Ray please test it if you can.
v3 -> v4:
- Addressed Rob's review
- Added trailers
- Rebased against v6.18-rc2v2 -> v3:
- Added additional patch to exportof_msi_xlate()
- Addressed review feedbackv3: https://lore.kernel.org/lkml/[email protected]/
v2: https://lore.kernel.org/lkml/[email protected]/
v1: https://lore.kernel.org/lkml/[email protected]/[1] https://lore.kernel.org/lkml/[email protected]/
Cc Sascha Bischoff <[email protected]>Cc Scott Branden <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Rob Herring <[email protected]>Cc Ray Jui <[email protected]>Cc Frank Li <[email protected]>Cc Manivannan Sadhasivam <[email protected]>Cc "Krzysztof Wilczyński" <[email protected]>Cc Marc Zyngier <[email protected]>
Quoted 3 lines
Lorenzo Pieralisi (5):
of/irq: Add msi-parent check toof_msi_xlate()of/irq: Fix OF node refcount inof_msi_get_domain()
I've applied these 2 for 6.18.
Quoted 13 lines
of/irq: Export
of_msi_xlate()for module usage
PCI: iproc: Implement MSI controller node detection withof_msi_xlate()irqchip/gic-its: Rework platform MSI deviceID detection
drivers/irqchip/irq-gic-its-msi-parent.c | 91 ++++++------------------ drivers/of/irq.c | 44 ++++++++++-- drivers/pci/controller/pcie-iproc.c | 22 ++---- 3 files changed, 68 insertions(+), 89 deletions(-)Signature · 1 line
2.50.1
Rob!
Quoted 6 lines · Rob Herring
Quoted 3 lines · Lorenzo Pieralisi
Lorenzo Pieralisi (5):
of/irq: Add msi-parent check toof_msi_xlate()of/irq: Fix OF node refcount inof_msi_get_domain()I've applied these 2 for 6.18.
The rest of this depends on those two.
Quoted 1 line
Quoted 1 line
of/irq: Export
of_msi_xlate()for module usage
Can you pick the three of/irq ones up and put them into a seperate branch based on rc1 so that I can pull that and apply the rest:
Quoted 3 lines
Quoted 3 lines
PCI: iproc: Implement MSI controller node detection with
of_msi_xlate()irqchip/gic-its: Rework platform MSI deviceID detection
Thanks,
tglx
Rob Herring
maintainerQuoted 9 lines · Thomas Gleixner
Rob!
Quoted 5 lines · Rob Herring
Quoted 3 lines · Lorenzo Pieralisi
Lorenzo Pieralisi (5):
of/irq: Add msi-parent check toof_msi_xlate()of/irq: Fix OF node refcount inof_msi_get_domain()
Quoted 8 lines
Quoted 1 line
I've applied these 2 for 6.18.
The rest of this depends on those two.
Quoted 1 line
Quoted 1 line
of/irq: Export
of_msi_xlate()for module usageCan you pick the three of/irq ones up and put them into a seperate branch based on rc1 so that I can pull that and apply the rest:
Yes. This series is the only thing I have queued for 6.18 fixes so far, so I'll add the 3rd patch and Cc you on my PR to Linus.
Rob
Quoted 11 lines · Rob Herring
Quoted 10 lines · Thomas Gleixner
Quoted 6 lines · Rob Herring
Quoted 3 lines · Lorenzo Pieralisi
Lorenzo Pieralisi (5):
of/irq: Add msi-parent check toof_msi_xlate()of/irq: Fix OF node refcount inof_msi_get_domain()I've applied these 2 for 6.18.
The rest of this depends on those two.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
of/irq: Export
of_msi_xlate()for module usageCan you pick the three of/irq ones up and put them into a seperate branch based on rc1 so that I can pull that and apply the rest:
Yes. This series is the only thing I have queued for 6.18 fixes so far, so I'll add the 3rd patch and Cc you on my PR to Linus.
Thanks!