Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v1 1/7] Bluetooth: btintel_pcie: Add LOG_MASK parsing from debug INI
@ 2026-10-29  9:53 Kiran K
  2026-10-29  9:53 ` [PATCH v1 2/7] Bluetooth: btintel_pcie: Add TX/RX packet dumps under LOG_MASK Kiran K
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Kiran K @ 2026-10-29  9:53 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: chethan.tumkur.narayan, chandrashekar.devegowda, Kiran K

Read an optional LOG_MASK entry from ibt_bt_dbg_cfg.ini and store it in
a new log_mask field so that diagnostic logging can be selected per
device without rebuilding the driver. The mask defaults to 0 and an
invalid or missing entry leaves it unchanged. Preserve existing DBG_PATH
and ENABLE_INI handling.

Individual logging categories are introduced by follow-up patches.

Assisted-by: Copilot:Claude Opus 4.7
Signed-off-by: Kiran K <kiran.k@intel.com>
---
 drivers/bluetooth/btintel_pcie.c | 38 +++++++++++++++++++++++++-------
 drivers/bluetooth/btintel_pcie.h |  3 +++
 2 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 88da286750fe..a25f4d866f57 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -31,6 +31,8 @@
 
 #define VERSION "0.1"
 
+/* Runtime diagnostic logging bits loaded from LOG_MASK in the debug INI. */
+
 #define BTINTEL_PCI_DEVICE(dev, subdev)	\
 	.vendor = PCI_VENDOR_ID_INTEL,	\
 	.device = (dev),		\
@@ -206,13 +208,13 @@ static inline bool btintel_pcie_dbg_to_wifi(struct btintel_pcie_data *data)
 }
 
 /* Name of the optional INI file used to override the default dbg_path
- * (data->dbg_path_cache) and yoyo ini settings.
+ * (data->dbg_path_cache), yoyo ini settings and runtime log_mask.
  */
 #define BTINTEL_PCIE_DBG_INI_FILE "ibt_bt_dbg_cfg.ini"
 
-/* Loads optional "DBG_PATH=<value>" and ENABLE_INI=<value>
+/* Loads optional "DBG_PATH=<value>", "ENABLE_INI=<value>" and "LOG_MASK=<value>"
  * overrides from BTINTEL_PCIE_DBG_INI_FILE
- * and applies them to data->dbg_path_cache and data->enable_ini.
+ * and applies them to data->dbg_path_cache, data->enable_ini and data->log_mask.
  *
  * DBG_PATH accepts BTINTEL_PCIE_WIFI_DBGC (0x06, default) and
  * BTINTEL_PCIE_DRAM (0x01, legacy); an invalid or missing entry leaves
@@ -220,6 +222,9 @@ static inline bool btintel_pcie_dbg_to_wifi(struct btintel_pcie_data *data)
  *
  * ENABLE_INI accepts 1 (enabled) or 0 (disabled); an invalid or missing
  * entry leaves data->enable_ini unchanged.
+ *
+ * LOG_MASK accepts any u32 bitmask (see BTINTEL_PCIE_DUMP_TX and friends).
+ * An invalid or missing entry leaves data->log_mask unchanged.
  */
 static void btintel_pcie_load_dbg_path_from_ini(struct btintel_pcie_data *data)
 {
@@ -227,12 +232,13 @@ static void btintel_pcie_load_dbg_path_from_ini(struct btintel_pcie_data *data)
 	const char *ini_file = BTINTEL_PCIE_DBG_INI_FILE;
 	char *buf, *cursor, *line;
 	bool dbg_path_applied = false;
+	bool log_mask_applied = false;
 	int err;
 
 	err = request_firmware_direct(&fw, ini_file, &data->pdev->dev);
 	if (err < 0) {
-		BT_DBG("%s not found (%d), using dbg_path=0x%02x",
-		       ini_file, err, data->dbg_path_cache);
+		BT_DBG("%s not found (%d), using dbg_path=0x%02x log_mask=0x%08x",
+		       ini_file, err, data->dbg_path_cache, data->log_mask);
 		if (data->dbg_path_cache != BTINTEL_PCIE_DRAM)
 			data->enable_ini = false;
 		return;
@@ -261,9 +267,7 @@ static void btintel_pcie_load_dbg_path_from_ini(struct btintel_pcie_data *data)
 		line = strim(line);
 		val = strim(eq + 1);
 
-		/* Accept "DBG_PATH"/"dbg_path"
-		 * case-insensitively as the key.
-		 */
+		/* Keys are case-insensitive. */
 		if (!strcasecmp(line, "DBG_PATH")) {
 			BT_INFO("Read DBG_PATH from %s: '%s'", ini_file, val);
 
@@ -279,6 +283,18 @@ static void btintel_pcie_load_dbg_path_from_ini(struct btintel_pcie_data *data)
 				BT_WARN("Invalid DBG_PATH='%s' in %s, using dbg_path=0x%02x",
 					val, ini_file, data->dbg_path_cache);
 			}
+		} else if (!strcasecmp(line, "LOG_MASK")) {
+			BT_INFO("Read LOG_MASK from %s: '%s'", ini_file, val);
+
+			if (kstrtouint(val, 0, &parsed) == 0) {
+				data->log_mask = parsed;
+				log_mask_applied = true;
+				BT_INFO("WRT log_mask accepted: 0x%08x",
+					data->log_mask);
+			} else {
+				BT_WARN("Invalid LOG_MASK='%s' in %s, using log_mask=0x%08x",
+					val, ini_file, data->log_mask);
+			}
 		} else if (!strcasecmp(line, "ENABLE_INI")) {
 			BT_INFO("Read ENABLE_INI from %s: '%s'", ini_file, val);
 
@@ -304,6 +320,11 @@ static void btintel_pcie_load_dbg_path_from_ini(struct btintel_pcie_data *data)
 
 	BT_DBG("ENABLE_INI effective state: %u", data->enable_ini);
 
+	if (log_mask_applied)
+		BT_DBG("Loaded log_mask=0x%08x from %s", data->log_mask, ini_file);
+	else
+		BT_DBG("No valid LOG_MASK in %s, log_mask=0x%08x", ini_file, data->log_mask);
+
 	kfree(buf);
 }
 
@@ -4530,6 +4551,7 @@ static int btintel_pcie_probe(struct pci_dev *pdev,
 	data->boot_stage_cache = 0x00;
 	data->img_resp_cache = 0x00;
 	data->dbg_path_cache = BTINTEL_PCIE_WIFI_DBGC;
+	data->log_mask = 0;
 	data->pcie_alloc_init = false;
 	data->enable_ini = false;
 	btintel_pcie_yoyo_init(&data->yoyo);
diff --git a/drivers/bluetooth/btintel_pcie.h b/drivers/bluetooth/btintel_pcie.h
index fff31ac8f87a..3e662c34cd02 100644
--- a/drivers/bluetooth/btintel_pcie.h
+++ b/drivers/bluetooth/btintel_pcie.h
@@ -717,6 +717,8 @@ struct btintel_pcie_ini_dump_info {
  * @boot_stage_cache: cached value of boot stage register
  * @img_resp_cache: cached value of image response register
  * @dbg_path_cache: cached debug output routing mode (BT DRAM or WiFi DBGC)
+ * @log_mask: runtime diagnostic logging mask loaded from LOG_MASK in the
+ *	debug INI file
  * @cnvi: CNVi register value
  * @cnvr: CNVr register value
  * @gp0_received: condition for gp0 interrupt
@@ -771,6 +773,7 @@ struct btintel_pcie_data {
 	u32	boot_stage_cache;
 	u32	img_resp_cache;
 	u32	dbg_path_cache;
+	u32	log_mask;
 	bool	enable_ini;
 	struct btintel_pcie_yoyo_ctx yoyo;
 
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-10-29 14:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-29  9:53 [PATCH v1 1/7] Bluetooth: btintel_pcie: Add LOG_MASK parsing from debug INI Kiran K
2026-10-29  9:53 ` [PATCH v1 2/7] Bluetooth: btintel_pcie: Add TX/RX packet dumps under LOG_MASK Kiran K
2026-10-29  9:53 ` [PATCH v1 3/7] Bluetooth: btintel_pcie: Add alive interrupt logging " Kiran K
2026-10-29  9:53 ` [PATCH v1 4/7] Bluetooth: btintel_pcie: Add Sx transition " Kiran K
2026-10-29  9:53 ` [PATCH v1 5/7] Bluetooth: btintel_pcie: Add MAC access " Kiran K
2026-10-29  9:53 ` [PATCH v1 6/7] Bluetooth: btintel_pcie: Add target memory read " Kiran K
2026-10-29  9:53 ` [PATCH v1 7/7] Bluetooth: btintel_pcie: Gate mailbox logging behind LOG_MASK Kiran K
2026-10-29 14:52 ` [v1,1/7] Bluetooth: btintel_pcie: Add LOG_MASK parsing from debug INI bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox