On 10/13/2026 3:05 AM, Trilok Soni wrote:
On 10/12/2026 11:18 AM, Kishore Batta wrote:
The Sahara protocol driver currently lives under the QAIC accelerator
subsystem even though the protocol is transported over MHI and is used by
multiple Qualcomm flashless devices. This makes Sahara appear QAIC specific
and complicates reuse by other MHI based devices.

Move the Sahara protocol driver under drivers/bus/mhi as a host client
driver and build it as an independent MHI protocol driver. This keeps the
QAIC driver focused on the accelerator device while allowing other MHI
users to enable Sahara without depending on QAIC.

As part of the move, add a dedicated Kconfig/Makefile hierarchy under the
MHI host client drivers and convert the driver to use module_mhi_driver()
instead of register/unregister hooks.

Signed-off-by: Kishore Batta <[email protected]>
---
  drivers/accel/qaic/Kconfig                          |  1 +
  drivers/accel/qaic/Makefile                         |  3 +--
  drivers/accel/qaic/qaic_drv.c                       |  9 ---------
  drivers/accel/qaic/sahara.h                         | 10 ----------
  drivers/bus/mhi/host/Makefile                       |  2 +-
  drivers/bus/mhi/host/clients/Kconfig                |  6 ++++++
  drivers/bus/mhi/host/clients/Makefile               |  1 +
  drivers/bus/mhi/host/clients/sahara/Kconfig         | 15 +++++++++++++++
  drivers/bus/mhi/host/clients/sahara/Makefile        |  2 ++
  .../qaic => bus/mhi/host/clients/sahara}/sahara.c   | 21 ++++++++-------------
  10 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/drivers/accel/qaic/Kconfig b/drivers/accel/qaic/Kconfig
index 
116e42d152ca885b8c59e33c7a87519a0abc6bb3..af90fdfcf77eeb6dd5ad309b33d793d4fdc91b1e
 100644
--- a/drivers/accel/qaic/Kconfig
+++ b/drivers/accel/qaic/Kconfig
@@ -8,6 +8,7 @@ config DRM_ACCEL_QAIC
        depends on DRM_ACCEL
        depends on PCI && HAS_IOMEM
        depends on MHI_BUS
+       depends on MHI_SAHARA
        select CRC32
        select WANT_DEV_COREDUMP
        help
diff --git a/drivers/accel/qaic/Makefile b/drivers/accel/qaic/Makefile
index 
71f727b74da3bb4478324689f02a7cea24a05c2d..e7b8458800072aa627f7f36c3257883aa56f4ce4
 100644
--- a/drivers/accel/qaic/Makefile
+++ b/drivers/accel/qaic/Makefile
@@ -13,7 +13,6 @@ qaic-y := \
        qaic_ras.o \
        qaic_ssr.o \
        qaic_sysfs.o \
-       qaic_timesync.o \
-       sahara.o
+       qaic_timesync.o
qaic-$(CONFIG_DEBUG_FS) += qaic_debugfs.o
diff --git a/drivers/accel/qaic/qaic_drv.c b/drivers/accel/qaic/qaic_drv.c
index 
0acf6cdd44f81430ec52c7120b8b50c60721a615..64e87dfaa560376ecdf1e6f8bf7abf6153160926
 100644
--- a/drivers/accel/qaic/qaic_drv.c
+++ b/drivers/accel/qaic/qaic_drv.c
@@ -32,7 +32,6 @@
  #include "qaic_ras.h"
  #include "qaic_ssr.h"
  #include "qaic_timesync.h"
-#include "sahara.h"
MODULE_IMPORT_NS("DMA_BUF"); @@ -789,12 +788,6 @@ static int __init qaic_init(void)
                goto free_pci;
        }
- ret = sahara_register();
-       if (ret) {
-               pr_debug("qaic: sahara_register failed %d\n", ret);
-               goto free_mhi;
-       }
-
        ret = qaic_timesync_init();
        if (ret)
                pr_debug("qaic: qaic_timesync_init failed %d\n", ret);
@@ -816,7 +809,6 @@ static int __init qaic_init(void)
free_bootlog:
        qaic_bootlog_unregister();
-free_mhi:
        mhi_driver_unregister(&qaic_mhi_driver);
  free_pci:
        pci_unregister_driver(&qaic_pci_driver);
@@ -845,7 +837,6 @@ static void __exit qaic_exit(void)
        qaic_ras_unregister();
        qaic_bootlog_unregister();
        qaic_timesync_deinit();
-       sahara_unregister();
        mhi_driver_unregister(&qaic_mhi_driver);
        pci_unregister_driver(&qaic_pci_driver);
  }
diff --git a/drivers/accel/qaic/sahara.h b/drivers/accel/qaic/sahara.h
deleted file mode 100644
index 
08037281c80e28f6c85b924c45ce2c2f9dc60c39..0000000000000000000000000000000000000000
--- a/drivers/accel/qaic/sahara.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-/* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. */
-
-#ifndef __SAHARA_H__
-#define __SAHARA_H__
-
-int sahara_register(void);
-void sahara_unregister(void);
-#endif /* __SAHARA_H__ */
diff --git a/drivers/bus/mhi/host/Makefile b/drivers/bus/mhi/host/Makefile
index 
2a16008aeb38127494782bbff4e1656428d2b776..2e8949f1a2fe6f3f3b2e1dc541f97d2c393d6a0f
 100644
--- a/drivers/bus/mhi/host/Makefile
+++ b/drivers/bus/mhi/host/Makefile
@@ -4,4 +4,4 @@ mhi-$(CONFIG_MHI_BUS_DEBUG) += debugfs.o
obj-$(CONFIG_MHI_BUS_PCI_GENERIC) += mhi_pci_generic.o
  mhi_pci_generic-y += pci_generic.o
-obj-y += clients/
+obj-$(CONFIG_MHI_BUS) += clients/
diff --git a/drivers/bus/mhi/host/clients/Kconfig 
b/drivers/bus/mhi/host/clients/Kconfig
index 
8bb5715e61d0d6e64a51012b4e1594ba46e5bfc1..1932344157a5b1dc25c8d63f6d4ac38f896d08a7
 100644
--- a/drivers/bus/mhi/host/clients/Kconfig
+++ b/drivers/bus/mhi/host/clients/Kconfig
@@ -15,3 +15,9 @@ config MHI_BUS_LOOPBACK
To compile this driver as a module, choose M here. The module
          will be called mhi_loopback.
+
+menu "MHI host client drivers"
+
+source "drivers/bus/mhi/host/clients/sahara/Kconfig"
+
+endmenu
diff --git a/drivers/bus/mhi/host/clients/Makefile 
b/drivers/bus/mhi/host/clients/Makefile
index 
3811b6928f42b38f94b1167941cf3b0fe512d32b..67e70de280369870164b4808f39d9b3340f2589b
 100644
--- a/drivers/bus/mhi/host/clients/Makefile
+++ b/drivers/bus/mhi/host/clients/Makefile
@@ -1,2 +1,3 @@
  obj-$(CONFIG_MHI_BUS_LOOPBACK) += mhi_loopback.o
  mhi_loopback-y += loopback.o
+obj-$(CONFIG_MHI_SAHARA) += sahara/
diff --git a/drivers/bus/mhi/host/clients/sahara/Kconfig 
b/drivers/bus/mhi/host/clients/sahara/Kconfig
new file mode 100644
index 
0000000000000000000000000000000000000000..f1fc7013a2dee0be645c50f32305659e591de7e7
--- /dev/null
+++ b/drivers/bus/mhi/host/clients/sahara/Kconfig
@@ -0,0 +1,15 @@
+config MHI_SAHARA
+       tristate "Sahara protocol driver"
+       depends on MHI_BUS
+       help
+         Enable support for the Sahara protocol transported over the MHI bus.
+
+         The Sahara protocol is used to transfer firmware images, retrieve
+         memory dumps and exchange command mode DDR calibration data between
+         host and device. This driver is not tied to a specific SoC and may be
+         used by multiple MHI based devices.
+
+         If unsure, say N.
+
+         To compile this driver as a module, choose M here: the module will be
+         called mhi_sahara.
diff --git a/drivers/bus/mhi/host/clients/sahara/Makefile 
b/drivers/bus/mhi/host/clients/sahara/Makefile
new file mode 100644
index 
0000000000000000000000000000000000000000..fc02a25935011cbd7138ea8f24b88cf5b032a4ce
--- /dev/null
+++ b/drivers/bus/mhi/host/clients/sahara/Makefile
@@ -0,0 +1,2 @@
+obj-$(CONFIG_MHI_SAHARA) += mhi_sahara.o
+mhi_sahara-y := sahara.o
diff --git a/drivers/accel/qaic/sahara.c 
b/drivers/bus/mhi/host/clients/sahara/sahara.c
similarity index 99%
rename from drivers/accel/qaic/sahara.c
rename to drivers/bus/mhi/host/clients/sahara/sahara.c
index 
c7c0b3eb4b65fb7776a6c724cb3105046cf6f7eb..dc64beae06ada6915a506ed8f4ae4d71c03158bb
 100644
--- a/drivers/accel/qaic/sahara.c
+++ b/drivers/bus/mhi/host/clients/sahara/sahara.c
@@ -1,19 +1,20 @@
  // SPDX-License-Identifier: GPL-2.0-only
-
-/* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. */
+/*
+ * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ *
+ */
Never delete the copyright lines please.  Is there any previous discussion on 
why we are doing it?

---Trilok Soni


Hi Trilok, In Patch 1 series, I was asked to match the style of comment matches the subsystem where this driver is moved to. Same has been incorporated. This driver was not developed before 2024 and hence kept same copyright.


Reply via email to