| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/09/18 22:59 | flow | patch-triage |
1mArgs:null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"KMSANReasoning": "",
"NeedsKMSAN": false,
"Reasoning": "The patch introduces PTP Hardware Clock (PHC) support for Qualcomm Modem Host Interface (MHI) devices via the MHI PCI generic host driver (mhi_pci_generic). This code requires physical Qualcomm PCIe hardware (such as SDX55/SDX65 modems) that is not emulated in standard QEMU or GCE virtual environments. Because the modified code is structurally unreachable in standard fuzzing environments, it does not warrant fuzzing.",
"WorthFuzzing": false
} |
| 1/1 | 2026/09/18 22:59 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 67d5e10f7d350a88eb8f35c55f62cf53e5dcd528\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Fri Sep 18 22:59:21 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/drivers/bus/mhi/common.h b/drivers/bus/mhi/common.h\nindex dda340aaed95a..64f9b2b94387a 100644\n--- a/drivers/bus/mhi/common.h\n+++ b/drivers/bus/mhi/common.h\n@@ -16,6 +16,7 @@\n #define MHICFG\t\t\t\t0x10\n #define CHDBOFF\t\t\t\t0x18\n #define ERDBOFF\t\t\t\t0x20\n+#define MISCOFF\t\t\t\t0x24\n #define BHIOFF\t\t\t\t0x28\n #define BHIEOFF\t\t\t\t0x2c\n #define DEBUGOFF\t\t\t0x30\n@@ -113,6 +114,13 @@\n #define MHISTATUS_MHISTATE_MASK\t\tGENMASK(15, 8)\n #define MHISTATUS_SYSERR_MASK\t\tBIT(2)\n #define MHISTATUS_READY_MASK\t\tBIT(0)\n+#define MISC_CAP_MASK\t\t\tGENMASK(31, 0)\n+#define CAP_CAPID_MASK\t\t\tGENMASK(31, 24)\n+#define CAP_NEXT_CAP_MASK\t\tGENMASK(23, 12)\n+\n+/* MHI TSC Timesync */\n+#define TSC_TIMESYNC_TIME_LOW_OFFSET\t(0x8)\n+#define TSC_TIMESYNC_TIME_HIGH_OFFSET\t(0xC)\n \n /* Command Ring Element macros */\n /* No operation command */\n@@ -204,6 +212,13 @@\n #define MHI_RSCTRE_DATA_DWORD1\t\tcpu_to_le32(FIELD_PREP(GENMASK(23, 16), \\\n \t\t\t\t\t\t\t MHI_PKT_TYPE_COALESCING))\n \n+#define MHI_CAP_ID_INTX\t\t\t0x1\n+#define MHI_CAP_ID_TIME_SYNC\t\t0x2\n+#define MHI_CAP_ID_BW_SCALE\t\t0x3\n+#define MHI_CAP_ID_TSC_TIME_SYNC\t0x4\n+#define MHI_CAP_ID_MAX_TRB_LEN\t\t0x5\n+#define MHI_CAP_ID_MAX\t\t\t0x6\n+\n enum mhi_pkt_type {\n \tMHI_PKT_TYPE_INVALID = 0x0,\n \tMHI_PKT_TYPE_NOOP_CMD = 0x1,\ndiff --git a/drivers/bus/mhi/host/Kconfig b/drivers/bus/mhi/host/Kconfig\nindex da5cd0c9fc620..7609768c0efeb 100644\n--- a/drivers/bus/mhi/host/Kconfig\n+++ b/drivers/bus/mhi/host/Kconfig\n@@ -29,3 +29,12 @@ config MHI_BUS_PCI_GENERIC\n \t This driver provides MHI PCI controller driver for devices such as\n \t Qualcomm SDX55 based PCIe modems.\n \n+config MHI_BUS_PHC\n+\ttristate \"MHI PHC driver\"\n+\tdepends on MHI_BUS\n+\tdepends on PTP_1588_CLOCK\n+\thelp\n+\t This driver provides Precision Time Protocol (PTP) clock and\n+\t communicates with MHI PCI driver to get the device side timestamp,\n+\t which enables precise time synchronization between the host and\n+\t the device.\ndiff --git a/drivers/bus/mhi/host/Makefile b/drivers/bus/mhi/host/Makefile\nindex 859c2f38451c6..f16b3195a03a1 100644\n--- a/drivers/bus/mhi/host/Makefile\n+++ b/drivers/bus/mhi/host/Makefile\n@@ -4,3 +4,5 @@ mhi-$(CONFIG_MHI_BUS_DEBUG) += debugfs.o\n \n obj-$(CONFIG_MHI_BUS_PCI_GENERIC) += mhi_pci_generic.o\n mhi_pci_generic-y += pci_generic.o\n+\n+obj-$(CONFIG_MHI_BUS_PHC) += mhi_phc.o\ndiff --git a/drivers/bus/mhi/host/init.c b/drivers/bus/mhi/host/init.c\nindex fd3050889412d..caa307c71890f 100644\n--- a/drivers/bus/mhi/host/init.c\n+++ b/drivers/bus/mhi/host/init.c\n@@ -465,6 +465,64 @@ static int mhi_init_dev_ctxt(struct mhi_controller *mhi_cntrl)\n \treturn ret;\n }\n \n+static int mhi_find_capability(struct mhi_controller *mhi_cntrl, u32 capability)\n+{\n+\tu32 val, cur_cap, next_offset, cur_offset;\n+\tint ret;\n+\n+\t/* Get the first supported capability offset */\n+\tret = mhi_read_reg_field(mhi_cntrl, mhi_cntrl-\u003eregs, MISCOFF, MISC_CAP_MASK, \u0026cur_offset);\n+\tif (ret)\n+\t\treturn 0;\n+\n+\tdo {\n+\t\tif (cur_offset \u003e= mhi_cntrl-\u003ereg_len)\n+\t\t\treturn 0;\n+\n+\t\tret = mhi_read_reg(mhi_cntrl, mhi_cntrl-\u003eregs, cur_offset, \u0026val);\n+\t\tif (ret)\n+\t\t\treturn 0;\n+\n+\t\tcur_cap = FIELD_GET(CAP_CAPID_MASK, val);\n+\t\tnext_offset = FIELD_GET(CAP_NEXT_CAP_MASK, val);\n+\t\tif (cur_cap \u003e= MHI_CAP_ID_MAX)\n+\t\t\treturn 0;\n+\n+\t\tif (cur_cap == capability)\n+\t\t\treturn cur_offset;\n+\n+\t\tcur_offset = next_offset;\n+\t} while (next_offset);\n+\n+\treturn 0;\n+}\n+\n+#if IS_ENABLED(CONFIG_MHI_BUS_PHC)\n+int mhi_init_tsc_timesync(struct mhi_controller *mhi_cntrl)\n+{\n+\tstruct device *dev = \u0026mhi_cntrl-\u003emhi_dev-\u003edev;\n+\tstruct mhi_timesync *mhi_tsync;\n+\tu32 time_offset;\n+\n+\ttime_offset = mhi_find_capability(mhi_cntrl, MHI_CAP_ID_TSC_TIME_SYNC);\n+\tif (!time_offset)\n+\t\treturn -ENXIO;\n+\n+\tmhi_tsync = devm_kzalloc(dev, sizeof(*mhi_tsync), GFP_KERNEL);\n+\tif (!mhi_tsync)\n+\t\treturn -ENOMEM;\n+\n+\tmutex_init(\u0026mhi_tsync-\u003ets_mutex);\n+\n+\t/* save time_offset for obtaining time via MMIO register reads */\n+\tmhi_tsync-\u003etime_reg = mhi_cntrl-\u003eregs + time_offset;\n+\n+\tmhi_cntrl-\u003etsc_timesync = mhi_tsync;\n+\n+\treturn 0;\n+}\n+#endif\n+\n int mhi_init_mmio(struct mhi_controller *mhi_cntrl)\n {\n \tu32 val;\n@@ -602,6 +660,13 @@ int mhi_init_mmio(struct mhi_controller *mhi_cntrl)\n \t\treturn ret;\n \t}\n \n+\t/* Discover TSC time sync capability, if present */\n+\tret = mhi_init_tsc_timesync(mhi_cntrl);\n+\tif (ret \u0026\u0026 ret != -ENXIO) {\n+\t\tdev_err(dev, \"Error configuring TSC time sync\\n\");\n+\t\treturn ret;\n+\t}\n+\n \treturn 0;\n }\n \ndiff --git a/drivers/bus/mhi/host/internal.h b/drivers/bus/mhi/host/internal.h\nindex 7b0ee5e3a12dd..bb96dfffabb6a 100644\n--- a/drivers/bus/mhi/host/internal.h\n+++ b/drivers/bus/mhi/host/internal.h\n@@ -9,6 +9,10 @@\n \n #include \"../common.h\"\n \n+#if IS_ENABLED(CONFIG_MHI_BUS_PHC)\n+#include \u003clinux/ptp_clock_kernel.h\u003e\n+#endif\n+\n extern const struct bus_type mhi_bus_type;\n \n /* Host request register */\n@@ -24,6 +28,24 @@ struct mhi_ctxt {\n \tdma_addr_t cmd_ctxt_addr;\n };\n \n+#if IS_ENABLED(CONFIG_MHI_BUS_PHC)\n+/**\n+ * struct mhi_timesync - MHI time synchronization structure\n+ * @time_reg: Points to address of Timesync register\n+ * @ts_mutex: Mutex for synchronization\n+ * @ptp_clock: associated PTP clock\n+ * @ptp_clock_info: PTP clock information\n+ * @mhi_dev: associated mhi device object\n+ */\n+struct mhi_timesync {\n+\tvoid __iomem *time_reg;\n+\tstruct mutex ts_mutex;\n+\tstruct ptp_clock *ptp_clock;\n+\tstruct ptp_clock_info ptp_clock_info;\n+\tstruct mhi_device *mhi_dev;\n+};\n+#endif\n+\n struct bhi_vec_entry {\n \t__le64 dma_addr;\n \t__le64 size;\n@@ -364,6 +386,8 @@ void mhi_db_brstmode_disable(struct mhi_controller *mhi_cntrl,\n \t\t\t dma_addr_t db_val);\n int __must_check mhi_read_reg(struct mhi_controller *mhi_cntrl,\n \t\t\t void __iomem *base, u32 offset, u32 *out);\n+int __must_check mhi_read_reg64(struct mhi_controller *mhi_cntrl,\n+\t\t\t\tvoid __iomem *base, u32 offset, u64 *out);\n int __must_check mhi_read_reg_field(struct mhi_controller *mhi_cntrl,\n \t\t\t\t void __iomem *base, u32 offset, u32 mask,\n \t\t\t\t u32 *out);\n@@ -372,6 +396,8 @@ int __must_check mhi_poll_reg_field(struct mhi_controller *mhi_cntrl,\n \t\t\t\t u32 val, u32 delayus, u32 timeout_ms);\n void mhi_write_reg(struct mhi_controller *mhi_cntrl, void __iomem *base,\n \t\t u32 offset, u32 val);\n+void __maybe_unused mhi_write_reg64(struct mhi_controller *mhi_cntrl, void __iomem *base,\n+\t\t\t\t u32 offset, u64 val);\n int __must_check mhi_write_reg_field(struct mhi_controller *mhi_cntrl,\n \t\t\t\t void __iomem *base, u32 offset, u32 mask,\n \t\t\t\t u32 val);\n@@ -388,6 +414,15 @@ int mhi_rddm_prepare(struct mhi_controller *mhi_cntrl,\n \t\t struct image_info *img_info);\n void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl);\n \n+#if IS_ENABLED(CONFIG_MHI_BUS_PHC)\n+int mhi_init_tsc_timesync(struct mhi_controller *mhi_cntrl);\n+#else\n+static inline int mhi_init_tsc_timesync(struct mhi_controller *mhi_cntrl)\n+{\n+\treturn 0;\n+}\n+#endif\n+\n int mhi_init_chan_ctxt(struct mhi_controller *mhi_cntrl,\n \t\t struct mhi_chan *mhi_chan);\n void mhi_deinit_chan_ctxt(struct mhi_controller *mhi_cntrl,\ndiff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c\nindex 4d458396233ab..1ca9f781bbdbb 100644\n--- a/drivers/bus/mhi/host/main.c\n+++ b/drivers/bus/mhi/host/main.c\n@@ -22,6 +22,7 @@ int __must_check mhi_read_reg(struct mhi_controller *mhi_cntrl,\n {\n \treturn mhi_cntrl-\u003eread_reg(mhi_cntrl, base + offset, out);\n }\n+EXPORT_SYMBOL_GPL(mhi_read_reg);\n \n int __must_check mhi_read_reg_field(struct mhi_controller *mhi_cntrl,\n \t\t\t\t void __iomem *base, u32 offset,\n@@ -67,6 +68,19 @@ void mhi_write_reg(struct mhi_controller *mhi_cntrl, void __iomem *base,\n \tmhi_cntrl-\u003ewrite_reg(mhi_cntrl, base + offset, val);\n }\n \n+int __must_check mhi_read_reg64(struct mhi_controller *mhi_cntrl,\n+\t\t\t\tvoid __iomem *base, u32 offset, u64 *out)\n+{\n+\treturn mhi_cntrl-\u003eread_reg64(mhi_cntrl, base + offset, out);\n+}\n+EXPORT_SYMBOL_GPL(mhi_read_reg64);\n+\n+void __maybe_unused mhi_write_reg64(struct mhi_controller *mhi_cntrl, void __iomem *base,\n+\t\t\t\t u32 offset, u64 val)\n+{\n+\tmhi_cntrl-\u003ewrite_reg64(mhi_cntrl, base + offset, val);\n+}\n+\n int __must_check mhi_write_reg_field(struct mhi_controller *mhi_cntrl,\n \t\t\t\t void __iomem *base, u32 offset, u32 mask,\n \t\t\t\t u32 val)\ndiff --git a/drivers/bus/mhi/host/mhi_phc.c b/drivers/bus/mhi/host/mhi_phc.c\nnew file mode 100644\nindex 0000000000000..b1d10431bd307\n--- /dev/null\n+++ b/drivers/bus/mhi/host/mhi_phc.c\n@@ -0,0 +1,161 @@\n+// SPDX-License-Identifier: GPL-2.0-only\n+/*\n+ * Copyright (c) 2026, Qualcomm Technologies, Inc. and/or its subsidiaries.\n+ */\n+\n+#include \u003clinux/module.h\u003e\n+#include \u003clinux/mhi.h\u003e\n+#include \u003clinux/ptp_clock_kernel.h\u003e\n+#include \"../common.h\"\n+#include \"internal.h\"\n+#include \"mhi_phc.h\"\n+\n+/**\n+ * struct mhi_timesync_info - MHI time sync info structure\n+ * @t_dev_lo: MHI device time of lower dword\n+ * @t_dev_hi: MHI device time of higher dword\n+ */\n+struct mhi_timesync_info {\n+\tu32 t_dev_lo;\n+\tu32 t_dev_hi;\n+};\n+\n+static int mhi_get_remote_tsc_time_sync(struct mhi_device *mhi_dev, struct mhi_timesync_info *time,\n+\t\t\t\t\tstruct ptp_system_timestamp *sts)\n+{\n+\tstruct mhi_controller *mhi_cntrl = mhi_dev-\u003emhi_cntrl;\n+\tstruct mhi_timesync *mhi_tsync = mhi_cntrl-\u003etsc_timesync;\n+\tstruct device *dev = \u0026mhi_cntrl-\u003emhi_dev-\u003edev;\n+\tu64 val = U64_MAX;\n+\tu32 hi, lo = 0;\n+\tint ret;\n+\n+\tif (!mhi_tsync || !mhi_tsync-\u003etime_reg) {\n+\t\tdev_err(dev, \"Time sync is not supported\\n\");\n+\t\treturn -EOPNOTSUPP;\n+\t}\n+\n+\tmhi_cntrl-\u003eruntime_get(mhi_cntrl);\n+\n+\t/* bring to M0 state */\n+\tret = mhi_device_get_sync(mhi_cntrl-\u003emhi_dev);\n+\tif (ret) {\n+\t\tmhi_cntrl-\u003eruntime_put(mhi_cntrl);\n+\t\treturn ret;\n+\t}\n+\n+\tguard(mutex)(\u0026mhi_tsync-\u003ets_mutex);\n+\n+\t// TODO: Disable ASPM\n+\n+\t/*\n+\t * time critical code to fetch device time, delay between these two steps\n+\t * should be deterministic as possible.\n+\t */\n+\tpreempt_disable();\n+\tlocal_irq_disable();\n+\n+\tptp_read_system_prets(sts);\n+\n+\tif (mhi_cntrl-\u003eread_reg64) {\n+\t\tret = mhi_read_reg64(mhi_cntrl, mhi_tsync-\u003etime_reg,\n+\t\t\t\t TSC_TIMESYNC_TIME_LOW_OFFSET, \u0026val);\n+\t\ttime-\u003et_dev_lo = (u32)val;\n+\t\ttime-\u003et_dev_hi = (u32)(val \u003e\u003e 32);\n+\t} else {\n+\t\t/*\n+\t\t * Read the high dword twice around the low dword and retry if it\n+\t\t * changed, to avoid a torn read across a device-side rollover.\n+\t\t */\n+\t\tdo {\n+\t\t\tret = mhi_read_reg(mhi_cntrl, mhi_tsync-\u003etime_reg,\n+\t\t\t\t\t TSC_TIMESYNC_TIME_HIGH_OFFSET, \u0026hi);\n+\t\t\tif (ret)\n+\t\t\t\tbreak;\n+\n+\t\t\tret = mhi_read_reg(mhi_cntrl, mhi_tsync-\u003etime_reg,\n+\t\t\t\t\t TSC_TIMESYNC_TIME_LOW_OFFSET, \u0026lo);\n+\t\t\tif (ret)\n+\t\t\t\tbreak;\n+\n+\t\t\tret = mhi_read_reg(mhi_cntrl, mhi_tsync-\u003etime_reg,\n+\t\t\t\t\t TSC_TIMESYNC_TIME_HIGH_OFFSET, \u0026time-\u003et_dev_hi);\n+\t\t} while (!ret \u0026\u0026 hi != time-\u003et_dev_hi);\n+\n+\t\ttime-\u003et_dev_lo = lo;\n+\t}\n+\n+\tptp_read_system_postts(sts);\n+\n+\tlocal_irq_enable();\n+\tpreempt_enable();\n+\n+\tmhi_device_put(mhi_cntrl-\u003emhi_dev);\n+\n+\tmhi_cntrl-\u003eruntime_put(mhi_cntrl);\n+\n+\treturn ret;\n+}\n+\n+static int qcom_ptp_gettimex64(struct ptp_clock_info *ptp, struct timespec64 *ts,\n+\t\t\t struct ptp_system_timestamp *sts)\n+{\n+\tstruct mhi_timesync *mhi_tsync = container_of(ptp, struct mhi_timesync, ptp_clock_info);\n+\tstruct mhi_timesync_info time;\n+\tktime_t ktime_cur;\n+\tint ret;\n+\n+\tret = mhi_get_remote_tsc_time_sync(mhi_tsync-\u003emhi_dev, \u0026time, sts);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tktime_cur = time.t_dev_hi * NSEC_PER_SEC + time.t_dev_lo;\n+\t*ts = ktime_to_timespec64(ktime_cur);\n+\n+\treturn 0;\n+}\n+\n+static struct ptp_clock_info qcom_ptp_clock_info = {\n+\t.owner = THIS_MODULE,\n+\t.gettimex64 = qcom_ptp_gettimex64,\n+};\n+\n+int mhi_phc_init(struct mhi_controller *mhi_cntrl)\n+{\n+\tstruct mhi_device *mhi_dev = mhi_cntrl-\u003emhi_dev;\n+\tstruct mhi_timesync *mhi_tsync = mhi_cntrl-\u003etsc_timesync;\n+\tint ret;\n+\n+\tif (!mhi_tsync)\n+\t\treturn -ENODEV;\n+\n+\tmhi_tsync-\u003emhi_dev = mhi_dev;\n+\n+\tmhi_tsync-\u003eptp_clock_info = qcom_ptp_clock_info;\n+\tstrscpy(mhi_tsync-\u003eptp_clock_info.name, mhi_dev-\u003ename, PTP_CLOCK_NAME_LEN);\n+\n+\tmhi_tsync-\u003eptp_clock = ptp_clock_register(\u0026mhi_tsync-\u003eptp_clock_info, \u0026mhi_dev-\u003edev);\n+\tif (IS_ERR(mhi_tsync-\u003eptp_clock)) {\n+\t\tret = PTR_ERR(mhi_tsync-\u003eptp_clock);\n+\t\tdev_err(\u0026mhi_dev-\u003edev, \"Failed to register PTP clock\\n\");\n+\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n+}\n+EXPORT_SYMBOL_GPL(mhi_phc_init);\n+\n+void mhi_phc_exit(struct mhi_controller *mhi_cntrl)\n+{\n+\tstruct mhi_timesync *mhi_tsync = mhi_cntrl-\u003etsc_timesync;\n+\n+\tif (!mhi_tsync || !mhi_tsync-\u003eptp_clock)\n+\t\treturn;\n+\n+\tptp_clock_unregister(mhi_tsync-\u003eptp_clock);\n+\tmhi_tsync-\u003eptp_clock = NULL;\n+}\n+EXPORT_SYMBOL_GPL(mhi_phc_exit);\n+\n+MODULE_LICENSE(\"GPL\");\n+MODULE_DESCRIPTION(\"MHI PHC driver\");\ndiff --git a/drivers/bus/mhi/host/mhi_phc.h b/drivers/bus/mhi/host/mhi_phc.h\nnew file mode 100644\nindex 0000000000000..263574ca53da5\n--- /dev/null\n+++ b/drivers/bus/mhi/host/mhi_phc.h\n@@ -0,0 +1,21 @@\n+/* SPDX-License-Identifier: GPL-2.0-only */\n+/*\n+ * Copyright (c) 2026, Qualcomm Technologies, Inc. and/or its subsidiaries.\n+ */\n+\n+#ifndef _MHI_PHC_H\n+#define _MHI_PHC_H\n+\n+#if IS_ENABLED(CONFIG_MHI_BUS_PHC)\n+int mhi_phc_init(struct mhi_controller *mhi_cntrl);\n+void mhi_phc_exit(struct mhi_controller *mhi_cntrl);\n+#else\n+static inline int mhi_phc_init(struct mhi_controller *mhi_cntrl)\n+{\n+\treturn 0;\n+}\n+\n+static inline void mhi_phc_exit(struct mhi_controller *mhi_cntrl) {}\n+#endif\n+\n+#endif /* _MHI_PHC_H */\ndiff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c\nindex b636e2c23b4d6..0aa5cee49bdc2 100644\n--- a/drivers/bus/mhi/host/pci_generic.c\n+++ b/drivers/bus/mhi/host/pci_generic.c\n@@ -16,6 +16,7 @@\n #include \u003clinux/pm_runtime.h\u003e\n #include \u003clinux/timer.h\u003e\n #include \u003clinux/workqueue.h\u003e\n+#include \"mhi_phc.h\"\n \n #define MHI_PCI_DEFAULT_BAR_NUM 0\n \n@@ -1100,6 +1101,27 @@ struct mhi_pci_device {\n \tbool reset_on_remove;\n };\n \n+#ifdef readq\n+static int mhi_pci_read_reg64(struct mhi_controller *mhi_cntrl,\n+\t\t\t void __iomem *addr, u64 *out)\n+{\n+\t*out = readq(addr);\n+\treturn 0;\n+}\n+#else\n+#define mhi_pci_read_reg64 NULL\n+#endif\n+\n+#ifdef writeq\n+static void mhi_pci_write_reg64(struct mhi_controller *mhi_cntrl,\n+\t\t\t\tvoid __iomem *addr, u64 val)\n+{\n+\twriteq(val, addr);\n+}\n+#else\n+#define mhi_pci_write_reg64 NULL\n+#endif\n+\n static int mhi_pci_read_reg(struct mhi_controller *mhi_cntrl,\n \t\t\t void __iomem *addr, u32 *out)\n {\n@@ -1123,9 +1145,11 @@ static void mhi_pci_status_cb(struct mhi_controller *mhi_cntrl,\n \tcase MHI_CB_FATAL_ERROR:\n \tcase MHI_CB_SYS_ERROR:\n \t\tdev_warn(\u0026pdev-\u003edev, \"firmware crashed (%u)\\n\", cb);\n+\t\tmhi_phc_exit(mhi_cntrl);\n \t\tpm_runtime_forbid(\u0026pdev-\u003edev);\n \t\tbreak;\n \tcase MHI_CB_EE_MISSION_MODE:\n+\t\tmhi_phc_init(mhi_cntrl);\n \t\tpm_runtime_allow(\u0026pdev-\u003edev);\n \t\tbreak;\n \tdefault:\n@@ -1403,6 +1427,8 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)\n \n \tmhi_cntrl-\u003eread_reg = mhi_pci_read_reg;\n \tmhi_cntrl-\u003ewrite_reg = mhi_pci_write_reg;\n+\tmhi_cntrl-\u003eread_reg64 = mhi_pci_read_reg64;\n+\tmhi_cntrl-\u003ewrite_reg64 = mhi_pci_write_reg64;\n \tmhi_cntrl-\u003estatus_cb = mhi_pci_status_cb;\n \tmhi_cntrl-\u003eruntime_get = mhi_pci_runtime_get;\n \tmhi_cntrl-\u003eruntime_put = mhi_pci_runtime_put;\n@@ -1491,6 +1517,9 @@ static void mhi_pci_remove(struct pci_dev *pdev)\n \t\ttimer_delete_sync(\u0026mhi_pdev-\u003ehealth_check_timer);\n \tcancel_work_sync(\u0026mhi_pdev-\u003erecovery_work);\n \n+\t/* Remove PHC */\n+\tmhi_phc_exit(mhi_cntrl);\n+\n \tif (test_and_clear_bit(MHI_PCI_DEV_STARTED, \u0026mhi_pdev-\u003estatus)) {\n \t\tmhi_power_down(mhi_cntrl, true);\n \t\tmhi_unprepare_after_power_down(mhi_cntrl);\ndiff --git a/include/linux/mhi.h b/include/linux/mhi.h\nindex 8616bacd8675d..3dc1844222cdf 100644\n--- a/include/linux/mhi.h\n+++ b/include/linux/mhi.h\n@@ -23,6 +23,8 @@ struct mhi_event;\n struct mhi_ctxt;\n struct mhi_cmd;\n struct mhi_buf_info;\n+struct mhi_timesync;\n+\n \n /**\n * enum mhi_callback - MHI callback\n@@ -341,6 +343,7 @@ struct mhi_controller_config {\n * @mhi_event: MHI event ring configurations table\n * @mhi_cmd: MHI command ring configurations table\n * @mhi_ctxt: MHI device context, shared memory between host and device\n+ * @tsc_timesync: MHI TSC timesync\n * @pm_mutex: Mutex for suspend/resume operation\n * @pm_lock: Lock for protecting MHI power management state\n * @timeout_ms: Timeout in ms for state transitions\n@@ -371,6 +374,8 @@ struct mhi_controller_config {\n * @unmap_single: CB function to destroy TRE buffer\n * @read_reg: Read a MHI register via the physical link (required)\n * @write_reg: Write a MHI register via the physical link (required)\n+ * @read_reg64: Read a 64 bit MHI register via the physical link (optional)\n+ * @write_reg64: Write a 64 bit MHI register via the physical link (optional)\n * @reset: Controller specific reset function (optional)\n * @edl_trigger: CB function to trigger EDL mode (optional)\n * @buffer_len: Bounce buffer length\n@@ -422,6 +427,8 @@ struct mhi_controller {\n \tstruct mhi_cmd *mhi_cmd;\n \tstruct mhi_ctxt *mhi_ctxt;\n \n+\tstruct mhi_timesync *tsc_timesync;\n+\n \tstruct mutex pm_mutex;\n \trwlock_t pm_lock;\n \tu32 timeout_ms;\n@@ -456,6 +463,10 @@ struct mhi_controller {\n \t\t\tu32 *out);\n \tvoid (*write_reg)(struct mhi_controller *mhi_cntrl, void __iomem *addr,\n \t\t\t u32 val);\n+\tint (*read_reg64)(struct mhi_controller *mhi_cntrl, void __iomem *addr,\n+\t\t\t u64 *out);\n+\tvoid (*write_reg64)(struct mhi_controller *mhi_cntrl, void __iomem *addr,\n+\t\t\t u64 val);\n \tvoid (*reset)(struct mhi_controller *mhi_cntrl);\n \tint (*edl_trigger)(struct mhi_controller *mhi_cntrl);\n \n"
} |
| 2/1 | 2026/09/18 22:59 | agent | patch-evaluator |
1mModel:core Args: null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch introduces PTP Hardware Clock (PHC) support for Qualcomm Modem Host Interface (MHI) devices via the MHI PCI generic host driver (mhi_pci_generic). This code requires physical Qualcomm PCIe hardware (such as SDX55/SDX65 modems) that is not emulated in standard QEMU or GCE virtual environments. Because the modified code is structurally unreachable in standard fuzzing environments, it does not warrant fuzzing.",
"WorthFuzzing": false
}Instruction: You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.
IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.
================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.
- REACHABILITY IS THE PRIMARY GATE:
Fuzzing can only discover bugs in code that can actually execute in standard virtualized
environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
regardless of whether it adds assertions or complex logic.
- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
Patch authors routinely label changes as "cleanups", "refactorings", or state
"No functional change intended". Do NOT take these claims at face value.
Code refactorings that rearrange logic, introduce helper functions, or alter state management
in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
If reachable executable code is modified or refactored, it MUST be fuzzed.
- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
Even if the author believes the invariant always holds, fuzzing is essential to verify whether
an unusual sequence of operations can violate it.
================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:
- Non-kernel and non-executable changes:
* Modifications to Documentation/, comments, or spelling fixes.
* User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
that do not affect the compiled kernel image (vmlinux) or kernel modules.
* Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
that do not alter control flow or data structures.
* Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
* Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
* Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
physical PCI hot-unplug or manual sysfs driver unbinding.
* Code paths exclusive to architectures other than the target architecture.
================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
* Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
* Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
* Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
* Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).
================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:
- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
Do NOT list generic, ubiquitous functions called by almost every program in the corpus
(including, but not limited to: general memory allocators and deallocators, page fault
and trap handlers, or core synchronization primitives; this is not an exhaustive list).
Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
which severely dilutes fuzzing effort away from the actual changes.
- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
List functions that specifically implement the logic being added or altered, or direct API entrypoints
for the subsystem feature under review.
- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).
================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit 67d5e10f7d350a88eb8f35c55f62cf53e5dcd528
Author: syz-cluster <triage@syzkaller.com>
Date: Fri Sep 18 22:59:21 2026 +0000
syz-cluster: applied patch under review
diff --git a/drivers/bus/mhi/common.h b/drivers/bus/mhi/common.h
index dda340aaed95a..64f9b2b94387a 100644
--- a/drivers/bus/mhi/common.h
+++ b/drivers/bus/mhi/common.h
@@ -16,6 +16,7 @@
#define MHICFG 0x10
#define CHDBOFF 0x18
#define ERDBOFF 0x20
+#define MISCOFF 0x24
#define BHIOFF 0x28
#define BHIEOFF 0x2c
#define DEBUGOFF 0x30
@@ -113,6 +114,13 @@
#define MHISTATUS_MHISTATE_MASK GENMASK(15, 8)
#define MHISTATUS_SYSERR_MASK BIT(2)
#define MHISTATUS_READY_MASK BIT(0)
+#define MISC_CAP_MASK GENMASK(31, 0)
+#define CAP_CAPID_MASK GENMASK(31, 24)
+#define CAP_NEXT_CAP_MASK GENMASK(23, 12)
+
+/* MHI TSC Timesync */
+#define TSC_TIMESYNC_TIME_LOW_OFFSET (0x8)
+#define TSC_TIMESYNC_TIME_HIGH_OFFSET (0xC)
/* Command Ring Element macros */
/* No operation command */
@@ -204,6 +212,13 @@
#define MHI_RSCTRE_DATA_DWORD1 cpu_to_le32(FIELD_PREP(GENMASK(23, 16), \
MHI_PKT_TYPE_COALESCING))
+#define MHI_CAP_ID_INTX 0x1
+#define MHI_CAP_ID_TIME_SYNC 0x2
+#define MHI_CAP_ID_BW_SCALE 0x3
+#define MHI_CAP_ID_TSC_TIME_SYNC 0x4
+#define MHI_CAP_ID_MAX_TRB_LEN 0x5
+#define MHI_CAP_ID_MAX 0x6
+
enum mhi_pkt_type {
MHI_PKT_TYPE_INVALID = 0x0,
MHI_PKT_TYPE_NOOP_CMD = 0x1,
diff --git a/drivers/bus/mhi/host/Kconfig b/drivers/bus/mhi/host/Kconfig
index da5cd0c9fc620..7609768c0efeb 100644
--- a/drivers/bus/mhi/host/Kconfig
+++ b/drivers/bus/mhi/host/Kconfig
@@ -29,3 +29,12 @@ config MHI_BUS_PCI_GENERIC
This driver provides MHI PCI controller driver for devices such as
Qualcomm SDX55 based PCIe modems.
+config MHI_BUS_PHC
+ tristate "MHI PHC driver"
+ depends on MHI_BUS
+ depends on PTP_1588_CLOCK
+ help
+ This driver provides Precision Time Protocol (PTP) clock and
+ communicates with MHI PCI driver to get the device side timestamp,
+ which enables precise time synchronization between the host and
+ the device.
diff --git a/drivers/bus/mhi/host/Makefile b/drivers/bus/mhi/host/Makefile
index 859c2f38451c6..f16b3195a03a1 100644
--- a/drivers/bus/mhi/host/Makefile
+++ b/drivers/bus/mhi/host/Makefile
@@ -4,3 +4,5 @@ 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-$(CONFIG_MHI_BUS_PHC) += mhi_phc.o
diff --git a/drivers/bus/mhi/host/init.c b/drivers/bus/mhi/host/init.c
index fd3050889412d..caa307c71890f 100644
--- a/drivers/bus/mhi/host/init.c
+++ b/drivers/bus/mhi/host/init.c
@@ -465,6 +465,64 @@ static int mhi_init_dev_ctxt(struct mhi_controller *mhi_cntrl)
return ret;
}
+static int mhi_find_capability(struct mhi_controller *mhi_cntrl, u32 capability)
+{
+ u32 val, cur_cap, next_offset, cur_offset;
+ int ret;
+
+ /* Get the first supported capability offset */
+ ret = mhi_read_reg_field(mhi_cntrl, mhi_cntrl->regs, MISCOFF, MISC_CAP_MASK, &cur_offset);
+ if (ret)
+ return 0;
+
+ do {
+ if (cur_offset >= mhi_cntrl->reg_len)
+ return 0;
+
+ ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->regs, cur_offset, &val);
+ if (ret)
+ return 0;
+
+ cur_cap = FIELD_GET(CAP_CAPID_MASK, val);
+ next_offset = FIELD_GET(CAP_NEXT_CAP_MASK, val);
+ if (cur_cap >= MHI_CAP_ID_MAX)
+ return 0;
+
+ if (cur_cap == capability)
+ return cur_offset;
+
+ cur_offset = next_offset;
+ } while (next_offset);
+
+ return 0;
+}
+
+#if IS_ENABLED(CONFIG_MHI_BUS_PHC)
+int mhi_init_tsc_timesync(struct mhi_controller *mhi_cntrl)
+{
+ struct device *dev = &mhi_cntrl->mhi_dev->dev;
+ struct mhi_timesync *mhi_tsync;
+ u32 time_offset;
+
+ time_offset = mhi_find_capability(mhi_cntrl, MHI_CAP_ID_TSC_TIME_SYNC);
+ if (!time_offset)
+ return -ENXIO;
+
+ mhi_tsync = devm_kzalloc(dev, sizeof(*mhi_tsync), GFP_KERNEL);
+ if (!mhi_tsync)
+ return -ENOMEM;
+
+ mutex_init(&mhi_tsync->ts_mutex);
+
+ /* save time_offset for obtaining time via MMIO register reads */
+ mhi_tsync->time_reg = mhi_cntrl->regs + time_offset;
+
+ mhi_cntrl->tsc_timesync = mhi_tsync;
+
+ return 0;
+}
+#endif
+
int mhi_init_mmio(struct mhi_controller *mhi_cntrl)
{
u32 val;
@@ -602,6 +660,13 @@ int mhi_init_mmio(struct mhi_controller *mhi_cntrl)
return ret;
}
+ /* Discover TSC time sync capability, if present */
+ ret = mhi_init_tsc_timesync(mhi_cntrl);
+ if (ret && ret != -ENXIO) {
+ dev_err(dev, "Error configuring TSC time sync\n");
+ return ret;
+ }
+
return 0;
}
diff --git a/drivers/bus/mhi/host/internal.h b/drivers/bus/mhi/host/internal.h
index 7b0ee5e3a12dd..bb96dfffabb6a 100644
--- a/drivers/bus/mhi/host/internal.h
+++ b/drivers/bus/mhi/host/internal.h
@@ -9,6 +9,10 @@
#include "../common.h"
+#if IS_ENABLED(CONFIG_MHI_BUS_PHC)
+#include <linux/ptp_clock_kernel.h>
+#endif
+
extern const struct bus_type mhi_bus_type;
/* Host request register */
@@ -24,6 +28,24 @@ struct mhi_ctxt {
dma_addr_t cmd_ctxt_addr;
};
+#if IS_ENABLED(CONFIG_MHI_BUS_PHC)
+/**
+ * struct mhi_timesync - MHI time synchronization structure
+ * @time_reg: Points to address of Timesync register
+ * @ts_mutex: Mutex for synchronization
+ * @ptp_clock: associated PTP clock
+ * @ptp_clock_info: PTP clock information
+ * @mhi_dev: associated mhi device object
+ */
+struct mhi_timesync {
+ void __iomem *time_reg;
+ struct mutex ts_mutex;
+ struct ptp_clock *ptp_clock;
+ struct ptp_clock_info ptp_clock_info;
+ struct mhi_device *mhi_dev;
+};
+#endif
+
struct bhi_vec_entry {
__le64 dma_addr;
__le64 size;
@@ -364,6 +386,8 @@ void mhi_db_brstmode_disable(struct mhi_controller *mhi_cntrl,
dma_addr_t db_val);
int __must_check mhi_read_reg(struct mhi_controller *mhi_cntrl,
void __iomem *base, u32 offset, u32 *out);
+int __must_check mhi_read_reg64(struct mhi_controller *mhi_cntrl,
+ void __iomem *base, u32 offset, u64 *out);
int __must_check mhi_read_reg_field(struct mhi_controller *mhi_cntrl,
void __iomem *base, u32 offset, u32 mask,
u32 *out);
@@ -372,6 +396,8 @@ int __must_check mhi_poll_reg_field(struct mhi_controller *mhi_cntrl,
u32 val, u32 delayus, u32 timeout_ms);
void mhi_write_reg(struct mhi_controller *mhi_cntrl, void __iomem *base,
u32 offset, u32 val);
+void __maybe_unused mhi_write_reg64(struct mhi_controller *mhi_cntrl, void __iomem *base,
+ u32 offset, u64 val);
int __must_check mhi_write_reg_field(struct mhi_controller *mhi_cntrl,
void __iomem *base, u32 offset, u32 mask,
u32 val);
@@ -388,6 +414,15 @@ int mhi_rddm_prepare(struct mhi_controller *mhi_cntrl,
struct image_info *img_info);
void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl);
+#if IS_ENABLED(CONFIG_MHI_BUS_PHC)
+int mhi_init_tsc_timesync(struct mhi_controller *mhi_cntrl);
+#else
+static inline int mhi_init_tsc_timesync(struct mhi_controller *mhi_cntrl)
+{
+ return 0;
+}
+#endif
+
int mhi_init_chan_ctxt(struct mhi_controller *mhi_cntrl,
struct mhi_chan *mhi_chan);
void mhi_deinit_chan_ctxt(struct mhi_controller *mhi_cntrl,
diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c
index 4d458396233ab..1ca9f781bbdbb 100644
--- a/drivers/bus/mhi/host/main.c
+++ b/drivers/bus/mhi/host/main.c
@@ -22,6 +22,7 @@ int __must_check mhi_read_reg(struct mhi_controller *mhi_cntrl,
{
return mhi_cntrl->read_reg(mhi_cntrl, base + offset, out);
}
+EXPORT_SYMBOL_GPL(mhi_read_reg);
int __must_check mhi_read_reg_field(struct mhi_controller *mhi_cntrl,
void __iomem *base, u32 offset,
@@ -67,6 +68,19 @@ void mhi_write_reg(struct mhi_controller *mhi_cntrl, void __iomem *base,
mhi_cntrl->write_reg(mhi_cntrl, base + offset, val);
}
+int __must_check mhi_read_reg64(struct mhi_controller *mhi_cntrl,
+ void __iomem *base, u32 offset, u64 *out)
+{
+ return mhi_cntrl->read_reg64(mhi_cntrl, base + offset, out);
+}
+EXPORT_SYMBOL_GPL(mhi_read_reg64);
+
+void __maybe_unused mhi_write_reg64(struct mhi_controller *mhi_cntrl, void __iomem *base,
+ u32 offset, u64 val)
+{
+ mhi_cntrl->write_reg64(mhi_cntrl, base + offset, val);
+}
+
int __must_check mhi_write_reg_field(struct mhi_controller *mhi_cntrl,
void __iomem *base, u32 offset, u32 mask,
u32 val)
diff --git a/drivers/bus/mhi/host/mhi_phc.c b/drivers/bus/mhi/host/mhi_phc.c
new file mode 100644
index 0000000000000..b1d10431bd307
--- /dev/null
+++ b/drivers/bus/mhi/host/mhi_phc.c
@@ -0,0 +1,161 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2026, Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#include <linux/module.h>
+#include <linux/mhi.h>
+#include <linux/ptp_clock_kernel.h>
+#include "../common.h"
+#include "internal.h"
+#include "mhi_phc.h"
+
+/**
+ * struct mhi_timesync_info - MHI time sync info structure
+ * @t_dev_lo: MHI device time of lower dword
+ * @t_dev_hi: MHI device time of higher dword
+ */
+struct mhi_timesync_info {
+ u32 t_dev_lo;
+ u32 t_dev_hi;
+};
+
+static int mhi_get_remote_tsc_time_sync(struct mhi_device *mhi_dev, struct mhi_timesync_info *time,
+ struct ptp_system_timestamp *sts)
+{
+ struct mhi_controller *mhi_cntrl = mhi_dev->mhi_cntrl;
+ struct mhi_timesync *mhi_tsync = mhi_cntrl->tsc_timesync;
+ struct device *dev = &mhi_cntrl->mhi_dev->dev;
+ u64 val = U64_MAX;
+ u32 hi, lo = 0;
+ int ret;
+
+ if (!mhi_tsync || !mhi_tsync->time_reg) {
+ dev_err(dev, "Time sync is not supported\n");
+ return -EOPNOTSUPP;
+ }
+
+ mhi_cntrl->runtime_get(mhi_cntrl);
+
+ /* bring to M0 state */
+ ret = mhi_device_get_sync(mhi_cntrl->mhi_dev);
+ if (ret) {
+ mhi_cntrl->runtime_put(mhi_cntrl);
+ return ret;
+ }
+
+ guard(mutex)(&mhi_tsync->ts_mutex);
+
+ // TODO: Disable ASPM
+
+ /*
+ * time critical code to fetch device time, delay between these two steps
+ * should be deterministic as possible.
+ */
+ preempt_disable();
+ local_irq_disable();
+
+ ptp_read_system_prets(sts);
+
+ if (mhi_cntrl->read_reg64) {
+ ret = mhi_read_reg64(mhi_cntrl, mhi_tsync->time_reg,
+ TSC_TIMESYNC_TIME_LOW_OFFSET, &val);
+ time->t_dev_lo = (u32)val;
+ time->t_dev_hi = (u32)(val >> 32);
+ } else {
+ /*
+ * Read the high dword twice around the low dword and retry if it
+ * changed, to avoid a torn read across a device-side rollover.
+ */
+ do {
+ ret = mhi_read_reg(mhi_cntrl, mhi_tsync->time_reg,
+ TSC_TIMESYNC_TIME_HIGH_OFFSET, &hi);
+ if (ret)
+ break;
+
+ ret = mhi_read_reg(mhi_cntrl, mhi_tsync->time_reg,
+ TSC_TIMESYNC_TIME_LOW_OFFSET, &lo);
+ if (ret)
+ break;
+
+ ret = mhi_read_reg(mhi_cntrl, mhi_tsync->time_reg,
+ TSC_TIMESYNC_TIME_HIGH_OFFSET, &time->t_dev_hi);
+ } while (!ret && hi != time->t_dev_hi);
+
+ time->t_dev_lo = lo;
+ }
+
+ ptp_read_system_postts(sts);
+
+ local_irq_enable();
+ preempt_enable();
+
+ mhi_device_put(mhi_cntrl->mhi_dev);
+
+ mhi_cntrl->runtime_put(mhi_cntrl);
+
+ return ret;
+}
+
+static int qcom_ptp_gettimex64(struct ptp_clock_info *ptp, struct timespec64 *ts,
+ struct ptp_system_timestamp *sts)
+{
+ struct mhi_timesync *mhi_tsync = container_of(ptp, struct mhi_timesync, ptp_clock_info);
+ struct mhi_timesync_info time;
+ ktime_t ktime_cur;
+ int ret;
+
+ ret = mhi_get_remote_tsc_time_sync(mhi_tsync->mhi_dev, &time, sts);
+ if (ret)
+ return ret;
+
+ ktime_cur = time.t_dev_hi * NSEC_PER_SEC + time.t_dev_lo;
+ *ts = ktime_to_timespec64(ktime_cur);
+
+ return 0;
+}
+
+static struct ptp_clock_info qcom_ptp_clock_info = {
+ .owner = THIS_MODULE,
+ .gettimex64 = qcom_ptp_gettimex64,
+};
+
+int mhi_phc_init(struct mhi_controller *mhi_cntrl)
+{
+ struct mhi_device *mhi_dev = mhi_cntrl->mhi_dev;
+ struct mhi_timesync *mhi_tsync = mhi_cntrl->tsc_timesync;
+ int ret;
+
+ if (!mhi_tsync)
+ return -ENODEV;
+
+ mhi_tsync->mhi_dev = mhi_dev;
+
+ mhi_tsync->ptp_clock_info = qcom_ptp_clock_info;
+ strscpy(mhi_tsync->ptp_clock_info.name, mhi_dev->name, PTP_CLOCK_NAME_LEN);
+
+ mhi_tsync->ptp_clock = ptp_clock_register(&mhi_tsync->ptp_clock_info, &mhi_dev->dev);
+ if (IS_ERR(mhi_tsync->ptp_clock)) {
+ ret = PTR_ERR(mhi_tsync->ptp_clock);
+ dev_err(&mhi_dev->dev, "Failed to register PTP clock\n");
+ return ret;
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(mhi_phc_init);
+
+void mhi_phc_exit(struct mhi_controller *mhi_cntrl)
+{
+ struct mhi_timesync *mhi_tsync = mhi_cntrl->tsc_timesync;
+
+ if (!mhi_tsync || !mhi_tsync->ptp_clock)
+ return;
+
+ ptp_clock_unregister(mhi_tsync->ptp_clock);
+ mhi_tsync->ptp_clock = NULL;
+}
+EXPORT_SYMBOL_GPL(mhi_phc_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("MHI PHC driver");
diff --git a/drivers/bus/mhi/host/mhi_phc.h b/drivers/bus/mhi/host/mhi_phc.h
new file mode 100644
index 0000000000000..263574ca53da5
--- /dev/null
+++ b/drivers/bus/mhi/host/mhi_phc.h
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2026, Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#ifndef _MHI_PHC_H
+#define _MHI_PHC_H
+
+#if IS_ENABLED(CONFIG_MHI_BUS_PHC)
+int mhi_phc_init(struct mhi_controller *mhi_cntrl);
+void mhi_phc_exit(struct mhi_controller *mhi_cntrl);
+#else
+static inline int mhi_phc_init(struct mhi_controller *mhi_cntrl)
+{
+ return 0;
+}
+
+static inline void mhi_phc_exit(struct mhi_controller *mhi_cntrl) {}
+#endif
+
+#endif /* _MHI_PHC_H */
diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
index b636e2c23b4d6..0aa5cee49bdc2 100644
--- a/drivers/bus/mhi/host/pci_generic.c
+++ b/drivers/bus/mhi/host/pci_generic.c
@@ -16,6 +16,7 @@
#include <linux/pm_runtime.h>
#include <linux/timer.h>
#include <linux/workqueue.h>
+#include "mhi_phc.h"
#define MHI_PCI_DEFAULT_BAR_NUM 0
@@ -1100,6 +1101,27 @@ struct mhi_pci_device {
bool reset_on_remove;
};
+#ifdef readq
+static int mhi_pci_read_reg64(struct mhi_controller *mhi_cntrl,
+ void __iomem *addr, u64 *out)
+{
+ *out = readq(addr);
+ return 0;
+}
+#else
+#define mhi_pci_read_reg64 NULL
+#endif
+
+#ifdef writeq
+static void mhi_pci_write_reg64(struct mhi_controller *mhi_cntrl,
+ void __iomem *addr, u64 val)
+{
+ writeq(val, addr);
+}
+#else
+#define mhi_pci_write_reg64 NULL
+#endif
+
static int mhi_pci_read_reg(struct mhi_controller *mhi_cntrl,
void __iomem *addr, u32 *out)
{
@@ -1123,9 +1145,11 @@ static void mhi_pci_status_cb(struct mhi_controller *mhi_cntrl,
case MHI_CB_FATAL_ERROR:
case MHI_CB_SYS_ERROR:
dev_warn(&pdev->dev, "firmware crashed (%u)\n", cb);
+ mhi_phc_exit(mhi_cntrl);
pm_runtime_forbid(&pdev->dev);
break;
case MHI_CB_EE_MISSION_MODE:
+ mhi_phc_init(mhi_cntrl);
pm_runtime_allow(&pdev->dev);
break;
default:
@@ -1403,6 +1427,8 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
mhi_cntrl->read_reg = mhi_pci_read_reg;
mhi_cntrl->write_reg = mhi_pci_write_reg;
+ mhi_cntrl->read_reg64 = mhi_pci_read_reg64;
+ mhi_cntrl->write_reg64 = mhi_pci_write_reg64;
mhi_cntrl->status_cb = mhi_pci_status_cb;
mhi_cntrl->runtime_get = mhi_pci_runtime_get;
mhi_cntrl->runtime_put = mhi_pci_runtime_put;
@@ -1491,6 +1517,9 @@ static void mhi_pci_remove(struct pci_dev *pdev)
timer_delete_sync(&mhi_pdev->health_check_timer);
cancel_work_sync(&mhi_pdev->recovery_work);
+ /* Remove PHC */
+ mhi_phc_exit(mhi_cntrl);
+
if (test_and_clear_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status)) {
mhi_power_down(mhi_cntrl, true);
mhi_unprepare_after_power_down(mhi_cntrl);
diff --git a/include/linux/mhi.h b/include/linux/mhi.h
index 8616bacd8675d..3dc1844222cdf 100644
--- a/include/linux/mhi.h
+++ b/include/linux/mhi.h
@@ -23,6 +23,8 @@ struct mhi_event;
struct mhi_ctxt;
struct mhi_cmd;
struct mhi_buf_info;
+struct mhi_timesync;
+
/**
* enum mhi_callback - MHI callback
@@ -341,6 +343,7 @@ struct mhi_controller_config {
* @mhi_event: MHI event ring configurations table
* @mhi_cmd: MHI command ring configurations table
* @mhi_ctxt: MHI device context, shared memory between host and device
+ * @tsc_timesync: MHI TSC timesync
* @pm_mutex: Mutex for suspend/resume operation
* @pm_lock: Lock for protecting MHI power management state
* @timeout_ms: Timeout in ms for state transitions
@@ -371,6 +374,8 @@ struct mhi_controller_config {
* @unmap_single: CB function to destroy TRE buffer
* @read_reg: Read a MHI register via the physical link (required)
* @write_reg: Write a MHI register via the physical link (required)
+ * @read_reg64: Read a 64 bit MHI register via the physical link (optional)
+ * @write_reg64: Write a 64 bit MHI register via the physical link (optional)
* @reset: Controller specific reset function (optional)
* @edl_trigger: CB function to trigger EDL mode (optional)
* @buffer_len: Bounce buffer length
@@ -422,6 +427,8 @@ struct mhi_controller {
struct mhi_cmd *mhi_cmd;
struct mhi_ctxt *mhi_ctxt;
+ struct mhi_timesync *tsc_timesync;
+
struct mutex pm_mutex;
rwlock_t pm_lock;
u32 timeout_ms;
@@ -456,6 +463,10 @@ struct mhi_controller {
u32 *out);
void (*write_reg)(struct mhi_controller *mhi_cntrl, void __iomem *addr,
u32 val);
+ int (*read_reg64)(struct mhi_controller *mhi_cntrl, void __iomem *addr,
+ u64 *out);
+ void (*write_reg64)(struct mhi_controller *mhi_cntrl, void __iomem *addr,
+ u64 val);
void (*reset)(struct mhi_controller *mhi_cntrl);
int (*edl_trigger)(struct mhi_controller *mhi_cntrl);
|
| 3/2 | 2026/09/18 22:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 10415 output: 19 thoughts: 855 Thoughts: **Evaluating the Fuzzing Suitability of the MHI PHC Patch** Okay, so I need to decide if this patch series, which adds MHI PHC (PTP Hardware Clock) support to the MHI bus host driver, warrants fuzzing with syzkaller. Let's break this down systematically. First, I need to understand the scope of the changes. The patch modifies several files, essentially adding definitions, configuration options, and initialization routines for this new PHC functionality. It appears to involve TSC timesync, MMIO operations (reading/writing to memory-mapped I/O registers), and callbacks to initialize and de-initialize the PHC based on the MHI bus's lifecycle. We're looking at Kconfig, Makefiles, header files, and some core driver code. There's a `mhi_phc.c` file that seems to contain the main logic related to the PHC. Now, the crucial question: can this code *actually be reached* in a standard fuzzing environment, like GCE or QEMU? This is the primary gate. The core triage guidelines say "REACHABILITY IS THE PRIMARY GATE." According to the guidelines, the patch will be *worth* fuzzing if all of the modified code doesn't fall into the category that would make the patch *not* worth fuzzing. I need to make sure the patch doesn't: * Involve structurally unreachable hardware. * Involve unreachable execution paths. So, is the MHI bus, and specifically the PHC functionality, emulated or accessible within a typical fuzzing setup? That's the key. What is MHI? "Modem Host Interface." I'm going to have to do a quick search to determine the hardware that uses MHI and whether it is supported in QEMU. Then I'll search for MHI in the kernel tree to see where else it's used. Once I know more about this MHI bus, I can evaluate its reachability. Based on the initial code review, this might involve some fairly low-level hardware interactions (MMIO and potentially hardware clocks), so accessibility in a standard environment is something I'm very mindful of. |
| 4/2 | 2026/09/18 22:59 | tool | grepper |
0mArgs:{
"Expression": "config MHI_BUS"
}Results: {
"Output": "drivers/bus/mhi/ep/Kconfig:1:config MHI_BUS_EP\ndrivers/bus/mhi/ep/Kconfig-2-\ttristate \"Modem Host Interface (MHI) bus Endpoint implementation\"\n--\ndrivers/bus/mhi/host/Kconfig-7-\ndrivers/bus/mhi/host/Kconfig:8:config MHI_BUS\ndrivers/bus/mhi/host/Kconfig-9-\ttristate \"Modem Host Interface (MHI) bus\"\n--\ndrivers/bus/mhi/host/Kconfig-15-\ndrivers/bus/mhi/host/Kconfig:16:config MHI_BUS_DEBUG\ndrivers/bus/mhi/host/Kconfig-17-\tbool \"Debugfs support for the MHI bus\"\n--\ndrivers/bus/mhi/host/Kconfig-23-\ndrivers/bus/mhi/host/Kconfig:24:config MHI_BUS_PCI_GENERIC\ndrivers/bus/mhi/host/Kconfig-25-\ttristate \"MHI PCI controller driver\"\n--\ndrivers/bus/mhi/host/Kconfig-31-\ndrivers/bus/mhi/host/Kconfig:32:config MHI_BUS_PHC\ndrivers/bus/mhi/host/Kconfig-33-\ttristate \"MHI PHC driver\"\n"
} |
| 5/2 | 2026/09/18 22:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 12096 output: 20 thoughts: 234 Thoughts: **MHI Bus Driver Thoughts** Okay, let's dive into this `Kconfig` file, specifically the MHI bus driver section. So, `drivers/bus/mhi/host/Kconfig`... right. I see the `MHI_BUS` config option. It's a tristate for the Modem Host Interface (MHI) bus. Essentially, a communication protocol developed by Qualcomm, used for network data and control packets over high-speed interfaces like PCIe to connect the host with a Qualcomm modem. Makes sense. Standard stuff. Then there's `MHI_BUS_PCI_GENERIC`. It depends on `MHI_BUS` and `PCI`, so it's a specific implementation, likely tailored for Qualcomm's SDX55 based PCIe modems. Okay, `REGMAP_MMIO` is selected, which is reasonable for direct memory mapped access. Now the question that pops into my head, and which I'll pursue as an experienced developer: Is there any virtual MHI bus implementation, or perhaps even a software emulation of this protocol somewhere in the kernel? I need to know the bigger picture. I'm going to search the kernel source now for any calls to `mhi_register_controller` or, perhaps more broadly, for the usage of `CONFIG_MHI_BUS`. It'll give me context around how it is used. I need to understand its breadth. |
| 6/2 | 2026/09/18 22:59 | tool | grepper |
0mArgs:{
"Expression": "mhi_register_controller"
}Results: {
"Output": "Documentation/mhi/topology.rst=20=Below are the roles of the MHI controller driver:\n--\nDocumentation/mhi/topology.rst-24-* Allocates struct mhi_controller and registers with the MHI bus framework\nDocumentation/mhi/topology.rst:25: with channel and event configurations using mhi_register_controller.\nDocumentation/mhi/topology.rst-26-* Initiates power on and shutdown sequence\n--\ndrivers/accel/qaic/mhi_controller.c=800=static int mhi_reset_and_async_power_up(struct mhi_controller *mhi_cntrl)\n--\ndrivers/accel/qaic/mhi_controller.c-826-\ndrivers/accel/qaic/mhi_controller.c:827:struct mhi_controller *qaic_mhi_register_controller(struct pci_dev *pci_dev, void __iomem *mhi_bar,\ndrivers/accel/qaic/mhi_controller.c-828-\t\t\t\t\t\t int mhi_irq, bool shared_msi, int family)\n--\ndrivers/accel/qaic/mhi_controller.c-875-\tmhi_config.timeout_ms = mhi_timeout_ms;\ndrivers/accel/qaic/mhi_controller.c:876:\tret = mhi_register_controller(mhi_cntrl, \u0026mhi_config);\ndrivers/accel/qaic/mhi_controller.c-877-\tif (ret) {\ndrivers/accel/qaic/mhi_controller.c:878:\t\tpci_err(pci_dev, \"mhi_register_controller failed %d\\n\", ret);\ndrivers/accel/qaic/mhi_controller.c-879-\t\treturn ERR_PTR(ret);\n--\ndrivers/accel/qaic/mhi_controller.h-8-\ndrivers/accel/qaic/mhi_controller.h:9:struct mhi_controller *qaic_mhi_register_controller(struct pci_dev *pci_dev, void __iomem *mhi_bar,\ndrivers/accel/qaic/mhi_controller.h-10-\t\t\t\t\t\t int mhi_irq, bool shared_msi, int family);\n--\ndrivers/accel/qaic/qaic_drv.c=570=static int qaic_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)\n--\ndrivers/accel/qaic/qaic_drv.c-596-\ndrivers/accel/qaic/qaic_drv.c:597:\tqdev-\u003emhi_cntrl = qaic_mhi_register_controller(pdev, qdev-\u003ebar_mhi, mhi_irq,\ndrivers/accel/qaic/qaic_drv.c-598-\t\t\t\t\t\t qdev-\u003esingle_msi, config-\u003efamily);\n--\ndrivers/bus/mhi/host/init.c=946=static int parse_config(struct mhi_controller *mhi_cntrl,\n--\ndrivers/bus/mhi/host/init.c-983-\ndrivers/bus/mhi/host/init.c:984:int mhi_register_controller(struct mhi_controller *mhi_cntrl,\ndrivers/bus/mhi/host/init.c-985-\t\t\t const struct mhi_controller_config *config)\n--\ndrivers/bus/mhi/host/init.c-1123-}\ndrivers/bus/mhi/host/init.c:1124:EXPORT_SYMBOL_GPL(mhi_register_controller);\ndrivers/bus/mhi/host/init.c-1125-\n--\ndrivers/bus/mhi/host/pci_generic.c=1389=static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)\n--\ndrivers/bus/mhi/host/pci_generic.c-1466-\ndrivers/bus/mhi/host/pci_generic.c:1467:\terr = mhi_register_controller(mhi_cntrl, mhi_cntrl_config);\ndrivers/bus/mhi/host/pci_generic.c-1468-\tif (err)\n--\ndrivers/net/wireless/ath/ath11k/mhi.c=335=int ath11k_mhi_register(struct ath11k_pci *ab_pci)\n--\ndrivers/net/wireless/ath/ath11k/mhi.c-409-\tab_pci-\u003emhi_pre_cb = MHI_CB_INVALID;\ndrivers/net/wireless/ath/ath11k/mhi.c:410:\tret = mhi_register_controller(mhi_ctrl, ath11k_mhi_config);\ndrivers/net/wireless/ath/ath11k/mhi.c-411-\tif (ret) {\n--\ndrivers/net/wireless/ath/ath12k/mhi.c=187=int ath12k_mhi_register(struct ath12k_pci *ab_pci)\n--\ndrivers/net/wireless/ath/ath12k/mhi.c-264-\ndrivers/net/wireless/ath/ath12k/mhi.c:265:\tret = mhi_register_controller(mhi_ctrl, ab-\u003ehw_params-\u003emhi_config);\ndrivers/net/wireless/ath/ath12k/mhi.c-266-\tif (ret) {\n--\ninclude/linux/mhi.h=296=struct mhi_controller_config {\n--\ninclude/linux/mhi.h-390- * Fields marked as (required) need to be populated by the controller driver\ninclude/linux/mhi.h:391: * before calling mhi_register_controller(). For the fields marked as (optional)\ninclude/linux/mhi.h-392- * they can be populated depending on the usecase.\n--\ninclude/linux/mhi.h=561=void mhi_free_controller(struct mhi_controller *mhi_cntrl);\n--\ninclude/linux/mhi.h-563-/**\ninclude/linux/mhi.h:564: * mhi_register_controller - Register MHI controller\ninclude/linux/mhi.h-565- * @mhi_cntrl: MHI controller to register\n--\ninclude/linux/mhi.h-567- */\ninclude/linux/mhi.h:568:int mhi_register_controller(struct mhi_controller *mhi_cntrl,\ninclude/linux/mhi.h-569-\t\t\tconst struct mhi_controller_config *config);\n"
} |
| 7/2 | 2026/09/18 22:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 14361 output: 24 thoughts: 128 Thoughts: **PCIe Hardware and MHI Controllers: A Quick Assessment** Okay, let's break this down. I'm seeing a familiar list: `qaic`, `mhi_pci_generic`, `ath11k` (PCI), and `ath12k` (PCI). My initial thought is, "Yep, all PCIe hardware." Qualcomm Cloud AI accelerators (qaic) using PCIe, Qualcomm SDX55 modems with the generic MHI implementation over PCIe, and the ever-present Qualcomm Wi-Fi chips – ath11k and ath12k – also on PCIe. But wait, this sparks a question: Are we dealing *only* with physical PCIe devices here, or is there some other layer involved? Do we have a platform MHI controller that might be the interface, or perhaps even a virtual MHI controller that sits on top of something else? That needs to be clarified. My next step is clear. Time to dive into the codebase and run a search. I need to find all instances where `mhi.h` is included, or where `mhi_register_controller` is used. That should give me a good picture of the different MHI controller types and their relationships with the various PCIe devices. Let's dig in and see what's what. |
| 8/2 | 2026/09/18 22:59 | tool | grepper |
0mArgs:{
"Expression": "#include \u003clinux/mhi\\.h\u003e"
}Results: {
"Output": "drivers/accel/qaic/mhi_controller.c-8-#include \u003clinux/memblock.h\u003e\ndrivers/accel/qaic/mhi_controller.c:9:#include \u003clinux/mhi.h\u003e\ndrivers/accel/qaic/mhi_controller.c-10-#include \u003clinux/moduleparam.h\u003e\n--\ndrivers/accel/qaic/qaic.h-10-#include \u003clinux/kref.h\u003e\ndrivers/accel/qaic/qaic.h:11:#include \u003clinux/mhi.h\u003e\ndrivers/accel/qaic/qaic.h-12-#include \u003clinux/mutex.h\u003e\n--\ndrivers/accel/qaic/qaic_control.c-12-#include \u003clinux/list.h\u003e\ndrivers/accel/qaic/qaic_control.c:13:#include \u003clinux/mhi.h\u003e\ndrivers/accel/qaic/qaic_control.c-14-#include \u003clinux/mm.h\u003e\n--\ndrivers/accel/qaic/qaic_debugfs.c-9-#include \u003clinux/list.h\u003e\ndrivers/accel/qaic/qaic_debugfs.c:10:#include \u003clinux/mhi.h\u003e\ndrivers/accel/qaic/qaic_debugfs.c-11-#include \u003clinux/mutex.h\u003e\n--\ndrivers/accel/qaic/qaic_drv.c-12-#include \u003clinux/kref.h\u003e\ndrivers/accel/qaic/qaic_drv.c:13:#include \u003clinux/mhi.h\u003e\ndrivers/accel/qaic/qaic_drv.c-14-#include \u003clinux/module.h\u003e\n--\ndrivers/accel/qaic/qaic_ras.c-8-#include \u003clinux/kernel.h\u003e\ndrivers/accel/qaic/qaic_ras.c:9:#include \u003clinux/mhi.h\u003e\ndrivers/accel/qaic/qaic_ras.c-10-\n--\ndrivers/accel/qaic/qaic_ssr.c-11-#include \u003clinux/kernel.h\u003e\ndrivers/accel/qaic/qaic_ssr.c:12:#include \u003clinux/mhi.h\u003e\ndrivers/accel/qaic/qaic_ssr.c-13-#include \u003clinux/workqueue.h\u003e\n--\ndrivers/accel/qaic/qaic_timesync.c-7-#include \u003clinux/math64.h\u003e\ndrivers/accel/qaic/qaic_timesync.c:8:#include \u003clinux/mhi.h\u003e\ndrivers/accel/qaic/qaic_timesync.c-9-#include \u003clinux/module.h\u003e\n--\ndrivers/accel/qaic/qaic_timesync.h-7-\ndrivers/accel/qaic/qaic_timesync.h:8:#include \u003clinux/mhi.h\u003e\ndrivers/accel/qaic/qaic_timesync.h-9-\n--\ndrivers/accel/qaic/sahara.c-7-#include \u003clinux/limits.h\u003e\ndrivers/accel/qaic/sahara.c:8:#include \u003clinux/mhi.h\u003e\ndrivers/accel/qaic/sahara.c-9-#include \u003clinux/minmax.h\u003e\n--\ndrivers/bus/mhi/common.h-10-#include \u003clinux/bitfield.h\u003e\ndrivers/bus/mhi/common.h:11:#include \u003clinux/mhi.h\u003e\ndrivers/bus/mhi/common.h-12-\n--\ndrivers/bus/mhi/host/boot.c-13-#include \u003clinux/list.h\u003e\ndrivers/bus/mhi/host/boot.c:14:#include \u003clinux/mhi.h\u003e\ndrivers/bus/mhi/host/boot.c-15-#include \u003clinux/module.h\u003e\n--\ndrivers/bus/mhi/host/debugfs.c-10-#include \u003clinux/list.h\u003e\ndrivers/bus/mhi/host/debugfs.c:11:#include \u003clinux/mhi.h\u003e\ndrivers/bus/mhi/host/debugfs.c-12-#include \u003clinux/module.h\u003e\n--\ndrivers/bus/mhi/host/init.c-14-#include \u003clinux/list.h\u003e\ndrivers/bus/mhi/host/init.c:15:#include \u003clinux/mhi.h\u003e\ndrivers/bus/mhi/host/init.c-16-#include \u003clinux/module.h\u003e\n--\ndrivers/bus/mhi/host/main.c-12-#include \u003clinux/list.h\u003e\ndrivers/bus/mhi/host/main.c:13:#include \u003clinux/mhi.h\u003e\ndrivers/bus/mhi/host/main.c-14-#include \u003clinux/module.h\u003e\n--\ndrivers/bus/mhi/host/mhi_phc.c-6-#include \u003clinux/module.h\u003e\ndrivers/bus/mhi/host/mhi_phc.c:7:#include \u003clinux/mhi.h\u003e\ndrivers/bus/mhi/host/mhi_phc.c-8-#include \u003clinux/ptp_clock_kernel.h\u003e\n--\ndrivers/bus/mhi/host/pci_generic.c-12-#include \u003clinux/device.h\u003e\ndrivers/bus/mhi/host/pci_generic.c:13:#include \u003clinux/mhi.h\u003e\ndrivers/bus/mhi/host/pci_generic.c-14-#include \u003clinux/module.h\u003e\n--\ndrivers/bus/mhi/host/pm.c-12-#include \u003clinux/list.h\u003e\ndrivers/bus/mhi/host/pm.c:13:#include \u003clinux/mhi.h\u003e\ndrivers/bus/mhi/host/pm.c-14-#include \u003clinux/module.h\u003e\n--\ndrivers/net/mhi_net.c-7-#include \u003clinux/if_arp.h\u003e\ndrivers/net/mhi_net.c:8:#include \u003clinux/mhi.h\u003e\ndrivers/net/mhi_net.c-9-#include \u003clinux/module.h\u003e\n--\ndrivers/net/wireless/ath/ath11k/pci.h-8-\ndrivers/net/wireless/ath/ath11k/pci.h:9:#include \u003clinux/mhi.h\u003e\ndrivers/net/wireless/ath/ath11k/pci.h-10-\n--\ndrivers/net/wireless/ath/ath12k/hw.h-9-\ndrivers/net/wireless/ath/ath12k/hw.h:10:#include \u003clinux/mhi.h\u003e\ndrivers/net/wireless/ath/ath12k/hw.h-11-#include \u003clinux/uuid.h\u003e\n--\ndrivers/net/wireless/ath/ath12k/pci.h-8-\ndrivers/net/wireless/ath/ath12k/pci.h:9:#include \u003clinux/mhi.h\u003e\ndrivers/net/wireless/ath/ath12k/pci.h-10-#include \u003clinux/pci.h\u003e\n--\ndrivers/net/wwan/mhi_wwan_ctrl.c-3-#include \u003clinux/kernel.h\u003e\ndrivers/net/wwan/mhi_wwan_ctrl.c:4:#include \u003clinux/mhi.h\u003e\ndrivers/net/wwan/mhi_wwan_ctrl.c-5-#include \u003clinux/module.h\u003e\n--\ndrivers/net/wwan/mhi_wwan_mbim.c-17-#include \u003clinux/ip.h\u003e\ndrivers/net/wwan/mhi_wwan_mbim.c:18:#include \u003clinux/mhi.h\u003e\ndrivers/net/wwan/mhi_wwan_mbim.c-19-#include \u003clinux/mii.h\u003e\n--\ninclude/linux/mhi_ep.h-9-#include \u003clinux/dma-direction.h\u003e\ninclude/linux/mhi_ep.h:10:#include \u003clinux/mhi.h\u003e\ninclude/linux/mhi_ep.h-11-\n--\nnet/qrtr/mhi.c-5-\nnet/qrtr/mhi.c:6:#include \u003clinux/mhi.h\u003e\nnet/qrtr/mhi.c-7-#include \u003clinux/module.h\u003e\n"
} |
| 9/2 | 2026/09/18 22:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 16857 output: 21 thoughts: 463 Thoughts: **MHI Controller Instantiation and Initialization Analysis** Okay, so I'm looking at where the MHI controller is being instantiated. Based on the code, it's pretty clear that it's being used in a few key places: the Qualcomm PCIe modem drivers (like SDX55) in `pci_generic.c`, the Qualcomm Cloud AI 100 accelerator PCIe card driver (`qaic/mhi_controller.c`), and within the Qualcomm Wi-Fi PCIe chip drivers (`ath11k` and `ath12k`). That's the lay of the land for direct instantiation. Now, I'm trying to figure out if there's any *other* way this thing is getting registered. I'm thinking, is there some platform device or virtual device driver that's calling `mhi_register_controller` or, specifically, `mhi_phc_init`? I need to understand the initialization flow more thoroughly. Wait a second, let's nail down where `mhi_phc_init` is *actually* called. It looks like the only place is within that `mhi_pci_status_cb` function in `pci_generic.c`. This is intriguing. The relevant patch shows that this function responds to certain callback codes from the MHI controller. It's handling errors and, importantly, the `MHI_CB_EE_MISSION_MODE` event. This is where the magic happens, or at least, the re-initialization. When the controller enters the "EE Mission Mode", `mhi_phc_init` is called and also `pm_runtime_allow` is called. Okay, let's make sure this is the only call to `mhi_phc_init`. I need to grep the entire codebase, and make sure that this is the only call. |
| 10/2 | 2026/09/18 22:59 | tool | grepper |
0mArgs:{
"Expression": "mhi_phc_init"
}Results: {
"Output": "drivers/bus/mhi/host/mhi_phc.c=118=static struct ptp_clock_info qcom_ptp_clock_info = {\n--\ndrivers/bus/mhi/host/mhi_phc.c-122-\ndrivers/bus/mhi/host/mhi_phc.c:123:int mhi_phc_init(struct mhi_controller *mhi_cntrl)\ndrivers/bus/mhi/host/mhi_phc.c-124-{\n--\ndrivers/bus/mhi/host/mhi_phc.c-145-}\ndrivers/bus/mhi/host/mhi_phc.c:146:EXPORT_SYMBOL_GPL(mhi_phc_init);\ndrivers/bus/mhi/host/mhi_phc.c-147-\n--\ndrivers/bus/mhi/host/mhi_phc.h-9-#if IS_ENABLED(CONFIG_MHI_BUS_PHC)\ndrivers/bus/mhi/host/mhi_phc.h:10:int mhi_phc_init(struct mhi_controller *mhi_cntrl);\ndrivers/bus/mhi/host/mhi_phc.h-11-void mhi_phc_exit(struct mhi_controller *mhi_cntrl);\ndrivers/bus/mhi/host/mhi_phc.h-12-#else\ndrivers/bus/mhi/host/mhi_phc.h:13:static inline int mhi_phc_init(struct mhi_controller *mhi_cntrl)\ndrivers/bus/mhi/host/mhi_phc.h-14-{\n--\ndrivers/bus/mhi/host/pci_generic.c=1138=static void mhi_pci_status_cb(struct mhi_controller *mhi_cntrl,\n--\ndrivers/bus/mhi/host/pci_generic.c-1151-\tcase MHI_CB_EE_MISSION_MODE:\ndrivers/bus/mhi/host/pci_generic.c:1152:\t\tmhi_phc_init(mhi_cntrl);\ndrivers/bus/mhi/host/pci_generic.c-1153-\t\tpm_runtime_allow(\u0026pdev-\u003edev);\n"
} |
| 11/2 | 2026/09/18 22:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 18328 output: 21 thoughts: 132 Thoughts: **My Initial Thoughts on MHI Initialization** Okay, so I'm digging into this MHI initialization sequence, and here's what I've got so far. It looks like `mhi_phc_init` is *only* called by `mhi_pci_status_cb` which is in `drivers/bus/mhi/host/pci_generic.c`. Interesting. I need to understand that relationship better. Now, what about `mhi_init_tsc_timesync`? That's the next critical piece. Let's see…where is *that* called? Right, it seems it's called by `mhi_init_mmio` in `drivers/bus/mhi/host/init.c` . So now I need to trace back from there. Where is `mhi_init_mmio` called from? Time for a quick `grep` to find all instances. That should give me the entry points and the overall initialization path. |
| 12/2 | 2026/09/18 22:59 | tool | grepper |
0mArgs:{
"Expression": "mhi_init_mmio"
}Results: {
"Output": "drivers/bus/mhi/host/init.c=501=int mhi_init_tsc_timesync(struct mhi_controller *mhi_cntrl)\n--\ndrivers/bus/mhi/host/init.c-525-\ndrivers/bus/mhi/host/init.c:526:int mhi_init_mmio(struct mhi_controller *mhi_cntrl)\ndrivers/bus/mhi/host/init.c-527-{\n--\ndrivers/bus/mhi/host/internal.h=408=void mhi_ring_chan_db(struct mhi_controller *mhi_cntrl,\n--\ndrivers/bus/mhi/host/internal.h-411-/* Initialization methods */\ndrivers/bus/mhi/host/internal.h:412:int mhi_init_mmio(struct mhi_controller *mhi_cntrl);\ndrivers/bus/mhi/host/internal.h-413-int mhi_rddm_prepare(struct mhi_controller *mhi_cntrl,\n--\ndrivers/bus/mhi/host/pm.c=170=int mhi_ready_state_transition(struct mhi_controller *mhi_cntrl)\n--\ndrivers/bus/mhi/host/pm.c-223-\t/* Configure MMIO registers */\ndrivers/bus/mhi/host/pm.c:224:\tret = mhi_init_mmio(mhi_cntrl);\ndrivers/bus/mhi/host/pm.c-225-\tif (ret) {\n"
} |
| 13/2 | 2026/09/18 22:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19100 output: 35 thoughts: 126 Thoughts: **My Initial Thoughts on the MHI Driver Initialization** Okay, so `mhi_init_mmio` is clearly crucial, and it's being invoked within `mhi_ready_state_transition`. That makes sense; we need to get the Memory-Mapped I/O setup when the MHI controller starts up. `mhi_ready_state_transition` is apparently the entry point for handling power-up or boot scenarios for the physical device. But wait, what’s the underlying hardware here? What is the PCI configuration? I need to understand the relationship between this and the PCI interface. Let's dig into that `pci_generic.c` file. I need to figure out what PCI IDs this driver is responsible for binding to. The `mhi_pci_id_table` within `drivers/bus/mhi/host/pci_generic.c` should hold the key to understanding the specific PCI devices this code supports. From there, I can better understand this initialization. |
| 14/2 | 2026/09/18 22:59 | tool | grepper |
0mArgs:{
"Expression": "mhi_pci_id_table",
"PathPrefix": "drivers/bus/mhi"
}Results: {
"Output": "drivers/bus/mhi/host/pci_generic.c=942=static const struct mhi_pci_dev_info mhi_netprisma_fcun69_info = {\n--\ndrivers/bus/mhi/host/pci_generic.c-952-/* Keep the list sorted based on the PID. New VID should be added as the last entry */\ndrivers/bus/mhi/host/pci_generic.c:953:static const struct pci_device_id mhi_pci_id_table[] = {\ndrivers/bus/mhi/host/pci_generic.c-954-\t{PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0116),\n--\ndrivers/bus/mhi/host/pci_generic.c-1087-};\ndrivers/bus/mhi/host/pci_generic.c:1088:MODULE_DEVICE_TABLE(pci, mhi_pci_id_table);\ndrivers/bus/mhi/host/pci_generic.c-1089-\n--\ndrivers/bus/mhi/host/pci_generic.c=1796=static struct pci_driver mhi_pci_driver = {\ndrivers/bus/mhi/host/pci_generic.c-1797-\t.name\t\t= \"mhi-pci-generic\",\ndrivers/bus/mhi/host/pci_generic.c:1798:\t.id_table\t= mhi_pci_id_table,\ndrivers/bus/mhi/host/pci_generic.c-1799-\t.probe\t\t= mhi_pci_probe,\n"
} |
| 15/2 | 2026/09/18 22:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19905 output: 30 thoughts: 166 Thoughts: **My Assessment of the `mhi_pci_driver` and QEMU Emulation** Okay, here's what I'm thinking... The `mhi_pci_driver` is specifically designed for Qualcomm PCIe modems. This means it's talking to those WWAN modems from companies like Foxconn, Telit, Quectel, Fibocom, and the usual suspects like the SDX20, SDX24, SDX55, and SDX65 series. Makes perfect sense. But then I hit a snag. The big question is: can I *emulate* one of these beasts in QEMU? And, no, the standard QEMU setup doesn't seem to natively understand Qualcomm MHI modems or their associated controllers. But then my mind wanders down the MHI endpoint path. Could I potentially connect an MHI endpoint, the `MHI_BUS_EP` specifically, using a PCI EP setup? Could I leverage vhost or even `pci-test` for this? That's the next avenue to explore. I'd better dive into the `drivers/bus/mhi/ep` code and see if there's any way to make this work. |
| 16/2 | 2026/09/18 22:59 | tool | grepper |
0mArgs:{
"Expression": "mhi_ep",
"PathPrefix": "drivers/bus/mhi"
}Results: {
"Output": "\nFull output is too long, showing 500 out of 1198 lines.\nUse more precise expression if possible.\n\ndrivers/bus/mhi/ep/Makefile:1:obj-$(CONFIG_MHI_BUS_EP) += mhi_ep.o\ndrivers/bus/mhi/ep/Makefile:2:mhi_ep-y := main.o mmio.o ring.o sm.o\n--\ndrivers/bus/mhi/ep/internal.h-13-\ndrivers/bus/mhi/ep/internal.h:14:extern const struct bus_type mhi_ep_bus_type;\ndrivers/bus/mhi/ep/internal.h-15-\n--\ndrivers/bus/mhi/ep/internal.h=94=struct mhi_generic_ctx {\n--\ndrivers/bus/mhi/ep/internal.h-104-\ndrivers/bus/mhi/ep/internal.h:105:enum mhi_ep_ring_type {\ndrivers/bus/mhi/ep/internal.h-106-\tRING_TYPE_CMD,\n--\ndrivers/bus/mhi/ep/internal.h-111-/* Ring element */\ndrivers/bus/mhi/ep/internal.h:112:union mhi_ep_ring_ctx {\ndrivers/bus/mhi/ep/internal.h-113-\tstruct mhi_cmd_ctxt cmd;\n--\ndrivers/bus/mhi/ep/internal.h-118-\ndrivers/bus/mhi/ep/internal.h:119:struct mhi_ep_ring_item {\ndrivers/bus/mhi/ep/internal.h-120-\tstruct list_head node;\ndrivers/bus/mhi/ep/internal.h:121:\tstruct mhi_ep_ring *ring;\ndrivers/bus/mhi/ep/internal.h-122-};\ndrivers/bus/mhi/ep/internal.h-123-\ndrivers/bus/mhi/ep/internal.h:124:struct mhi_ep_ring {\ndrivers/bus/mhi/ep/internal.h:125:\tstruct mhi_ep_cntrl *mhi_cntrl;\ndrivers/bus/mhi/ep/internal.h:126:\tunion mhi_ep_ring_ctx *ring_ctx;\ndrivers/bus/mhi/ep/internal.h-127-\tstruct mhi_ring_element *ring_cache;\ndrivers/bus/mhi/ep/internal.h:128:\tenum mhi_ep_ring_type type;\ndrivers/bus/mhi/ep/internal.h-129-\tstruct delayed_work intmodt_work;\n--\ndrivers/bus/mhi/ep/internal.h-143-\ndrivers/bus/mhi/ep/internal.h:144:struct mhi_ep_cmd {\ndrivers/bus/mhi/ep/internal.h:145:\tstruct mhi_ep_ring ring;\ndrivers/bus/mhi/ep/internal.h-146-};\ndrivers/bus/mhi/ep/internal.h-147-\ndrivers/bus/mhi/ep/internal.h:148:struct mhi_ep_event {\ndrivers/bus/mhi/ep/internal.h:149:\tstruct mhi_ep_ring ring;\ndrivers/bus/mhi/ep/internal.h-150-};\ndrivers/bus/mhi/ep/internal.h-151-\ndrivers/bus/mhi/ep/internal.h:152:struct mhi_ep_state_transition {\ndrivers/bus/mhi/ep/internal.h-153-\tstruct list_head node;\n--\ndrivers/bus/mhi/ep/internal.h-156-\ndrivers/bus/mhi/ep/internal.h:157:struct mhi_ep_chan {\ndrivers/bus/mhi/ep/internal.h-158-\tchar *name;\ndrivers/bus/mhi/ep/internal.h:159:\tstruct mhi_ep_device *mhi_dev;\ndrivers/bus/mhi/ep/internal.h:160:\tstruct mhi_ep_ring ring;\ndrivers/bus/mhi/ep/internal.h-161-\tstruct mutex lock;\ndrivers/bus/mhi/ep/internal.h:162:\tvoid (*xfer_cb)(struct mhi_ep_device *mhi_dev, struct mhi_result *result);\ndrivers/bus/mhi/ep/internal.h-163-\tenum mhi_ch_state state;\n--\ndrivers/bus/mhi/ep/internal.h-173-/* MHI Ring related functions */\ndrivers/bus/mhi/ep/internal.h:174:void mhi_ep_ring_init(struct mhi_ep_ring *ring, enum mhi_ep_ring_type type, u32 id);\ndrivers/bus/mhi/ep/internal.h:175:void mhi_ep_ring_reset(struct mhi_ep_cntrl *mhi_cntrl, struct mhi_ep_ring *ring);\ndrivers/bus/mhi/ep/internal.h:176:int mhi_ep_ring_start(struct mhi_ep_cntrl *mhi_cntrl, struct mhi_ep_ring *ring,\ndrivers/bus/mhi/ep/internal.h:177:\t\t union mhi_ep_ring_ctx *ctx);\ndrivers/bus/mhi/ep/internal.h:178:size_t mhi_ep_ring_addr2offset(struct mhi_ep_ring *ring, u64 ptr);\ndrivers/bus/mhi/ep/internal.h:179:int mhi_ep_ring_add_element(struct mhi_ep_ring *ring, struct mhi_ring_element *element);\ndrivers/bus/mhi/ep/internal.h:180:void mhi_ep_ring_inc_index(struct mhi_ep_ring *ring);\ndrivers/bus/mhi/ep/internal.h:181:int mhi_ep_update_wr_offset(struct mhi_ep_ring *ring);\ndrivers/bus/mhi/ep/internal.h-182-\ndrivers/bus/mhi/ep/internal.h-183-/* MMIO related functions */\ndrivers/bus/mhi/ep/internal.h:184:u32 mhi_ep_mmio_read(struct mhi_ep_cntrl *mhi_cntrl, u32 offset);\ndrivers/bus/mhi/ep/internal.h:185:void mhi_ep_mmio_write(struct mhi_ep_cntrl *mhi_cntrl, u32 offset, u32 val);\ndrivers/bus/mhi/ep/internal.h:186:void mhi_ep_mmio_masked_write(struct mhi_ep_cntrl *mhi_cntrl, u32 offset, u32 mask, u32 val);\ndrivers/bus/mhi/ep/internal.h:187:u32 mhi_ep_mmio_masked_read(struct mhi_ep_cntrl *dev, u32 offset, u32 mask);\ndrivers/bus/mhi/ep/internal.h:188:void mhi_ep_mmio_enable_ctrl_interrupt(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h:189:void mhi_ep_mmio_disable_ctrl_interrupt(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h:190:void mhi_ep_mmio_enable_cmdb_interrupt(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h:191:void mhi_ep_mmio_disable_cmdb_interrupt(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h:192:void mhi_ep_mmio_enable_chdb(struct mhi_ep_cntrl *mhi_cntrl, u32 ch_id);\ndrivers/bus/mhi/ep/internal.h:193:void mhi_ep_mmio_disable_chdb(struct mhi_ep_cntrl *mhi_cntrl, u32 ch_id);\ndrivers/bus/mhi/ep/internal.h:194:void mhi_ep_mmio_enable_chdb_interrupts(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h:195:bool mhi_ep_mmio_read_chdb_status_interrupts(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h:196:void mhi_ep_mmio_mask_interrupts(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h:197:void mhi_ep_mmio_get_chc_base(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h:198:void mhi_ep_mmio_get_erc_base(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h:199:void mhi_ep_mmio_get_crc_base(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h:200:u64 mhi_ep_mmio_get_db(struct mhi_ep_ring *ring);\ndrivers/bus/mhi/ep/internal.h:201:void mhi_ep_mmio_set_env(struct mhi_ep_cntrl *mhi_cntrl, u32 value);\ndrivers/bus/mhi/ep/internal.h:202:void mhi_ep_mmio_clear_reset(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h:203:void mhi_ep_mmio_reset(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h:204:void mhi_ep_mmio_get_mhi_state(struct mhi_ep_cntrl *mhi_cntrl, enum mhi_state *state,\ndrivers/bus/mhi/ep/internal.h-205-\t\t\t bool *mhi_reset);\ndrivers/bus/mhi/ep/internal.h:206:void mhi_ep_mmio_init(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h:207:void mhi_ep_mmio_update_ner(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h-208-\ndrivers/bus/mhi/ep/internal.h-209-/* MHI EP core functions */\ndrivers/bus/mhi/ep/internal.h:210:int mhi_ep_send_state_change_event(struct mhi_ep_cntrl *mhi_cntrl, enum mhi_state state);\ndrivers/bus/mhi/ep/internal.h:211:int mhi_ep_send_ee_event(struct mhi_ep_cntrl *mhi_cntrl, enum mhi_ee_type exec_env);\ndrivers/bus/mhi/ep/internal.h:212:bool mhi_ep_check_mhi_state(struct mhi_ep_cntrl *mhi_cntrl, enum mhi_state cur_mhi_state,\ndrivers/bus/mhi/ep/internal.h-213-\t\t\t enum mhi_state mhi_state);\ndrivers/bus/mhi/ep/internal.h:214:int mhi_ep_set_mhi_state(struct mhi_ep_cntrl *mhi_cntrl, enum mhi_state mhi_state);\ndrivers/bus/mhi/ep/internal.h:215:int mhi_ep_set_m0_state(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h:216:int mhi_ep_set_m3_state(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h:217:int mhi_ep_set_ready_state(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h:218:void mhi_ep_handle_syserr(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h:219:void mhi_ep_resume_channels(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h:220:void mhi_ep_suspend_channels(struct mhi_ep_cntrl *mhi_cntrl);\ndrivers/bus/mhi/ep/internal.h-221-\n--\ndrivers/bus/mhi/ep/main.c-14-#include \u003clinux/irq.h\u003e\ndrivers/bus/mhi/ep/main.c:15:#include \u003clinux/mhi_ep.h\u003e\ndrivers/bus/mhi/ep/main.c-16-#include \u003clinux/module.h\u003e\n--\ndrivers/bus/mhi/ep/main.c-21-\ndrivers/bus/mhi/ep/main.c:22:static DEFINE_IDA(mhi_ep_cntrl_ida);\ndrivers/bus/mhi/ep/main.c-23-\ndrivers/bus/mhi/ep/main.c:24:static int mhi_ep_create_device(struct mhi_ep_cntrl *mhi_cntrl, u32 ch_id);\ndrivers/bus/mhi/ep/main.c:25:static int mhi_ep_destroy_device(struct device *dev, void *data);\ndrivers/bus/mhi/ep/main.c-26-\ndrivers/bus/mhi/ep/main.c:27:static int mhi_ep_send_event(struct mhi_ep_cntrl *mhi_cntrl, u32 ring_idx,\ndrivers/bus/mhi/ep/main.c-28-\t\t\t struct mhi_ring_element *el, bool bei)\n--\ndrivers/bus/mhi/ep/main.c-30-\tstruct device *dev = \u0026mhi_cntrl-\u003emhi_dev-\u003edev;\ndrivers/bus/mhi/ep/main.c:31:\tunion mhi_ep_ring_ctx *ctx;\ndrivers/bus/mhi/ep/main.c:32:\tstruct mhi_ep_ring *ring;\ndrivers/bus/mhi/ep/main.c-33-\tint ret;\n--\ndrivers/bus/mhi/ep/main.c-36-\tring = \u0026mhi_cntrl-\u003emhi_event[ring_idx].ring;\ndrivers/bus/mhi/ep/main.c:37:\tctx = (union mhi_ep_ring_ctx *)\u0026mhi_cntrl-\u003eev_ctx_cache[ring_idx];\ndrivers/bus/mhi/ep/main.c-38-\tif (!ring-\u003estarted) {\ndrivers/bus/mhi/ep/main.c:39:\t\tret = mhi_ep_ring_start(mhi_cntrl, ring, ctx);\ndrivers/bus/mhi/ep/main.c-40-\t\tif (ret) {\n--\ndrivers/bus/mhi/ep/main.c-46-\t/* Add element to the event ring */\ndrivers/bus/mhi/ep/main.c:47:\tret = mhi_ep_ring_add_element(ring, el);\ndrivers/bus/mhi/ep/main.c-48-\tif (ret) {\n--\ndrivers/bus/mhi/ep/main.c-85-\ndrivers/bus/mhi/ep/main.c:86:static int mhi_ep_send_completion_event(struct mhi_ep_cntrl *mhi_cntrl, struct mhi_ep_ring *ring,\ndrivers/bus/mhi/ep/main.c-87-\t\t\t\t\tstruct mhi_ring_element *tre, u32 len, enum mhi_ev_ccs code)\n--\ndrivers/bus/mhi/ep/main.c-99-\ndrivers/bus/mhi/ep/main.c:100:\tret = mhi_ep_send_event(mhi_cntrl, ring-\u003eer_index, event, MHI_TRE_DATA_GET_BEI(tre));\ndrivers/bus/mhi/ep/main.c-101-\tkmem_cache_free(mhi_cntrl-\u003eev_ring_el_cache, event);\n--\ndrivers/bus/mhi/ep/main.c-105-\ndrivers/bus/mhi/ep/main.c:106:int mhi_ep_send_state_change_event(struct mhi_ep_cntrl *mhi_cntrl, enum mhi_state state)\ndrivers/bus/mhi/ep/main.c-107-{\n--\ndrivers/bus/mhi/ep/main.c-117-\ndrivers/bus/mhi/ep/main.c:118:\tret = mhi_ep_send_event(mhi_cntrl, 0, event, 0);\ndrivers/bus/mhi/ep/main.c-119-\tkmem_cache_free(mhi_cntrl-\u003eev_ring_el_cache, event);\n--\ndrivers/bus/mhi/ep/main.c-123-\ndrivers/bus/mhi/ep/main.c:124:int mhi_ep_send_ee_event(struct mhi_ep_cntrl *mhi_cntrl, enum mhi_ee_type exec_env)\ndrivers/bus/mhi/ep/main.c-125-{\n--\ndrivers/bus/mhi/ep/main.c-135-\ndrivers/bus/mhi/ep/main.c:136:\tret = mhi_ep_send_event(mhi_cntrl, 0, event, 0);\ndrivers/bus/mhi/ep/main.c-137-\tkmem_cache_free(mhi_cntrl-\u003eev_ring_el_cache, event);\n--\ndrivers/bus/mhi/ep/main.c-141-\ndrivers/bus/mhi/ep/main.c:142:static int mhi_ep_send_cmd_comp_event(struct mhi_ep_cntrl *mhi_cntrl, enum mhi_ev_ccs code)\ndrivers/bus/mhi/ep/main.c-143-{\ndrivers/bus/mhi/ep/main.c:144:\tstruct mhi_ep_ring *ring = \u0026mhi_cntrl-\u003emhi_cmd-\u003ering;\ndrivers/bus/mhi/ep/main.c-145-\tstruct mhi_ring_element *event;\n--\ndrivers/bus/mhi/ep/main.c-155-\ndrivers/bus/mhi/ep/main.c:156:\tret = mhi_ep_send_event(mhi_cntrl, 0, event, 0);\ndrivers/bus/mhi/ep/main.c-157-\tkmem_cache_free(mhi_cntrl-\u003eev_ring_el_cache, event);\n--\ndrivers/bus/mhi/ep/main.c-161-\ndrivers/bus/mhi/ep/main.c:162:static int mhi_ep_process_cmd_ring(struct mhi_ep_ring *ring, struct mhi_ring_element *el)\ndrivers/bus/mhi/ep/main.c-163-{\ndrivers/bus/mhi/ep/main.c:164:\tstruct mhi_ep_cntrl *mhi_cntrl = ring-\u003emhi_cntrl;\ndrivers/bus/mhi/ep/main.c-165-\tstruct device *dev = \u0026mhi_cntrl-\u003emhi_dev-\u003edev;\ndrivers/bus/mhi/ep/main.c-166-\tstruct mhi_result result = {};\ndrivers/bus/mhi/ep/main.c:167:\tstruct mhi_ep_chan *mhi_chan;\ndrivers/bus/mhi/ep/main.c:168:\tstruct mhi_ep_ring *ch_ring;\ndrivers/bus/mhi/ep/main.c-169-\tu32 tmp, ch_id;\n--\ndrivers/bus/mhi/ep/main.c-189-\t\tif (!ch_ring-\u003estarted) {\ndrivers/bus/mhi/ep/main.c:190:\t\t\tret = mhi_ep_ring_start(mhi_cntrl, ch_ring,\ndrivers/bus/mhi/ep/main.c:191:\t\t\t\t(union mhi_ep_ring_ctx *)\u0026mhi_cntrl-\u003ech_ctx_cache[ch_id]);\ndrivers/bus/mhi/ep/main.c-192-\t\t\tif (ret) {\ndrivers/bus/mhi/ep/main.c-193-\t\t\t\tdev_err(dev, \"Failed to start ring for channel (%u)\\n\", ch_id);\ndrivers/bus/mhi/ep/main.c:194:\t\t\t\tret = mhi_ep_send_cmd_comp_event(mhi_cntrl,\ndrivers/bus/mhi/ep/main.c-195-\t\t\t\t\t\t\tMHI_EV_CC_UNDEFINED_ERR);\n--\ndrivers/bus/mhi/ep/main.c-211-\ndrivers/bus/mhi/ep/main.c:212:\t\tret = mhi_ep_send_cmd_comp_event(mhi_cntrl, MHI_EV_CC_SUCCESS);\ndrivers/bus/mhi/ep/main.c-213-\t\tif (ret) {\n--\ndrivers/bus/mhi/ep/main.c-230-\t\tif (!(ch_id % 2) \u0026\u0026 !mhi_chan-\u003emhi_dev) {\ndrivers/bus/mhi/ep/main.c:231:\t\t\tret = mhi_ep_create_device(mhi_cntrl, ch_id);\ndrivers/bus/mhi/ep/main.c-232-\t\t\tif (ret) {\n--\ndrivers/bus/mhi/ep/main.c-234-\t\t\t\tmutex_lock(\u0026mhi_cntrl-\u003estate_lock);\ndrivers/bus/mhi/ep/main.c:235:\t\t\t\tmhi_ep_handle_syserr(mhi_cntrl);\ndrivers/bus/mhi/ep/main.c-236-\t\t\t\tmutex_unlock(\u0026mhi_cntrl-\u003estate_lock);\n--\ndrivers/bus/mhi/ep/main.c-241-\t\t/* Finally, enable DB for the channel */\ndrivers/bus/mhi/ep/main.c:242:\t\tmhi_ep_mmio_enable_chdb(mhi_cntrl, ch_id);\ndrivers/bus/mhi/ep/main.c-243-\n--\ndrivers/bus/mhi/ep/main.c-253-\t\t/* Disable DB for the channel */\ndrivers/bus/mhi/ep/main.c:254:\t\tmhi_ep_mmio_disable_chdb(mhi_cntrl, ch_id);\ndrivers/bus/mhi/ep/main.c-255-\n--\ndrivers/bus/mhi/ep/main.c-269-\ndrivers/bus/mhi/ep/main.c:270:\t\tret = mhi_ep_send_cmd_comp_event(mhi_cntrl, MHI_EV_CC_SUCCESS);\ndrivers/bus/mhi/ep/main.c-271-\t\tif (ret) {\n--\ndrivers/bus/mhi/ep/main.c-287-\t\t/* Stop and reset the transfer ring */\ndrivers/bus/mhi/ep/main.c:288:\t\tmhi_ep_ring_reset(mhi_cntrl, ch_ring);\ndrivers/bus/mhi/ep/main.c-289-\n--\ndrivers/bus/mhi/ep/main.c-303-\ndrivers/bus/mhi/ep/main.c:304:\t\tret = mhi_ep_send_cmd_comp_event(mhi_cntrl, MHI_EV_CC_SUCCESS);\ndrivers/bus/mhi/ep/main.c-305-\t\tif (ret) {\n--\ndrivers/bus/mhi/ep/main.c-326-\ndrivers/bus/mhi/ep/main.c:327:bool mhi_ep_queue_is_empty(struct mhi_ep_device *mhi_dev, enum dma_data_direction dir)\ndrivers/bus/mhi/ep/main.c-328-{\ndrivers/bus/mhi/ep/main.c:329:\tstruct mhi_ep_chan *mhi_chan = (dir == DMA_FROM_DEVICE) ? mhi_dev-\u003edl_chan :\ndrivers/bus/mhi/ep/main.c-330-\t\t\t\t\t\t\t\tmhi_dev-\u003eul_chan;\ndrivers/bus/mhi/ep/main.c:331:\tstruct mhi_ep_cntrl *mhi_cntrl = mhi_dev-\u003emhi_cntrl;\ndrivers/bus/mhi/ep/main.c:332:\tstruct mhi_ep_ring *ring = \u0026mhi_cntrl-\u003emhi_chan[mhi_chan-\u003echan].ring;\ndrivers/bus/mhi/ep/main.c-333-\n--\ndrivers/bus/mhi/ep/main.c-335-}\ndrivers/bus/mhi/ep/main.c:336:EXPORT_SYMBOL_GPL(mhi_ep_queue_is_empty);\ndrivers/bus/mhi/ep/main.c-337-\ndrivers/bus/mhi/ep/main.c:338:static void mhi_ep_read_completion(struct mhi_ep_buf_info *buf_info)\ndrivers/bus/mhi/ep/main.c-339-{\ndrivers/bus/mhi/ep/main.c:340:\tstruct mhi_ep_device *mhi_dev = buf_info-\u003emhi_dev;\ndrivers/bus/mhi/ep/main.c:341:\tstruct mhi_ep_cntrl *mhi_cntrl = mhi_dev-\u003emhi_cntrl;\ndrivers/bus/mhi/ep/main.c:342:\tstruct mhi_ep_chan *mhi_chan = mhi_dev-\u003eul_chan;\ndrivers/bus/mhi/ep/main.c:343:\tstruct mhi_ep_ring *ring = \u0026mhi_cntrl-\u003emhi_chan[mhi_chan-\u003echan].ring;\ndrivers/bus/mhi/ep/main.c-344-\tstruct mhi_ring_element *el = \u0026ring-\u003ering_cache[ring-\u003erd_offset];\n--\ndrivers/bus/mhi/ep/main.c-367-\t\t\tif (MHI_TRE_DATA_GET_IEOB(el)) {\ndrivers/bus/mhi/ep/main.c:368:\t\t\t\tret = mhi_ep_send_completion_event(mhi_cntrl, ring, el,\ndrivers/bus/mhi/ep/main.c-369-\t\t\t\t\t\t\t MHI_TRE_DATA_GET_LEN(el),\n--\ndrivers/bus/mhi/ep/main.c-383-\t\t\tif (MHI_TRE_DATA_GET_IEOT(el)) {\ndrivers/bus/mhi/ep/main.c:384:\t\t\t\tret = mhi_ep_send_completion_event(mhi_cntrl, ring, el,\ndrivers/bus/mhi/ep/main.c-385-\t\t\t\t\t\t\t MHI_TRE_DATA_GET_LEN(el),\n--\ndrivers/bus/mhi/ep/main.c-395-\ndrivers/bus/mhi/ep/main.c:396:\tmhi_ep_ring_inc_index(ring);\ndrivers/bus/mhi/ep/main.c-397-\n--\ndrivers/bus/mhi/ep/main.c-401-\ndrivers/bus/mhi/ep/main.c:402:static int mhi_ep_read_channel(struct mhi_ep_cntrl *mhi_cntrl,\ndrivers/bus/mhi/ep/main.c:403:\t\t\t struct mhi_ep_ring *ring)\ndrivers/bus/mhi/ep/main.c-404-{\ndrivers/bus/mhi/ep/main.c:405:\tstruct mhi_ep_chan *mhi_chan = \u0026mhi_cntrl-\u003emhi_chan[ring-\u003ech_id];\ndrivers/bus/mhi/ep/main.c-406-\tstruct device *dev = \u0026mhi_cntrl-\u003emhi_dev-\u003edev;\ndrivers/bus/mhi/ep/main.c-407-\tsize_t tr_len, read_offset;\ndrivers/bus/mhi/ep/main.c:408:\tstruct mhi_ep_buf_info buf_info = {};\ndrivers/bus/mhi/ep/main.c-409-\tu32 len = MHI_EP_DEFAULT_MTU;\n--\ndrivers/bus/mhi/ep/main.c-443-\t\tbuf_info.size = tr_len;\ndrivers/bus/mhi/ep/main.c:444:\t\tbuf_info.cb = mhi_ep_read_completion;\ndrivers/bus/mhi/ep/main.c-445-\t\tbuf_info.cb_buf = buf_addr;\n--\ndrivers/bus/mhi/ep/main.c-462-\t/* Read until the some buffer is left or the ring becomes not empty */\ndrivers/bus/mhi/ep/main.c:463:\t} while (!mhi_ep_queue_is_empty(mhi_chan-\u003emhi_dev, DMA_TO_DEVICE));\ndrivers/bus/mhi/ep/main.c-464-\n--\ndrivers/bus/mhi/ep/main.c-472-\ndrivers/bus/mhi/ep/main.c:473:static int mhi_ep_process_ch_ring(struct mhi_ep_ring *ring)\ndrivers/bus/mhi/ep/main.c-474-{\ndrivers/bus/mhi/ep/main.c:475:\tstruct mhi_ep_cntrl *mhi_cntrl = ring-\u003emhi_cntrl;\ndrivers/bus/mhi/ep/main.c-476-\tstruct mhi_result result = {};\ndrivers/bus/mhi/ep/main.c:477:\tstruct mhi_ep_chan *mhi_chan;\ndrivers/bus/mhi/ep/main.c-478-\tint ret;\n--\ndrivers/bus/mhi/ep/main.c-496-\t\t/* UL channel */\ndrivers/bus/mhi/ep/main.c:497:\t\tret = mhi_ep_read_channel(mhi_cntrl, ring);\ndrivers/bus/mhi/ep/main.c-498-\t\tif (ret) {\n--\ndrivers/bus/mhi/ep/main.c-506-\ndrivers/bus/mhi/ep/main.c:507:static void mhi_ep_skb_completion(struct mhi_ep_buf_info *buf_info)\ndrivers/bus/mhi/ep/main.c-508-{\ndrivers/bus/mhi/ep/main.c:509:\tstruct mhi_ep_device *mhi_dev = buf_info-\u003emhi_dev;\ndrivers/bus/mhi/ep/main.c:510:\tstruct mhi_ep_cntrl *mhi_cntrl = mhi_dev-\u003emhi_cntrl;\ndrivers/bus/mhi/ep/main.c:511:\tstruct mhi_ep_chan *mhi_chan = mhi_dev-\u003edl_chan;\ndrivers/bus/mhi/ep/main.c:512:\tstruct mhi_ep_ring *ring = \u0026mhi_cntrl-\u003emhi_chan[mhi_chan-\u003echan].ring;\ndrivers/bus/mhi/ep/main.c-513-\tstruct mhi_ring_element *el = \u0026ring-\u003ering_cache[ring-\u003erd_offset];\n--\ndrivers/bus/mhi/ep/main.c-525-\ndrivers/bus/mhi/ep/main.c:526:\tret = mhi_ep_send_completion_event(mhi_cntrl, ring, el, buf_info-\u003esize,\ndrivers/bus/mhi/ep/main.c-527-\t\t\t\t\t buf_info-\u003ecode);\n--\ndrivers/bus/mhi/ep/main.c-532-\ndrivers/bus/mhi/ep/main.c:533:\tmhi_ep_ring_inc_index(ring);\ndrivers/bus/mhi/ep/main.c-534-}\n--\ndrivers/bus/mhi/ep/main.c-536-/* TODO: Handle partially formed TDs */\ndrivers/bus/mhi/ep/main.c:537:int mhi_ep_queue_skb(struct mhi_ep_device *mhi_dev, struct sk_buff *skb)\ndrivers/bus/mhi/ep/main.c-538-{\ndrivers/bus/mhi/ep/main.c:539:\tstruct mhi_ep_cntrl *mhi_cntrl = mhi_dev-\u003emhi_cntrl;\ndrivers/bus/mhi/ep/main.c:540:\tstruct mhi_ep_chan *mhi_chan = mhi_dev-\u003edl_chan;\ndrivers/bus/mhi/ep/main.c-541-\tstruct device *dev = \u0026mhi_chan-\u003emhi_dev-\u003edev;\ndrivers/bus/mhi/ep/main.c:542:\tstruct mhi_ep_buf_info buf_info = {};\ndrivers/bus/mhi/ep/main.c-543-\tstruct mhi_ring_element *el;\ndrivers/bus/mhi/ep/main.c-544-\tu32 buf_left, read_offset;\ndrivers/bus/mhi/ep/main.c:545:\tstruct mhi_ep_ring *ring;\ndrivers/bus/mhi/ep/main.c-546-\tsize_t tr_len;\n--\ndrivers/bus/mhi/ep/main.c-562-\ndrivers/bus/mhi/ep/main.c:563:\t\tif (mhi_ep_queue_is_empty(mhi_dev, DMA_FROM_DEVICE)) {\ndrivers/bus/mhi/ep/main.c-564-\t\t\tdev_err(dev, \"TRE not available!\\n\");\n--\ndrivers/bus/mhi/ep/main.c-577-\t\tbuf_info.size = tr_len;\ndrivers/bus/mhi/ep/main.c:578:\t\tbuf_info.cb = mhi_ep_skb_completion;\ndrivers/bus/mhi/ep/main.c-579-\t\tbuf_info.cb_buf = skb;\n--\ndrivers/bus/mhi/ep/main.c-617-}\ndrivers/bus/mhi/ep/main.c:618:EXPORT_SYMBOL_GPL(mhi_ep_queue_skb);\ndrivers/bus/mhi/ep/main.c-619-\ndrivers/bus/mhi/ep/main.c:620:static int mhi_ep_cache_host_cfg(struct mhi_ep_cntrl *mhi_cntrl)\ndrivers/bus/mhi/ep/main.c-621-{\n--\ndrivers/bus/mhi/ep/main.c-626-\t/* Update the number of event rings (NER) programmed by the host */\ndrivers/bus/mhi/ep/main.c:627:\tmhi_ep_mmio_update_ner(mhi_cntrl);\ndrivers/bus/mhi/ep/main.c-628-\n--\ndrivers/bus/mhi/ep/main.c-636-\t/* Get the channel context base pointer from host */\ndrivers/bus/mhi/ep/main.c:637:\tmhi_ep_mmio_get_chc_base(mhi_cntrl);\ndrivers/bus/mhi/ep/main.c-638-\n--\ndrivers/bus/mhi/ep/main.c-649-\t/* Get the event context base pointer from host */\ndrivers/bus/mhi/ep/main.c:650:\tmhi_ep_mmio_get_erc_base(mhi_cntrl);\ndrivers/bus/mhi/ep/main.c-651-\n--\ndrivers/bus/mhi/ep/main.c-662-\t/* Get the command context base pointer from host */\ndrivers/bus/mhi/ep/main.c:663:\tmhi_ep_mmio_get_crc_base(mhi_cntrl);\ndrivers/bus/mhi/ep/main.c-664-\n--\ndrivers/bus/mhi/ep/main.c-675-\t/* Initialize command ring */\ndrivers/bus/mhi/ep/main.c:676:\tret = mhi_ep_ring_start(mhi_cntrl, \u0026mhi_cntrl-\u003emhi_cmd-\u003ering,\ndrivers/bus/mhi/ep/main.c:677:\t\t\t\t(union mhi_ep_ring_ctx *)mhi_cntrl-\u003ecmd_ctx_cache);\ndrivers/bus/mhi/ep/main.c-678-\tif (ret) {\n--\ndrivers/bus/mhi/ep/main.c-699-\ndrivers/bus/mhi/ep/main.c:700:static void mhi_ep_free_host_cfg(struct mhi_ep_cntrl *mhi_cntrl)\ndrivers/bus/mhi/ep/main.c-701-{\n--\ndrivers/bus/mhi/ep/main.c-717-\ndrivers/bus/mhi/ep/main.c:718:static void mhi_ep_enable_int(struct mhi_ep_cntrl *mhi_cntrl)\ndrivers/bus/mhi/ep/main.c-719-{\n--\ndrivers/bus/mhi/ep/main.c-724-\t */\ndrivers/bus/mhi/ep/main.c:725:\tmhi_ep_mmio_enable_ctrl_interrupt(mhi_cntrl);\ndrivers/bus/mhi/ep/main.c:726:\tmhi_ep_mmio_enable_cmdb_interrupt(mhi_cntrl);\ndrivers/bus/mhi/ep/main.c-727-}\ndrivers/bus/mhi/ep/main.c-728-\ndrivers/bus/mhi/ep/main.c:729:static int mhi_ep_enable(struct mhi_ep_cntrl *mhi_cntrl)\ndrivers/bus/mhi/ep/main.c-730-{\n--\ndrivers/bus/mhi/ep/main.c-739-\t\tmsleep(M0_WAIT_DELAY_MS);\ndrivers/bus/mhi/ep/main.c:740:\t\tmhi_ep_mmio_get_mhi_state(mhi_cntrl, \u0026state, \u0026mhi_reset);\ndrivers/bus/mhi/ep/main.c-741-\t\tif (mhi_reset) {\ndrivers/bus/mhi/ep/main.c-742-\t\t\t/* Clear the MHI reset if host is in reset state */\ndrivers/bus/mhi/ep/main.c:743:\t\t\tmhi_ep_mmio_clear_reset(mhi_cntrl);\ndrivers/bus/mhi/ep/main.c-744-\t\t\tdev_info(dev, \"Detected Host reset while waiting for M0\\n\");\n--\ndrivers/bus/mhi/ep/main.c-753-\ndrivers/bus/mhi/ep/main.c:754:\tret = mhi_ep_cache_host_cfg(mhi_cntrl);\ndrivers/bus/mhi/ep/main.c-755-\tif (ret) {\n--\ndrivers/bus/mhi/ep/main.c-759-\ndrivers/bus/mhi/ep/main.c:760:\tmhi_ep_mmio_set_env(mhi_cntrl, MHI_EE_AMSS);\ndrivers/bus/mhi/ep/main.c-761-\ndrivers/bus/mhi/ep/main.c-762-\t/* Enable all interrupts now */\ndrivers/bus/mhi/ep/main.c:763:\tmhi_ep_enable_int(mhi_cntrl);\ndrivers/bus/mhi/ep/main.c-764-\n--\ndrivers/bus/mhi/ep/main.c-767-\ndrivers/bus/mhi/ep/main.c:768:static void mhi_ep_cmd_ring_worker(struct work_struct *work)\ndrivers/bus/mhi/ep/main.c-769-{\ndrivers/bus/mhi/ep/main.c:770:\tstruct mhi_ep_cntrl *mhi_cntrl = container_of(work, struct mhi_ep_cntrl, cmd_ring_work);\ndrivers/bus/mhi/ep/main.c:771:\tstruct mhi_ep_ring *ring = \u0026mhi_cntrl-\u003emhi_cmd-\u003ering;\ndrivers/bus/mhi/ep/main.c-772-\tstruct device *dev = \u0026mhi_cntrl-\u003emhi_dev-\u003edev;\n--\ndrivers/bus/mhi/ep/main.c-776-\t/* Update the write offset for the ring */\ndrivers/bus/mhi/ep/main.c:777:\tret = mhi_ep_update_wr_offset(ring);\ndrivers/bus/mhi/ep/main.c-778-\tif (ret) {\n--\ndrivers/bus/mhi/ep/main.c-793-\ndrivers/bus/mhi/ep/main.c:794:\t\tret = mhi_ep_process_cmd_ring(ring, el);\ndrivers/bus/mhi/ep/main.c-795-\t\tif (ret \u0026\u0026 ret != -ENODEV)\n--\ndrivers/bus/mhi/ep/main.c-797-\ndrivers/bus/mhi/ep/main.c:798:\t\tmhi_ep_ring_inc_index(ring);\ndrivers/bus/mhi/ep/main.c-799-\t}\n--\ndrivers/bus/mhi/ep/main.c-801-\ndrivers/bus/mhi/ep/main.c:802:static void mhi_ep_ch_ring_worker(struct work_struct *work)\ndrivers/bus/mhi/ep/main.c-803-{\ndrivers/bus/mhi/ep/main.c:804:\tstruct mhi_ep_cntrl *mhi_cntrl = container_of(work, struct mhi_ep_cntrl, ch_ring_work);\ndrivers/bus/mhi/ep/main.c-805-\tstruct device *dev = \u0026mhi_cntrl-\u003emhi_dev-\u003edev;\ndrivers/bus/mhi/ep/main.c:806:\tstruct mhi_ep_ring_item *itr, *tmp;\ndrivers/bus/mhi/ep/main.c:807:\tstruct mhi_ep_ring *ring;\ndrivers/bus/mhi/ep/main.c:808:\tstruct mhi_ep_chan *chan;\ndrivers/bus/mhi/ep/main.c-809-\tunsigned long flags;\n--\ndrivers/bus/mhi/ep/main.c-835-\t\t/* Update the write offset for the ring */\ndrivers/bus/mhi/ep/main.c:836:\t\tret = mhi_ep_update_wr_offset(ring);\ndrivers/bus/mhi/ep/main.c-837-\t\tif (ret) {\n--\ndrivers/bus/mhi/ep/main.c-851-\t\tdev_dbg(dev, \"Processing the ring for channel (%u)\\n\", ring-\u003ech_id);\ndrivers/bus/mhi/ep/main.c:852:\t\tret = mhi_ep_process_ch_ring(ring);\ndrivers/bus/mhi/ep/main.c-853-\t\tif (ret) {\n--\ndrivers/bus/mhi/ep/main.c-865-\ndrivers/bus/mhi/ep/main.c:866:static void mhi_ep_state_worker(struct work_struct *work)\ndrivers/bus/mhi/ep/main.c-867-{\ndrivers/bus/mhi/ep/main.c:868:\tstruct mhi_ep_cntrl *mhi_cntrl = container_of(work, struct mhi_ep_cntrl, state_work);\ndrivers/bus/mhi/ep/main.c-869-\tstruct device *dev = \u0026mhi_cntrl-\u003emhi_dev-\u003edev;\ndrivers/bus/mhi/ep/main.c:870:\tstruct mhi_ep_state_transition *itr, *tmp;\ndrivers/bus/mhi/ep/main.c-871-\tunsigned long flags;\n--\ndrivers/bus/mhi/ep/main.c-885-\t\tcase MHI_STATE_M0:\ndrivers/bus/mhi/ep/main.c:886:\t\t\tret = mhi_ep_set_m0_state(mhi_cntrl);\ndrivers/bus/mhi/ep/main.c-887-\t\t\tif (ret)\n--\ndrivers/bus/mhi/ep/main.c-890-\t\tcase MHI_STATE_M3:\ndrivers/bus/mhi/ep/main.c:891:\t\t\tret = mhi_ep_set_m3_state(mhi_cntrl);\ndrivers/bus/mhi/ep/main.c-892-\t\t\tif (ret)\n--\ndrivers/bus/mhi/ep/main.c-902-\ndrivers/bus/mhi/ep/main.c:903:static void mhi_ep_queue_channel_db(struct mhi_ep_cntrl *mhi_cntrl, unsigned long ch_int,\ndrivers/bus/mhi/ep/main.c-904-\t\t\t\t u32 ch_idx)\ndrivers/bus/mhi/ep/main.c-905-{\ndrivers/bus/mhi/ep/main.c:906:\tstruct mhi_ep_ring_item *item;\ndrivers/bus/mhi/ep/main.c:907:\tstruct mhi_ep_ring *ring;\ndrivers/bus/mhi/ep/main.c-908-\tbool work = !!ch_int;\n--\ndrivers/bus/mhi/ep/main.c-940- */\ndrivers/bus/mhi/ep/main.c:941:static void mhi_ep_check_channel_interrupt(struct mhi_ep_cntrl *mhi_cntrl)\ndrivers/bus/mhi/ep/main.c-942-{\n--\ndrivers/bus/mhi/ep/main.c-945-\t/* Bail out if there is no channel doorbell interrupt */\ndrivers/bus/mhi/ep/main.c:946:\tif (!mhi_ep_mmio_read_chdb_status_interrupts(mhi_cntrl))\ndrivers/bus/mhi/ep/main.c-947-\t\treturn;\n--\ndrivers/bus/mhi/ep/main.c-954-\t\tif (ch_int) {\ndrivers/bus/mhi/ep/main.c:955:\t\t\tmhi_ep_queue_channel_db(mhi_cntrl, ch_int, ch_idx);\ndrivers/bus/mhi/ep/main.c:956:\t\t\tmhi_ep_mmio_write(mhi_cntrl, MHI_CHDB_INT_CLEAR_n(i),\ndrivers/bus/mhi/ep/main.c-957-\t\t\t\t\t\t\tmhi_cntrl-\u003echdb[i].status);\n--\ndrivers/bus/mhi/ep/main.c-961-\ndrivers/bus/mhi/ep/main.c:962:static void mhi_ep_process_ctrl_interrupt(struct mhi_ep_cntrl *mhi_cntrl,\ndrivers/bus/mhi/ep/main.c-963-\t\t\t\t\t enum mhi_state state)\ndrivers/bus/mhi/ep/main.c-964-{\ndrivers/bus/mhi/ep/main.c:965:\tstruct mhi_ep_state_transition *item;\ndrivers/bus/mhi/ep/main.c-966-\n--\ndrivers/bus/mhi/ep/main.c-983- */\ndrivers/bus/mhi/ep/main.c:984:static irqreturn_t mhi_ep_irq(int irq, void *data)\ndrivers/bus/mhi/ep/main.c-985-{\ndrivers/bus/mhi/ep/main.c:986:\tstruct mhi_ep_cntrl *mhi_cntrl = data;\ndrivers/bus/mhi/ep/main.c-987-\tstruct device *dev = \u0026mhi_cntrl-\u003emhi_dev-\u003edev;\n--\ndrivers/bus/mhi/ep/main.c-992-\t/* Acknowledge the ctrl interrupt */\ndrivers/bus/mhi/ep/main.c:993:\tint_value = mhi_ep_mmio_read(mhi_cntrl, MHI_CTRL_INT_STATUS);\ndrivers/bus/mhi/ep/main.c:994:\tmhi_ep_mmio_write(mhi_cntrl, MHI_CTRL_INT_CLEAR, int_value);\ndrivers/bus/mhi/ep/main.c-995-\n--\ndrivers/bus/mhi/ep/main.c-998-\t\tdev_dbg(dev, \"Processing ctrl interrupt\\n\");\ndrivers/bus/mhi/ep/main.c:999:\t\tmhi_ep_mmio_get_mhi_state(mhi_cntrl, \u0026state, \u0026mhi_reset);\ndrivers/bus/mhi/ep/main.c-1000-\t\tif (mhi_reset) {\n--\ndrivers/bus/mhi/ep/main.c-1006-\ndrivers/bus/mhi/ep/main.c:1007:\t\tmhi_ep_process_ctrl_interrupt(mhi_cntrl, state);\ndrivers/bus/mhi/ep/main.c-1008-\t}\n--\ndrivers/bus/mhi/ep/main.c-1016-\t/* Check for channel interrupts */\ndrivers/bus/mhi/ep/main.c:1017:\tmhi_ep_check_channel_interrupt(mhi_cntrl);\ndrivers/bus/mhi/ep/main.c-1018-\n--\ndrivers/bus/mhi/ep/main.c-1021-\ndrivers/bus/mhi/ep/main.c:1022:static void mhi_ep_abort_transfer(struct mhi_ep_cntrl *mhi_cntrl)\ndrivers/bus/mhi/ep/main.c-1023-{\ndrivers/bus/mhi/ep/main.c:1024:\tstruct mhi_ep_ring *ch_ring, *ev_ring;\ndrivers/bus/mhi/ep/main.c-1025-\tstruct mhi_result result = {};\ndrivers/bus/mhi/ep/main.c:1026:\tstruct mhi_ep_chan *mhi_chan;\ndrivers/bus/mhi/ep/main.c-1027-\tint i;\n--\ndrivers/bus/mhi/ep/main.c-1060-\t/* Destroy devices associated with all channels */\ndrivers/bus/mhi/ep/main.c:1061:\tdevice_for_each_child(\u0026mhi_cntrl-\u003emhi_dev-\u003edev, NULL, mhi_ep_destroy_device);\ndrivers/bus/mhi/ep/main.c-1062-\n--\ndrivers/bus/mhi/ep/main.c-1070-\t\tmutex_lock(\u0026mhi_chan-\u003elock);\ndrivers/bus/mhi/ep/main.c:1071:\t\tmhi_ep_ring_reset(mhi_cntrl, ch_ring);\ndrivers/bus/mhi/ep/main.c-1072-\t\tmutex_unlock(\u0026mhi_chan-\u003elock);\n--\ndrivers/bus/mhi/ep/main.c-1081-\t\tmutex_lock(\u0026mhi_cntrl-\u003eevent_lock);\ndrivers/bus/mhi/ep/main.c:1082:\t\tmhi_ep_ring_reset(mhi_cntrl, ev_ring);\ndrivers/bus/mhi/ep/main.c-1083-\t\tmutex_unlock(\u0026mhi_cntrl-\u003eevent_lock);\n--\ndrivers/bus/mhi/ep/main.c-1086-\t/* Stop and reset the command ring */\ndrivers/bus/mhi/ep/main.c:1087:\tmhi_ep_ring_reset(mhi_cntrl, \u0026mhi_cntrl-\u003emhi_cmd-\u003ering);\ndrivers/bus/mhi/ep/main.c-1088-\n\n"
} |
| 17/2 | 2026/09/18 22:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 34052 output: 22 thoughts: 32 Thoughts: Okay, here's my take on those thoughts, framed as my own: **Investigating the Role of `CONFIG_MHI_BUS_EP`** Alright, time to get to the bottom of this. I need to understand what `CONFIG_MHI_BUS_EP` is actually *doing*. My first instinct is always to see how it's being *used*. So, let's fire up a `grep` and search for instances of `mhi_ep_register_controller`. That function call, or something related to it, is a pretty good bet for showing me where this configuration option comes into play. It'll reveal the code paths that are conditional on this flag. From there, I can trace back and get a better picture of the whole picture. Let's see what we find! |
| 18/2 | 2026/09/18 23:00 | tool | grepper |
0mArgs:{
"Expression": "mhi_ep_register_controller"
}Results: {
"Output": "drivers/bus/mhi/ep/main.c=1406=static int mhi_ep_chan_init(struct mhi_ep_cntrl *mhi_cntrl,\n--\ndrivers/bus/mhi/ep/main.c-1462- */\ndrivers/bus/mhi/ep/main.c:1463:int mhi_ep_register_controller(struct mhi_ep_cntrl *mhi_cntrl,\ndrivers/bus/mhi/ep/main.c-1464-\t\t\t\tconst struct mhi_ep_cntrl_config *config)\n--\ndrivers/bus/mhi/ep/main.c-1588-}\ndrivers/bus/mhi/ep/main.c:1589:EXPORT_SYMBOL_GPL(mhi_ep_register_controller);\ndrivers/bus/mhi/ep/main.c-1590-\n--\ndrivers/pci/endpoint/functions/pci-epf-mhi.c=779=static int pci_epf_mhi_link_up(struct pci_epf *epf)\n--\ndrivers/pci/endpoint/functions/pci-epf-mhi.c-807-\t/* Register the MHI EP controller */\ndrivers/pci/endpoint/functions/pci-epf-mhi.c:808:\tret = mhi_ep_register_controller(mhi_cntrl, info-\u003econfig);\ndrivers/pci/endpoint/functions/pci-epf-mhi.c-809-\tif (ret) {\n--\ninclude/linux/mhi_ep.h=257=void mhi_ep_driver_unregister(struct mhi_ep_driver *mhi_drv);\n--\ninclude/linux/mhi_ep.h-259-/**\ninclude/linux/mhi_ep.h:260: * mhi_ep_register_controller - Register MHI Endpoint controller\ninclude/linux/mhi_ep.h-261- * @mhi_cntrl: MHI Endpoint controller to register\n--\ninclude/linux/mhi_ep.h-265- */\ninclude/linux/mhi_ep.h:266:int mhi_ep_register_controller(struct mhi_ep_cntrl *mhi_cntrl,\ninclude/linux/mhi_ep.h-267-\t\t\t const struct mhi_ep_cntrl_config *config);\n"
} |
| 19/2 | 2026/09/18 23:00 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 34890 output: 43 thoughts: 613 Thoughts: **My Assessment of the MHI Host Driver Patch** Okay, so this patch touches `pci-epf-mhi.c`, which makes me immediately think "device-side PCIe endpoint function." But then I see the changes are in `drivers/bus/mhi/host/` which is... confusing. This patch is modifying: `init.c`, `pci_generic.c`, `mhi_phc.c`, and `main.c` – all host-side MHI bus controller stuff. The big question is: can this host MHI code *actually* run without a real physical device present? Time to check the "WorthFuzzing" criteria. Specifically, Section 2 is important. The section indicates that if the code is unreachable hardware such as vendor-specific PCIe switches, or smartNICs it is not worth fuzzing. Now, am I looking at vendor-specific PCIe hardware drivers? The MHI PCI driver sounds like it might be. Let's see... the description for `MHI_BUS_PCI_GENERIC` says it's for devices *like* Qualcomm SDX55 based PCIe modems. Okay, that's getting closer. And `MHI_BUS_PHC` says it provides PTP clock and relies on the MHI PCI driver for timestamps. So, how does `mhi_phc` even *get* initialized? Ah, looking at `pci_generic.c`, there's `mhi_pci_status_cb`. This gets called when the MHI PCI controller enters "EE mission mode." Inside that callback, `mhi_phc_init` gets called. Now, when does `mhi_pci_probe` execute? Only when a physical PCI device that matches the `mhi_pci_id_table` is present. Alright, the critical check... does any virtual PCI device match the entries in `mhi_pci_id_table`? I need to go look at those IDs in `drivers/bus/mhi/host/pci_generic.c` to be sure. My initial gut feeling is that since it mentions Qualcomm SDX55 modems, it's likely a hardware-specific driver, so fuzzing might be a waste of time based on the "structurally unreachable hardware" criteria. But, I *need* to check those PCI IDs to be sure. |
| 20/2 | 2026/09/18 23:00 | tool | read-file |
0mArgs:{
"File": "drivers/bus/mhi/host/pci_generic.c",
"FirstLine": 950,
"LineCount": 80
}Results: {
"Contents": " 950:\t};\n 951:\t\n 952:\t/* Keep the list sorted based on the PID. New VID should be added as the last entry */\n 953:\tstatic const struct pci_device_id mhi_pci_id_table[] = {\n 954:\t\t{PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0116),\n 955:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_qcom_sa8775p_info },\n 956:\t\t/* Telit FN920C04 (sdx35) */\n 957:\t\t{PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x011a, 0x1c5d, 0x2020),\n 958:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_telit_fn920c04_info },\n 959:\t\t/* Telit FE910C04 (sdx35) */\n 960:\t\t{PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x011a, 0x1c5d, 0x202a),\n 961:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_telit_fe910c04_info },\n 962:\t\t/* Telit FE912C04 (sdx35) */\n 963:\t\t{ PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x011a, 0x1c5d, 0x2045),\n 964:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_telit_fe912c04_info },\n 965:\t\t{ PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x011a),\n 966:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_qcom_sdx35_info },\n 967:\t\t{ PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0304),\n 968:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_qcom_sdx24_info },\n 969:\t\t{ PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x0306, PCI_VENDOR_ID_QCOM, 0x010c),\n 970:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_foxconn_sdx55_info },\n 971:\t\t/* EM919x (sdx55), use the same vid:pid as qcom-sdx55m */\n 972:\t\t{ PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x0306, 0x18d7, 0x0200),\n 973:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_sierra_em919x_info },\n 974:\t\t/* EM929x (sdx65), use the same configuration as EM919x */\n 975:\t\t{ PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x0308, 0x18d7, 0x0301),\n 976:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_sierra_em919x_info },\n 977:\t\t/* Telit FN980 hardware revision v1 */\n 978:\t\t{ PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x0306, 0x1C5D, 0x2000),\n 979:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_telit_fn980_hw_v1_info },\n 980:\t\t{ PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0306),\n 981:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_qcom_sdx55_info },\n 982:\t\t/* Telit FN990 */\n 983:\t\t{ PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x0308, 0x1c5d, 0x2010),\n 984:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_telit_fn990_info },\n 985:\t\t/* Telit FE990A */\n 986:\t\t{ PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x0308, 0x1c5d, 0x2015),\n 987:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_telit_fe990a_info },\n 988:\t\t/* Foxconn T99W696, all variants */\n 989:\t\t{ PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x0308, PCI_VENDOR_ID_FOXCONN, PCI_ANY_ID),\n 990:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_foxconn_t99w696_info },\n 991:\t\t{ PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0308),\n 992:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_qcom_sdx65_info },\n 993:\t\t/* Telit FN990B40 (sdx72) */\n 994:\t\t{ PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x0309, 0x1c5d, 0x201a),\n 995:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_telit_fn990b40_info },\n 996:\t\t/* Telit FE990B40 (sdx72) */\n 997:\t\t{ PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x0309, 0x1c5d, 0x2025),\n 998:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_telit_fe990b40_info },\n 999:\t\t{ PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0309),\n1000:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_qcom_sdx75_info },\n1001:\t\t/* QDU100, x100-DU */\n1002:\t\t{ PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0601),\n1003:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_qcom_qdu100_info },\n1004:\t\t{ PCI_DEVICE(PCI_VENDOR_ID_QUECTEL, 0x1001), /* EM120R-GL (sdx24) */\n1005:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_quectel_em1xx_info },\n1006:\t\t{ PCI_DEVICE(PCI_VENDOR_ID_QUECTEL, 0x1002), /* EM160R-GL (sdx24) */\n1007:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_quectel_em1xx_info },\n1008:\t\t/* RM520N-GL (sdx6x), eSIM */\n1009:\t\t{ PCI_DEVICE(PCI_VENDOR_ID_QUECTEL, 0x1004),\n1010:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_quectel_rm5xx_info },\n1011:\t\t/* RM520N-GL (sdx6x), Lenovo variant */\n1012:\t\t{ PCI_DEVICE(PCI_VENDOR_ID_QUECTEL, 0x1007),\n1013:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_quectel_rm5xx_info },\n1014:\t\t{ PCI_DEVICE(PCI_VENDOR_ID_QUECTEL, 0x100d), /* EM160R-GL (sdx24) */\n1015:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_quectel_em1xx_info },\n1016:\t\t{ PCI_DEVICE(PCI_VENDOR_ID_QUECTEL, 0x2001), /* EM120R-GL for FCCL (sdx24) */\n1017:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_quectel_em1xx_info },\n1018:\t\t/* T99W175 (sdx55), Both for eSIM and Non-eSIM */\n1019:\t\t{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0ab),\n1020:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_foxconn_t99w175_info },\n1021:\t\t/* DW5930e (sdx55), With eSIM, It's also T99W175 */\n1022:\t\t{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0b0),\n1023:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_foxconn_dw5930e_info },\n1024:\t\t/* DW5930e (sdx55), Non-eSIM, It's also T99W175 */\n1025:\t\t{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0b1),\n1026:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_foxconn_dw5930e_info },\n1027:\t\t/* T99W175 (sdx55), Based on Qualcomm new baseline */\n1028:\t\t{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0bf),\n1029:\t\t\t.driver_data = (kernel_ulong_t) \u0026mhi_foxconn_t99w175_info },\n"
} |
| 21/2 | 2026/09/18 23:00 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 38689 output: 20 thoughts: 105 Thoughts: **My Assessment of MHI PCI Device Specificity** Okay, so looking at this `mhi_pci_id_table`, I'm seeing a list of PCI IDs that are pretty clearly tied to physical, Qualcomm-based modem cards. This is what I expected, given the context. We're talking about real hardware from the usual suspects: Qualcomm, Foxconn, Telit, Quectel, Fibocom, Dell, HP, Sierra Wireless, Lenovo, and so on. None of these IDs would suggest a virtual device or something emulated by QEMU. That's a good starting point. But, given my expertise, I always need to be thorough. I don't want to make assumptions. Just because they're not *in this table*, doesn't mean they don't exist somewhere. So, let's take a quick look around. I need to make sure there aren't any sneaky virtual MHI devices hiding elsewhere in the kernel tree. I'll search the `drivers/`, `sound/`, and `net/` directories, just to be safe. I'll be looking for any mentions of "mhi" in those areas, just in case something is lurking that might challenge my initial understanding. |
| 22/2 | 2026/09/18 23:00 | tool | grepper |
0mArgs:{
"Expression": "mhi_driver_register"
}Results: {
"Output": "Documentation/mhi/topology.rst=54=Below are the roles of the MHI driver:\nDocumentation/mhi/topology.rst-55-\nDocumentation/mhi/topology.rst:56:* Registers the driver with the MHI bus framework using mhi_driver_register.\nDocumentation/mhi/topology.rst-57-* Prepares the device for transfer by calling mhi_prepare_for_transfer.\n--\ndrivers/accel/qaic/qaic_debugfs.c=298=int qaic_bootlog_register(void)\ndrivers/accel/qaic/qaic_debugfs.c-299-{\ndrivers/accel/qaic/qaic_debugfs.c:300:\treturn mhi_driver_register(\u0026qaic_bootlog_mhi_driver);\ndrivers/accel/qaic/qaic_debugfs.c-301-}\n--\ndrivers/accel/qaic/qaic_drv.c=776=static int __init qaic_init(void)\n--\ndrivers/accel/qaic/qaic_drv.c-785-\ndrivers/accel/qaic/qaic_drv.c:786:\tret = mhi_driver_register(\u0026qaic_mhi_driver);\ndrivers/accel/qaic/qaic_drv.c-787-\tif (ret) {\ndrivers/accel/qaic/qaic_drv.c:788:\t\tpr_debug(\"qaic: mhi_driver_register failed %d\\n\", ret);\ndrivers/accel/qaic/qaic_drv.c-789-\t\tgoto free_pci;\n--\ndrivers/accel/qaic/qaic_ras.c=633=int qaic_ras_register(void)\ndrivers/accel/qaic/qaic_ras.c-634-{\ndrivers/accel/qaic/qaic_ras.c:635:\treturn mhi_driver_register(\u0026qaic_ras_mhi_driver);\ndrivers/accel/qaic/qaic_ras.c-636-}\n--\ndrivers/accel/qaic/qaic_ssr.c=807=int qaic_ssr_register(void)\ndrivers/accel/qaic/qaic_ssr.c-808-{\ndrivers/accel/qaic/qaic_ssr.c:809:\treturn mhi_driver_register(\u0026qaic_ssr_mhi_driver);\ndrivers/accel/qaic/qaic_ssr.c-810-}\n--\ndrivers/accel/qaic/qaic_timesync.c=388=int qaic_timesync_init(void)\n--\ndrivers/accel/qaic/qaic_timesync.c-391-\ndrivers/accel/qaic/qaic_timesync.c:392:\tret = mhi_driver_register(\u0026qaic_timesync_driver);\ndrivers/accel/qaic/qaic_timesync.c-393-\tif (ret)\ndrivers/accel/qaic/qaic_timesync.c-394-\t\treturn ret;\ndrivers/accel/qaic/qaic_timesync.c:395:\tret = mhi_driver_register(\u0026qaic_boot_timesync_driver);\ndrivers/accel/qaic/qaic_timesync.c-396-\n--\ndrivers/accel/qaic/sahara.c=926=int sahara_register(void)\ndrivers/accel/qaic/sahara.c-927-{\ndrivers/accel/qaic/sahara.c:928:\treturn mhi_driver_register(\u0026sahara_mhi_driver);\ndrivers/accel/qaic/sahara.c-929-}\n--\ndrivers/bus/mhi/host/init.c=1398=static void mhi_remove(struct device *dev)\n--\ndrivers/bus/mhi/host/init.c-1465-\ndrivers/bus/mhi/host/init.c:1466:int __mhi_driver_register(struct mhi_driver *mhi_drv, struct module *owner)\ndrivers/bus/mhi/host/init.c-1467-{\n--\ndrivers/bus/mhi/host/init.c-1477-}\ndrivers/bus/mhi/host/init.c:1478:EXPORT_SYMBOL_GPL(__mhi_driver_register);\ndrivers/bus/mhi/host/init.c-1479-\n--\ninclude/linux/mhi.h=575=void mhi_unregister_controller(struct mhi_controller *mhi_cntrl);\n--\ninclude/linux/mhi.h-578- * module_mhi_driver() - Helper macro for drivers that don't do\ninclude/linux/mhi.h:579: * anything special other than using default mhi_driver_register() and\ninclude/linux/mhi.h-580- * mhi_driver_unregister(). This eliminates a lot of boilerplate.\n--\ninclude/linux/mhi.h-583-#define module_mhi_driver(mhi_drv) \\\ninclude/linux/mhi.h:584:\tmodule_driver(mhi_drv, mhi_driver_register, \\\ninclude/linux/mhi.h-585-\t\t mhi_driver_unregister)\n--\ninclude/linux/mhi.h-589- */\ninclude/linux/mhi.h:590:#define mhi_driver_register(mhi_drv) \\\ninclude/linux/mhi.h:591:\t__mhi_driver_register(mhi_drv, THIS_MODULE)\ninclude/linux/mhi.h-592-\ninclude/linux/mhi.h-593-/**\ninclude/linux/mhi.h:594: * __mhi_driver_register - Register driver with MHI framework\ninclude/linux/mhi.h-595- * @mhi_drv: Driver associated with the device\n--\ninclude/linux/mhi.h-597- */\ninclude/linux/mhi.h:598:int __mhi_driver_register(struct mhi_driver *mhi_drv, struct module *owner);\ninclude/linux/mhi.h-599-\n"
} |
| 23/2 | 2026/09/18 23:00 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 40654 output: 128 thoughts: 1330 Thoughts: **Analysis of Fuzzing Worthiness for MHI Bus Host Stack Modifications** Okay, let's break this down systematically. I need to determine if fuzzing the changes made in this commit is worth the effort. My first step is to trace the affected code and understand its execution context. I'll start by examining the files: `net/qrtr/mhi.c`, `drivers/net/mhi_net.c`, `drivers/net/wwan/mhi_wwan_ctrl.c`, and `drivers/net/wwan/mhi_wwan_mbim.c`. I see these are all MHI client drivers, bound to `mhi_device`s that are, in turn, created by the MHI controller on the MHI bus. The next question is what creates the MHI controller? I see it's limited to `mhi_pci_generic` (Qualcomm PCIe modems), `qaic` (Qualcomm Cloud AI PCIe accelerator), and `ath11k_pci` / `ath12k_pci` (Qualcomm PCIe Wi-Fi chips). And, specifically, the `mhi_phc` is only used by `mhi_pci_generic` and during `mhi_init_tsc_timesync` when an MHI controller initializes. Now, the crucial question: can this hardware be reached in a standard virtualized environment like QEMU or GCE? The answer, unequivocally, is no. Qualcomm SDX modems, AI accelerators, and ath11k/ath12k Wi-Fi chips are all physical PCIe devices. They are not emulated by standard QEMU or GCE. The guidelines state, and I quote, "Structurally unreachable hardware: Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed, ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU." Let's review the specific criteria: Reachability is the primary gate. Fuzzing is only useful for code that *can* actually execute in standard virtualized environments. If code is structurally unreachable, it MUST NOT be fuzzed, regardless of additional logic. When deciding when to return `WorthFuzzing=false`, this modified code fits *precisely* into the "structurally unreachable hardware" category. Now, let's carefully review the *modified* files to confirm that all affected code falls into this category: 1. `drivers/bus/mhi/common.h`: MHI TSC Timesync header definitions 2. `drivers/bus/mhi/host/Kconfig`: Adds MHI_BUS_PHC. 3. `drivers/bus/mhi/host/Makefile`: Compiles mhi_phc.o 4. `drivers/bus/mhi/host/init.c`: Adds `mhi_find_capability` and `mhi_init_tsc_timesync`, and calls `mhi_init_tsc_timesync` in `mhi_init_mmio`. 5. `drivers/bus/mhi/host/internal.h`: structs and prototypes for MHI timesync and 64-bit reg read/write. 6. `drivers/bus/mhi/host/main.c`: implements `mhi_read_reg64` and `mhi_write_reg64` wrappers. 7. `drivers/bus/mhi/host/mhi_phc.c`: New driver implementing PTP hardware clock for MHI. 8. `drivers/bus/mhi/host/mhi_phc.h`: header for `mhi_phc_init`/`mhi_phc_exit`. 9. `drivers/bus/mhi/host/pci_generic.c`: adds 64-bit reg callbacks and calls `mhi_phc_init`/`mhi_phc_exit`. 10. `include/linux/mhi.h`: Adds fields to `struct mhi_controller`. Every single modified file and function belongs to the Modem Host Interface (MHI) bus host stack and, specifically, to the Qualcomm MHI PCI generic driver or the MHI PHC driver. There are no software-emulated devices or virtual bus alternatives for MHI in standard virtualized environments. The hardware consists of *physical* Qualcomm PCIe modems and PCI endpoint devices. Therefore, all the modified code is *structurally unreachable* without physical Qualcomm PCIe hardware. Therefore, the only correct outcome is that `WorthFuzzing` should be `false`. Now, let's make absolutely sure the `set-results` |
| 24/2 | 2026/09/18 23:00 | tool | set-results |
0mArgs:{
"EnableConfigs": [],
"FocusSymbols": [],
"Reasoning": "The patch introduces PTP Hardware Clock (PHC) support for Qualcomm Modem Host Interface (MHI) devices via the MHI PCI generic host driver (mhi_pci_generic). This code requires physical Qualcomm PCIe hardware (such as SDX55/SDX65 modems) that is not emulated in standard QEMU or GCE virtual environments. Because the modified code is structurally unreachable in standard fuzzing environments, it does not warrant fuzzing.",
"WorthFuzzing": false
}Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch introduces PTP Hardware Clock (PHC) support for Qualcomm Modem Host Interface (MHI) devices via the MHI PCI generic host driver (mhi_pci_generic). This code requires physical Qualcomm PCIe hardware (such as SDX55/SDX65 modems) that is not emulated in standard QEMU or GCE virtual environments. Because the modified code is structurally unreachable in standard fuzzing environments, it does not warrant fuzzing.",
"WorthFuzzing": false
} |
| 25/1 | 2026/09/18 23:00 | action | If |
0mArgs:{
"WorthFuzzing": false
}Results: null |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|