Bluetooth: btintel_pcie: Route debug traces to WiFi DBGC by default

Set dbg_output_mode to 0x06 (BTINTEL_PCIE_WIFI_DBGC) by default so
firmware debug traces are forwarded to the WiFi DBGC. In this mode:

  - Host DBGC fragment/data buffers are NOT allocated.
  - Context info publishes dbgc_addr/size as 0.

Add a small helper btintel_pcie_dbg_to_wifi() driven by a cached
dbg_path_cache field in struct btintel_pcie_data, initialized to
BTINTEL_PCIE_WIFI_DBGC in probe.

Signed-off-by: Kiran K <kiran.k@intel.com>
Signed-off-by: Catherine L <catherine.l@intel.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Catherine L 2026-08-19 20:02:19 +05:30 committed by Luiz Augusto von Dentz
parent d572ea4b62
commit 0d3f5d805b
2 changed files with 55 additions and 4 deletions

View File

@ -180,6 +180,15 @@ static inline char *btintel_pcie_alivectxt_state2str(u32 alive_intr_ctxt)
}
}
/* Returns true when firmware traces are routed to the WiFi DBGC. In that
* mode the host must not allocate DBGC buffers and must not publish their
* addresses in the context info.
*/
static inline bool btintel_pcie_dbg_to_wifi(struct btintel_pcie_data *data)
{
return data->dbg_path_cache != BTINTEL_PCIE_DRAM;
}
/* This function initializes the memory for DBGC buffers and formats the
* DBGC fragment which consists header info and DBGC buffer's LSB, MSB and
* size as the payload
@ -1864,6 +1873,15 @@ static void btintel_pcie_coredump_worker(struct work_struct *work)
if (!data->hdev)
goto out;
/* When firmware routes debug traces to the WiFi DBGC, no host
* DBGC buffers were allocated, so there is nothing to dump here.
*/
if (btintel_pcie_dbg_to_wifi(data)) {
bt_dev_info(data->hdev,
"Skipping coredump: debug traces routed to WiFi DBGC");
goto out;
}
btintel_pcie_dump_traces(data->hdev);
out:
/* Release guard last so a new trigger can run only after this
@ -2261,9 +2279,18 @@ static void btintel_pcie_init_ci(struct btintel_pcie_data *data,
ci->num_urbdq1 = data->rxq.count;
ci->urbdq_db_vec = BTINTEL_PCIE_RXQ_NUM;
ci->dbg_output_mode = 0x01;
ci->dbgc_addr = data->dbgc.frag_p_addr;
ci->dbgc_size = data->dbgc.frag_size;
ci->dbg_output_mode = btintel_pcie_dbg_to_wifi(data) ?
BTINTEL_PCIE_WIFI_DBGC : BTINTEL_PCIE_DRAM;
if (btintel_pcie_dbg_to_wifi(data)) {
/* Firmware forwards debug traces to the WiFi DBGC, so no
* host DBGC buffer is needed; leave dbgc_addr/size as 0.
*/
ci->dbgc_addr = 0;
ci->dbgc_size = 0;
} else {
ci->dbgc_addr = data->dbgc.frag_p_addr;
ci->dbgc_size = data->dbgc.frag_size;
}
ci->dbg_preset = 0x00;
}
@ -2491,7 +2518,14 @@ static int btintel_pcie_alloc(struct btintel_pcie_data *data)
v_addr += ci_size;
/* Setup data buffers for dbgc */
err = btintel_pcie_setup_dbgc(data);
if (btintel_pcie_dbg_to_wifi(data)) {
/* Firmware routes traces to the WiFi DBGC; skip host DBGC
* buffer allocation entirely.
*/
err = 0;
} else {
err = btintel_pcie_setup_dbgc(data);
}
if (err)
goto exit_error_txq;
@ -3405,6 +3439,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;
/* FLR can be invoked by echoing to debugfs path, so explicitly
* initialized
*/

View File

@ -94,6 +94,20 @@
/* Num of alloc Dbg buff (4) + (LSB(4), MSB(4), Size(4)) for each buffer */
#define BTINTEL_PCIE_DBGC_FRAG_PAYLOAD_SIZE 196
/* dbg_output_mode values for the context info.
* BTINTEL_PCIE_DRAM: firmware writes traces to host DRAM DBGC buffers.
* BTINTEL_PCIE_WIFI_DBGC: firmware forwards traces to the WiFi DBGC; the
* host does NOT need to allocate DBGC fragment/data buffers and must
* publish dbgc_addr/size as 0 in the context info.
*
* Encoding of BTINTEL_PCIE_WIFI_DBGC (0x06):
* Bit[0] DBGC O/P : 0 = SRAM (don't care, DBGI selected)
* Bit[1] DBGC I/P : 1 = DBGI
* Bits[2:3] DBGI O/P : 01 = WiFi DBGC
*/
#define BTINTEL_PCIE_DRAM 0x01
#define BTINTEL_PCIE_WIFI_DBGC 0x06
/* Causes for the FH register interrupts */
enum msix_fh_int_causes {
BTINTEL_PCIE_MSIX_FH_INT_CAUSES_0 = BIT(0), /* cause 0 */
@ -503,6 +517,7 @@ struct btintel_pcie_dump_header {
* @hw_init_mask: initial unmaksed hw causes
* @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)
* @cnvi: CNVi register value
* @cnvr: CNVr register value
* @gp0_received: condition for gp0 interrupt
@ -550,6 +565,7 @@ struct btintel_pcie_data {
u32 boot_stage_cache;
u32 img_resp_cache;
u32 dbg_path_cache;
u32 cnvi;
u32 cnvr;