public inbox for linux-arm-msm@vger.kernel.org
 help / color / mirror / Atom feed
From: Ekansh Gupta via B4 Relay <devnull+ekansh.gupta.oss.qualcomm.com@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 "Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	 Thierry Reding <thierry.reding@kernel.org>,
	 Mikko Perttunen <mperttunen@nvidia.com>,
	David Airlie <airlied@gmail.com>,
	 Simona Vetter <simona@ffwll.ch>, Joerg Roedel <joro@8bytes.org>,
	 Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	 Arnd Bergmann <arnd@arndb.de>,
	Srinivas Kandagatla <srini@kernel.org>,
	 Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	 Bharath Kumar <quic_bkumar@quicinc.com>,
	 Chenna Kesava Raju <quic_chennak@quicinc.com>
Cc: linux-kernel@vger.kernel.org, driver-core@lists.linux.dev,
	 dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org,
	 iommu@lists.linux.dev, linux-arm-msm@vger.kernel.org,
	 Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>
Subject: [PATCH 2/3] gpu: host1x: Migrate to generic context device bus
Date: Tue, 14 Apr 2026 22:01:16 +0530	[thread overview]
Message-ID: <20260414-computebus-v1-2-4d904d40926a@oss.qualcomm.com> (raw)
In-Reply-To: <20260414-computebus-v1-0-4d904d40926a@oss.qualcomm.com>

From: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>

Replace the host1x-specific context device bus with the generic
context_device_bus_type. This eliminates driver-specific bus
infrastructure in favor of shared code in the driver core.

The host1x driver creates synthetic context bank devices to represent
IOMMU contexts for memory isolation. These devices were previously
registered on a host1x-specific bus ("host1x-context"), but this
functionality is now provided by the generic "context-device" bus.

The IOMMU subsystem is updated to recognize the generic bus instead
of the host1x-specific one, allowing proper IOMMU operations on
context devices.

This change maintains functional equivalence - context devices still
work the same way, just on a different bus. The device names remain
"host1x-ctx.N" to preserve any userspace dependencies.

Signed-off-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>
---
 drivers/gpu/host1x/Kconfig       |  5 +----
 drivers/gpu/host1x/Makefile      |  1 -
 drivers/gpu/host1x/context.c     |  2 +-
 drivers/gpu/host1x/context.h     |  3 +--
 drivers/gpu/host1x/context_bus.c | 26 --------------------------
 drivers/iommu/iommu.c            |  6 +++---
 6 files changed, 6 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/host1x/Kconfig b/drivers/gpu/host1x/Kconfig
index e6c78ae2003a..e3e3896f4d71 100644
--- a/drivers/gpu/host1x/Kconfig
+++ b/drivers/gpu/host1x/Kconfig
@@ -1,13 +1,10 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
-config TEGRA_HOST1X_CONTEXT_BUS
-	bool
-
 config TEGRA_HOST1X
 	tristate "NVIDIA Tegra host1x driver"
 	depends on ARCH_TEGRA || COMPILE_TEST
 	select DMA_SHARED_BUFFER
-	select TEGRA_HOST1X_CONTEXT_BUS
+	select CONTEXT_DEVICE_BUS
 	select IOMMU_IOVA
 	help
 	  Driver for the NVIDIA Tegra host1x hardware.
diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile
index fead483af0b4..2ccd9a5f1c65 100644
--- a/drivers/gpu/host1x/Makefile
+++ b/drivers/gpu/host1x/Makefile
@@ -23,4 +23,3 @@ host1x-$(CONFIG_IOMMU_API) += \
 	context.o
 
 obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
-obj-$(CONFIG_TEGRA_HOST1X_CONTEXT_BUS) += context_bus.o
diff --git a/drivers/gpu/host1x/context.c b/drivers/gpu/host1x/context.c
index d50d41c20561..6411c17cc060 100644
--- a/drivers/gpu/host1x/context.c
+++ b/drivers/gpu/host1x/context.c
@@ -54,7 +54,7 @@ int host1x_memory_context_list_init(struct host1x *host1x)
 		ctx->dev.dma_mask = &ctx->dma_mask;
 		ctx->dev.coherent_dma_mask = ctx->dma_mask;
 		dev_set_name(&ctx->dev, "host1x-ctx.%d", i);
-		ctx->dev.bus = &host1x_context_device_bus_type;
+		ctx->dev.bus = &context_device_bus_type;
 		ctx->dev.parent = host1x->dev;
 		ctx->dev.release = host1x_memory_context_release;
 
diff --git a/drivers/gpu/host1x/context.h b/drivers/gpu/host1x/context.h
index 3e03bc1d3bac..87ae522fafc7 100644
--- a/drivers/gpu/host1x/context.h
+++ b/drivers/gpu/host1x/context.h
@@ -8,13 +8,12 @@
 #ifndef __HOST1X_CONTEXT_H
 #define __HOST1X_CONTEXT_H
 
+#include <linux/context_bus.h>
 #include <linux/mutex.h>
 #include <linux/refcount.h>
 
 struct host1x;
 
-extern struct bus_type host1x_context_device_bus_type;
-
 struct host1x_memory_context_list {
 	struct mutex lock;
 	struct host1x_memory_context *devs;
diff --git a/drivers/gpu/host1x/context_bus.c b/drivers/gpu/host1x/context_bus.c
deleted file mode 100644
index 7cd0e1a5edd1..000000000000
--- a/drivers/gpu/host1x/context_bus.c
+++ /dev/null
@@ -1,26 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (c) 2021, NVIDIA Corporation.
- */
-
-#include <linux/device.h>
-#include <linux/of.h>
-
-const struct bus_type host1x_context_device_bus_type = {
-	.name = "host1x-context",
-};
-EXPORT_SYMBOL_GPL(host1x_context_device_bus_type);
-
-static int __init host1x_context_device_bus_init(void)
-{
-	int err;
-
-	err = bus_register(&host1x_context_device_bus_type);
-	if (err < 0) {
-		pr_err("bus type registration failed: %d\n", err);
-		return err;
-	}
-
-	return 0;
-}
-postcore_initcall(host1x_context_device_bus_init);
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 61c12ba78206..f01a13e2e634 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -16,7 +16,7 @@
 #include <linux/export.h>
 #include <linux/slab.h>
 #include <linux/errno.h>
-#include <linux/host1x_context_bus.h>
+#include <linux/context_bus.h>
 #include <linux/iommu.h>
 #include <linux/iommufd.h>
 #include <linux/idr.h>
@@ -173,8 +173,8 @@ static const struct bus_type * const iommu_buses[] = {
 #ifdef CONFIG_FSL_MC_BUS
 	&fsl_mc_bus_type,
 #endif
-#ifdef CONFIG_TEGRA_HOST1X_CONTEXT_BUS
-	&host1x_context_device_bus_type,
+#ifdef CONFIG_CONTEXT_DEVICE_BUS
+	&context_device_bus_type,
 #endif
 #ifdef CONFIG_CDX_BUS
 	&cdx_bus_type,

-- 
2.34.1



  parent reply	other threads:[~2026-04-14 16:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-14 16:31 [PATCH 0/3] Introduce generic context device bus for IOMMU context isolation Ekansh Gupta via B4 Relay
2026-04-14 16:31 ` [PATCH 1/3] drivers: base: Add generic context device bus Ekansh Gupta via B4 Relay
2026-04-14 16:49   ` Greg Kroah-Hartman
2026-04-15 17:34     ` Vishnu Reddy
2026-04-20 22:56       ` Jason Gunthorpe
2026-04-15 11:25   ` Srinivas Kandagatla
2026-04-15 17:16   ` Vishnu Reddy
2026-04-14 16:31 ` Ekansh Gupta via B4 Relay [this message]
2026-04-14 16:31 ` [PATCH 3/3] misc: fastrpc: Use context device bus for compute banks Ekansh Gupta via B4 Relay
2026-04-14 17:59   ` Dmitry Baryshkov
2026-04-15 11:36   ` Srinivas Kandagatla
2026-04-15 16:05   ` Vishnu Reddy
2026-04-19  0:16     ` 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=20260414-computebus-v1-2-4d904d40926a@oss.qualcomm.com \
    --to=devnull+ekansh.gupta.oss.qualcomm.com@kernel.org \
    --cc=airlied@gmail.com \
    --cc=arnd@arndb.de \
    --cc=dakr@kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=driver-core@lists.linux.dev \
    --cc=ekansh.gupta@oss.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mperttunen@nvidia.com \
    --cc=quic_bkumar@quicinc.com \
    --cc=quic_chennak@quicinc.com \
    --cc=rafael@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=simona@ffwll.ch \
    --cc=srini@kernel.org \
    --cc=thierry.reding@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