Bluetooth: btintel_pcie: Fix driver not posting maximum rx buffers
PATCH v2 1/3 Bluetooth: btintel_pcie: Fix driver not posting maximum rx buffers
The driver was posting only 6 rx buffers, despite the maximum rx buffers being defined as 16. Having fewer RX buffers caused firmware exceptions in HID use cases when events arrived in bursts.
Exception seen on android 6.12 kernel.
E Bluetooth: hci0: Received hw exception interrupt
E Bluetooth: hci0: Received gp1 mailbox interrupt
D Bluetooth: hci0: 00000000: ff 3e 87 80 03 01 01 01 03 01 0c 0d 02 1c 10 0e D Bluetooth: hci0: 00000010: 01 00 05 14 66 b0 28 b0 c0 b0 28 b0 ac af 28 b0 D Bluetooth: hci0: 00000020: 14 f1 28 b0 00 00 00 00 fa 04 00 00 00 00 40 10 D Bluetooth: hci0: 00000030: 08 00 00 00 7a 7a 7a 7a 47 00 fb a0 10 00 00 00 D Bluetooth: hci0: 00000000: 10 01 0a
E Bluetooth: hci0: ---- Dump of debug registers —
E Bluetooth: hci0: boot stage: 0xe0fb0047
E Bluetooth: hci0: ipc status: 0x00000004
E Bluetooth: hci0: ipc control: 0x00000000
E Bluetooth: hci0: ipc sleep control: 0x00000000
E Bluetooth: hci0: mbox_1: 0x00badbad
E Bluetooth: hci0: mbox_2: 0x0000101c
E Bluetooth: hci0: mbox_3: 0x00000008
E Bluetooth: hci0: mbox_4: 0x7a7a7a7a
---
changes from v1->v2:
- Update commit message
- Add dmesg snipped related firmware exception
drivers/bluetooth/btintel_pcie.c | 3 ++- drivers/bluetooth/btintel_pcie.h | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/bluetooth/btintel_pcie.c +2 -1
@@ -396,8 +396,9 @@ static int btintel_pcie_submit_rx(struct btintel_pcie_data *data)static int btintel_pcie_start_rx (struct btintel_pcie_data *data) {int i, ret; +struct rxq *rxq = &data->rxq; -for (i =0 ; i <BTINTEL_PCIE_RX_MAX_QUEUE ; i++) { +for (i =0 ; i < rxq->count; i++) { ret =btintel_pcie_submit_rx (data);if (ret)return ret;
drivers/bluetooth/btintel_pcie.h +0 -3
@@ -177,9 +177,6 @@ enum {/* Doorbell vector for TFD */ #define BTINTEL_PCIE_TX_DB_VEC 0 -/* Number of pending RX requests for downlink */ -#define BTINTEL_PCIE_RX_MAX_QUEUE 6 -/* Doorbell vector for FRBD */ #define BTINTEL_PCIE_RX_DB_VEC 513
Signature · 1 line
2.43.0
PATCH v2 2/3 Bluetooth: btintel_pcie: Increase the tx and rx descriptor count
From: Chandrashekar Devegowda <[email protected]>
This change addresses latency issues observed in HID use cases where events arrive in bursts. By increasing the Rx descriptor count to 64, the firmware can handle bursty data more effectively, reducing latency and preventing buffer overflows.
--- drivers/bluetooth/btintel_pcie.c | 24 ++++++++++++------------ drivers/bluetooth/btintel_pcie.h | 7 +++++-- 2 files changed, 17 insertions(+), 14 deletions(-)
drivers/bluetooth/btintel_pcie.c +12 -12
@@ -1783,8 +1783,8 @@ static int btintel_pcie_alloc(struct btintel_pcie_data *data)* + size of index * Number of queues(2) * type of index array(4) * + size of context information */ - total = (sizeof (struct tfd ) +sizeof (struct urbd0 ) +sizeof (struct frbd ) - +sizeof (struct urbd1 )) *BTINTEL_DESCS_COUNT ; + total = (sizeof (struct tfd ) +sizeof (struct urbd0 )) *BTINTEL_PCIE_TX_DESCS_COUNT ; + total += (sizeof (struct frbd ) +sizeof (struct urbd1 )) *BTINTEL_PCIE_RX_DESCS_COUNT ;/* Add the sum of size of index array and size of ci struct */ total += (sizeof (u16) *BTINTEL_PCIE_NUM_QUEUES *4 ) +sizeof (struct ctx_info );
@@ -1809,36 +1809,36 @@ static int btintel_pcie_alloc(struct btintel_pcie_data *data) data->dma_v_addr = v_addr;/* Setup descriptor count */ - data->txq.count =BTINTEL_DESCS_COUNT ; - data->rxq.count =BTINTEL_DESCS_COUNT ; + data->txq.count =BTINTEL_PCIE_TX_DESCS_COUNT ; + data->rxq.count =BTINTEL_PCIE_RX_DESCS_COUNT ;/* Setup tfds */ data->txq.tfds_p_addr = p_addr; data->txq.tfds = v_addr; - p_addr += (sizeof (struct tfd ) *BTINTEL_DESCS_COUNT ); - v_addr += (sizeof (struct tfd ) *BTINTEL_DESCS_COUNT ); + p_addr += (sizeof (struct tfd ) *BTINTEL_PCIE_TX_DESCS_COUNT ); + v_addr += (sizeof (struct tfd ) *BTINTEL_PCIE_TX_DESCS_COUNT );/* Setup urbd0 */ data->txq.urbd0s_p_addr = p_addr; data->txq.urbd0s = v_addr; - p_addr += (sizeof (struct urbd0 ) *BTINTEL_DESCS_COUNT ); - v_addr += (sizeof (struct urbd0 ) *BTINTEL_DESCS_COUNT ); + p_addr += (sizeof (struct urbd0 ) *BTINTEL_PCIE_TX_DESCS_COUNT ); + v_addr += (sizeof (struct urbd0 ) *BTINTEL_PCIE_TX_DESCS_COUNT );/* Setup FRBD*/ data->rxq.frbds_p_addr = p_addr; data->rxq.frbds = v_addr; - p_addr += (sizeof (struct frbd ) *BTINTEL_DESCS_COUNT ); - v_addr += (sizeof (struct frbd ) *BTINTEL_DESCS_COUNT ); + p_addr += (sizeof (struct frbd ) *BTINTEL_PCIE_RX_DESCS_COUNT ); + v_addr += (sizeof (struct frbd ) *BTINTEL_PCIE_RX_DESCS_COUNT );/* Setup urbd1 */ data->rxq.urbd1s_p_addr = p_addr; data->rxq.urbd1s = v_addr; - p_addr += (sizeof (struct urbd1 ) *BTINTEL_DESCS_COUNT ); - v_addr += (sizeof (struct urbd1 ) *BTINTEL_DESCS_COUNT ); + p_addr += (sizeof (struct urbd1 ) *BTINTEL_PCIE_RX_DESCS_COUNT ); + v_addr += (sizeof (struct urbd1 ) *BTINTEL_PCIE_RX_DESCS_COUNT );/* Setup data buffers for txq */ err =btintel_pcie_setup_txq_bufs (data, &data->txq);
drivers/bluetooth/btintel_pcie.h +5 -2
@@ -154,8 +154,11 @@ enum msix_mbox_int_causes {/* Default interrupt timeout in msec */ #define BTINTEL_DEFAULT_INTR_TIMEOUT_MS 3000 -/* The number of descriptors in TX/RX queues */ -#define BTINTEL_DESCS_COUNT 16 +/* The number of descriptors in TX queues */ +#define BTINTEL_PCIE_TX_DESCS_COUNT 32 + +/* The number of descriptors in RX queues */ +#define BTINTEL_PCIE_RX_DESCS_COUNT 64/* Number of Queue for TX and RX * It indicates the index of the IA(Index Array)
Signature · 1 line
2.43.0
PATCH v2 3/3 Bluetooth: btintel_pcie: Reduce driver buffer posting to prevent race condition
In reply to Kiran KFrom: Chandrashekar Devegowda <[email protected]>
Modify the driver to post 3 fewer buffers than the maximum rx buffers
(64) allowed for the firmware. This change mitigates a hardware issue causing a race condition in the firmware, improving stability and data handling.
---
changes from v1->v2:
- Add errata details
drivers/bluetooth/btintel_pcie.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/bluetooth/btintel_pcie.c +6 -1
@@ -398,7 +398,12 @@ static int btintel_pcie_start_rx(struct btintel_pcie_data *data)int i, ret;struct rxq *rxq = &data->rxq; -for (i =0 ; i < rxq->count; i++) { +/* WREQ-198603 - Post (BTINTEL_PCIE_RX_DESCS_COUNT - 3) buffers to +* overcome the hardware issues leading to race condition at the +* firmware. +*/ + +for (i =0 ; i < rxq->count -3 ; i++) { ret =btintel_pcie_submit_rx (data);if (ret)return ret;
Signature · 1 line
2.43.0
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=967825
---Test result---
Test Summary:
CheckPatch PENDING 0.21 seconds GitLint PENDING 0.20 seconds SubjectPrefix PASS 0.35 seconds BuildKernel PASS 24.36 seconds CheckAllWarning PASS 26.61 seconds CheckSparse PASS 29.99 seconds BuildKernel32 PASS 23.87 seconds TestRunnerSetup PASS 453.04 seconds TestRunner_l2cap-tester PASS 24.98 seconds TestRunner_iso-tester PASS 43.65 seconds TestRunner_bnep-tester PASS 5.80 seconds TestRunner_mgmt-tester PASS 146.57 seconds TestRunner_rfcomm-tester PASS 9.35 seconds TestRunner_sco-tester PASS 14.55 seconds TestRunner_ioctl-tester PASS 9.70 seconds TestRunner_mesh-tester PASS 7.22 seconds TestRunner_smp-tester PASS 8.44 seconds TestRunner_userchan-tester PASS 6.08 seconds IncrementalBuild PENDING 0.83 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:
---
Regards,
Linux Bluetooth
This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 23 lines · On Sun, 1 Jun 2025 08:58:22 +0530 you wrote:
The driver was posting only 6 rx buffers, despite the maximum rx buffers being defined as 16. Having fewer RX buffers caused firmware exceptions in HID use cases when events arrived in bursts.
Exception seen on android 6.12 kernel.
E Bluetooth: hci0: Received hw exception interrupt
E Bluetooth: hci0: Received gp1 mailbox interrupt
D Bluetooth: hci0: 00000000: ff 3e 87 80 03 01 01 01 03 01 0c 0d 02 1c 10 0e D Bluetooth: hci0: 00000010: 01 00 05 14 66 b0 28 b0 c0 b0 28 b0 ac af 28 b0 D Bluetooth: hci0: 00000020: 14 f1 28 b0 00 00 00 00 fa 04 00 00 00 00 40 10 D Bluetooth: hci0: 00000030: 08 00 00 00 7a 7a 7a 7a 47 00 fb a0 10 00 00 00 D Bluetooth: hci0: 00000000: 10 01 0a
E Bluetooth: hci0: ---- Dump of debug registers —
E Bluetooth: hci0: boot stage:0xe0fb0047
E Bluetooth: hci0: ipc status:0x00000004
E Bluetooth: hci0: ipc control:0x00000000
E Bluetooth: hci0: ipc sleep control:0x00000000
E Bluetooth: hci0:mbox_1:0x00badbad
E Bluetooth: hci0:mbox_2:0x0000101c
E Bluetooth: hci0:mbox_3:0x00000008
E Bluetooth: hci0:mbox_4:0x7a7a7a7a
Quoted 1 line
[...]
Here is the summary with links:
- [v2,1/3] Bluetooth: btintel_pcie: Fix driver not posting maximum rx buffers
https://git.kernel.org/bluetooth/bluetooth-next/c/31b3d39c89f9 - [v2,2/3] Bluetooth: btintel_pcie: Increase the tx and rx descriptor count https://git.kernel.org/bluetooth/bluetooth-next/c/e849b59c9db0
- [v2,3/3] Bluetooth: btintel_pcie: Reduce driver buffer posting to prevent race condition (no matching commit)
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html