public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/3] Bluetooth: btintel_pcie: Fix driver not posting maximum rx buffers
@ 2025-06-03 10:04 Kiran K
  2025-06-03 10:04 ` [PATCH v3 2/3] Bluetooth: btintel_pcie: Increase the tx and rx descriptor count Kiran K
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Kiran K @ 2025-06-03 10:04 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: ravishankar.srivatsa, chethan.tumkur.narayan,
	chandrashekar.devegowda, vijay.satija, aluvala.sai.teja, Kiran K

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

Signed-off-by: Chandrashekar Devegowda <chandrashekar.devegowda@intel.com>
Signed-off-by: Kiran K <kiran.k@intel.com>
Fixes: c2b636b3f788 ("Bluetooth: btintel_pcie: Add support for PCIe transport")
---
changes from v2->v3:
- No change

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(-)

diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 50fe17f1e1d1..2c7731803c9f 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -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;
diff --git a/drivers/bluetooth/btintel_pcie.h b/drivers/bluetooth/btintel_pcie.h
index 21b964b15c1c..5ddd6d7d8d45 100644
--- a/drivers/bluetooth/btintel_pcie.h
+++ b/drivers/bluetooth/btintel_pcie.h
@@ -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
 
-- 
2.43.0


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

* [PATCH v3 2/3] Bluetooth: btintel_pcie: Increase the tx and rx descriptor count
  2025-06-03 10:04 [PATCH v3 1/3] Bluetooth: btintel_pcie: Fix driver not posting maximum rx buffers Kiran K
@ 2025-06-03 10:04 ` Kiran K
  2025-06-03 10:04 ` [PATCH v3] Bluetooth: btintel_pcie: Reduce driver buffer posting to prevent race condition Kiran K
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Kiran K @ 2025-06-03 10:04 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: ravishankar.srivatsa, chethan.tumkur.narayan,
	chandrashekar.devegowda, vijay.satija, aluvala.sai.teja, Kiran K

From: Chandrashekar Devegowda <chandrashekar.devegowda@intel.com>

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.

Signed-off-by: Chandrashekar Devegowda <chandrashekar.devegowda@intel.com>
Signed-off-by: Kiran K <kiran.k@intel.com>
Fixes: c2b636b3f788 ("Bluetooth: btintel_pcie: Add support for PCIe transport")
---
changes in v3:
 - Add fixes tag

changes in v2:
 - No change

 drivers/bluetooth/btintel_pcie.c | 24 ++++++++++++------------
 drivers/bluetooth/btintel_pcie.h |  7 +++++--
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 2c7731803c9f..03f13de4a723 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -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);
diff --git a/drivers/bluetooth/btintel_pcie.h b/drivers/bluetooth/btintel_pcie.h
index 5ddd6d7d8d45..7dad4523236c 100644
--- a/drivers/bluetooth/btintel_pcie.h
+++ b/drivers/bluetooth/btintel_pcie.h
@@ -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)
-- 
2.43.0


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

* [PATCH v3] Bluetooth: btintel_pcie: Reduce driver buffer posting to prevent race condition
  2025-06-03 10:04 [PATCH v3 1/3] Bluetooth: btintel_pcie: Fix driver not posting maximum rx buffers Kiran K
  2025-06-03 10:04 ` [PATCH v3 2/3] Bluetooth: btintel_pcie: Increase the tx and rx descriptor count Kiran K
@ 2025-06-03 10:04 ` Kiran K
  2025-06-03 10:18   ` [v3] " bluez.test.bot
  2025-06-03 14:50   ` [PATCH v3] " patchwork-bot+bluetooth
  2025-06-03 10:36 ` [v3,1/3] Bluetooth: btintel_pcie: Fix driver not posting maximum rx buffers bluez.test.bot
  2025-06-03 14:50 ` [PATCH v3 1/3] " patchwork-bot+bluetooth
  3 siblings, 2 replies; 7+ messages in thread
From: Kiran K @ 2025-06-03 10:04 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: ravishankar.srivatsa, chethan.tumkur.narayan,
	chandrashekar.devegowda, vijay.satija, aluvala.sai.teja, Kiran K

From: Chandrashekar Devegowda <chandrashekar.devegowda@intel.com>

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.

Signed-off-by: Chandrashekar Devegowda <chandrashekar.devegowda@intel.com>
Signed-off-by: Kiran K <kiran.k@intel.com>
Fixes: c2b636b3f788 ("Bluetooth: btintel_pcie: Add support for PCIe transport")
---
changes in v3:
 - Remove reference to JIRA link
 - Add Fixes tag

 drivers/bluetooth/btintel_pcie.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 03f13de4a723..563165c5efae 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -398,7 +398,11 @@ 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++) {
+	/* 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;
-- 
2.43.0


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

* RE: [v3] Bluetooth: btintel_pcie: Reduce driver buffer posting to prevent race condition
  2025-06-03 10:04 ` [PATCH v3] Bluetooth: btintel_pcie: Reduce driver buffer posting to prevent race condition Kiran K
@ 2025-06-03 10:18   ` bluez.test.bot
  2025-06-03 14:50   ` [PATCH v3] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 7+ messages in thread
From: bluez.test.bot @ 2025-06-03 10:18 UTC (permalink / raw)
  To: linux-bluetooth, kiran.k

[-- Attachment #1: Type: text/plain, Size: 566 bytes --]

This is an automated email and please do not reply to this email.

Dear Submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.

----- Output -----

error: patch failed: drivers/bluetooth/btintel_pcie.c:398
error: drivers/bluetooth/btintel_pcie.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch

Please resolve the issue and submit the patches again.


---
Regards,
Linux Bluetooth


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

* RE: [v3,1/3] Bluetooth: btintel_pcie: Fix driver not posting maximum rx buffers
  2025-06-03 10:04 [PATCH v3 1/3] Bluetooth: btintel_pcie: Fix driver not posting maximum rx buffers Kiran K
  2025-06-03 10:04 ` [PATCH v3 2/3] Bluetooth: btintel_pcie: Increase the tx and rx descriptor count Kiran K
  2025-06-03 10:04 ` [PATCH v3] Bluetooth: btintel_pcie: Reduce driver buffer posting to prevent race condition Kiran K
@ 2025-06-03 10:36 ` bluez.test.bot
  2025-06-03 14:50 ` [PATCH v3 1/3] " patchwork-bot+bluetooth
  3 siblings, 0 replies; 7+ messages in thread
From: bluez.test.bot @ 2025-06-03 10:36 UTC (permalink / raw)
  To: linux-bluetooth, kiran.k

[-- Attachment #1: Type: text/plain, Size: 1682 bytes --]

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=968236

---Test result---

Test Summary:
CheckPatch                    PENDING   0.40 seconds
GitLint                       PENDING   0.34 seconds
SubjectPrefix                 PASS      0.12 seconds
BuildKernel                   PASS      24.50 seconds
CheckAllWarning               PASS      27.26 seconds
CheckSparse                   PASS      30.68 seconds
BuildKernel32                 PASS      24.40 seconds
TestRunnerSetup               PASS      460.82 seconds
TestRunner_l2cap-tester       PASS      25.20 seconds
TestRunner_iso-tester         PASS      41.49 seconds
TestRunner_bnep-tester        PASS      5.79 seconds
TestRunner_mgmt-tester        PASS      129.88 seconds
TestRunner_rfcomm-tester      PASS      9.46 seconds
TestRunner_sco-tester         PASS      14.80 seconds
TestRunner_ioctl-tester       PASS      10.02 seconds
TestRunner_mesh-tester        PASS      7.33 seconds
TestRunner_smp-tester         PASS      8.55 seconds
TestRunner_userchan-tester    PASS      6.35 seconds
IncrementalBuild              PENDING   0.63 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


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

* Re: [PATCH v3] Bluetooth: btintel_pcie: Reduce driver buffer posting to prevent race condition
  2025-06-03 10:04 ` [PATCH v3] Bluetooth: btintel_pcie: Reduce driver buffer posting to prevent race condition Kiran K
  2025-06-03 10:18   ` [v3] " bluez.test.bot
@ 2025-06-03 14:50   ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 7+ messages in thread
From: patchwork-bot+bluetooth @ 2025-06-03 14:50 UTC (permalink / raw)
  To: Kiran K
  Cc: linux-bluetooth, ravishankar.srivatsa, chethan.tumkur.narayan,
	chandrashekar.devegowda, vijay.satija, aluvala.sai.teja

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Tue,  3 Jun 2025 15:34:40 +0530 you wrote:
> From: Chandrashekar Devegowda <chandrashekar.devegowda@intel.com>
> 
> 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.
> 
> [...]

Here is the summary with links:
  - [v3] Bluetooth: btintel_pcie: Reduce driver buffer posting to prevent race condition
    https://git.kernel.org/bluetooth/bluetooth-next/c/fa2c8bfe6794

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH v3 1/3] Bluetooth: btintel_pcie: Fix driver not posting maximum rx buffers
  2025-06-03 10:04 [PATCH v3 1/3] Bluetooth: btintel_pcie: Fix driver not posting maximum rx buffers Kiran K
                   ` (2 preceding siblings ...)
  2025-06-03 10:36 ` [v3,1/3] Bluetooth: btintel_pcie: Fix driver not posting maximum rx buffers bluez.test.bot
@ 2025-06-03 14:50 ` patchwork-bot+bluetooth
  3 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+bluetooth @ 2025-06-03 14:50 UTC (permalink / raw)
  To: Kiran K
  Cc: linux-bluetooth, ravishankar.srivatsa, chethan.tumkur.narayan,
	chandrashekar.devegowda, vijay.satija, aluvala.sai.teja

Hello:

This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Tue,  3 Jun 2025 15:34:38 +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
> 
> [...]

Here is the summary with links:
  - [v3,1/3] Bluetooth: btintel_pcie: Fix driver not posting maximum rx buffers
    https://git.kernel.org/bluetooth/bluetooth-next/c/31b3d39c89f9
  - [v3,2/3] Bluetooth: btintel_pcie: Increase the tx and rx descriptor count
    https://git.kernel.org/bluetooth/bluetooth-next/c/e849b59c9db0

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-06-03 14:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-03 10:04 [PATCH v3 1/3] Bluetooth: btintel_pcie: Fix driver not posting maximum rx buffers Kiran K
2025-06-03 10:04 ` [PATCH v3 2/3] Bluetooth: btintel_pcie: Increase the tx and rx descriptor count Kiran K
2025-06-03 10:04 ` [PATCH v3] Bluetooth: btintel_pcie: Reduce driver buffer posting to prevent race condition Kiran K
2025-06-03 10:18   ` [v3] " bluez.test.bot
2025-06-03 14:50   ` [PATCH v3] " patchwork-bot+bluetooth
2025-06-03 10:36 ` [v3,1/3] Bluetooth: btintel_pcie: Fix driver not posting maximum rx buffers bluez.test.bot
2025-06-03 14:50 ` [PATCH v3 1/3] " patchwork-bot+bluetooth

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