Thread (15 messages) 15 messages, 3 authors, 2026-03-16

Re: [PATCH v10 2/3] of: factor arguments passed to of_map_id() into a struct

From: Vijayanand Jitta <hidden>
Date: 2026-03-16 17:07:41
Also in: imx, linux-arm-msm, linux-devicetree, linux-iommu, linux-pci, lkml, xen-devel


On 3/12/2026 7:48 PM, Dmitry Baryshkov wrote:
On Thu, Mar 12, 2026 at 05:12:51PM +0530, Vijayanand Jitta wrote:
quoted

On 3/10/2026 2:53 AM, Dmitry Baryshkov wrote:
quoted
On Mon, Mar 09, 2026 at 01:03:38AM +0530, Vijayanand Jitta wrote:
quoted
From: Charan Teja Kalla <redacted>

Change of_map_id() to take a pointer to struct of_phandle_args
instead of passing target device node and translated IDs separately.
Update all callers accordingly.

Subsequent patch will make use of the args_count field in
struct of_phandle_args.

Suggested-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Charan Teja Kalla <redacted>
Signed-off-by: Vijayanand Jitta <redacted>
---
 drivers/cdx/cdx_msi.c                    |  5 ++-
 drivers/iommu/of_iommu.c                 |  2 +-
 drivers/irqchip/irq-gic-its-msi-parent.c | 11 ++++--
 drivers/of/base.c                        | 63 ++++++++++++++++----------------
 drivers/of/irq.c                         |  8 +++-
 drivers/pci/controller/dwc/pci-imx6.c    | 16 ++++++--
 drivers/pci/controller/pcie-apple.c      |  5 ++-
 drivers/xen/grant-dma-ops.c              |  4 +-
 include/linux/of.h                       | 12 +++---
 9 files changed, 76 insertions(+), 50 deletions(-)
diff --git a/drivers/cdx/cdx_msi.c b/drivers/cdx/cdx_msi.c
index 63b3544ec997..03232b5ffbca 100644
--- a/drivers/cdx/cdx_msi.c
+++ b/drivers/cdx/cdx_msi.c
@@ -121,6 +121,7 @@ static int cdx_msi_prepare(struct irq_domain *msi_domain,
 			   struct device *dev,
 			   int nvec, msi_alloc_info_t *info)
 {
+	struct of_phandle_args msi_spec = { .np = NULL };
Why do you need to set it? Parse functions ignore passed args, don't
they?
The parse function does check arg->np on input — if it is non-NULL,
it is used to match only entries targeting that specific node.

Also, there is this existing path in drivers/pci/msi/irqdomain.c which
pre-sets the node and passes it as input to of_msi_xlate(), so the node
pointer is not ignored by the parse code:
Is it only being used for MSIs? If so, can we make that explicit in the
API by having the 'filter' device_node pointer?
Yes, I see this is used only in the MSI path via of_msi_xlate(). 

By filter do you mean the below changes ? here of_map_id() and of_map_msi_id() would accept the filter
as a separate parameter so that arg becomes a pure output:


int of_map_id(const struct device_node *np, u32 id, const char *map_name,
              const char *cells_name, const char *map_mask_name,
              const struct device_node *filter_np, struct of_phandle_args *arg);

int of_map_msi_id(const struct device_node *np, u32 id,
                  const struct device_node *filter_np, struct of_phandle_args *arg);

of_msi_xlate() would then pass *msi_np as filter_np down to of_map_msi_id
and IOMMU callers would pass NULL to of_map_id. 

Does this look fine ? I can include this in v11.

Thanks,
Vijay
quoted
u32 pci_msi_domain_get_msi_rid(struct irq_domain *domain, struct pci_dev *pdev)
{
        struct device_node *of_node;
        u32 rid = pci_dev_id(pdev);

        pci_for_each_dma_alias(pdev, get_msi_id_cb, &rid);

        of_node = irq_domain_get_of_node(domain);
        rid = of_node ? of_msi_xlate(&pdev->dev, &of_node, rid) :
                        iort_msi_map_id(&pdev->dev, rid);

        return rid;
}
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help