All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v1 1/3] gpu: host1x: Remove implicit IOMMU backing on client's registration
Date: Sun, 23 Jun 2019 20:37:41 +0300	[thread overview]
Message-ID: <20190623173743.24088-1-digetx@gmail.com> (raw)

On ARM32 we don't want any of the clients device to be backed by the
implicit domain, simply because we can't afford such a waste on older
Tegra SoCs that have very few domains available in total. The recent IOMMU
support addition for the Video Decoder hardware uncovered the problem
that an unfortunate drivers probe order results in the DRM driver probe
failure if CONFIG_ARM_DMA_USE_IOMMU=y due to a shortage of IOMMU domains
caused by the implicit backing. The host1x_client_register() is a common
function that is invoked by all of the relevant DRM drivers during theirs
probe and hence it is convenient to remove the implicit backing there,
resolving the problem.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/gpu/host1x/bus.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
index 742aa9ff21b8..559df3974afb 100644
--- a/drivers/gpu/host1x/bus.c
+++ b/drivers/gpu/host1x/bus.c
@@ -14,6 +14,10 @@
 #include "bus.h"
 #include "dev.h"
 
+#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
+#include <asm/dma-iommu.h>
+#endif
+
 static DEFINE_MUTEX(clients_lock);
 static LIST_HEAD(clients);
 
@@ -710,6 +714,21 @@ int host1x_client_register(struct host1x_client *client)
 	struct host1x *host1x;
 	int err;
 
+#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
+	/*
+	 * The client's driver could be backed by implicit IOMMU mapping
+	 * and we don't want to have that because all of current Tegra
+	 * drivers are managing IOMMU by themselves. This is a convenient
+	 * place for unmapping of the implicit mapping because this function
+	 * is called by all host1x drivers during theirs probe.
+	 */
+	if (client->dev->archdata.mapping) {
+		struct dma_iommu_mapping *mapping =
+			to_dma_iommu_mapping(client->dev);
+		arm_iommu_detach_device(client->dev);
+		arm_iommu_release_mapping(mapping);
+	}
+#endif
 	mutex_lock(&devices_lock);
 
 	list_for_each_entry(host1x, &devices, list) {
-- 
2.22.0

             reply	other threads:[~2019-06-23 17:37 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-23 17:37 Dmitry Osipenko [this message]
2019-06-23 17:37 ` [PATCH v1 2/3] drm/tegra: Fix 2d and 3d clients detaching from IOMMU domain Dmitry Osipenko
2019-10-24 11:58   ` Thierry Reding
2019-10-24 11:58     ` Thierry Reding
2019-10-24 13:28     ` Dmitry Osipenko
2019-10-24 13:28       ` Dmitry Osipenko
2019-10-24 13:50       ` Thierry Reding
2019-10-24 13:50         ` Thierry Reding
2019-10-24 15:47         ` Dmitry Osipenko
2019-10-24 15:47           ` Dmitry Osipenko
2019-10-24 15:56           ` Thierry Reding
2019-10-24 15:56             ` Thierry Reding
2019-10-24 15:57             ` Dmitry Osipenko
2019-10-24 15:57               ` Dmitry Osipenko
2019-10-24 16:09               ` Dmitry Osipenko
2019-10-24 16:09                 ` Dmitry Osipenko
2019-10-24 16:21                 ` Dmitry Osipenko
2019-10-24 16:21                   ` Dmitry Osipenko
2019-10-24 16:31                   ` Dmitry Osipenko
2019-10-24 16:31                     ` Dmitry Osipenko
2019-10-24 17:28                     ` Thierry Reding
2019-10-24 17:28                       ` Thierry Reding
2019-10-24 18:46                       ` Dmitry Osipenko
2019-10-24 18:46                         ` Dmitry Osipenko
2019-10-25 11:48                         ` Thierry Reding
2019-10-25 11:48                           ` Thierry Reding
2019-10-25 12:35                           ` Dmitry Osipenko
2019-10-25 12:35                             ` Dmitry Osipenko
2019-06-23 17:37 ` [PATCH v1 3/3] drm/tegra: vic: Use common helpers to attach/detach " Dmitry Osipenko
2019-06-24  7:04 ` [PATCH v1 1/3] gpu: host1x: Remove implicit IOMMU backing on client's registration Christoph Hellwig
2019-06-24 12:55   ` Dmitry Osipenko
2019-10-24 11:50 ` Thierry Reding
2019-10-24 11:50   ` Thierry Reding
2019-10-24 13:35   ` Dmitry Osipenko
2019-10-24 13:35     ` Dmitry Osipenko
2019-10-24 13:47     ` Thierry Reding
2019-10-24 13:47       ` Thierry Reding
2019-10-24 17:15       ` Dmitry Osipenko
2019-10-24 17:15         ` Dmitry Osipenko
2019-10-24 17:09     ` Dmitry Osipenko
2019-10-24 17:09       ` Dmitry Osipenko

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=20190623173743.24088-1-digetx@gmail.com \
    --to=digetx@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.