From: Robin Murphy <robin.murphy@arm.com>
To: joro@8bytes.org, will@kernel.org,
laurent.pinchart@ideasonboard.com, mchehab@kernel.org,
andersson@kernel.org, mathieu.poirier@linaro.org
Cc: hns@goldelico.com, b-padhi@ti.com, andreas@kemnade.info,
iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
linux-omap@vger.kernel.org, linux-media@vger.kernel.org,
linux-remoteproc@vger.kernel.org
Subject: [PATCH 3/4] iommu/omap: Add minimal fwnode support
Date: Mon, 28 Oct 2024 17:58:37 +0000 [thread overview]
Message-ID: <cfd766f96bc799e32b97f4664707adbcf99097b0.1730136799.git.robin.murphy@arm.com> (raw)
In-Reply-To: <cover.1730136799.git.robin.murphy@arm.com>
The OMAP driver uses the generic "iommus" DT binding but is the final
holdout not implementing a corresponding .of_xlate method. Unfortunately
this now results in __iommu_probe_device() failing to find ops due to
client devices missing the expected IOMMU fwnode association. The legacy
DT parsing in omap_iommu_probe_device() could probably all be delegated
to generic code now, but for the sake of an immediate fix, just add a
minimal .of_xlate implementation to allow client fwspecs to be created
appropriately, and so the ops lookup to work again.
This means we also need to register the additional instances on DRA7 so
that of_iommu_xlate() doesn't defer indefinitely waiting for their ops
either, but we'll continue to hide them from sysfs just in case. This
also renders the bus_iommu_probe() call entirely redundant.
Reported-by: Beleswar Padhi <b-padhi@ti.com>
Link: https://lore.kernel.org/linux-iommu/0dbde87b-593f-4b14-8929-b78e189549ad@ti.com/
Reported-by: H. Nikolaus Schaller <hns@goldelico.com>
Link: https://lore.kernel.org/linux-media/A7C284A9-33A5-4E21-9B57-9C4C213CC13F@goldelico.com/
Fixes: 17de3f5fdd35 ("iommu: Retire bus ops")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
drivers/iommu/omap-iommu.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index c9528065a59a..3f72aef8bd5b 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -1230,25 +1230,24 @@ static int omap_iommu_probe(struct platform_device *pdev)
if (err)
return err;
- err = iommu_device_register(&obj->iommu, &omap_iommu_ops, &pdev->dev);
- if (err)
- goto out_sysfs;
obj->has_iommu_driver = true;
}
+ err = iommu_device_register(&obj->iommu, &omap_iommu_ops, &pdev->dev);
+ if (err)
+ goto out_sysfs;
+
pm_runtime_enable(obj->dev);
omap_iommu_debugfs_add(obj);
dev_info(&pdev->dev, "%s registered\n", obj->name);
- /* Re-probe bus to probe device attached to this IOMMU */
- bus_iommu_probe(&platform_bus_type);
-
return 0;
out_sysfs:
- iommu_device_sysfs_remove(&obj->iommu);
+ if (obj->has_iommu_driver)
+ iommu_device_sysfs_remove(&obj->iommu);
return err;
}
@@ -1256,10 +1255,10 @@ static void omap_iommu_remove(struct platform_device *pdev)
{
struct omap_iommu *obj = platform_get_drvdata(pdev);
- if (obj->has_iommu_driver) {
+ if (obj->has_iommu_driver)
iommu_device_sysfs_remove(&obj->iommu);
- iommu_device_unregister(&obj->iommu);
- }
+
+ iommu_device_unregister(&obj->iommu);
omap_iommu_debugfs_remove(obj);
@@ -1723,12 +1722,19 @@ static void omap_iommu_release_device(struct device *dev)
}
+static int omap_iommu_of_xlate(struct device *dev, const struct of_phandle_args *args)
+{
+ /* TODO: collect args->np to save re-parsing in probe above */
+ return 0;
+}
+
static const struct iommu_ops omap_iommu_ops = {
.identity_domain = &omap_iommu_identity_domain,
.domain_alloc_paging = omap_iommu_domain_alloc_paging,
.probe_device = omap_iommu_probe_device,
.release_device = omap_iommu_release_device,
.device_group = generic_single_device_group,
+ .of_xlate = omap_iommu_of_xlate,
.pgsize_bitmap = OMAP_IOMMU_PGSIZES,
.default_domain_ops = &(const struct iommu_domain_ops) {
.attach_dev = omap_iommu_attach_dev,
--
2.39.2.101.g768bb238c484.dirty
next prev parent reply other threads:[~2024-10-28 17:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-28 17:58 [PATCH 0/4] Fix omap-iommu bitrot Robin Murphy
2024-10-28 17:58 ` [PATCH 1/4] remoteproc/omap: Handle ARM dma_iommu_mapping Robin Murphy
2024-12-06 17:00 ` Mathieu Poirier
2024-10-28 17:58 ` [PATCH 2/4] media: omap3isp: " Robin Murphy
2025-02-15 6:57 ` Sicelo
2025-02-15 19:43 ` Laurent Pinchart
2025-02-16 10:27 ` Sakari Ailus
2024-10-28 17:58 ` Robin Murphy [this message]
2024-10-28 17:58 ` [PATCH 4/4] iommu: Make bus_iommu_probe() static Robin Murphy
2024-10-28 20:46 ` [PATCH 0/4] Fix omap-iommu bitrot H. Nikolaus Schaller
2024-10-28 22:56 ` Mathieu Poirier
2024-10-29 17:07 ` Kevin Hilman
2024-10-30 4:55 ` Beleswar Prasad Padhi
2024-10-30 9:55 ` Joerg Roedel
2024-10-30 11:20 ` H. Nikolaus Schaller
2024-10-30 12:38 ` Joerg Roedel
2024-10-30 13:28 ` Sicelo
2024-10-30 23:49 ` Adam Ford
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=cfd766f96bc799e32b97f4664707adbcf99097b0.1730136799.git.robin.murphy@arm.com \
--to=robin.murphy@arm.com \
--cc=andersson@kernel.org \
--cc=andreas@kemnade.info \
--cc=b-padhi@ti.com \
--cc=hns@goldelico.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=mchehab@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).