summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorRobin Murphy <robin.murphy@arm.com>2026-06-03 10:13:14 +0300
committerRob Herring (Arm) <robh@kernel.org>2026-06-12 18:25:39 +0300
commitccb2fd725d411265df8f7ce12a66c226b16014e6 (patch)
tree530cf5edfa1ae3b8ab3ccac46be9df1603a28fc2 /include/linux
parentf71f07bee9b56b94f7828cf3082ea19ec590de36 (diff)
downloadlinux-ccb2fd725d411265df8f7ce12a66c226b16014e6.tar.xz
of: Respect #{iommu,msi}-cells in maps
So far our parsing of {iommu,msi}-map properties has always blindly assumed that the output specifiers will always have exactly 1 cell. This typically does happen to be the case, but is not actually enforced (and the PCI msi-map binding even explicitly states support for 0 or 1 cells) - as a result we've now ended up with dodgy DTs out in the field which depend on this behaviour to map a 1-cell specifier for a 2-cell provider, despite that being bogus per the bindings themselves. Since there is some potential use in being able to map at least single input IDs to multi-cell output specifiers (and properly support 0-cell outputs as well), add support for properly parsing and using the target nodes' #cells values, albeit with the unfortunate complication of still having to work around expectations of the old behaviour too. Since there are multi-cell output specifiers, the callers of of_map_id() may need to get the exact cell output value for further processing. Update of_map_id() to set args_count in the output to reflect the actual number of output specifier cells. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Charan Teja Kalla <charan.kalla@oss.qualcomm.com> Signed-off-by: Vijayanand Jitta <vijayanand.jitta@oss.qualcomm.com> Link: https://patch.msgid.link/20260603-parse_iommu_cells-v16-3-dc509dacb19a@oss.qualcomm.com Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/of.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index ea50b45d9ff7..374b249766a2 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -465,7 +465,8 @@ const char *of_prop_next_string(const struct property *prop, const char *cur);
bool of_console_check(const struct device_node *dn, char *name, int index);
int of_map_id(const struct device_node *np, u32 id,
- const char *map_name, const char *map_mask_name,
+ const char *map_name, const char *cells_name,
+ const char *map_mask_name,
struct device_node * const *filter_np,
struct of_phandle_args *arg);
@@ -950,7 +951,8 @@ static inline void of_property_clear_flag(struct property *p, unsigned long flag
}
static inline int of_map_id(const struct device_node *np, u32 id,
- const char *map_name, const char *map_mask_name,
+ const char *map_name, const char *cells_name,
+ const char *map_mask_name,
struct device_node * const *filter_np,
struct of_phandle_args *arg)
{