On 2/24/2026 4:14 AM, Dmitry Baryshkov wrote:
On Tue, Feb 24, 2026 at 12:38:58AM +0530, Ekansh Gupta wrote:
Introduce a built-in compute context-bank (CB) bus used by the Qualcomm DSP accelerator (QDA) driver to represent DSP CB devices that require IOMMU configuration. This separates the CB bus from the QDA driver and allows QDA to remain a loadable module while the bus is always built-in.
Why? What is the actual problem that you are trying to solve?
Bus needs to be built-in as it is being used by iommu driver. I'll add more details here.
A new bool Kconfig symbol DRM_ACCEL_QDA_COMPUTE_BUS is added and is
Don't describe the patch contents. Please.
Ack.
selected by the main DRM_ACCEL_QDA driver. The parent accel Makefile is updated to descend into the QDA directory for both built-in and module builds so that the CB bus is compiled into vmlinux while the driver remains modular.
The CB bus is registered at postcore_initcall() time and is exposed to the IOMMU core through iommu_buses[] in the same way as the Tegra host1x context-bus. This enables later patches to create CB devices on this bus and obtain IOMMU domains for them.
Note, there is nothing QDA-specific in this patch. Please explain, why the bus is QDA-specific? Can we generalize it?
I needed a custom bus here to use for the compute cb devices for iommu configurations, I don't see any reason to keep it QDA-specific. The only requirement is that this should be enabled built in whenever QDA is enabled.
But if I keep it generic, where should this be placed? Should it be accel(or drm?) specific?
Signed-off-by: Ekansh Gupta ekansh.gupta@oss.qualcomm.com
drivers/accel/Makefile | 1 + drivers/accel/qda/Kconfig | 5 +++++ drivers/accel/qda/Makefile | 2 ++ drivers/accel/qda/qda_compute_bus.c | 23 +++++++++++++++++++++++ drivers/iommu/iommu.c | 4 ++++ include/linux/qda_compute_bus.h | 22 ++++++++++++++++++++++ 6 files changed, 57 insertions(+)
diff --git a/drivers/accel/Makefile b/drivers/accel/Makefile index 58c08dd5f389..9ed843cd293f 100644 --- a/drivers/accel/Makefile +++ b/drivers/accel/Makefile @@ -6,4 +6,5 @@ obj-$(CONFIG_DRM_ACCEL_HABANALABS) += habanalabs/ obj-$(CONFIG_DRM_ACCEL_IVPU) += ivpu/ obj-$(CONFIG_DRM_ACCEL_QAIC) += qaic/ obj-$(CONFIG_DRM_ACCEL_QDA) += qda/ +obj-$(CONFIG_DRM_ACCEL_QDA_COMPUTE_BUS) += qda/ obj-$(CONFIG_DRM_ACCEL_ROCKET) += rocket/ \ No newline at end of file diff --git a/drivers/accel/qda/Kconfig b/drivers/accel/qda/Kconfig index 484d21ff1b55..ef1fa384efbe 100644 --- a/drivers/accel/qda/Kconfig +++ b/drivers/accel/qda/Kconfig @@ -3,11 +3,16 @@ # Qualcomm DSP accelerator driver #
+config DRM_ACCEL_QDA_COMPUTE_BUS
- bool
config DRM_ACCEL_QDA tristate "Qualcomm DSP accelerator" depends on DRM_ACCEL depends on ARCH_QCOM || COMPILE_TEST depends on RPMSG
- select DRM_ACCEL_QDA_COMPUTE_BUS help Enables the DRM-based accelerator driver for Qualcomm's Hexagon DSPs. This driver provides a standardized interface for offloading computational
diff --git a/drivers/accel/qda/Makefile b/drivers/accel/qda/Makefile index e7f23182589b..242684ef1af7 100644 --- a/drivers/accel/qda/Makefile +++ b/drivers/accel/qda/Makefile @@ -8,3 +8,5 @@ obj-$(CONFIG_DRM_ACCEL_QDA) := qda.o qda-y := \ qda_drv.o \ qda_rpmsg.o \
+obj-$(CONFIG_DRM_ACCEL_QDA_COMPUTE_BUS) += qda_compute_bus.o diff --git a/drivers/accel/qda/qda_compute_bus.c b/drivers/accel/qda/qda_compute_bus.c new file mode 100644 index 000000000000..1d9c39948fb5 --- /dev/null +++ b/drivers/accel/qda/qda_compute_bus.c @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +#include <linux/device.h> +#include <linux/init.h>
+struct bus_type qda_cb_bus_type = {
- .name = "qda-compute-cb",
+}; +EXPORT_SYMBOL_GPL(qda_cb_bus_type);
+static int __init qda_cb_bus_init(void) +{
- int err;
- err = bus_register(&qda_cb_bus_type);
- if (err < 0) {
pr_err("qda-compute-cb bus registration failed: %d\n", err);return err;- }
- return 0;
+}
+postcore_initcall(qda_cb_bus_init); diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 4926a43118e6..5dee912686ee 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -33,6 +33,7 @@ #include <trace/events/iommu.h> #include <linux/sched/mm.h> #include <linux/msi.h> +#include <linux/qda_compute_bus.h> #include <uapi/linux/iommufd.h> #include "dma-iommu.h" @@ -178,6 +179,9 @@ static const struct bus_type * const iommu_buses[] = { #ifdef CONFIG_CDX_BUS &cdx_bus_type, #endif +#ifdef CONFIG_DRM_ACCEL_QDA_COMPUTE_BUS
- &qda_cb_bus_type,
+#endif }; /* diff --git a/include/linux/qda_compute_bus.h b/include/linux/qda_compute_bus.h new file mode 100644 index 000000000000..807122d84e3f --- /dev/null +++ b/include/linux/qda_compute_bus.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/*
- Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
- */
+#ifndef __QDA_COMPUTE_BUS_H__ +#define __QDA_COMPUTE_BUS_H__
+#include <linux/device.h>
+/*
- Custom bus type for QDA compute context bank (CB) devices
- This bus type is used for manually created CB devices that represent
- IOMMU context banks. The custom bus allows proper IOMMU configuration
- and device management for these virtual devices.
- */
+#ifdef CONFIG_DRM_ACCEL_QDA_COMPUTE_BUS +extern struct bus_type qda_cb_bus_type; +#endif
+#endif /* __QDA_COMPUTE_BUS_H__ */
-- 2.34.1