linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 1/4] remoteproc/omap: Handle ARM dma_iommu_mapping
Date: Mon, 28 Oct 2024 17:58:35 +0000	[thread overview]
Message-ID: <6186e311cb6f64a787f87fd41e49a73f409b789c.1730136799.git.robin.murphy@arm.com> (raw)
In-Reply-To: <cover.1730136799.git.robin.murphy@arm.com>

It's no longer practical for the OMAP IOMMU driver to trick
arm_setup_iommu_dma_ops() into ignoring its presence, so let's use the
same tactic as other IOMMU API users on 32-bit ARM and explicitly kick
the arch code's dma_iommu_mapping out of the way to avoid problems.

Fixes: 4720287c7bf7 ("iommu: Remove struct iommu_ops *iommu from arch_setup_dma_ops()")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 drivers/remoteproc/omap_remoteproc.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/remoteproc/omap_remoteproc.c b/drivers/remoteproc/omap_remoteproc.c
index 9ae2e831456d..3260dd512491 100644
--- a/drivers/remoteproc/omap_remoteproc.c
+++ b/drivers/remoteproc/omap_remoteproc.c
@@ -37,6 +37,10 @@
 
 #include <linux/platform_data/dmtimer-omap.h>
 
+#ifdef CONFIG_ARM_DMA_USE_IOMMU
+#include <asm/dma-iommu.h>
+#endif
+
 #include "omap_remoteproc.h"
 #include "remoteproc_internal.h"
 
@@ -1323,6 +1327,19 @@ static int omap_rproc_probe(struct platform_device *pdev)
 	/* All existing OMAP IPU and DSP processors have an MMU */
 	rproc->has_iommu = true;
 
+#ifdef CONFIG_ARM_DMA_USE_IOMMU
+	/*
+	 * Throw away the ARM DMA mapping that we'll never use, so it doesn't
+	 * interfere with the core rproc->domain and we get the right DMA ops.
+	 */
+	if (pdev->dev.archdata.mapping) {
+		struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(&pdev->dev);
+
+		arm_iommu_detach_device(&pdev->dev);
+		arm_iommu_release_mapping(mapping);
+	}
+#endif
+
 	ret = omap_rproc_of_get_internal_memories(pdev, rproc);
 	if (ret)
 		return ret;
-- 
2.39.2.101.g768bb238c484.dirty


  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 ` Robin Murphy [this message]
2024-12-06 17:00   ` [PATCH 1/4] remoteproc/omap: Handle ARM dma_iommu_mapping 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 ` [PATCH 3/4] iommu/omap: Add minimal fwnode support Robin Murphy
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=6186e311cb6f64a787f87fd41e49a73f409b789c.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).