AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/10/16 00:47 flow patch-triage
1m Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "KMSANReasoning": "",
  "NeedsKMSAN": false,
  "Reasoning": "The patch introduces a debugfs file 'bt_reset' and the handler mt7921_bt_reset() to trigger a Bluetooth subsystem reset. The debugfs entry is explicitly created only when the underlying bus is MMIO (mt76_is_mmio()), which is exclusive to the mt7921e PCIe driver. Because standard virtualized fuzzing environments (QEMU/GCE) lack emulation for MediaTek MT7921 PCIe hardware, the modified code path is structurally unreachable.",
  "WorthFuzzing": false
}

1/1 2026/10/16 00:47 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit 7bc80f19e9788788fc05629caec5ef75aa8ae06c\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Fri Oct 16 00:47:03 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c\nindex 62bf33347e9e2..0f98900914aba 100644\n--- a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c\n+++ b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c\n@@ -247,6 +247,48 @@ static int mt7921_chip_reset(void *data, u64 val)\n \n DEFINE_DEBUGFS_ATTRIBUTE(fops_reset, NULL, mt7921_chip_reset, \"%lld\\n\");\n \n+static int mt7921_bt_reset(void *data, u64 val)\n+{\n+\tstruct mt792x_dev *dev = data;\n+\tint ret = 0;\n+\n+\tif (val != 1)\n+\t\treturn -EINVAL;\n+\n+\tif (!mt76_is_mmio(\u0026dev-\u003emt76))\n+\t\treturn -EOPNOTSUPP;\n+\n+\tmt792x_mutex_acquire(dev);\n+\tif (mt76_rr(dev, MT_HW_CHIPID) != 0x7961) {\n+\t\tret = -EOPNOTSUPP;\n+\t\tgoto out;\n+\t}\n+\n+\t/* Match the MT7961 sequence in btmtk_usb_subsys_reset(). PCIe can\n+\t * still reach these registers when Bluetooth's USB interface is wedged.\n+\t * A USB port reprobe may be needed afterwards to enumerate it again.\n+\t */\n+\tmt76_wr(dev, MT7921_BT_EP_RST_OPT, 0x00010001);\n+\tmt76_rr(dev, MT7921_BT_WDT_STATUS);\n+\tmt76_wr(dev, MT7921_BT_SUBSYS_RST, 1);\n+\tmt76_wr(dev, MT7921_BT_UDMA_INT_STA, 0xff);\n+\tmt76_rr(dev, MT7921_BT_UDMA_INT_STA);\n+\tmt76_wr(dev, MT7921_BT_UDMA_INT_STA1, 0xff);\n+\tmt76_rr(dev, MT7921_BT_UDMA_INT_STA1);\n+\tmsleep(20);\n+\tmt76_wr(dev, MT7921_BT_SUBSYS_RST, 0);\n+\tmt76_rr(dev, MT7921_BT_SUBSYS_RST);\n+\n+\tif (!mt76_poll_msec(dev, MT7921_BT_MISC,\n+\t\t\t    MT7921_BT_RST_DONE, MT7921_BT_RST_DONE, 1000))\n+\t\tret = -ETIMEDOUT;\n+out:\n+\tmt792x_mutex_release(dev);\n+\treturn ret;\n+}\n+\n+DEFINE_DEBUGFS_ATTRIBUTE(fops_bt_reset, NULL, mt7921_bt_reset, \"%lld\\n\");\n+\n static int\n mt7921s_sched_quota_read(struct seq_file *s, void *data)\n {\n@@ -284,6 +326,8 @@ int mt7921_init_debugfs(struct mt792x_dev *dev)\n \tdebugfs_create_file(\"idle-timeout\", 0600, dir, dev,\n \t\t\t    \u0026fops_pm_idle_timeout);\n \tdebugfs_create_file(\"chip_reset\", 0600, dir, dev, \u0026fops_reset);\n+\tif (mt76_is_mmio(\u0026dev-\u003emt76))\n+\t\tdebugfs_create_file(\"bt_reset\", 0200, dir, dev, \u0026fops_bt_reset);\n \tdebugfs_create_devm_seqfile(dev-\u003emt76.dev, \"runtime_pm_stats\", dir,\n \t\t\t\t    mt792x_pm_stats);\n \tdebugfs_create_file(\"deep-sleep\", 0600, dir, dev, \u0026fops_ds);\ndiff --git a/drivers/net/wireless/mediatek/mt76/mt792x_regs.h b/drivers/net/wireless/mediatek/mt76/mt792x_regs.h\nindex 3587f61e098a7..0e3650580e7d5 100644\n--- a/drivers/net/wireless/mediatek/mt76/mt792x_regs.h\n+++ b/drivers/net/wireless/mediatek/mt76/mt792x_regs.h\n@@ -421,6 +421,14 @@\n #define MT_CBTOP_RGU_WF_SUBSYS_RST\tMT_CBTOP_RGU(0x600)\n #define MT_CBTOP_RGU_WF_SUBSYS_RST_WF_WHOLE_PATH BIT(0)\n \n+#define MT7921_BT_MISC\t\t\t0x70002510\n+#define MT7921_BT_RST_DONE\t\tBIT(8)\n+#define MT7921_BT_SUBSYS_RST\t\t0x70002610\n+#define MT7921_BT_UDMA_INT_STA\t\t0x74000024\n+#define MT7921_BT_UDMA_INT_STA1\t\t0x74000308\n+#define MT7921_BT_WDT_STATUS\t\t0x740003a0\n+#define MT7921_BT_EP_RST_OPT\t\t0x74011890\n+\n #define MT7925_CBTOP_RGU_WF_SUBSYS_RST\t0x70028600\n #define MT7925_WFSYS_INIT_DONE_ADDR\t0x184c1604\n #define MT7925_WFSYS_INIT_DONE\t\t0x00001d1e\n"
}

2/1 2026/10/16 00:47 agent patch-evaluator
1m Model:
core

Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch introduces a debugfs file 'bt_reset' and the handler mt7921_bt_reset() to trigger a Bluetooth subsystem reset. The debugfs entry is explicitly created only when the underlying bus is MMIO (mt76_is_mmio()), which is exclusive to the mt7921e PCIe driver. Because standard virtualized fuzzing environments (QEMU/GCE) lack emulation for MediaTek MT7921 PCIe hardware, the modified code path is structurally unreachable.",
  "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 7bc80f19e9788788fc05629caec5ef75aa8ae06c
Author: syz-cluster <triage@syzkaller.com>
Date:   Fri Oct 16 00:47:03 2026 +0000

    syz-cluster: applied patch under review

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
index 62bf33347e9e2..0f98900914aba 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
@@ -247,6 +247,48 @@ static int mt7921_chip_reset(void *data, u64 val)
 
 DEFINE_DEBUGFS_ATTRIBUTE(fops_reset, NULL, mt7921_chip_reset, "%lld\n");
 
+static int mt7921_bt_reset(void *data, u64 val)
+{
+	struct mt792x_dev *dev = data;
+	int ret = 0;
+
+	if (val != 1)
+		return -EINVAL;
+
+	if (!mt76_is_mmio(&dev->mt76))
+		return -EOPNOTSUPP;
+
+	mt792x_mutex_acquire(dev);
+	if (mt76_rr(dev, MT_HW_CHIPID) != 0x7961) {
+		ret = -EOPNOTSUPP;
+		goto out;
+	}
+
+	/* Match the MT7961 sequence in btmtk_usb_subsys_reset(). PCIe can
+	 * still reach these registers when Bluetooth's USB interface is wedged.
+	 * A USB port reprobe may be needed afterwards to enumerate it again.
+	 */
+	mt76_wr(dev, MT7921_BT_EP_RST_OPT, 0x00010001);
+	mt76_rr(dev, MT7921_BT_WDT_STATUS);
+	mt76_wr(dev, MT7921_BT_SUBSYS_RST, 1);
+	mt76_wr(dev, MT7921_BT_UDMA_INT_STA, 0xff);
+	mt76_rr(dev, MT7921_BT_UDMA_INT_STA);
+	mt76_wr(dev, MT7921_BT_UDMA_INT_STA1, 0xff);
+	mt76_rr(dev, MT7921_BT_UDMA_INT_STA1);
+	msleep(20);
+	mt76_wr(dev, MT7921_BT_SUBSYS_RST, 0);
+	mt76_rr(dev, MT7921_BT_SUBSYS_RST);
+
+	if (!mt76_poll_msec(dev, MT7921_BT_MISC,
+			    MT7921_BT_RST_DONE, MT7921_BT_RST_DONE, 1000))
+		ret = -ETIMEDOUT;
+out:
+	mt792x_mutex_release(dev);
+	return ret;
+}
+
+DEFINE_DEBUGFS_ATTRIBUTE(fops_bt_reset, NULL, mt7921_bt_reset, "%lld\n");
+
 static int
 mt7921s_sched_quota_read(struct seq_file *s, void *data)
 {
@@ -284,6 +326,8 @@ int mt7921_init_debugfs(struct mt792x_dev *dev)
 	debugfs_create_file("idle-timeout", 0600, dir, dev,
 			    &fops_pm_idle_timeout);
 	debugfs_create_file("chip_reset", 0600, dir, dev, &fops_reset);
+	if (mt76_is_mmio(&dev->mt76))
+		debugfs_create_file("bt_reset", 0200, dir, dev, &fops_bt_reset);
 	debugfs_create_devm_seqfile(dev->mt76.dev, "runtime_pm_stats", dir,
 				    mt792x_pm_stats);
 	debugfs_create_file("deep-sleep", 0600, dir, dev, &fops_ds);
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_regs.h b/drivers/net/wireless/mediatek/mt76/mt792x_regs.h
index 3587f61e098a7..0e3650580e7d5 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x_regs.h
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_regs.h
@@ -421,6 +421,14 @@
 #define MT_CBTOP_RGU_WF_SUBSYS_RST	MT_CBTOP_RGU(0x600)
 #define MT_CBTOP_RGU_WF_SUBSYS_RST_WF_WHOLE_PATH BIT(0)
 
+#define MT7921_BT_MISC			0x70002510
+#define MT7921_BT_RST_DONE		BIT(8)
+#define MT7921_BT_SUBSYS_RST		0x70002610
+#define MT7921_BT_UDMA_INT_STA		0x74000024
+#define MT7921_BT_UDMA_INT_STA1		0x74000308
+#define MT7921_BT_WDT_STATUS		0x740003a0
+#define MT7921_BT_EP_RST_OPT		0x74011890
+
 #define MT7925_CBTOP_RGU_WF_SUBSYS_RST	0x70028600
 #define MT7925_WFSYS_INIT_DONE_ADDR	0x184c1604
 #define MT7925_WFSYS_INIT_DONE		0x00001d1e

3/2 2026/10/16 00:47 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 4418
							output: 22
							thoughts: 796
						

Thoughts:
**Fuzzing Evaluation: MT7921 Debugfs Entry**

Okay, I need to determine if this patch, adding a `bt_reset` debugfs entry to the MT7921 driver, is worth fuzzing with syzkaller. Let's break this down systematically.

First, I see the patch introduces `drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c` and a new `bt_reset` entry. Looking at the code, it's pretty straightforward: it seems to provide a way to reset some Bluetooth component associated with the MT7921. There are checks involved:  it validates the input `val` to ensure it's 1 and then has checks related to memory mapped IO.

Now, the crucial question: what *is* MT7921? Is this a physical chip, or something emulated? I need to know if I can reasonably test this within a standard QEMU environment. If it requires specialized hardware, that's an immediate red flag. I should quickly check the source tree itself, and if that is unfruitful, use grepper to see if it makes mention of PCI/SDIO/USB hardware or if it's emulated in QEMU.

I need to make sure this meets the negative criteria that would indicate the code is **not** worth fuzzing. I can ignore it if it is a case such as:
*   Non-kernel and non-executable changes
*   Structurally unreachable hardware
*   Unreachable execution paths

Wait a second, there is a `mt76_is_mmio` call! That is good. The `debugfs_create_file` call is guarded by this. And the code itself shows `if (mt76_is_mmio(&dev->mt76))`. This implies Memory Mapped I/O, which is what I should check.

So, *is* MT7921 PCIe only, or are there USB and SDIO variants? The code suggests the possibility of multiple interfaces, but I must verify that `mt76_is_mmio` encompasses all the types. Let's use grepper to investigate the `mt76_is_mmio` definition. That will tell me if I can access it in the standard QEMU environment. I need to understand whether this debugfs entry is tied specifically to PCIe, or if it's broader and potentially accessible through other interfaces. The function `mt76_is_mmio` will be the key to that answer.



4/2 2026/10/16 00:47 tool grepper
0m Args:
{
  "Expression": "mt76_is_mmio"
}

Results:
{
  "Output": "\nFull output is too long, showing 200 out of 263 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (22 files in total):\ndrivers/net/wireless/mediatek/mt76/debugfs.c:1\ndrivers/net/wireless/mediatek/mt76/mac80211.c:1\ndrivers/net/wireless/mediatek/mt76/mcu.c:1\ndrivers/net/wireless/mediatek/mt76/mt76.h:3\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c:5\ndrivers/net/wireless/mediatek/mt76/mt7615/main.c:1\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c:4\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c:3\ndrivers/net/wireless/mediatek/mt76/mt76x0/main.c:2\ndrivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h:1\ndrivers/net/wireless/mediatek/mt76/mt76x0/phy.c:3\ndrivers/net/wireless/mediatek/mt76/mt76x02_mcu.c:1\ndrivers/net/wireless/mediatek/mt76/mt76x02_util.c:1\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:3\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:1\ndrivers/net/wireless/mediatek/mt76/mt7921/mac.c:3\ndrivers/net/wireless/mediatek/mt76/mt7921/main.c:2\ndrivers/net/wireless/mediatek/mt76/mt7921/mcu.c:1\ndrivers/net/wireless/mediatek/mt76/mt7925/debugfs.c:1\ndrivers/net/wireless/mediatek/mt76/mt7925/init.c:1\ndrivers/net/wireless/mediatek/mt76/mt7925/mac.c:6\ndrivers/net/wireless/mediatek/mt76/mt7925/mcu.c:2\n\ndrivers/net/wireless/mediatek/mt76/debugfs.c=29=mt76_napi_threaded_set(void *data, u64 val)\n--\ndrivers/net/wireless/mediatek/mt76/debugfs.c-32-\ndrivers/net/wireless/mediatek/mt76/debugfs.c:33:\tif (!mt76_is_mmio(dev))\ndrivers/net/wireless/mediatek/mt76/debugfs.c-34-\t\treturn -EOPNOTSUPP;\n--\ndrivers/net/wireless/mediatek/mt76/mac80211.c=618=int mt76_create_page_pool(struct mt76_dev *dev, struct mt76_queue *q)\n--\ndrivers/net/wireless/mediatek/mt76/mac80211.c-645-\ndrivers/net/wireless/mediatek/mt76/mac80211.c:646:\tif (mt76_is_mmio(dev)) {\ndrivers/net/wireless/mediatek/mt76/mac80211.c-647-\t\t/* rely on page_pool for DMA mapping */\n--\ndrivers/net/wireless/mediatek/mt76/mcu.c=72=int mt76_mcu_skb_send_and_get_msg(struct mt76_dev *dev, struct sk_buff *skb,\n--\ndrivers/net/wireless/mediatek/mt76/mcu.c-85-\ndrivers/net/wireless/mediatek/mt76/mcu.c:86:\tif ((mt76_is_mmio(dev) \u0026\u0026 atomic_read(\u0026dev-\u003ebus_hung)) ||\ndrivers/net/wireless/mediatek/mt76/mcu.c-87-\t    (mt76_is_sdio(dev) \u0026\u0026 test_bit(MT76_RESET, \u0026dev-\u003ephy.state) \u0026\u0026\n--\ndrivers/net/wireless/mediatek/mt76/mt76.h=95=struct mt76_bus_ops {\n--\ndrivers/net/wireless/mediatek/mt76/mt76.h-110-#define mt76_is_usb(dev) ((dev)-\u003ebus-\u003etype == MT76_BUS_USB)\ndrivers/net/wireless/mediatek/mt76/mt76.h:111:#define mt76_is_mmio(dev) ((dev)-\u003ebus-\u003etype == MT76_BUS_MMIO)\ndrivers/net/wireless/mediatek/mt76/mt76.h-112-#define mt76_is_sdio(dev) ((dev)-\u003ebus-\u003etype == MT76_BUS_SDIO)\n--\ndrivers/net/wireless/mediatek/mt76/mt76.h=1761=static inline bool mt76_npu_device_active(struct mt76_dev *dev)\ndrivers/net/wireless/mediatek/mt76/mt76.h-1762-{\ndrivers/net/wireless/mediatek/mt76/mt76.h:1763:\treturn mt76_is_mmio(dev) \u0026\u0026 !!rcu_access_pointer(dev-\u003emmio.npu);\ndrivers/net/wireless/mediatek/mt76/mt76.h-1764-}\n--\ndrivers/net/wireless/mediatek/mt76/mt76.h=1766=static inline bool mt76_ppe_device_active(struct mt76_dev *dev)\ndrivers/net/wireless/mediatek/mt76/mt76.h-1767-{\ndrivers/net/wireless/mediatek/mt76/mt76.h:1768:\treturn mt76_is_mmio(dev) \u0026\u0026 !!rcu_access_pointer(dev-\u003emmio.ppe_dev);\ndrivers/net/wireless/mediatek/mt76/mt76.h-1769-}\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c=330=static int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb)\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c-389-\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c:390:\tif (mt76_is_mmio(\u0026dev-\u003emt76) \u0026\u0026 (rxd0 \u0026 csum_mask) == csum_mask \u0026\u0026\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c-391-\t    !(csum_status \u0026 (BIT(0) | BIT(2) | BIT(3))))\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c=709=int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c-721-\tstruct ieee80211_vif *vif = info-\u003econtrol.vif;\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c:722:\tbool is_mmio = mt76_is_mmio(\u0026dev-\u003emt76);\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c-723-\tu32 val, sz_txd = is_mmio ? MT_TXD_SIZE : MT_USB_TXD_SIZE;\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c=1094=void mt7615_mac_set_rates(struct mt7615_phy *phy, struct mt7615_sta *sta,\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c-1103-\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c:1104:\tif (!mt76_is_mmio(\u0026dev-\u003emt76)) {\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c-1105-\t\tmt7615_mac_queue_rate_update(phy, sta, probe_rate, rates);\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c=1593=bool mt7615_rx_check(struct mt76_dev *mdev, void *data, int len)\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c-1603-\tcase PKT_TYPE_TXRX_NOTIFY:\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c:1604:\t\tif (!mt76_is_mmio(mdev))\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c-1605-\t\t\treturn false;\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c=1618=void mt7615_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c-1638-\tcase PKT_TYPE_TXRX_NOTIFY:\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c:1639:\t\tif (!mt76_is_mmio(mdev)) {\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c-1640-\t\t\tdev_kfree_skb(skb);\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/main.c=337=static int mt7615_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/main.c-394-\tmt76_wcid_key_setup(\u0026dev-\u003emt76, wcid, key);\ndrivers/net/wireless/mediatek/mt76/mt7615/main.c:395:\tif (mt76_is_mmio(\u0026dev-\u003emt76))\ndrivers/net/wireless/mediatek/mt76/mt7615/main.c-396-\t\terr = mt7615_mac_wtbl_set_key(dev, wcid, key);\n--\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c=410=mt76_connac2_mac_write_txwi_80211(struct mt76_dev *dev, __le32 *txwi,\n--\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c-492-\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c:493:\tif (mt76_is_mmio(dev)) {\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c-494-\t\tval = FIELD_PREP(MT_TXD7_TYPE, fc_type) |\n--\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c=504=void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,\n--\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c-513-\tu8 p_fmt, q_idx, omac_idx = 0, wmm_idx = 0, band_idx = 0;\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c:514:\tu32 val, sz_txd = mt76_is_mmio(dev) ? MT_TXD_SIZE : MT_SDIO_TXD_SIZE;\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c-515-\tbool is_8023 = info-\u003eflags \u0026 IEEE80211_TX_CTL_HW_80211_ENCAP;\n--\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c-539-\t} else if (qid \u003e= MT_TXQ_PSD) {\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c:540:\t\tp_fmt = mt76_is_mmio(dev) ? MT_TX_TYPE_CT : MT_TX_TYPE_SF;\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c-541-\t\tq_idx = MT_LMAC_ALTX0;\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c-542-\t} else {\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c:543:\t\tp_fmt = mt76_is_mmio(dev) ? MT_TX_TYPE_CT : MT_TX_TYPE_SF;\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c-544-\t\tq_idx = wmm_idx * MT76_CONNAC_MAX_WMM_SETS +\n--\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c=1324=int mt76_connac_mcu_sta_wed_update(struct mt76_dev *dev, struct sk_buff *skb)\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c-1325-{\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c:1326:\tif (!mt76_is_mmio(dev))\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c-1327-\t\treturn 0;\n--\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c=2617=mt76_connac_mcu_set_wow_ctrl(struct mt76_phy *phy, struct ieee80211_vif *vif,\n--\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c-2657-\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c:2658:\tif (mt76_is_mmio(dev))\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c-2659-\t\treq.wow_ctrl_tlv.wakeup_hif = WOW_PCIE;\n--\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c=2670=int mt76_connac_mcu_set_hif_suspend(struct mt76_dev *dev, bool suspend, bool wait_resp)\n--\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c-2693-\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c:2694:\tif (mt76_is_mmio(dev))\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c-2695-\t\treq.hdr.hif_type = 2;\n--\ndrivers/net/wireless/mediatek/mt76/mt76x0/main.c=11=int mt76x0_set_channel(struct mt76_phy *mphy)\n--\ndrivers/net/wireless/mediatek/mt76/mt76x0/main.c-15-\tmt76x02_pre_tbtt_enable(dev, false);\ndrivers/net/wireless/mediatek/mt76/mt76x0/main.c:16:\tif (mt76_is_mmio(\u0026dev-\u003emt76))\ndrivers/net/wireless/mediatek/mt76/mt76x0/main.c-17-\t\ttasklet_disable(\u0026dev-\u003edfs_pd.dfs_tasklet);\n--\ndrivers/net/wireless/mediatek/mt76/mt76x0/main.c-23-\ndrivers/net/wireless/mediatek/mt76/mt76x0/main.c:24:\tif (mt76_is_mmio(\u0026dev-\u003emt76)) {\ndrivers/net/wireless/mediatek/mt76/mt76x0/main.c-25-\t\tmt76x02_dfs_init_params(dev);\n--\ndrivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h=31=static inline bool is_mt7610e(struct mt76x02_dev *dev)\ndrivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h-32-{\ndrivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h:33:\tif (!mt76_is_mmio(\u0026dev-\u003emt76))\ndrivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h-34-\t\treturn false;\n--\ndrivers/net/wireless/mediatek/mt76/mt76x0/phy.c=168=mt76x0_phy_rf_csr_wr_rp(struct mt76x02_dev *dev,\n--\ndrivers/net/wireless/mediatek/mt76/mt76x0/phy.c-178-#define RF_RANDOM_WRITE(dev, tab) do {\t\t\t\t\t\\\ndrivers/net/wireless/mediatek/mt76/mt76x0/phy.c:179:\tif (mt76_is_mmio(\u0026dev-\u003emt76))\t\t\t\t\t\\\ndrivers/net/wireless/mediatek/mt76/mt76x0/phy.c-180-\t\tmt76x0_phy_rf_csr_wr_rp(dev, tab, ARRAY_SIZE(tab));\t\\\n--\ndrivers/net/wireless/mediatek/mt76/mt76x0/phy.c=697=mt76x0_phy_get_delta_power(struct mt76x02_dev *dev, u8 tx_mode,\n--\ndrivers/net/wireless/mediatek/mt76/mt76x0/phy.c-748-\t\tdata = mt76_rr(dev, MT_BBP(CORE, 1));\ndrivers/net/wireless/mediatek/mt76/mt76x0/phy.c:749:\t\tif (is_mt7630(dev) \u0026\u0026 mt76_is_mmio(\u0026dev-\u003emt76)) {\ndrivers/net/wireless/mediatek/mt76/mt76x0/phy.c-750-\t\t\tint offset;\n--\ndrivers/net/wireless/mediatek/mt76/mt76x0/phy.c=1116=static void mt76x0_rf_patch_reg_array(struct mt76x02_dev *dev,\n--\ndrivers/net/wireless/mediatek/mt76/mt76x0/phy.c-1126-\t\tcase MT_RF(0, 3):\ndrivers/net/wireless/mediatek/mt76/mt76x0/phy.c:1127:\t\t\tif (mt76_is_mmio(\u0026dev-\u003emt76)) {\ndrivers/net/wireless/mediatek/mt76/mt76x0/phy.c-1128-\t\t\t\tif (is_mt7630(dev))\n--\ndrivers/net/wireless/mediatek/mt76/mt76x02_mcu.c=117=int mt76x02_mcu_calibrate(struct mt76x02_dev *dev, int type, u32 param)\n--\ndrivers/net/wireless/mediatek/mt76/mt76x02_mcu.c-125-\t};\ndrivers/net/wireless/mediatek/mt76/mt76x02_mcu.c:126:\tbool is_mt76x2e = mt76_is_mmio(\u0026dev-\u003emt76) \u0026\u0026 is_mt76x2(dev);\ndrivers/net/wireless/mediatek/mt76/mt76x02_mcu.c-127-\tint ret;\n--\ndrivers/net/wireless/mediatek/mt76/mt76x02_util.c=622=void mt76x02_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta,\n--\ndrivers/net/wireless/mediatek/mt76/mt76x02_util.c-629-\tmt76_stop_tx_queues(\u0026dev-\u003emphy, sta, true);\ndrivers/net/wireless/mediatek/mt76/mt76x02_util.c:630:\tif (mt76_is_mmio(mdev))\ndrivers/net/wireless/mediatek/mt76/mt76x02_util.c-631-\t\tmt76x02_mac_wcid_set_drop(dev, idx, ps);\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c=250=static int mt7921_bt_reset(void *data, u64 val)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-257-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:258:\tif (!mt76_is_mmio(\u0026dev-\u003emt76))\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-259-\t\treturn -EOPNOTSUPP;\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c=306=int mt7921_init_debugfs(struct mt792x_dev *dev)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-311-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:312:\tif (mt76_is_mmio(\u0026dev-\u003emt76))\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-313-\t\tdebugfs_create_devm_seqfile(dev-\u003emt76.dev, \"xmit-queues\",\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-328-\tdebugfs_create_file(\"chip_reset\", 0600, dir, dev, \u0026fops_reset);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:329:\tif (mt76_is_mmio(\u0026dev-\u003emt76))\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-330-\t\tdebugfs_create_file(\"bt_reset\", 0200, dir, dev, \u0026fops_bt_reset);\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c=170=int mt7921_register_device(struct mt792x_dev *dev)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-217-\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:218:\tif (!mt76_is_mmio(\u0026dev-\u003emt76))\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-219-\t\thw-\u003eextra_tx_headroom += MT_SDIO_TXD_SIZE + MT_SDIO_HDR_SIZE;\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/mac.c=169=mt7921_mac_fill_rx(struct mt792x_dev *dev, struct sk_buff *skb)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/mac.c-239-\ndrivers/net/wireless/mediatek/mt76/mt7921/mac.c:240:\tif (mt76_is_mmio(\u0026dev-\u003emt76) \u0026\u0026 (rxd0 \u0026 csum_mask) == csum_mask \u0026\u0026\ndrivers/net/wireless/mediatek/mt76/mt7921/mac.c-241-\t    !(csum_status \u0026 (BIT(0) | BIT(2) | BIT(3))))\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/mac.c=553=bool mt7921_rx_check(struct mt76_dev *mdev, void *data, int len)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/mac.c-563-\tcase PKT_TYPE_TXRX_NOTIFY:\ndrivers/net/wireless/mediatek/mt76/mt7921/mac.c:564:\t\tif (!mt76_is_mmio(mdev))\ndrivers/net/wireless/mediatek/mt76/mt7921/mac.c-565-\t\t\treturn false;\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/mac.c=578=void mt7921_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/mac.c-594-\tcase PKT_TYPE_TXRX_NOTIFY:\ndrivers/net/wireless/mediatek/mt76/mt7921/mac.c:595:\t\tif (!mt76_is_mmio(mdev)) {\ndrivers/net/wireless/mediatek/mt76/mt7921/mac.c-596-\t\t\tnapi_consume_skb(skb, 1);\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/main.c=227=int __mt7921_start(struct mt792x_phy *phy)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/main.c-252-\t\t\t\t     MT792x_WATCHDOG_TIME);\ndrivers/net/wireless/mediatek/mt76/mt7921/main.c:253:\tif (mt76_is_mmio(mphy-\u003edev)) {\ndrivers/net/wireless/mediatek/mt76/mt7921/main.c-254-\t\terr = mt7921_mcu_radio_led_ctrl(phy-\u003edev, EXT_CMD_RADIO_LED_CTRL_ENABLE);\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/main.c=284=static void mt7921_stop(struct ieee80211_hw *hw, bool suspend)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/main.c-288-\n\n"
}

5/2 2026/10/16 00:47 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 12997
							output: 24
							thoughts: 40
						

Thoughts:
Okay, let's dive into this. Here's my thought process on the matter:

**Analyzing the mt7921_init_debugfs Function Call**

Alright, I'm going to start by getting a handle on this `mt7921_init_debugfs` function. My first question is, which drivers are actually *using* it? I need to understand the scope and context before I can dive deeper. Let's get a list of the callers. With that information, I'll move on to tracing the function's call sites within the codebase. I need to pinpoint the exact locations where `mt7921_init_debugfs` is invoked. Understanding where and when this function gets called will paint a clearer picture of its purpose and impact. I'm looking for the essential pieces of information to determine the function's influence within the system.



6/2 2026/10/16 00:47 tool grepper
0m Args:
{
  "Expression": "mt7921_init_debugfs"
}

Results:
{
  "Output": "drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c=293=mt7921s_sched_quota_read(struct seq_file *s, void *data)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-305-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:306:int mt7921_init_debugfs(struct mt792x_dev *dev)\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-307-{\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c=131=static void mt7921_init_work(struct work_struct *work)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-151-\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:152:\tret = mt7921_init_debugfs(dev);\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-153-\tif (ret) {\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/mt7921.h=286=void mt7921_set_stream_he_caps(struct mt792x_phy *phy);\ndrivers/net/wireless/mediatek/mt76/mt7921/mt7921.h:287:int mt7921_init_debugfs(struct mt792x_dev *dev);\ndrivers/net/wireless/mediatek/mt76/mt7921/mt7921.h-288-\n"
}

7/2 2026/10/16 00:47 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 13730
							output: 36
							thoughts: 41
						

Thoughts:
Okay, let's dive into this. Here's how I'd approach this task, walking through my thought process:

**Investigating MT7921 Bus Support**

Alright, I'm starting a little investigation into the MT7921 wireless chipset. My initial goal is to figure out what bus interfaces this particular driver supports. Knowing the supported bus(es) is foundational; it helps determine the hardware interaction pathways and where to look for deeper configuration options.

First, I need to understand the architectural overview for how the driver operates. To kickstart the analysis, I will look at the source tree that houses this driver. Given the path `drivers/net/wireless/mediatek/mt76/mt7921/`, I'll start by listing the contents of that directory. This will reveal the file structure, headers, and likely the key source files. By examining the files within, especially those related to bus initialization or device probing, I'll identify the supported bus types (e.g., PCI, SDIO, USB). Once I have a better understanding of supported interfaces, I can examine the relevant bus initialization routines to understand their specific logic and how the driver adapts to each bus.



8/2 2026/10/16 00:47 tool codesearch-dir-index
0m Args:
{
  "Dir": "drivers/net/wireless/mediatek/mt76/mt7921"
}

Results:
{
  "Files": [
    "debugfs.c",
    "init.c",
    "mac.c",
    "main.c",
    "mcu.c",
    "mcu.h",
    "mt7921.h",
    "pci.c",
    "pci_mac.c",
    "pci_mcu.c",
    "regd.c",
    "regd.h",
    "regs.h",
    "sdio.c",
    "sdio_mac.c",
    "sdio_mcu.c",
    "testmode.c",
    "usb.c"
  ],
  "Subdirs": null
}

9/2 2026/10/16 00:47 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 14208
							output: 62
							thoughts: 273
						

Thoughts:
**Investigating the `bt_reset` Function**

Okay, so I'm looking at these driver files: `debugfs.c`, `pci.c`, `sdio.c`, and `usb.c`. Let's dig into this `bt_reset` function; it looks interesting. Specifically, it seems to be in a very specific spot.

Looking at `mt7921_bt_reset`... the code checks for `val != 1` and, crucially, uses `mt76_is_mmio(&dev->mt76)`. Interesting! If that condition isn't met, it bails out with `-EOPNOTSUPP`. That's the crux.

Then, there's a debugfs file called "bt_reset" that gets created if the same condition, `mt76_is_mmio(&dev->mt76)`, is true. So, this debugfs entry is tied directly to the `mmio` condition.

Wait a second... what *bus* is `mt76_is_mmio` referring to? Is it PCI, USB, or SDIO? I need to figure out how `dev->mt76` is set up.

Okay, time to check where `mt76_is_mmio` is being evaluated in the drivers. I'll need to go through `pci.c`, `usb.c`, and `sdio.c` to see how the `dev->bus->type` is being set. It's time to zero in on `pci.c` and see if the bus type is set there.



10/2 2026/10/16 00:47 tool grepper
0m Args:
{
  "Expression": "MT76_BUS_",
  "PathPrefixes": [
    "drivers/net/wireless/mediatek/mt76/mt7921/",
    "drivers/net/wireless/mediatek/mt76/"
  ]
}

Results:
{
  "Output": "drivers/net/wireless/mediatek/mt76/mmio.c=110=void mt76_mmio_init(struct mt76_dev *dev, void __iomem *regs)\n--\ndrivers/net/wireless/mediatek/mt76/mmio.c-119-\t\t.rd_rp = mt76_mmio_rd_rp,\ndrivers/net/wireless/mediatek/mt76/mmio.c:120:\t\t.type = MT76_BUS_MMIO,\ndrivers/net/wireless/mediatek/mt76/mmio.c-121-\t};\n--\ndrivers/net/wireless/mediatek/mt76/mt76.h=73=enum mt76_bus_type {\ndrivers/net/wireless/mediatek/mt76/mt76.h:74:\tMT76_BUS_MMIO,\ndrivers/net/wireless/mediatek/mt76/mt76.h:75:\tMT76_BUS_USB,\ndrivers/net/wireless/mediatek/mt76/mt76.h:76:\tMT76_BUS_SDIO,\ndrivers/net/wireless/mediatek/mt76/mt76.h-77-};\n--\ndrivers/net/wireless/mediatek/mt76/mt76.h=95=struct mt76_bus_ops {\n--\ndrivers/net/wireless/mediatek/mt76/mt76.h-109-\ndrivers/net/wireless/mediatek/mt76/mt76.h:110:#define mt76_is_usb(dev) ((dev)-\u003ebus-\u003etype == MT76_BUS_USB)\ndrivers/net/wireless/mediatek/mt76/mt76.h:111:#define mt76_is_mmio(dev) ((dev)-\u003ebus-\u003etype == MT76_BUS_MMIO)\ndrivers/net/wireless/mediatek/mt76/mt76.h:112:#define mt76_is_sdio(dev) ((dev)-\u003ebus-\u003etype == MT76_BUS_SDIO)\ndrivers/net/wireless/mediatek/mt76/mt76.h-113-\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/sdio.c=76=static int mt7663s_probe(struct sdio_func *func,\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/sdio.c-99-\t\t.rd_rp = mt76s_rd_rp,\ndrivers/net/wireless/mediatek/mt76/mt7615/sdio.c:100:\t\t.type = MT76_BUS_SDIO,\ndrivers/net/wireless/mediatek/mt76/mt7615/sdio.c-101-\t};\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/usb.c=119=static int mt7663u_probe(struct usb_interface *usb_intf,\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/usb.c-140-\t\t.write_copy = mt7663u_copy,\ndrivers/net/wireless/mediatek/mt76/mt7615/usb.c:141:\t\t.type = MT76_BUS_USB,\ndrivers/net/wireless/mediatek/mt76/mt7615/usb.c-142-\t};\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c=626=static const struct mt76_bus_ops mt7921_aer_bus_hung_ops = {\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c-629-\t.rmw = mt791_aer_rmw,\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c:630:\t.type = MT76_BUS_MMIO\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c-631-};\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/sdio.c=90=static int mt7921s_probe(struct sdio_func *func,\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/sdio.c-117-\t\t.rd_rp = mt76s_rd_rp,\ndrivers/net/wireless/mediatek/mt76/mt7921/sdio.c:118:\t\t.type = MT76_BUS_SDIO,\ndrivers/net/wireless/mediatek/mt76/mt7921/sdio.c-119-\t};\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c=150=static int mt7921u_probe(struct usb_interface *usb_intf,\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c-181-\t\t.write_copy = mt792xu_copy,\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c:182:\t\t.type = MT76_BUS_USB,\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c-183-\t};\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c=159=static int mt7925u_probe(struct usb_interface *usb_intf,\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c-189-\t\t.write_copy = mt792xu_copy,\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c:190:\t\t.type = MT76_BUS_USB,\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c-191-\t};\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_usb.c=74=static const struct mt76_bus_ops mt792xu_bus_hung_ops = {\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_usb.c-79-\t.read_copy = mt792xu_bus_hung_read_copy,\ndrivers/net/wireless/mediatek/mt76/mt792x_usb.c:80:\t.type = MT76_BUS_USB,\ndrivers/net/wireless/mediatek/mt76/mt792x_usb.c-81-};\n--\ndrivers/net/wireless/mediatek/mt76/usb.c=1210=int mt76u_init(struct mt76_dev *dev, struct usb_interface *intf)\n--\ndrivers/net/wireless/mediatek/mt76/usb.c-1219-\t\t.rd_rp = mt76u_rd_rp,\ndrivers/net/wireless/mediatek/mt76/usb.c:1220:\t\t.type = MT76_BUS_USB,\ndrivers/net/wireless/mediatek/mt76/usb.c-1221-\t};\n"
}

11/2 2026/10/16 00:47 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 16775
							output: 22
							thoughts: 74
						

Thoughts:
Here's my thought process, as if I were analyzing this code:

**Deep Dive into `mt76_is_mmio`**

Okay, so the code's pointing me at `mt76_is_mmio`. Let's clarify its behavior, as a quick check reveals that this function is only ever true when the bus type is `MT76_BUS_MMIO`. That seems straightforward enough, but where does the definition of `MT76_BUS_MMIO` originate? Aha, it looks like it gets initialized through the `mt76_mmio_init` function.

Now, if I really want to understand the initialization and potential side effects of this flag, I need to understand where `mt76_mmio_init` gets called. Let's see who's calling *that* function and determine the critical path of how this is all set up. Understanding those callers will give me the context I need to really gauge the meaning of `mt76_is_mmio` within this driver. Time to dig in!



12/2 2026/10/16 00:47 tool grepper
0m Args:
{
  "Expression": "mt76_mmio_init"
}

Results:
{
  "Output": "drivers/net/wireless/mediatek/mt76/mmio.c=108=EXPORT_SYMBOL_GPL(mt76_set_irq_mask);\ndrivers/net/wireless/mediatek/mt76/mmio.c-109-\ndrivers/net/wireless/mediatek/mt76/mmio.c:110:void mt76_mmio_init(struct mt76_dev *dev, void __iomem *regs)\ndrivers/net/wireless/mediatek/mt76/mmio.c-111-{\n--\ndrivers/net/wireless/mediatek/mt76/mmio.c-127-}\ndrivers/net/wireless/mediatek/mt76/mmio.c:128:EXPORT_SYMBOL_GPL(mt76_mmio_init);\n--\ndrivers/net/wireless/mediatek/mt76/mt76.h=1228=bool ____mt76_poll_msec(struct mt76_dev *dev, u32 offset, u32 mask, u32 val,\n--\ndrivers/net/wireless/mediatek/mt76/mt76.h-1233-\ndrivers/net/wireless/mediatek/mt76/mt76.h:1234:void mt76_mmio_init(struct mt76_dev *dev, void __iomem *regs);\ndrivers/net/wireless/mediatek/mt76/mt76.h-1235-void mt76_pci_disable_aspm(struct pci_dev *pdev);\n--\ndrivers/net/wireless/mediatek/mt76/mt7603/pci.c=15=mt76pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)\n--\ndrivers/net/wireless/mediatek/mt76/mt7603/pci.c-40-\tdev = container_of(mdev, struct mt7603_dev, mt76);\ndrivers/net/wireless/mediatek/mt76/mt7603/pci.c:41:\tmt76_mmio_init(mdev, pcim_iomap_table(pdev)[0]);\ndrivers/net/wireless/mediatek/mt76/mt7603/pci.c-42-\n--\ndrivers/net/wireless/mediatek/mt76/mt7603/soc.c=10=mt76_wmac_probe(struct platform_device *pdev)\n--\ndrivers/net/wireless/mediatek/mt76/mt7603/soc.c-31-\tdev = container_of(mdev, struct mt7603_dev, mt76);\ndrivers/net/wireless/mediatek/mt76/mt7603/soc.c:32:\tmt76_mmio_init(mdev, mem_base);\ndrivers/net/wireless/mediatek/mt76/mt7603/soc.c-33-\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/mmio.c=166=int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base,\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/mmio.c-201-\tdev = container_of(mdev, struct mt7615_dev, mt76);\ndrivers/net/wireless/mediatek/mt76/mt7615/mmio.c:202:\tmt76_mmio_init(\u0026dev-\u003emt76, mem_base);\ndrivers/net/wireless/mediatek/mt76/mt7615/mmio.c-203-\ttasklet_setup(\u0026mdev-\u003eirq_tasklet, mt7615_irq_tasklet);\n--\ndrivers/net/wireless/mediatek/mt76/mt76x0/pci.c=154=mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id)\n--\ndrivers/net/wireless/mediatek/mt76/mt76x0/pci.c-199-\ndrivers/net/wireless/mediatek/mt76/mt76x0/pci.c:200:\tmt76_mmio_init(mdev, pcim_iomap_table(pdev)[0]);\ndrivers/net/wireless/mediatek/mt76/mt76x0/pci.c-201-\n--\ndrivers/net/wireless/mediatek/mt76/mt76x2/pci.c=20=mt76x2e_probe(struct pci_dev *pdev, const struct pci_device_id *id)\n--\ndrivers/net/wireless/mediatek/mt76/mt76x2/pci.c-61-\tdev = container_of(mdev, struct mt76x02_dev, mt76);\ndrivers/net/wireless/mediatek/mt76/mt76x2/pci.c:62:\tmt76_mmio_init(mdev, pcim_iomap_table(pdev)[0]);\ndrivers/net/wireless/mediatek/mt76/mt76x2/pci.c-63-\tmt76x2_reset_wlan(dev, false);\n--\ndrivers/net/wireless/mediatek/mt76/mt7915/mmio.c=740=static int mt7915_mmio_init(struct mt76_dev *mdev,\n--\ndrivers/net/wireless/mediatek/mt76/mt7915/mmio.c-747-\tdev = container_of(mdev, struct mt7915_dev, mt76);\ndrivers/net/wireless/mediatek/mt76/mt7915/mmio.c:748:\tmt76_mmio_init(\u0026dev-\u003emt76, mem_base);\ndrivers/net/wireless/mediatek/mt76/mt7915/mmio.c-749-\tspin_lock_init(\u0026dev-\u003ereg_lock);\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c=259=static int mt7921_pci_probe(struct pci_dev *pdev,\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c-363-\tdev-\u003eirq_map = \u0026irq_map;\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c:364:\tmt76_mmio_init(\u0026dev-\u003emt76, regs);\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c-365-\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/pci.c=587=static int mt7925_pci_probe(struct pci_dev *pdev,\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/pci.c-689-\ndrivers/net/wireless/mediatek/mt76/mt7925/pci.c:690:\tmt76_mmio_init(\u0026dev-\u003emt76, pcim_iomap_table(pdev)[0]);\ndrivers/net/wireless/mediatek/mt76/mt7925/pci.c-691-\ttasklet_init(\u0026mdev-\u003eirq_tasklet, mt792x_irq_tasklet, (unsigned long)dev);\n--\ndrivers/net/wireless/mediatek/mt76/mt7996/mmio.c=643=static int mt7996_mmio_init(struct mt76_dev *mdev,\n--\ndrivers/net/wireless/mediatek/mt76/mt7996/mmio.c-650-\tdev = container_of(mdev, struct mt7996_dev, mt76);\ndrivers/net/wireless/mediatek/mt76/mt7996/mmio.c:651:\tmt76_mmio_init(\u0026dev-\u003emt76, mem_base);\ndrivers/net/wireless/mediatek/mt76/mt7996/mmio.c-652-\tspin_lock_init(\u0026dev-\u003ereg_lock);\n"
}

13/2 2026/10/16 00:47 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 19247
							output: 45
							thoughts: 494
						

Thoughts:
**Investigating the `bt_reset` debugfs entry with respect to mt7921 and QEMU**

Okay, so I'm trying to figure out the conditions under which we can see the `/sys/kernel/debug/.../bt_reset` file for the mt7921 driver, specifically with an eye toward emulating this in QEMU. My first thought was to examine `mt7921_pci_probe` in `drivers/net/wireless/mediatek/mt76/mt7921/pci.c`, since that's the obvious place to start for PCIe devices and see if QEMU supports any emulated versions of this.

But then I had a hunch. Could the USB path use `mt76_is_mmio`? So I went to `drivers/net/wireless/mediatek/mt76/mt7921/usb.c` and checked `mt7921u_probe`. Ah, it uses `mt792xu_copy` and doesn't call `mt76_mmio_init`. This suggests something about the memory mapping.

I needed to check the definition of `mt76_is_mmio`, so I dove into `debugfs.c`. There it is:

```c
	if (!mt76_is_mmio(&dev->mt76))
		return -EOPNOTSUPP;
```
And crucially:

```c
	if (mt76_is_mmio(&dev->mt76))
		debugfs_create_file("bt_reset", 0200, dir, dev, &fops_bt_reset);
```

Okay, so the `bt_reset` file is only created if `mt76_is_mmio` returns true. Then I looked at the comment in `mt7921_bt_reset`. It explicitly mentions PCIe and USB Bluetooth interface issues:

```c
	/* Match the MT7961 sequence in btmtk_usb_subsys_reset(). PCIe can
	 * still reach these registers when Bluetooth's USB interface is wedged.
	 * A USB port reprobe may be needed afterwards to enumerate it again.
	 */
```

That's the key!  So, if that `bt_reset` file is created, that means `mt76_is_mmio` is true for this device. I remember that the `mt7921` pci driver explicitly uses `mt76_mmio_init` when probing the PCIe version.

```c
	mt76_mmio_init(&dev->mt76, regs);
```

So, that tells me the conditions needed to use that debug entry.
Now, is there any platform or SoC driver for the mt7921? Let's do a quick grep. This will tell me if we might see this entry on other hardware.



14/2 2026/10/16 00:47 tool grepper
0m Args:
{
  "Expression": "mt7921",
  "PathPrefixes": [
    "drivers/net/wireless/mediatek/mt76/mt7921/"
  ]
}

Results:
{
  "Output": "\nFull output is too long, showing 200 out of 2543 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (18 files in total):\ndrivers/net/wireless/mediatek/mt76/mt7921/Makefile:9\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:48\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:31\ndrivers/net/wireless/mediatek/mt76/mt7921/mac.c:40\ndrivers/net/wireless/mediatek/mt76/mt7921/main.c:172\ndrivers/net/wireless/mediatek/mt76/mt7921/mcu.c:107\ndrivers/net/wireless/mediatek/mt76/mt7921/mcu.h:10\ndrivers/net/wireless/mediatek/mt76/mt7921/mt7921.h:93\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c:78\ndrivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c:8\ndrivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c:11\ndrivers/net/wireless/mediatek/mt76/mt7921/regd.c:49\ndrivers/net/wireless/mediatek/mt76/mt7921/regd.h:14\ndrivers/net/wireless/mediatek/mt76/mt7921/sdio.c:44\ndrivers/net/wireless/mediatek/mt76/mt7921/sdio_mac.c:29\ndrivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c:16\ndrivers/net/wireless/mediatek/mt76/mt7921/testmode.c:21\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c:36\n\ndrivers/net/wireless/mediatek/mt76/mt7921/Makefile-2-\ndrivers/net/wireless/mediatek/mt76/mt7921/Makefile:3:obj-$(CONFIG_MT7921_COMMON) += mt7921-common.o\ndrivers/net/wireless/mediatek/mt76/mt7921/Makefile:4:obj-$(CONFIG_MT7921E) += mt7921e.o\ndrivers/net/wireless/mediatek/mt76/mt7921/Makefile:5:obj-$(CONFIG_MT7921S) += mt7921s.o\ndrivers/net/wireless/mediatek/mt76/mt7921/Makefile:6:obj-$(CONFIG_MT7921U) += mt7921u.o\ndrivers/net/wireless/mediatek/mt76/mt7921/Makefile-7-\ndrivers/net/wireless/mediatek/mt76/mt7921/Makefile:8:mt7921-common-y := mac.o mcu.o regd.o main.o init.o debugfs.o\ndrivers/net/wireless/mediatek/mt76/mt7921/Makefile:9:mt7921-common-$(CONFIG_NL80211_TESTMODE) += testmode.o\ndrivers/net/wireless/mediatek/mt76/mt7921/Makefile:10:mt7921e-y := pci.o pci_mac.o pci_mcu.o\ndrivers/net/wireless/mediatek/mt76/mt7921/Makefile:11:mt7921s-y := sdio.o sdio_mac.o sdio_mcu.o\ndrivers/net/wireless/mediatek/mt76/mt7921/Makefile:12:mt7921u-y := usb.o\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-3-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:4:#include \"mt7921.h\"\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-5-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c=6=static int\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:7:mt7921_reg_set(void *data, u64 val)\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-8-{\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c=18=static int\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:19:mt7921_reg_get(void *data, u64 *val)\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-20-{\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-29-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:30:DEFINE_DEBUGFS_ATTRIBUTE(fops_regval, mt7921_reg_get, mt7921_reg_set,\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-31-\t\t\t \"0x%08llx\\n\");\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c=32=static int\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:33:mt7921_fw_debug_set(void *data, u64 val)\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-34-{\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-39-\tdev-\u003efw_debug = (u8)val;\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:40:\tmt7921_mcu_fw_log_2_host(dev, dev-\u003efw_debug);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-41-\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c=47=static int\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:48:mt7921_fw_debug_get(void *data, u64 *val)\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-49-{\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-56-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:57:DEFINE_DEBUGFS_ATTRIBUTE(fops_fw_debug, mt7921_fw_debug_get,\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:58:\t\t\t mt7921_fw_debug_set, \"%lld\\n\");\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-59-\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c=62=static void\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:63:mt7921_seq_puts_array(struct seq_file *file, const char *str,\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-64-\t\t      s8 *val, int len)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-76-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:77:#define mt7921_print_txpwr_entry(prefix, rate)\t\t\t\t\\\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-78-({\t\t\t\t\t\t\t\t\t\\\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:79:\tmt7921_seq_puts_array(s, #prefix \" (user)\",\t\t\t\\\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-80-\t\t\t      txpwr.data[TXPWR_USER].rate,\t\t\\\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-81-\t\t\t      ARRAY_SIZE(txpwr.data[TXPWR_USER].rate)); \\\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:82:\tmt7921_seq_puts_array(s, #prefix \" (eeprom)\",\t\t\t\\\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-83-\t\t\t      txpwr.data[TXPWR_EEPROM].rate,\t\t\\\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-84-\t\t\t      ARRAY_SIZE(txpwr.data[TXPWR_EEPROM].rate)); \\\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:85:\tmt7921_seq_puts_array(s, #prefix \" (tmac)\",\t\t\t\\\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-86-\t\t\t      txpwr.data[TXPWR_MAC].rate,\t\t\\\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c=90=static int\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:91:mt7921_txpwr(struct seq_file *s, void *data)\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-92-{\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-93-\tstruct mt792x_dev *dev = dev_get_drvdata(s-\u003eprivate);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:94:\tstruct mt7921_txpwr txpwr;\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-95-\tint ret;\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-97-\tmt792x_mutex_acquire(dev);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:98:\tret = mt7921_get_txpwr_info(dev, \u0026txpwr);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-99-\tmt792x_mutex_release(dev);\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-106-\t\t   \" \", \"1m\", \"2m\", \"5m\", \"11m\");\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:107:\tmt7921_print_txpwr_entry(CCK, cck);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-108-\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-111-\t\t   \"48m\", \"54m\");\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:112:\tmt7921_print_txpwr_entry(OFDM, ofdm);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-113-\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-116-\t\t   \"mcs6\", \"mcs7\");\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:117:\tmt7921_print_txpwr_entry(HT20, ht20);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-118-\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-121-\t\t   \"mcs6\", \"mcs7\", \"mcs32\");\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:122:\tmt7921_print_txpwr_entry(HT40, ht40);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-123-\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-126-\t\t   \"mcs6\", \"mcs7\", \"mcs8\", \"mcs9\", \"mcs10\", \"mcs11\");\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:127:\tmt7921_print_txpwr_entry(VHT20, vht20);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:128:\tmt7921_print_txpwr_entry(VHT40, vht40);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:129:\tmt7921_print_txpwr_entry(VHT80, vht80);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:130:\tmt7921_print_txpwr_entry(VHT160, vht160);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:131:\tmt7921_print_txpwr_entry(HE26, he26);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:132:\tmt7921_print_txpwr_entry(HE52, he52);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:133:\tmt7921_print_txpwr_entry(HE106, he106);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:134:\tmt7921_print_txpwr_entry(HE242, he242);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:135:\tmt7921_print_txpwr_entry(HE484, he484);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:136:\tmt7921_print_txpwr_entry(HE996, he996);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:137:\tmt7921_print_txpwr_entry(HE996x2, he996x2);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-138-\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c=142=static int\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:143:mt7921_pm_set(void *data, u64 val)\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-144-{\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-166-\tpm-\u003eenable_user = val;\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:167:\tmt7921_set_runtime_pm(dev);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-168-\tmt76_connac_power_save_sched(\u0026dev-\u003emphy, pm);\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c=175=static int\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:176:mt7921_pm_get(void *data, u64 *val)\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-177-{\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-184-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:185:DEFINE_DEBUGFS_ATTRIBUTE(fops_pm, mt7921_pm_get, mt7921_pm_set, \"%lld\\n\");\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-186-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c=187=static int\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:188:mt7921_deep_sleep_set(void *data, u64 val)\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-189-{\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c=211=static int\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:212:mt7921_deep_sleep_get(void *data, u64 *val)\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-213-{\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-220-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:221:DEFINE_DEBUGFS_ATTRIBUTE(fops_ds, mt7921_deep_sleep_get,\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:222:\t\t\t mt7921_deep_sleep_set, \"%lld\\n\");\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-223-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c=224=DEFINE_DEBUGFS_ATTRIBUTE(fops_pm_idle_timeout, mt792x_pm_idle_timeout_get,\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-226-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:227:static int mt7921_chip_reset(void *data, u64 val)\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-228-{\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-247-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:248:DEFINE_DEBUGFS_ATTRIBUTE(fops_reset, NULL, mt7921_chip_reset, \"%lld\\n\");\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-249-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:250:static int mt7921_bt_reset(void *data, u64 val)\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-251-{\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-289-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:290:DEFINE_DEBUGFS_ATTRIBUTE(fops_bt_reset, NULL, mt7921_bt_reset, \"%lld\\n\");\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-291-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c=292=static int\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:293:mt7921s_sched_quota_read(struct seq_file *s, void *data)\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-294-{\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-305-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:306:int mt7921_init_debugfs(struct mt792x_dev *dev)\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-307-{\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-321-\tdebugfs_create_devm_seqfile(dev-\u003emt76.dev, \"txpower_sku\", dir,\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:322:\t\t\t\t    mt7921_txpwr);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-323-\tdebugfs_create_file(\"tx_stats\", 0400, dir, dev, \u0026mt792x_tx_stats_fops);\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-335-\t\tdebugfs_create_devm_seqfile(dev-\u003emt76.dev, \"sched-quota\", dir,\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:336:\t\t\t\t\t    mt7921s_sched_quota_read);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-337-\treturn 0;\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-8-#include \u003clinux/firmware.h\u003e\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:9:#include \"mt7921.h\"\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-10-#include \"../mt76_connac2_mac.h\"\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-13-\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:14:static ssize_t mt7921_thermal_temp_show(struct device *dev,\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-15-\t\t\t\t\tstruct device_attribute *attr,\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-24-\t\tmt792x_mutex_acquire(mdev);\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:25:\t\ttemperature = mt7921_mcu_get_temperature(phy);\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-26-\t\tmt792x_mutex_release(mdev);\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-36-}\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:37:static SENSOR_DEVICE_ATTR_RO(temp1_input, mt7921_thermal_temp, 0);\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-38-\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:39:static struct attribute *mt7921_hwmon_attrs[] = {\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-40-\t\u0026sensor_dev_attr_temp1_input.dev_attr.attr,\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-42-};\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:43:ATTRIBUTE_GROUPS(mt7921_hwmon);\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-44-\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:45:static int mt7921_thermal_init(struct mt792x_phy *phy)\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-46-{\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-53-\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:54:\tname = devm_kasprintf(\u0026wiphy-\u003edev, GFP_KERNEL, \"mt7921_%s\",\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-55-\t\t\t      wiphy_name(wiphy));\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-59-\thwmon = devm_hwmon_device_register_with_groups(\u0026wiphy-\u003edev, name, phy,\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:60:\t\t\t\t\t\t       mt7921_hwmon_groups);\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-61-\treturn PTR_ERR_OR_ZERO(hwmon);\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-63-\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:64:int mt7921_mac_init(struct mt792x_dev *dev)\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-65-{\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-74-\tfor (i = 0; i \u003c MT792x_WTBL_SIZE; i++)\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:75:\t\tmt7921_mac_wtbl_update(dev, i,\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-76-\t\t\t\t       MT_WTBL_UPDATE_ADM_COUNT_CLEAR);\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-81-}\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:82:EXPORT_SYMBOL_GPL(mt7921_mac_init);\n\n"
}

15/2 2026/10/16 00:47 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 27744
							output: 50
							thoughts: 220
						

Thoughts:
**Investigating MT7921 Driver Probing in QEMU and Syzkaller**

Okay, so I need to figure out how to probe the MT7921 driver in a QEMU environment, specifically the PCIe version, `mt7921e`. My initial thought is to check `drivers/net/wireless/mediatek/mt76/mt7921/pci.c`. But hold on, can I even *do* that in a standard QEMU setup, or even in a syzkaller environment for that matter? Does QEMU even *emulate* the MT7921 PCIe card? Nope, I know it usually provides virtio devices, e1000, rtl8139, and a few others, but nothing that directly mimics this specific card.

Alright, pivot. Can I probe this thing via USB? Maybe using syzkaller's USB raw gadget, or vhci, or even just the dummy_hcd? To figure that out, I'd better check `drivers/net/wireless/mediatek/mt76/mt7921/usb.c`. Let's see what `usb.c` actually *does* and whether any `fops_bt_reset` is created for USB device. I should probably read both `usb.c` and `debugfs.c` carefully.



16/2 2026/10/16 00:47 tool read-file
0m Args:
{
  "File": "drivers/net/wireless/mediatek/mt76/mt7921/usb.c",
  "FirstLine": 150,
  "LineCount": 50
}

Results:
{
  "Contents": " 150:\tstatic int mt7921u_probe(struct usb_interface *usb_intf,\n 151:\t\t\t\t const struct usb_device_id *id)\n 152:\t{\n 153:\t\tstatic const struct mt76_driver_ops drv_ops = {\n 154:\t\t\t.txwi_size = MT_SDIO_TXD_SIZE,\n 155:\t\t\t.drv_flags = MT_DRV_RX_DMA_HDR | MT_DRV_HW_MGMT_TXQ |\n 156:\t\t\t\t     MT_DRV_AMSDU_OFFLOAD,\n 157:\t\t\t.survey_flags = SURVEY_INFO_TIME_TX |\n 158:\t\t\t\t\tSURVEY_INFO_TIME_RX |\n 159:\t\t\t\t\tSURVEY_INFO_TIME_BSS_RX,\n 160:\t\t\t.tx_prepare_skb = mt7921_usb_sdio_tx_prepare_skb,\n 161:\t\t\t.tx_complete_skb = mt7921_usb_sdio_tx_complete_skb,\n 162:\t\t\t.tx_status_data = mt7921_usb_sdio_tx_status_data,\n 163:\t\t\t.rx_skb = mt7921_queue_rx_skb,\n 164:\t\t\t.rx_check = mt7921_rx_check,\n 165:\t\t\t.sta_add = mt7921_mac_sta_add,\n 166:\t\t\t.sta_event = mt7921_mac_sta_event,\n 167:\t\t\t.sta_remove = mt7921_mac_sta_remove,\n 168:\t\t\t.update_survey = mt792x_update_channel,\n 169:\t\t\t.set_channel = mt7921_set_channel,\n 170:\t\t};\n 171:\t\tstatic const struct mt792x_hif_ops hif_ops = {\n 172:\t\t\t.mcu_init = mt7921u_mcu_init,\n 173:\t\t\t.init_reset = mt792xu_init_reset,\n 174:\t\t\t.reset = mt7921u_mac_reset,\n 175:\t\t};\n 176:\t\tstatic struct mt76_bus_ops bus_ops = {\n 177:\t\t\t.rr = mt792xu_rr,\n 178:\t\t\t.wr = mt792xu_wr,\n 179:\t\t\t.rmw = mt792xu_rmw,\n 180:\t\t\t.read_copy = mt76u_read_copy,\n 181:\t\t\t.write_copy = mt792xu_copy,\n 182:\t\t\t.type = MT76_BUS_USB,\n 183:\t\t};\n 184:\t\tstruct usb_device *udev = interface_to_usbdev(usb_intf);\n 185:\t\tstruct ieee80211_ops *ops;\n 186:\t\tstruct ieee80211_hw *hw;\n 187:\t\tstruct mt792x_dev *dev;\n 188:\t\tstruct mt76_dev *mdev;\n 189:\t\tu8 features;\n 190:\t\tint ret;\n 191:\t\n 192:\t\tops = mt792x_get_mac80211_ops(\u0026usb_intf-\u003edev, \u0026mt7921_ops,\n 193:\t\t\t\t\t      (void *)id-\u003edriver_info, \u0026features);\n 194:\t\tif (!ops)\n 195:\t\t\treturn -ENOMEM;\n 196:\t\n 197:\t\tops-\u003estop = mt792xu_stop;\n 198:\t\tmdev = mt76_alloc_device(\u0026usb_intf-\u003edev, sizeof(*dev), ops, \u0026drv_ops);\n 199:\t\tif (!mdev)\n"
}

17/2 2026/10/16 00:47 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 29338
							output: 51
							thoughts: 454
						

Thoughts:
**Analyzing the "bt_reset" Debugfs Entry**

Okay, let's break this down. I'm seeing a potential issue with the `bt_reset` debugfs entry in this Mediatek driver. Specifically, I'm tracing its creation and use. First, I noticed that in `mt7921u_probe`, the `bus_ops.type` is explicitly set to `MT76_BUS_USB`.

Now, if I jump over to `debugfs.c`, I find the `debugfs_create_file("bt_reset", ...)` call. The critical thing here is the conditional: `if (mt76_is_mmio(&dev->mt76))`. The code *only* creates the `bt_reset` file if `mt76_is_mmio` returns true.

Looking inside the `mt7921_bt_reset` function, it seems the intention is a direct memory mapped register access: `if (!mt76_is_mmio(&dev->mt76)) return -EOPNOTSUPP;`. This *also* uses the same condition. If the device isn't using MMIO, this function should return an error.

The function `mt76_is_mmio` is defined as `(dev)->bus->type == MT76_BUS_MMIO`. Knowing this, for USB devices, where `bus_ops.type` is `MT76_BUS_USB`,  `mt76_is_mmio` will *always* evaluate to false. Thus, the `bt_reset` debugfs entry is *never* created for USB devices.

I'm thinking, "Well, what about SDIO?" The code for SDIO, in `sdio.c`, is clear: `.type = MT76_BUS_SDIO`.  Again, `MT76_BUS_SDIO` is not `MT76_BUS_MMIO`. So, the `bt_reset` entry won't appear for SDIO either.

This means that `mt76_is_mmio(&dev->mt76)` *should* only be true for PCIe devices (`mt7921e`). I'll need to double check the PCI code, just to be sure.



18/2 2026/10/16 00:47 tool read-file
0m Args:
{
  "File": "drivers/net/wireless/mediatek/mt76/mt7921/pci.c",
  "FirstLine": 255,
  "LineCount": 40
}

Results:
{
  "Contents": " 255:\t\n 256:\t\treturn mt792x_dma_enable(dev);\n 257:\t}\n 258:\t\n 259:\tstatic int mt7921_pci_probe(struct pci_dev *pdev,\n 260:\t\t\t\t    const struct pci_device_id *id)\n 261:\t{\n 262:\t\tstatic const struct mt76_driver_ops drv_ops = {\n 263:\t\t\t/* txwi_size = txd size + txp size */\n 264:\t\t\t.txwi_size = MT_TXD_SIZE + sizeof(struct mt76_connac_hw_txp),\n 265:\t\t\t.drv_flags = MT_DRV_TXWI_NO_FREE | MT_DRV_HW_MGMT_TXQ |\n 266:\t\t\t\t     MT_DRV_AMSDU_OFFLOAD,\n 267:\t\t\t.survey_flags = SURVEY_INFO_TIME_TX |\n 268:\t\t\t\t\tSURVEY_INFO_TIME_RX |\n 269:\t\t\t\t\tSURVEY_INFO_TIME_BSS_RX,\n 270:\t\t\t.token_size = MT7921_TOKEN_SIZE,\n 271:\t\t\t.tx_prepare_skb = mt7921e_tx_prepare_skb,\n 272:\t\t\t.tx_complete_skb = mt76_connac_tx_complete_skb,\n 273:\t\t\t.rx_check = mt7921_rx_check,\n 274:\t\t\t.rx_skb = mt7921_queue_rx_skb,\n 275:\t\t\t.rx_poll_complete = mt792x_rx_poll_complete,\n 276:\t\t\t.sta_add = mt7921_mac_sta_add,\n 277:\t\t\t.sta_event = mt7921_mac_sta_event,\n 278:\t\t\t.sta_remove = mt7921_mac_sta_remove,\n 279:\t\t\t.update_survey = mt792x_update_channel,\n 280:\t\t\t.set_channel = mt7921_set_channel,\n 281:\t\t};\n 282:\t\tstatic const struct mt792x_hif_ops mt7921_pcie_ops = {\n 283:\t\t\t.init_reset = mt7921e_init_reset,\n 284:\t\t\t.reset = mt7921e_mac_reset,\n 285:\t\t\t.mcu_init = mt7921e_mcu_init,\n 286:\t\t\t.drv_own = mt792xe_mcu_drv_pmctrl,\n 287:\t\t\t.fw_own = mt792xe_mcu_fw_pmctrl,\n 288:\t\t};\n 289:\t\tstatic const struct mt792x_pcie_reg mt7921_pcie_reg = {\n 290:\t\t\t.imask = MT_PCIE_MAC_INT_ENABLE,\n 291:\t\t\t.pm = MT_PCIE_MAC_PM,\n 292:\t\t};\n 293:\t\tstatic const struct mt792x_irq_map irq_map = {\n 294:\t\t\t.host_irq_enable = MT_WFDMA0_HOST_INT_ENA,\n"
}

19/2 2026/10/16 00:47 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 31217
							output: 54
							thoughts: 28
						

Thoughts:
Okay, let's dive into this. Here's my understanding, presented as a personal thought process, given my expertise:

**Examining the MT7921 PCI Device IDs**

Alright, I need to get a handle on what's happening with this `mt7921_pci_probe` function within `pci.c`. The first thing that comes to mind, as I know my way around the PCI device ID landscape, is to check the *device IDs* themselves. I'm thinking, "Let's scrutinize those device IDs." Knowing the specific IDs, of course, is fundamental to how this probe function even *works*. Are we handling different revisions? Multiple vendor-specific devices with the MT7921 chipset? What are the implications if there's a problem there? This is the starting point, the foundation of understanding how the system identifies and supports this hardware. This probe function *relies* on that precise match. I need to make sure those IDs are what I expect them to be, and that the function is correctly identifying and handling them. It’s the essential preliminary step before I can dig deeper into the actual probe process.



20/2 2026/10/16 00:48 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "mt7921_pci_ids",
  "PathPrefixes": [
    "drivers/net/wireless/mediatek/mt76/mt7921/pci.c"
  ]
}

Results:
{
  "error": "no matches"
}

21/2 2026/10/16 00:48 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 31561
							output: 52
							thoughts: 20
						

Thoughts:
Okay, let's dive into this. Here's my thought process on what I'm about to do:

**Examining the `pci_device_id` Table in `pci.c`**

Alright, so the task at hand is to understand the `pci_device_id` table. I'm going to jump straight into `pci.c` and take a look at it. I know this table is critical for device identification and driver binding within the PCI subsystem, so I need a clear understanding of its structure and purpose to get a real handle on this. I'm especially interested in how the table is populated, how the matching logic works, and any associated macros or helper functions that interact with this table. Any details about handling wildcards or complex matching rules are key, as those are usually present in these tables. This investigation is going to set the stage for understanding how device drivers are actually tied to their associated PCI devices at runtime.



22/2 2026/10/16 00:48 tool grepper
0m Args:
{
  "Expression": "MODULE_DEVICE_TABLE\\(pci",
  "PathPrefixes": [
    "drivers/net/wireless/mediatek/mt76/mt7921/pci.c"
  ]
}

Results:
{
  "Output": "drivers/net/wireless/mediatek/mt76/mt7921/pci.c=730=module_pci_driver(mt7921_pci_driver);\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c-731-\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c:732:MODULE_DEVICE_TABLE(pci, mt7921_pci_device_table);\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c-733-MODULE_FIRMWARE(MT7920_FIRMWARE_WM);\n"
}

23/2 2026/10/16 00:48 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 32022
							output: 56
							thoughts: 18
						

Thoughts:
Okay, here's my interpretation of what's going on, framed as a first-person expert perspective:

**Diving into the `mt7921_pci_device_table`**

Alright, let's take a look at this `mt7921_pci_device_table`.  Based on the naming convention, I'm immediately expecting to see a structure or array, likely a table, containing information about the MediaTek MT7921 Wi-Fi chip, specifically its PCI device details. This is the starting point for driver initialization, that I know very well. This table will be critical for the system to correctly identify the hardware and load the appropriate driver. I'm guessing that the table includes PCI vendor and device IDs, perhaps revision IDs, and maybe some associated flags or pointers to more device-specific configuration data. This is how the system differentiates between the many PCI devices connected. I anticipate that this table will be well-structured and easy to read, as it's the fundamental starting point for this driver. I'm keen to confirm that there's a good entry here.



24/2 2026/10/16 00:48 tool grepper
0m Args:
{
  "Expression": "mt7921_pci_device_table",
  "PathPrefixes": [
    "drivers/net/wireless/mediatek/mt76/mt7921/pci.c"
  ]
}

Results:
{
  "Output": "drivers/net/wireless/mediatek/mt76/mt7921/pci.c-16-\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c:17:static const struct pci_device_id mt7921_pci_device_table[] = {\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c-18-\t{ PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x7961),\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c=720=static struct pci_driver mt7921_pci_driver = {\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c-721-\t.name\t\t= KBUILD_MODNAME,\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c:722:\t.id_table\t= mt7921_pci_device_table,\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c-723-\t.probe\t\t= mt7921_pci_probe,\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c=730=module_pci_driver(mt7921_pci_driver);\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c-731-\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c:732:MODULE_DEVICE_TABLE(pci, mt7921_pci_device_table);\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c-733-MODULE_FIRMWARE(MT7920_FIRMWARE_WM);\n"
}

25/2 2026/10/16 00:48 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 32836
							output: 49
							thoughts: 475
						

Thoughts:
**Analyzing the Feasibility of Fuzzing the mt7921_pci_driver**

Okay, so the `mt7921_pci_driver` handles the MediaTek MT7961 PCIe Wireless Network Adapter, which is a real piece of hardware, a Wi-Fi 6 / Bluetooth combo chip. The question is, can I reach this driver in an emulated environment? QEMU doesn't emulate the MT7961, neither in standard QEMU nor GCE. So, I need to see if there's *any* way to reach this code without the physical hardware.

Let's revisit the "WorthFuzzing=false" criteria. Specifically, the "Structurally unreachable hardware" part. This is where drivers for PCIe cards that *aren't* emulated in standard QEMU come into play. Examples include vendor-specific PCIe switches and SmartNICs. *That* is my concern. Is the MT7961 in that category?

To find out, I need to determine if there's any way to trigger this code path without the physical card. The critical function is `mt7921_init_debugfs`. Can `mt76_is_mmio` be true for something else? Does a mock/virtual driver register this function? I'll check all the callers of `mt7921_init_debugfs`. A quick grep shows it's called from `mt7921_init_work` in `drivers/net/wireless/mediatek/mt76/mt7921/init.c`.

Now, how and when is `mt7921_init_work` scheduled? I'll need to dig into `init.c` to trace the execution path and assess the conditions required for this code to be executed. If this requires the physical PCIe card, or if it is unreachable via standard emulation, then I might have a case for setting `WorthFuzzing=false`.



26/2 2026/10/16 00:48 tool grepper
0m Args:
{
  "Expression": "mt7921_init_work",
  "PathPrefixes": [
    "drivers/net/wireless/mediatek/mt76/mt7921/"
  ]
}

Results:
{
  "Output": "drivers/net/wireless/mediatek/mt76/mt7921/init.c=109=static int mt7921_init_hardware(struct mt792x_dev *dev)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-130-\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:131:static void mt7921_init_work(struct work_struct *work)\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-132-{\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c=170=int mt7921_register_device(struct mt792x_dev *dev)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-199-\tINIT_WORK(\u0026dev-\u003ereset_work, mt7921_mac_reset_work);\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:200:\tINIT_WORK(\u0026dev-\u003einit_work, mt7921_init_work);\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-201-\n"
}

27/2 2026/10/16 00:48 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 34140
							output: 23
							thoughts: 16
						

Thoughts:
Here's my thought process, as if I were considering this myself:

**Tracing the Device Registration**

Okay, so I'm trying to figure out the flow. I need to pinpoint the exact location where `mt7921_register_device` is invoked. Understanding that call point is crucial for grasping how the driver initializes and integrates the hardware, and how it's handled by the OS. It's a key piece of the puzzle to understand device instantiation. I need to trace this function back to its origin.



28/2 2026/10/16 00:48 tool grepper
0m Args:
{
  "Expression": "mt7921_register_device"
}

Results:
{
  "Output": "drivers/net/wireless/mediatek/mt76/mt7921/init.c=131=static void mt7921_init_work(struct work_struct *work)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-169-\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:170:int mt7921_register_device(struct mt792x_dev *dev)\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-171-{\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c-255-}\ndrivers/net/wireless/mediatek/mt76/mt7921/init.c:256:EXPORT_SYMBOL_GPL(mt7921_register_device);\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/mt7921.h=209=int __mt7921_start(struct mt792x_phy *phy);\ndrivers/net/wireless/mediatek/mt76/mt7921/mt7921.h:210:int mt7921_register_device(struct mt792x_dev *dev);\ndrivers/net/wireless/mediatek/mt76/mt7921/mt7921.h-211-void mt7921_unregister_device(struct mt792x_dev *dev);\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c=259=static int mt7921_pci_probe(struct pci_dev *pdev,\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c-434-\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c:435:\tret = mt7921_register_device(dev);\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c-436-\tif (ret)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/sdio.c=90=static int mt7921s_probe(struct sdio_func *func,\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/sdio.c-188-\ndrivers/net/wireless/mediatek/mt76/mt7921/sdio.c:189:\tret = mt7921_register_device(dev);\ndrivers/net/wireless/mediatek/mt76/mt7921/sdio.c-190-\tif (ret)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c=150=static int mt7921u_probe(struct usb_interface *usb_intf,\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c-245-\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c:246:\tret = mt7921_register_device(dev);\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c-247-\tif (ret)\n"
}

29/2 2026/10/16 00:48 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 35172
							output: 22
							thoughts: 2300
						

Thoughts:
**Analysis of `bt_reset` Reachability in MT7921 Driver**

Okay, let's break this down. My initial focus is the `mt7921_bt_reset` functionality and whether it's reachable for fuzzing purposes, given the constraints of standard QEMU or GCE environments.

First, I see `mt7921_register_device` is the top-level registration function. It's called from `mt7921_pci_probe`, `mt7921s_probe`, and `mt7921u_probe`, corresponding to PCIe, SDIO, and USB bus types, respectively.

Now, looking at `mt7921_init_debugfs`, I note the creation of a debugfs entry for "bt_reset". This is conditional: `if (mt76_is_mmio(&dev->mt76))`. This is critical. `mt76_is_mmio` is only true for PCIe (`mt7921_pci_probe`). The USB (`mt7921u_probe`) and SDIO (`mt7921s_probe`) paths don't satisfy this condition. Therefore, "bt_reset" is only created and accessible in the PCIe case.

Further, the `mt7921_bt_reset` callback itself, even if somehow invoked via some other means, includes a check `if (!mt76_is_mmio(&dev->mt76))` and returns `-EOPNOTSUPP` if it's not MMIO. So the code is clearly written to be unreachable.

The key question is whether an MT7921 PCIe device is emulated in standard QEMU or GCE. I know from experience that QEMU doesn't emulate MT7921 PCIe hardware; It is a specific piece of hardware required. This falls squarely under the "structurally unreachable hardware" category defined in the fuzzing guidelines.

Okay, so I understand that PCIe is out. What about USB? Syzkaller *can* emulate USB devices using raw-gadget / dummy_hcd. Let's see if the code path for USB ever gets to the `bt_reset` functionality.

In `mt7921u_probe`, the `bus_ops` are set to USB, meaning that `dev->mt76.bus->type` is `MT76_BUS_USB`. Looking at the definition of `mt76_is_mmio`, it's defined as `((dev)->bus->type == MT76_BUS_MMIO)`.  Since the bus type is USB, the condition `mt76_is_mmio(&dev->mt76)` evaluates to `false`. Therefore, the `debugfs_create_file` call for "bt_reset" is *never* executed for USB, and `mt7921_bt_reset` is never called.

Finally, I checked `drivers/net/wireless/mediatek/mt76/mt792x_regs.h`. These are register definitions; and they are *only* used within `mt7921_bt_reset`.

**Conclusion:** The code related to `bt_reset` and those newly added register definitions are *unreachable* in the context of standard QEMU and GCE environments because they require either PCIe hardware not emulated, or are conditional and unreachable on USB. Therefore, based on the fuzzing guidelines, this code should **not** be considered worth fuzzing.



30/2 2026/10/16 00:48 tool grepper
0m Args:
{
  "Expression": "MT7921_BT_"
}

Results:
{
  "Output": "drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c=250=static int mt7921_bt_reset(void *data, u64 val)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-270-\t */\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:271:\tmt76_wr(dev, MT7921_BT_EP_RST_OPT, 0x00010001);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:272:\tmt76_rr(dev, MT7921_BT_WDT_STATUS);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:273:\tmt76_wr(dev, MT7921_BT_SUBSYS_RST, 1);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:274:\tmt76_wr(dev, MT7921_BT_UDMA_INT_STA, 0xff);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:275:\tmt76_rr(dev, MT7921_BT_UDMA_INT_STA);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:276:\tmt76_wr(dev, MT7921_BT_UDMA_INT_STA1, 0xff);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:277:\tmt76_rr(dev, MT7921_BT_UDMA_INT_STA1);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-278-\tmsleep(20);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:279:\tmt76_wr(dev, MT7921_BT_SUBSYS_RST, 0);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:280:\tmt76_rr(dev, MT7921_BT_SUBSYS_RST);\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-281-\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:282:\tif (!mt76_poll_msec(dev, MT7921_BT_MISC,\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c:283:\t\t\t    MT7921_BT_RST_DONE, MT7921_BT_RST_DONE, 1000))\ndrivers/net/wireless/mediatek/mt76/mt7921/debugfs.c-284-\t\tret = -ETIMEDOUT;\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_regs.h-423-\ndrivers/net/wireless/mediatek/mt76/mt792x_regs.h:424:#define MT7921_BT_MISC\t\t\t0x70002510\ndrivers/net/wireless/mediatek/mt76/mt792x_regs.h:425:#define MT7921_BT_RST_DONE\t\tBIT(8)\ndrivers/net/wireless/mediatek/mt76/mt792x_regs.h:426:#define MT7921_BT_SUBSYS_RST\t\t0x70002610\ndrivers/net/wireless/mediatek/mt76/mt792x_regs.h:427:#define MT7921_BT_UDMA_INT_STA\t\t0x74000024\ndrivers/net/wireless/mediatek/mt76/mt792x_regs.h:428:#define MT7921_BT_UDMA_INT_STA1\t\t0x74000308\ndrivers/net/wireless/mediatek/mt76/mt792x_regs.h:429:#define MT7921_BT_WDT_STATUS\t\t0x740003a0\ndrivers/net/wireless/mediatek/mt76/mt792x_regs.h:430:#define MT7921_BT_EP_RST_OPT\t\t0x74011890\ndrivers/net/wireless/mediatek/mt76/mt792x_regs.h-431-\n"
}

31/2 2026/10/16 00:48 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 39503
							output: 138
							thoughts: 2872
						

Thoughts:
**Analysis of the MT7921 Bluetooth Reset Functionality**

Okay, let's break this down. My initial thought was that this `mt7921_bt_reset` function is only ever called in the `mt7921_bt_reset` function itself. Now, can we actually hit this `mt76_is_mmio` in QEMU or Syzkaller? Let's trace it down. Looks like `MT76_BUS_MMIO` is set during `mt76_mmio_init` which is called by the PCI driver for the MT7921. Specifically, I see it in `drivers/net/wireless/mediatek/mt76/mt7921/pci.c`. Good, that narrows it down. Only the MT7921 PCI driver uses this MMIO path, and the relevant registers are all defined for the MT7921.

Right, so this code is *only* used for the MediaTek MT7921 PCIe wireless device. That's a PCIe adapter. Standard QEMU and GCE environments aren't going to emulate that hardware, right? The PCI ID check confirms this, and the code path is completely dependent on that particular hardware.

Hold on, let me quickly double-check the patch itself. Okay, the patch adds a debugfs entry called "bt_reset" and defines `mt7921_bt_reset`. Crucially, debugfs entry is conditional on `mt76_is_mmio()`, and the reset function also checks this. Looking at the logic, the code is using MMIO to reset the Bluetooth subsystem, and it's doing this by writing to specific hardware registers.

The key is that this is *structurally unreachable hardware* in typical fuzzing environments. We're looking at a vendor-specific PCIe device (MediaTek MT7921 / MT7961), not something emulated in standard QEMU.
```json
{
    "WorthFuzzing": false,
    "FocusSymbols": [],
    "EnableConfigs": [],
    "Reasoning": "The patch adds a debugfs node `bt_reset` and corresponding handler `mt7921_bt_reset()` to reset the Bluetooth subsystem via PCIe MMIO. The node is guarded by `if (mt76_is_mmio(&dev->mt76))` and `mt7921_bt_reset()` also checks `mt76_is_mmio()`, which is only set when probed via the MT7921 PCIe driver (`mt7921e`). The MediaTek MT7921 PCIe wireless device requires physical ASIC hardware not emulated in standard QEMU or GCE virtual environments. Therefore, the modified code is structurally unreachable for fuzzing."
}
```



32/2 2026/10/16 00:48 tool set-results
0m Args:
{
  "EnableConfigs": [],
  "FocusSymbols": [],
  "Reasoning": "The patch introduces a debugfs file 'bt_reset' and the handler mt7921_bt_reset() to trigger a Bluetooth subsystem reset. The debugfs entry is explicitly created only when the underlying bus is MMIO (mt76_is_mmio()), which is exclusive to the mt7921e PCIe driver. Because standard virtualized fuzzing environments (QEMU/GCE) lack emulation for MediaTek MT7921 PCIe hardware, the modified code path is structurally unreachable.",
  "WorthFuzzing": false
}

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch introduces a debugfs file 'bt_reset' and the handler mt7921_bt_reset() to trigger a Bluetooth subsystem reset. The debugfs entry is explicitly created only when the underlying bus is MMIO (mt76_is_mmio()), which is exclusive to the mt7921e PCIe driver. Because standard virtualized fuzzing environments (QEMU/GCE) lack emulation for MediaTek MT7921 PCIe hardware, the modified code path is structurally unreachable.",
  "WorthFuzzing": false
}

33/1 2026/10/16 00:48 action If
0m Args:
{
  "WorthFuzzing": false
}

Results:
null

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)