From: Krzysztof Kozlowski <krzk@kernel.org>
To: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>,
Vikash Garodia <vikash.garodia@oss.qualcomm.com>,
"Joerg Roedel (AMD)" <joro@8bytes.org>,
Vasant Hegde <vasant.hegde@amd.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
David Woodhouse <dwmw2@infradead.org>,
Lu Baolu <baolu.lu@linux.intel.com>,
Jean-Philippe Brucker <jpb@kernel.org>,
Rob Herring <robh@kernel.org>,
Saravana Kannan <saravanak@kernel.org>,
Tomasz Nowicki <tomasz.nowicki@caviumnetworks.com>,
Eric Auger <eric.auger@redhat.com>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Joerg Roedel <jroedel@suse.de>,
Srinath Mannam <srinath.mannam@broadcom.com>,
Oza Pawandeep <quic_poza@quicinc.com>,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
Alex Williamson <alex@shazbot.org>
Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
virtualization@lists.linux.dev, devicetree@vger.kernel.org,
kvm@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-media@vger.kernel.org
Subject: Re: [PATCH v7 4/5] iommu/of: Require reg for iommu-addresses
Date: Wed, 18 Nov 2026 13:27:58 +0100 [thread overview]
Message-ID: <2a282370-025b-4c0e-8a87-4d05aa1d87a0@kernel.org> (raw)
In-Reply-To: <ce05d74a-58d1-f605-44c1-ceb9b9d8b9d4@oss.qualcomm.com>
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.
>
>>
>>> 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 <robh@kernel.org>
>>> Co-developed-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
>>> Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
>>> Signed-off-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
>>> ---
>>> 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?
Best regards,
Krzysztof
next prev parent reply other threads:[~2026-11-18 12:28 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 17:14 [PATCH v7 0/5] of_iommu: add support for "iommu-ranges" Vikash Garodia
2026-11-06 17:14 ` [PATCH v7 1/5] iommu/dma: Keep reserved regions below the IOVA rbtree anchor Vikash Garodia
2026-11-11 13:03 ` Dmitry Baryshkov
2026-11-13 12:08 ` Krzysztof Kozlowski
2026-11-06 17:14 ` [PATCH v7 2/5] iommu: Use resource_size_t for reserved region length Vikash Garodia
2026-11-10 17:28 ` Rob Herring (Arm)
2026-11-11 13:02 ` Dmitry Baryshkov
2026-11-13 12:11 ` Krzysztof Kozlowski
2026-11-06 17:14 ` [PATCH v7 3/5] iommu/of: Make OF_IOMMU depend on OF_ADDRESS Vikash Garodia
2026-11-11 13:03 ` Dmitry Baryshkov
2026-11-12 13:40 ` Vikash Garodia
2026-11-18 9:02 ` Dmitry Baryshkov
2026-11-18 11:28 ` Vikash Garodia
2026-11-13 12:37 ` Krzysztof Kozlowski
2026-11-06 17:14 ` [PATCH v7 4/5] iommu/of: Require reg for iommu-addresses Vikash Garodia
2026-11-11 12:02 ` Bryan O'Donoghue
2026-11-12 14:04 ` Vikash Garodia
2026-11-12 14:19 ` Bryan O'Donoghue
2026-11-13 13:11 ` Krzysztof Kozlowski
2026-11-17 16:24 ` Vishnu Reddy
2026-11-18 12:27 ` Krzysztof Kozlowski [this message]
2026-11-06 17:14 ` [PATCH v7 5/5] iommu/of: Add support for "iommu-ranges" on a device node Vikash Garodia
2026-11-13 9:36 ` Yijie Yang
2026-11-17 5:28 ` Vishnu Reddy
2026-11-13 13:20 ` Krzysztof Kozlowski
2026-11-11 11:04 ` [PATCH v7 0/5] of_iommu: add support for "iommu-ranges" Vinayak Katoch
2026-11-11 13:01 ` Dmitry Baryshkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2a282370-025b-4c0e-8a87-4d05aa1d87a0@kernel.org \
--to=krzk@kernel.org \
--cc=alex@shazbot.org \
--cc=baolu.lu@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=bryan.odonoghue@linaro.org \
--cc=busanna.reddy@oss.qualcomm.com \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=eric.auger@redhat.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=jpb@kernel.org \
--cc=jroedel@suse.de \
--cc=kvm@vger.kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=quic_poza@quicinc.com \
--cc=robh@kernel.org \
--cc=robin.murphy@arm.com \
--cc=saravanak@kernel.org \
--cc=srinath.mannam@broadcom.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=tomasz.nowicki@caviumnetworks.com \
--cc=vasant.hegde@amd.com \
--cc=vikash.garodia@oss.qualcomm.com \
--cc=virtualization@lists.linux.dev \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®