On 11/18/2026 5:57 PM, Krzysztof Kozlowski wrote: > On 17/11/2026 17:24, Vishnu Reddy wrote: >> Hi Krzysztof, >> >> Thanks for review. >> >> On 11/13/2026 6:41 PM, Krzysztof Kozlowski wrote: >>> On 06/11/2026 18:14, Vikash Garodia wrote: >>>> The "iommu-addresses" property describes an identity 1:1 mapping between >>>> an IOVA range and the physical memory specified by "reg" in the same >>>> reserved-memory node. Without "reg", there is no physical memory to map. >>> This looks like ABI break. >> The original discussion was to avoid keeping iommu-addresses in the >> reserved-memory, if not backed by reg. In such cases, it is more meaningful >> to move that entry to corresponding device node. >> Given this direction, the schema was defined accordingly and the code is now >> updated to match the dt-schema. At least on Linux, I do not see any client >> using iommu-addresses without reg. > Yeah, but ABI is for all users, not only in-tree.
To avoid an ABI break, it would be better to preserve the existing iommu-addresses behavior and avoid this change. > > >>>> The DT schema now requires "reg" whenever "iommu-addresses" is present. >>>> Align the kernel implementation with this requirement. >>>> https://github.com/devicetree-org/dt-schema/pull/207 >>>> >>>> An identity mapping requires matching IOVA and "reg" ranges. Reject >>>> mismatched ranges and report an error. >>>> >>>> Suggested-by: Rob Herring <[email protected]> >>>> Co-developed-by: Vishnu Reddy <[email protected]> >>>> Signed-off-by: Vishnu Reddy <[email protected]> >>>> Signed-off-by: Vikash Garodia <[email protected]> >>>> --- >>>> drivers/iommu/of_iommu.c | 32 +++++++++++++++----------------- >>>> 1 file changed, 15 insertions(+), 17 deletions(-) >>>> >>>> diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c >>>> index >>>> 6675fc900e6c2d55b34c61dc9effaeb48e24f18f..00b02c19f27e195fc36c4bc1d91253255147c9ab >>>> 100644 >>>> --- a/drivers/iommu/of_iommu.c >>>> +++ b/drivers/iommu/of_iommu.c >>>> @@ -174,19 +174,12 @@ iommu_resv_region_get_type(struct device *dev, >>>> { >>>> phys_addr_t end = start + length - 1; >>>> >>>> - /* >>>> - * IOMMU regions without an associated physical region cannot be >>>> - * mapped and are simply reservations. >>>> - */ >>>> - if (phys->start >= phys->end) >>>> - return IOMMU_RESV_RESERVED; >>>> - >>>> /* may be IOMMU_RESV_DIRECT_RELAXABLE for certain cases */ >>>> if (start == phys->start && end == phys->end) >>>> return IOMMU_RESV_DIRECT; >>>> >>>> - dev_warn(dev, "treating non-direct mapping [%pr] -> [%pap-%pap] as >>>> reservation\n", phys, >>>> - &start, &end); >>>> + dev_err(dev, "non-direct mapping [%pr] -> [%pap-%pap] is not >>>> supported\n", phys, >>>> + &start, &end); >>>> return IOMMU_RESV_RESERVED; >>>> } >>>> >>>> @@ -211,12 +204,14 @@ void of_iommu_get_resv_regions(struct device *dev, >>>> struct list_head *list) >>>> struct resource phys; >>>> int size; >>>> >>>> - memset(&phys, 0, sizeof(phys)); >>>> + maps = of_get_property(it.node, "iommu-addresses", &size); >>>> + if (!maps) >>>> + continue; >>>> >>>> /* >>>> - * The "reg" property is optional and can be omitted by >>>> reserved-memory regions >>>> - * that represent reservations in the IOVA space, which are >>>> regions that should >>>> - * not be mapped. >>>> + * "iommu-addresses" must be used in combination with a "reg" >>>> that provides >>>> + * the physical address and size of this memory region, for an >>>> identity 1:1 >>>> + * IOVA mapping to that physical memory. >>>> */ >>>> if (of_property_present(it.node, "reg")) { >>>> err = of_address_to_resource(it.node, 0, &phys); >>>> @@ -225,11 +220,11 @@ void of_iommu_get_resv_regions(struct device *dev, >>>> struct list_head *list) >>>> it.node, err); >>>> continue; >>>> } >>>> - } >>>> - >>>> - maps = of_get_property(it.node, "iommu-addresses", &size); >>>> - if (!maps) >>> I miss the point why you are moving this part. Irrespective to actual >>> ABI break, why do you nee to check for iommu-addresses before? >> It is more optimal to check for iommu-addresses and then read the reg. On the >> contrary, earlier reg is read irrespective of iommu-addresses is present or >> not. So in a way reading iommu-addresses first would ensure that reg is read >> only if iommu-addresses is present. > Sorry, I don't follow. What is here on the contrary? To what part? The intention was only to avoid parsing reg for nodes that do not use iommu-addresses. Given the ABI concerns, we can keep the existing behavior. > > Best regards, > Krzysztof
