Skip to contentSkip to conversation

Bluetooth: btintel_pcie: Make driver wait for alive interrupt

PATCH Superseded Kiran K 4 participants 15 messages Jul 7, 2025 – Jul 15, 2025 Bluetooth drivers

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Kiran K

author
#0 lore raw

PATCH 1/2 Bluetooth: btintel_pcie: Make driver wait for alive interrupt

Firmware raises an alive interrupt upon receiving the 0xfc01 (Intel reset) command. This change fixes the driver to properly wait for the alive interrupt.

Fixes 05c200c8f029 ("Bluetooth: btintel_pcie: Add handshake between driver and firmware")
---
 drivers/bluetooth/btintel_pcie.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)
drivers/bluetooth/btintel_pcie.c +14 -13
index 1113a6310bd0..f893ad6fc87a 100644
@@ -947,11 +947,13 @@ static void btintel_pcie_msix_gp0_handler(struct btintel_pcie_data *data)
 	case BTINTEL_PCIE_INTEL_HCI_RESET1:
 		if (btintel_pcie_in_op(data)) {
 			submit_rx = true;
+			signal_waitq = true;
 			break;
 		}
 
 		if (btintel_pcie_in_iml(data)) {
 			submit_rx = true;
+			signal_waitq = true;
 			data->alive_intr_ctxt = BTINTEL_PCIE_FW_DL;
 			break;
 		}
@@ -1985,8 +1987,9 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
 			if (opcode == 0xfc01)
 				btintel_pcie_inject_cmd_complete(hdev, opcode);
 		}
-		/* Firmware raises alive interrupt on HCI_OP_RESET */
-		if (opcode == HCI_OP_RESET)
+
+		/* Firmware raises alive interrupt on HCI_OP_RESET or 0xfc01*/
+		if (opcode == HCI_OP_RESET || opcode == 0xfc01)
 			data->gp0_received = false;
 
 		hdev->stat.cmd_tx++;
@@ -2025,17 +2028,15 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
 		bt_dev_dbg(data->hdev, "sent cmd: 0x%4.4x alive context changed: %s  ->  %s",
 			   opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
 			   btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
-		if (opcode == HCI_OP_RESET) {
-			ret = wait_event_timeout(data->gp0_wait_q,
-						 data->gp0_received,
-						 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
-			if (!ret) {
-				hdev->stat.err_tx++;
-				bt_dev_err(hdev, "No alive interrupt received for %s",
-					   btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
-				ret = -ETIME;
-				goto exit_error;
-			}
+		ret = wait_event_timeout(data->gp0_wait_q,
+					 data->gp0_received,
+					 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
+		if (!ret) {
+			hdev->stat.err_tx++;
+			bt_dev_err(hdev, "No alive interrupt received for %s",
+				   btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
+			ret = -ETIME;
+			goto exit_error;
 		}
 	}
 	hdev->stat.byte_tx += skb->len;
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 2/2 Bluetooth: btintel_pcie: Fix alive context state handling

Firmware raises alive interrpt on sending 0xfc01 command. Alive context maintained in driver needs to be updated before sending 0xfc01 (Intel Reset) or 0x03c0 (HCI Reset) to avoid the potential race condition where the context is also updated in threaded irq.

Fixes 05c200c8f029 ("Bluetooth: btintel_pcie: Add handshake between driver and firmware")
---
 drivers/bluetooth/btintel_pcie.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/bluetooth/btintel_pcie.c +14 -11
index f893ad6fc87a..d29103b102e4 100644
@@ -1988,10 +1988,6 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
 				btintel_pcie_inject_cmd_complete(hdev, opcode);
 		}
 
-		/* Firmware raises alive interrupt on HCI_OP_RESET or 0xfc01*/
-		if (opcode == HCI_OP_RESET || opcode == 0xfc01)
-			data->gp0_received = false;
-
 		hdev->stat.cmd_tx++;
 		break;
 	case HCI_ACLDATA_PKT:
@@ -2012,6 +2008,20 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
 	memcpy(skb_push(skb, BTINTEL_PCIE_HCI_TYPE_LEN), &type,
 	       BTINTEL_PCIE_HCI_TYPE_LEN);
 
+	if (type == BTINTEL_PCIE_HCI_CMD_PKT) {
+		/* Firmware raises alive interrupt on HCI_OP_RESET or 0xfc01*/
+		if (opcode == HCI_OP_RESET || opcode == 0xfc01) {
+			data->gp0_received = false;
+			old_ctxt = data->alive_intr_ctxt;
+			data->alive_intr_ctxt =
+				(opcode == 0xfc01 ? BTINTEL_PCIE_INTEL_HCI_RESET1 :
+					BTINTEL_PCIE_HCI_RESET);
+			bt_dev_dbg(data->hdev, "sending cmd: 0x%4.4x alive context changed: %s  ->  %s",
+				   opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
+				   btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
+		}
+	}
+
 	ret = btintel_pcie_send_sync(data, skb);
 	if (ret) {
 		hdev->stat.err_tx++;
@@ -2021,13 +2031,6 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
 
 	if (type == BTINTEL_PCIE_HCI_CMD_PKT &&
 	    (opcode == HCI_OP_RESET || opcode == 0xfc01)) {
-		old_ctxt = data->alive_intr_ctxt;
-		data->alive_intr_ctxt =
-			(opcode == 0xfc01 ? BTINTEL_PCIE_INTEL_HCI_RESET1 :
-				BTINTEL_PCIE_HCI_RESET);
-		bt_dev_dbg(data->hdev, "sent cmd: 0x%4.4x alive context changed: %s  ->  %s",
-			   opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
-			   btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
 		ret = wait_event_timeout(data->gp0_wait_q,
 					 data->gp0_received,
 					 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
Signature · 1 line
2.43.0
#8 lore raw
In reply to Kiran K

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

---Test result---

Test Summary:

CheckPatch                    PENDING   0.36 seconds
GitLint                       PENDING   0.23 seconds
SubjectPrefix                 PASS      0.18 seconds
BuildKernel                   PASS      24.10 seconds
CheckAllWarning               PASS      26.41 seconds
CheckSparse                   PASS      29.76 seconds
BuildKernel32                 PASS      23.98 seconds
TestRunnerSetup               PASS      466.76 seconds
TestRunner_l2cap-tester       PASS      24.93 seconds
TestRunner_iso-tester         PASS      33.97 seconds
TestRunner_bnep-tester        PASS      5.93 seconds
TestRunner_mgmt-tester        FAIL      130.72 seconds
TestRunner_rfcomm-tester      PASS      9.22 seconds
TestRunner_sco-tester         PASS      14.60 seconds
TestRunner_ioctl-tester       PASS      9.92 seconds
TestRunner_mesh-tester        FAIL      11.32 seconds
TestRunner_smp-tester         PASS      8.43 seconds
TestRunner_userchan-tester    PASS      6.11 seconds
IncrementalBuild              PENDING   0.70 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 490, Passed: 482 (98.4%), Failed: 4, Not Run: 4

Failed Test Cases

LL Privacy - Add Device 2 (2 Devices to AL)          Failed       0.194 seconds
LL Privacy - Set Flags 1 (Add to RL)                 Failed       0.160 seconds
LL Privacy - Set Flags 2 (Enable RL)                 Failed       0.164 seconds
LL Privacy - Start Discovery 2 (Disable RL)          Failed       0.200 seconds

##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0

Failed Test Cases

Mesh - Send cancel - 1                               Timed out    2.170 seconds
Mesh - Send cancel - 2                               Timed out    2.004 seconds

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:

---
Regards,
Linux Bluetooth

#9 lore raw
In reply to Kiran K

Dear Sai, dear Kiran,

Thank you for your patch.

Am 07.07.25 um 05:46 schrieb Kiran K:

Quoted 3 lines

Firmware raises an alive interrupt upon receiving the 0xfc01 (Intel reset) command. This change fixes the driver to properly wait for the alive interrupt.

What is the consequence of not waiting?

Quoted 26 lines
Fixes 05c200c8f029 ("Bluetooth: btintel_pcie: Add handshake between driver and firmware")
---
  drivers/bluetooth/btintel_pcie.c | 27 ++++++++++++++-------------
  1 file changed, 14 insertions(+), 13 deletions(-)
drivers/bluetooth/btintel_pcie.c +2 -0
index 1113a6310bd0..f893ad6fc87a 100644
@@ -947,11 +947,13 @@ static void btintel_pcie_msix_gp0_handler(struct btintel_pcie_data *data)
  	case BTINTEL_PCIE_INTEL_HCI_RESET1:
  		if (btintel_pcie_in_op(data)) {
  			submit_rx = true;
+			signal_waitq = true;
  			break;
  		}
 
  		if (btintel_pcie_in_iml(data)) {
  			submit_rx = true;
+			signal_waitq = true;
  			data->alive_intr_ctxt = BTINTEL_PCIE_FW_DL;
  			break;
  		}

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 1991

Quoted 7 lines
drivers/bluetooth/btintel_pcie.c +2 -2
@@ -1985,8 +1987,9 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
  			if (opcode == 0xfc01)
  				btintel_pcie_inject_cmd_complete(hdev, opcode);
  		}
-		/* Firmware raises alive interrupt on HCI_OP_RESET */
-		if (opcode == HCI_OP_RESET)
+
+		/* Firmware raises alive interrupt on HCI_OP_RESET or 0xfc01*/

A space is missing before */.

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 1992

Quoted 1 line
drivers/bluetooth/btintel_pcie.c +1 -0
+		if (opcode == HCI_OP_RESET || opcode == 0xfc01)

Please define a macro for the magic number.

Quoted 15 lines
drivers/bluetooth/btintel_pcie.c +0 -8
  			data->gp0_received = false;
 
  		hdev->stat.cmd_tx++;
@@ -2025,17 +2028,15 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
  		bt_dev_dbg(data->hdev, "sent cmd: 0x%4.4x alive context changed: %s  ->  %s",
  			   opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
  			   btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
-		if (opcode == HCI_OP_RESET) {
-			ret = wait_event_timeout(data->gp0_wait_q,
-						 data->gp0_received,
-						 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
-			if (!ret) {
-				hdev->stat.err_tx++;
-				bt_dev_err(hdev, "No alive interrupt received for %s",
-					   btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 2037

Quoted 10 lines
drivers/bluetooth/btintel_pcie.c +7 -3
-				ret = -ETIME;
-				goto exit_error;
-			}
+		ret = wait_event_timeout(data->gp0_wait_q,
+					 data->gp0_received,
+					 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
+		if (!ret) {
+			hdev->stat.err_tx++;
+			bt_dev_err(hdev, "No alive interrupt received for %s",
+				   btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));

In a follow-up patch, the log message could be improved by also adding the timeout value to it.

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 2042

Quoted 5 lines
drivers/bluetooth/btintel_pcie.c +2 -0
+			ret = -ETIME;
+			goto exit_error;
  		}
  	}
  	hdev->stat.byte_tx += skb->len;

Kind regards,

Paul

#2 lore raw

Re: [PATCH v1 2/2] Bluetooth: btintel_pcie: Fix alive context state handling

In reply to Kiran K

Dear Kiran, dear Sai,

Thank you for the patch.

Am 07.07.25 um 05:46 schrieb Kiran K:

Quoted 1 line

Firmware raises alive interrpt on sending 0xfc01 command. Alive context

interr*u*pt

(I would have hoped, two developers would spot such a typo, a spell checker also highlights.)

Quoted 3 lines

maintained in driver needs to be updated before sending 0xfc01 (Intel Reset) or 0x03c0 (HCI Reset) to avoid the potential race condition where the context is also updated in threaded irq.

Do you have a reproducer for the issue?

Quoted 3 lines
Fixes 05c200c8f029 ("Bluetooth: btintel_pcie: Add handshake between driver and firmware")

I’d add the Fixes tag before the Signed-off-by lines.

Quoted 20 lines
---
  drivers/bluetooth/btintel_pcie.c | 25 ++++++++++++++-----------
  1 file changed, 14 insertions(+), 11 deletions(-)
drivers/bluetooth/btintel_pcie.c +0 -4
index f893ad6fc87a..d29103b102e4 100644
@@ -1988,10 +1988,6 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
  				btintel_pcie_inject_cmd_complete(hdev, opcode);
  		}
 
-		/* Firmware raises alive interrupt on HCI_OP_RESET or 0xfc01*/
-		if (opcode == HCI_OP_RESET || opcode == 0xfc01)
-			data->gp0_received = false;
-
  		hdev->stat.cmd_tx++;
  		break;
  	case HCI_ACLDATA_PKT:

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 2013

Quoted 6 lines
drivers/bluetooth/btintel_pcie.c +3 -0
@@ -2012,6 +2008,20 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
  	memcpy(skb_push(skb, BTINTEL_PCIE_HCI_TYPE_LEN), &type,
  	       BTINTEL_PCIE_HCI_TYPE_LEN);
 
+	if (type == BTINTEL_PCIE_HCI_CMD_PKT) {
+		/* Firmware raises alive interrupt on HCI_OP_RESET or 0xfc01*/
+		if (opcode == HCI_OP_RESET || opcode == 0xfc01) {

Why not keep the form of just one if statement with && in the condition? as below?

Quoted 18 lines
drivers/bluetooth/btintel_pcie.c +11 -0
+			data->gp0_received = false;
+			old_ctxt = data->alive_intr_ctxt;
+			data->alive_intr_ctxt =
+				(opcode == 0xfc01 ? BTINTEL_PCIE_INTEL_HCI_RESET1 :
+					BTINTEL_PCIE_HCI_RESET);
+			bt_dev_dbg(data->hdev, "sending cmd: 0x%4.4x alive context changed: %s  ->  %s",
+				   opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
+				   btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
+		}
+	}
+
  	ret = btintel_pcie_send_sync(data, skb);
  	if (ret) {
  		hdev->stat.err_tx++;
@@ -2021,13 +2031,6 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
 
  	if (type == BTINTEL_PCIE_HCI_CMD_PKT &&
  	    (opcode == HCI_OP_RESET || opcode == 0xfc01)) {

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 2036

Quoted 10 lines
drivers/bluetooth/btintel_pcie.c +0 -7
-		old_ctxt = data->alive_intr_ctxt;
-		data->alive_intr_ctxt =
-			(opcode == 0xfc01 ? BTINTEL_PCIE_INTEL_HCI_RESET1 :
-				BTINTEL_PCIE_HCI_RESET);
-		bt_dev_dbg(data->hdev, "sent cmd: 0x%4.4x alive context changed: %s  ->  %s",
-			   opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
-			   btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
  		ret = wait_event_timeout(data->gp0_wait_q,
  					 data->gp0_received,
  					 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));

Kind regards,

Paul

author
#10 lore raw
In reply to Paul Menzel

Hi Paul,

Thanks for the comments.

Quoted 6 lines

Subject: Re: [PATCH v1 1/2] Bluetooth: btintel_pcie: Make driver wait for alive interrupt

Dear Sai, dear Kiran,

Quoted 8 lines

Thank you for your patch.

Am 07.07.25 um 05:46 schrieb Kiran K:

Quoted 3 lines

Firmware raises an alive interrupt upon receiving the 0xfc01 (Intel reset) command. This change fixes the driver to properly wait for the alive interrupt.

What is the consequence of not waiting?

This is an alignment between driver and firmware. If driver doesn’t wait for alive interrupt, then there is chance of stack sending commands before the firmware is ready to accept.

Quoted 34 lines

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_msix_gp0_handler(struct

Quoted 15 lines
Fixes 05c200c8f029 ("Bluetooth: btintel_pcie: Add handshake between

driver and firmware")

---
  drivers/bluetooth/btintel_pcie.c | 27 ++++++++++++++-------------
  1 file changed, 14 insertions(+), 13 deletions(-)
drivers/bluetooth/btintel_pcie.c +0 -0
index 1113a6310bd0..f893ad6fc87a 100644
@@ -947,11 +947,13 @@ static void btintel_pcie_msix_gp0_handler(struct

btintel_pcie_data *data)

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev

Quoted 14 lines
drivers/bluetooth/btintel_pcie.c +2 -0
  	case BTINTEL_PCIE_INTEL_HCI_RESET1:
  		if (btintel_pcie_in_op(data)) {
  			submit_rx = true;
+			signal_waitq = true;
  			break;
  		}
 
  		if (btintel_pcie_in_iml(data)) {
  			submit_rx = true;
+			signal_waitq = true;
  			data->alive_intr_ctxt = BTINTEL_PCIE_FW_DL;
  			break;
  		}
@@ -1985,8 +1987,9 @@ static int btintel_pcie_send_frame(struct hci_dev

*hdev,

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev · line 1988

Quoted 2 lines
drivers/bluetooth/btintel_pcie.c +0 -0
  			if (opcode == 0xfc01)
  				btintel_pcie_inject_cmd_complete(hdev,

opcode);

Quoted 8 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev,

Quoted 5 lines
drivers/bluetooth/btintel_pcie.c +2 -2
  		}
-		/* Firmware raises alive interrupt on HCI_OP_RESET */
-		if (opcode == HCI_OP_RESET)
+
+		/* Firmware raises alive interrupt on HCI_OP_RESET or

0xfc01*/

A space is missing before */.

Ack.

Quoted 5 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 1992

Quoted 2 lines
drivers/bluetooth/btintel_pcie.c +1 -0
+		if (opcode == HCI_OP_RESET || opcode == 0xfc01)

Please define a macro for the magic number.

This is vendor specific opcode and is also shared across btintel.c, btusb.c and hci_intel.c. Would it be acceptable to submit a separate patch for this change alone?

Quoted 28 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev

Quoted 4 lines
drivers/bluetooth/btintel_pcie.c +0 -0
  			data->gp0_received = false;
 
  		hdev->stat.cmd_tx++;
@@ -2025,17 +2028,15 @@ static int btintel_pcie_send_frame(struct hci_dev

*hdev,

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev · line 2028

Quoted 1 line
drivers/bluetooth/btintel_pcie.c +0 -0
  		bt_dev_dbg(data->hdev, "sent cmd: 0x%4.4x alive context

changed: %s -> %s",

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev,

Quoted 7 lines
drivers/bluetooth/btintel_pcie.c +0 -4
  			   opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
  			   btintel_pcie_alivectxt_state2str(data-
 alive_intr_ctxt));
-		if (opcode == HCI_OP_RESET) {
-			ret = wait_event_timeout(data->gp0_wait_q,
-						 data->gp0_received,
-

msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev,

Quoted 3 lines
drivers/bluetooth/btintel_pcie.c +0 -3
-			if (!ret) {
-				hdev->stat.err_tx++;
-				bt_dev_err(hdev, "No alive interrupt received

for %s",

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev,

Quoted 8 lines
drivers/bluetooth/btintel_pcie.c +3 -4
-					   btintel_pcie_alivectxt_state2str(data-
 alive_intr_ctxt));
-				ret = -ETIME;
-				goto exit_error;
-			}
+		ret = wait_event_timeout(data->gp0_wait_q,
+					 data->gp0_received,
+

msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));

Quoted 8 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev,

Quoted 5 lines
drivers/bluetooth/btintel_pcie.c +4 -0
+		if (!ret) {
+			hdev->stat.err_tx++;
+			bt_dev_err(hdev, "No alive interrupt received for %s",
+				   btintel_pcie_alivectxt_state2str(data-
 alive_intr_ctxt));

In a follow-up patch, the log message could be improved by also adding the timeout value to it.

Ack.

Quoted 11 lines
Quoted 6 lines
drivers/bluetooth/btintel_pcie.c +2 -0
+			ret = -ETIME;
+			goto exit_error;
  		}
  	}
  	hdev->stat.byte_tx += skb->len;

Kind regards,

Paul

Thanks,
Kiran

author
#3 lore raw

RE: [PATCH v1 2/2] Bluetooth: btintel_pcie: Fix alive context state handling

In reply to Paul Menzel

Hi Paul,

Quoted 8 lines

Subject: Re: [PATCH v1 2/2] Bluetooth: btintel_pcie: Fix alive context state handling

Dear Kiran, dear Sai,

Thank you for the patch.

Quoted 8 lines

Am 07.07.25 um 05:46 schrieb Kiran K:

Quoted 2 lines

Firmware raises alive interrpt on sending 0xfc01 command. Alive context

interr*u*pt

(I would have hoped, two developers would spot such a typo, a spell checker also highlights.)

Ack. Unfortunately 'interrpt' was missing in my codespell dictionary. I have updated the same. Thanks.

Quoted 6 lines
Quoted 4 lines

maintained in driver needs to be updated before sending 0xfc01 (Intel Reset) or 0x03c0 (HCI Reset) to avoid the potential race condition where the context is also updated in threaded irq.

Do you have a reproducer for the issue?

Yes. Issue was reproduced in stress reboot scenario although reproduction rate is less - 1/25.

Quoted 7 lines
Quoted 5 lines
Fixes 05c200c8f029 ("Bluetooth: btintel_pcie: Add handshake between

driver and firmware")

I’d add the Fixes tag before the Signed-off-by lines.

Ack.

Quoted 76 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev

Quoted 11 lines
---
  drivers/bluetooth/btintel_pcie.c | 25 ++++++++++++++-----------
  1 file changed, 14 insertions(+), 11 deletions(-)
drivers/bluetooth/btintel_pcie.c +0 -0
index f893ad6fc87a..d29103b102e4 100644
@@ -1988,10 +1988,6 @@ static int btintel_pcie_send_frame(struct hci_dev

*hdev,

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev · line 1988

Quoted 1 line
drivers/bluetooth/btintel_pcie.c +0 -0
  				btintel_pcie_inject_cmd_complete(hdev,

opcode);

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev · line 1991

Quoted 3 lines
drivers/bluetooth/btintel_pcie.c +0 -1
  		}
 
-		/* Firmware raises alive interrupt on HCI_OP_RESET or

0xfc01*/

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev

Quoted 7 lines
drivers/bluetooth/btintel_pcie.c +0 -3
-		if (opcode == HCI_OP_RESET || opcode == 0xfc01)
-			data->gp0_received = false;
-
  		hdev->stat.cmd_tx++;
  		break;
  	case HCI_ACLDATA_PKT:
@@ -2012,6 +2008,20 @@ static int btintel_pcie_send_frame(struct hci_dev

*hdev,

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev,

Quoted 5 lines
drivers/bluetooth/btintel_pcie.c +2 -0
  	memcpy(skb_push(skb, BTINTEL_PCIE_HCI_TYPE_LEN), &type,
  	       BTINTEL_PCIE_HCI_TYPE_LEN);
 
+	if (type == BTINTEL_PCIE_HCI_CMD_PKT) {
+		/* Firmware raises alive interrupt on HCI_OP_RESET or

0xfc01*/

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 2013

Quoted 1 line
drivers/bluetooth/btintel_pcie.c +1 -0
+		if (opcode == HCI_OP_RESET || opcode == 0xfc01) {

Why not keep the form of just one if statement with && in the condition? as below?

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev,

Quoted 4 lines
drivers/bluetooth/btintel_pcie.c +4 -0
+			data->gp0_received = false;
+			old_ctxt = data->alive_intr_ctxt;
+			data->alive_intr_ctxt =
+				(opcode == 0xfc01 ?

BTINTEL_PCIE_INTEL_HCI_RESET1 :

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev · line 2019

Quoted 2 lines
drivers/bluetooth/btintel_pcie.c +2 -0
+					BTINTEL_PCIE_HCI_RESET);
+			bt_dev_dbg(data->hdev, "sending cmd: 0x%4.4x alive

context changed: %s -> %s",

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev · line 2020

Quoted 1 line
drivers/bluetooth/btintel_pcie.c +1 -0
+				   opcode,

btintel_pcie_alivectxt_state2str(old_ctxt),

Quoted 9 lines
drivers/bluetooth/btintel_pcie.c +4 -0
+				   btintel_pcie_alivectxt_state2str(data-
 alive_intr_ctxt));
+		}
+	}
+
  	ret = btintel_pcie_send_sync(data, skb);
  	if (ret) {

hdev->stat.err_tx++;

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct · line 2027

Quoted 7 lines
drivers/bluetooth/btintel_pcie.c +0 -3
@@ -2021,13 +2031,6 @@ static int btintel_pcie_send_frame(struct
 hci_dev *hdev,
 
  	if (type == BTINTEL_PCIE_HCI_CMD_PKT &&
  	    (opcode == HCI_OP_RESET || opcode == 0xfc01)) {
-		old_ctxt = data->alive_intr_ctxt;
-		data->alive_intr_ctxt =
-			(opcode == 0xfc01 ? BTINTEL_PCIE_INTEL_HCI_RESET1

:

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct · line 2029

Quoted 2 lines
drivers/bluetooth/btintel_pcie.c +0 -2
-				BTINTEL_PCIE_HCI_RESET);
-		bt_dev_dbg(data->hdev, "sent cmd: 0x%4.4x alive context

changed: %s -> %s",

Quoted 6 lines
drivers/bluetooth/btintel_pcie.c +0 -2
-			   opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
-			   btintel_pcie_alivectxt_state2str(data-
 alive_intr_ctxt));
  		ret = wait_event_timeout(data->gp0_wait_q,

data->gp0_received,

msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));

Quoted 3 lines

Kind regards,

Paul

Regards,
Kiran

#11 lore raw
In reply to K, Kiran

Dear Kiran,

Am 08.07.25 um 14:23 schrieb K, Kiran:

Quoted 7 lines
Quoted 7 lines

Subject: Re: [PATCH v1 1/2] Bluetooth: btintel_pcie: Make driver wait for alive interrupt

Am 07.07.25 um 05:46 schrieb Kiran K:

Quoted 3 lines

Firmware raises an alive interrupt upon receiving the 0xfc01 (Intel reset) command. This change fixes the driver to properly wait for the alive interrupt.

Quoted 5 lines
Quoted 1 line

What is the consequence of not waiting?

This is an alignment between driver and firmware. If driver doesn’t wait for alive interrupt, then there is chance of stack sending commands before the firmware is ready to accept.

Thank you for elaborating. It’d be great if you added it to the commit message, when you resend.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Fixes 05c200c8f029 ("Bluetooth: btintel_pcie: Add handshake between driver and firmware")

I would also put the Fixes: tag above the Signed-off-by line.

Quoted 35 lines
Quoted 17 lines
Quoted 17 lines
---
   drivers/bluetooth/btintel_pcie.c | 27 ++++++++++++++-------------
   1 file changed, 14 insertions(+), 13 deletions(-)
drivers/bluetooth/btintel_pcie.c +1 -0
index 1113a6310bd0..f893ad6fc87a 100644
@@ -947,11 +947,13 @@ static void btintel_pcie_msix_gp0_handler(struct btintel_pcie_data *data)
   	case BTINTEL_PCIE_INTEL_HCI_RESET1:
   		if (btintel_pcie_in_op(data)) {
   			submit_rx = true;
+			signal_waitq = true;
   			break;
   		}
 
Quoted 16 lines
Quoted 7 lines
drivers/bluetooth/btintel_pcie.c +1 -0
   		if (btintel_pcie_in_iml(data)) {
   			submit_rx = true;
+			signal_waitq = true;
   			data->alive_intr_ctxt = BTINTEL_PCIE_FW_DL;
   			break;
   		}

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 1991

Quoted 7 lines
drivers/bluetooth/btintel_pcie.c +2 -2
@@ -1985,8 +1987,9 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
   			if (opcode == 0xfc01)
   				btintel_pcie_inject_cmd_complete(hdev, opcode);
   		}
-		/* Firmware raises alive interrupt on HCI_OP_RESET */
-		if (opcode == HCI_OP_RESET)
+
+		/* Firmware raises alive interrupt on HCI_OP_RESET or 0xfc01*/

A space is missing before */.

Ack.

Quoted 7 lines
Quoted 3 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 1992

Quoted 1 line
drivers/bluetooth/btintel_pcie.c +1 -0
+		if (opcode == HCI_OP_RESET || opcode == 0xfc01)

Please define a macro for the magic number.

This is vendor specific opcode and is also shared across btintel.c, btusb.c and hci_intel.c. Would it be acceptable to submit a separate patch for this change alone?

Sure. Fine by me.

Quoted 28 lines
Quoted 20 lines
Quoted 20 lines
drivers/bluetooth/btintel_pcie.c +2 -11
   			data->gp0_received = false;
 
   		hdev->stat.cmd_tx++;
@@ -2025,17 +2028,15 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
   		bt_dev_dbg(data->hdev, "sent cmd: 0x%4.4x alive context changed: %s  ->  %s",
   			   opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
   			   btintel_pcie_alivectxt_state2str(data - alive_intr_ctxt));
-		if (opcode == HCI_OP_RESET) {
-			ret = wait_event_timeout(data->gp0_wait_q,
-						 data->gp0_received,
-						 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
-			if (!ret) {
-				hdev->stat.err_tx++;
-				bt_dev_err(hdev, "No alive interrupt received for %s",
-					   btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
-				ret = -ETIME;
-				goto exit_error;
-			}
+		ret = wait_event_timeout(data->gp0_wait_q,
+					 data->gp0_received,
Quoted 8 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 2037

Quoted 5 lines
drivers/bluetooth/btintel_pcie.c +5 -0
+					 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
+		if (!ret) {
+			hdev->stat.err_tx++;
+			bt_dev_err(hdev, "No alive interrupt received for %s",
+				   btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));

In a follow-up patch, the log message could be improved by also adding the timeout value to it.

Quoted 7 lines

Ack.

Quoted 5 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 2042

Quoted 5 lines
drivers/bluetooth/btintel_pcie.c +2 -0
+			ret = -ETIME;
+			goto exit_error;
   		}
   	}
   	hdev->stat.byte_tx += skb->len;

Kind regards,

Paul

#6 lore raw

Re: [PATCH v1 2/2] Bluetooth: btintel_pcie: Fix alive context state handling

In reply to Kiran K

Hi Kiran,

Quoted 5 lines · Kiran K

Firmware raises alive interrpt on sending 0xfc01 command. Alive context maintained in driver needs to be updated before sending 0xfc01 (Intel Reset) or 0x03c0 (HCI Reset) to avoid the potential race condition where the context is also updated in threaded irq.

This should be a little more specific, like explaining what is alive interrupt supposed to mean or if we cannot do any communication wheel these are pending?

Quoted 23 lines
Fixes 05c200c8f029 ("Bluetooth: btintel_pcie: Add handshake between driver and firmware")
---
 drivers/bluetooth/btintel_pcie.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/bluetooth/btintel_pcie.c +0 -4
index f893ad6fc87a..d29103b102e4 100644
@@ -1988,10 +1988,6 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
                                btintel_pcie_inject_cmd_complete(hdev, opcode);
                }
 
-               /* Firmware raises alive interrupt on HCI_OP_RESET or 0xfc01*/
-               if (opcode == HCI_OP_RESET || opcode == 0xfc01)
-                       data->gp0_received = false;
-
                hdev->stat.cmd_tx++;
                break;
        case HCI_ACLDATA_PKT:

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 2014

Quoted 7 lines
drivers/bluetooth/btintel_pcie.c +4 -0
@@ -2012,6 +2008,20 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
        memcpy(skb_push(skb, BTINTEL_PCIE_HCI_TYPE_LEN), &type,
               BTINTEL_PCIE_HCI_TYPE_LEN);
 
+       if (type == BTINTEL_PCIE_HCI_CMD_PKT) {
+               /* Firmware raises alive interrupt on HCI_OP_RESET or 0xfc01*/
+               if (opcode == HCI_OP_RESET || opcode == 0xfc01) {
+                       data->gp0_received = false;

This type of flags should really be made into atomic flags so they can be checked atomically, anyway this shouldn't block these fixes but something I very much look forward to be changed.

Quoted 31 lines
drivers/bluetooth/btintel_pcie.c +10 -8
+                       old_ctxt = data->alive_intr_ctxt;
+                       data->alive_intr_ctxt =
+                               (opcode == 0xfc01 ? BTINTEL_PCIE_INTEL_HCI_RESET1 :
+                                       BTINTEL_PCIE_HCI_RESET);
+                       bt_dev_dbg(data->hdev, "sending cmd: 0x%4.4x alive context changed: %s  ->  %s",
+                                  opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
+                                  btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
+               }
+       }
+
        ret = btintel_pcie_send_sync(data, skb);
        if (ret) {
                hdev->stat.err_tx++;
@@ -2021,13 +2031,6 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
 
        if (type == BTINTEL_PCIE_HCI_CMD_PKT &&
            (opcode == HCI_OP_RESET || opcode == 0xfc01)) {
-               old_ctxt = data->alive_intr_ctxt;
-               data->alive_intr_ctxt =
-                       (opcode == 0xfc01 ? BTINTEL_PCIE_INTEL_HCI_RESET1 :
-                               BTINTEL_PCIE_HCI_RESET);
-               bt_dev_dbg(data->hdev, "sent cmd: 0x%4.4x alive context changed: %s  ->  %s",
-                          opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
-                          btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
                ret = wait_event_timeout(data->gp0_wait_q,
                                         data->gp0_received,
                                         msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
--

2.43.0

Signature · 1 line
Luiz Augusto von Dentz
#13 lore raw
In reply to Kiran K

Hi Kiran,

Quoted 56 lines · Kiran K

Firmware raises an alive interrupt upon receiving the 0xfc01 (Intel reset) command. This change fixes the driver to properly wait for the alive interrupt.

Fixes 05c200c8f029 ("Bluetooth: btintel_pcie: Add handshake between driver and firmware")
---
 drivers/bluetooth/btintel_pcie.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)
drivers/bluetooth/btintel_pcie.c +5 -12
index 1113a6310bd0..f893ad6fc87a 100644
@@ -947,11 +947,13 @@ static void btintel_pcie_msix_gp0_handler(struct btintel_pcie_data *data)
        case BTINTEL_PCIE_INTEL_HCI_RESET1:
                if (btintel_pcie_in_op(data)) {
                        submit_rx = true;
+                       signal_waitq = true;
                        break;
                }
 
                if (btintel_pcie_in_iml(data)) {
                        submit_rx = true;
+                       signal_waitq = true;
                        data->alive_intr_ctxt = BTINTEL_PCIE_FW_DL;
                        break;
                }
@@ -1985,8 +1987,9 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
                        if (opcode == 0xfc01)
                                btintel_pcie_inject_cmd_complete(hdev, opcode);
                }
-               /* Firmware raises alive interrupt on HCI_OP_RESET */
-               if (opcode == HCI_OP_RESET)
+
+               /* Firmware raises alive interrupt on HCI_OP_RESET or 0xfc01*/
+               if (opcode == HCI_OP_RESET || opcode == 0xfc01)
                        data->gp0_received = false;
 
                hdev->stat.cmd_tx++;
@@ -2025,17 +2028,15 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
                bt_dev_dbg(data->hdev, "sent cmd: 0x%4.4x alive context changed: %s  ->  %s",
                           opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
                           btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
-               if (opcode == HCI_OP_RESET) {
-                       ret = wait_event_timeout(data->gp0_wait_q,
-                                                data->gp0_received,
-                                                msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
-                       if (!ret) {
-                               hdev->stat.err_tx++;
-                               bt_dev_err(hdev, "No alive interrupt received for %s",
-                                          btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
-                               ret = -ETIME;
-                               goto exit_error;

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 2039

Quoted 10 lines
drivers/bluetooth/btintel_pcie.c +9 -1
-                       }
+               ret = wait_event_timeout(data->gp0_wait_q,
+                                        data->gp0_received,
+                                        msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
+               if (!ret) {
+                       hdev->stat.err_tx++;
+                       bt_dev_err(hdev, "No alive interrupt received for %s",
+                                  btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
+                       ret = -ETIME;
+                       goto exit_error;

This should probably go into btintel_pcie_send_sync instead of doing a post handling as above, also if I read this right then we have to wait on 2 interrupts when it comes to HCI_Reset and 0xfc01? btintel_pcie_send_sync already waits on URBD0 this also adds GP0, having 2 interrupts means proper ordering needs to be enforced, otherwise if GP0 happens before URBD0 this will probably timeout, if this is done on purpose let document why we think it is ok to do it.

Quoted 7 lines
drivers/bluetooth/btintel_pcie.c +0 -1
                }
        }
        hdev->stat.byte_tx += skb->len;
--

2.43.0

Signature · 1 line
Luiz Augusto von Dentz
#4 lore raw

Re: [PATCH v1 2/2] Bluetooth: btintel_pcie: Fix alive context state handling

In reply to K, Kiran

Dear Kiran,

Thank you for your reply.

Am 08.07.25 um 14:30 schrieb K, Kiran:

Quoted 5 lines
Quoted 5 lines

Subject: Re: [PATCH v1 2/2] Bluetooth: btintel_pcie: Fix alive context state handling

Am 07.07.25 um 05:46 schrieb Kiran K:

Quoted 1 line

Firmware raises alive interrpt on sending 0xfc01 command. Alive context

Quoted 7 lines
Quoted 4 lines

interr*u*pt

(I would have hoped, two developers would spot such a typo, a spell checker also highlights.)

Ack. Unfortunately 'interrpt' was missing in my codespell dictionary. I have updated the same. Thanks.

hunspell or a/ispell should find it by defautl.

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

maintained in driver needs to be updated before sending 0xfc01 (Intel Reset) or 0x03c0 (HCI Reset) to avoid the potential race condition where the context is also updated in threaded irq.

Do you have a reproducer for the issue?

Yes. Issue was reproduced in stress reboot scenario although reproduction rate is less - 1/25.

It’d be great if you added that to the commit message, and what scripts/commands you run for this stress reboot scenario.

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
Fixes 05c200c8f029 ("Bluetooth: btintel_pcie: Add handshake between driver and firmware")

I’d add the Fixes tag before the Signed-off-by lines.

Ack.

There is one more comment below.

Quoted 53 lines
Quoted 53 lines
Quoted 21 lines
---
   drivers/bluetooth/btintel_pcie.c | 25 ++++++++++++++-----------
   1 file changed, 14 insertions(+), 11 deletions(-)
drivers/bluetooth/btintel_pcie.c +0 -4
index f893ad6fc87a..d29103b102e4 100644
@@ -1988,10 +1988,6 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
   				btintel_pcie_inject_cmd_complete(hdev, opcode);
   		}
 
-		/* Firmware raises alive interrupt on HCI_OP_RESET or 0xfc01*/
-		if (opcode == HCI_OP_RESET || opcode == 0xfc01)
-			data->gp0_received = false;
-
   		hdev->stat.cmd_tx++;
   		break;
   	case HCI_ACLDATA_PKT:

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 2013

Quoted 6 lines
drivers/bluetooth/btintel_pcie.c +3 -0
@@ -2012,6 +2008,20 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
   	memcpy(skb_push(skb, BTINTEL_PCIE_HCI_TYPE_LEN), &type,
   	       BTINTEL_PCIE_HCI_TYPE_LEN);
 
+	if (type == BTINTEL_PCIE_HCI_CMD_PKT) {
+		/* Firmware raises alive interrupt on HCI_OP_RESET or 0xfc01*/
+		if (opcode == HCI_OP_RESET || opcode == 0xfc01) {

Why not keep the form of just one if statement with && in the condition? as below?

Quoted 15 lines
drivers/bluetooth/btintel_pcie.c +11 -0
+			data->gp0_received = false;
+			old_ctxt = data->alive_intr_ctxt;
+			data->alive_intr_ctxt =
+				(opcode == 0xfc01 ? BTINTEL_PCIE_INTEL_HCI_RESET1 :
+					BTINTEL_PCIE_HCI_RESET);
+			bt_dev_dbg(data->hdev, "sending cmd: 0x%4.4x alive context changed: %s  ->  %s",
+				   opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
+				   btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
+		}
+	}
+
   	ret = btintel_pcie_send_sync(data, skb);
   	if (ret) {
   		hdev->stat.err_tx++;

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 2026

Quoted 6 lines
drivers/bluetooth/btintel_pcie.c +0 -3
@@ -2021,13 +2031,6 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
 
   	if (type == BTINTEL_PCIE_HCI_CMD_PKT &&
   	    (opcode == HCI_OP_RESET || opcode == 0xfc01)) {
-		old_ctxt = data->alive_intr_ctxt;
-		data->alive_intr_ctxt =
-			(opcode == 0xfc01 ? BTINTEL_PCIE_INTEL_HCI_RESET1

:

Quoted 7 lines
Quoted 7 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 2036

Quoted 7 lines
drivers/bluetooth/btintel_pcie.c +0 -4
-				BTINTEL_PCIE_HCI_RESET);
-		bt_dev_dbg(data->hdev, "sent cmd: 0x%4.4x alive context changed: %s  ->  %s",
-			   opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
-			   btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
   		ret = wait_event_timeout(data->gp0_wait_q,
   					 data->gp0_received,
 					 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));

Kind regards,

Paul

author
#12 lore raw
In reply to Paul Menzel

Hi Paul,

Quoted 16 lines

Subject: Re: [PATCH v1 1/2] Bluetooth: btintel_pcie: Make driver wait for alive interrupt

Dear Kiran,

Am 08.07.25 um 14:23 schrieb K, Kiran:

Quoted 8 lines
Quoted 8 lines

Subject: Re: [PATCH v1 1/2] Bluetooth: btintel_pcie: Make driver wait for alive interrupt

Am 07.07.25 um 05:46 schrieb Kiran K:

Quoted 3 lines

Firmware raises an alive interrupt upon receiving the 0xfc01 (Intel reset) command. This change fixes the driver to properly wait for the alive interrupt.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

What is the consequence of not waiting?

This is an alignment between driver and firmware. If driver doesn’t wait for alive interrupt, then there is chance of stack sending commands before the firmware is ready to accept.

Thank you for elaborating. It’d be great if you added it to the commit message, when you resend.

Ack.

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Fixes 05c200c8f029 ("Bluetooth: btintel_pcie: Add handshake between

driver and firmware")

I would also put the Fixes: tag above the Signed-off-by line.

Ack.

Quoted 44 lines
Quoted 11 lines
Quoted 11 lines

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_msix_gp0_handler(struct

Quoted 11 lines
---
   drivers/bluetooth/btintel_pcie.c | 27 ++++++++++++++-------------
   1 file changed, 14 insertions(+), 13 deletions(-)
drivers/bluetooth/btintel_pcie.c +0 -0
index 1113a6310bd0..f893ad6fc87a 100644
@@ -947,11 +947,13 @@ static void btintel_pcie_msix_gp0_handler(struct

btintel_pcie_data *data)

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/bluetooth/btintel_pcie.c +1 -0
   	case BTINTEL_PCIE_INTEL_HCI_RESET1:
   		if (btintel_pcie_in_op(data)) {
   			submit_rx = true;
+			signal_waitq = true;
   			break;
   		}
 
Quoted 7 lines
Quoted 7 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev

Quoted 7 lines
drivers/bluetooth/btintel_pcie.c +1 -0
   		if (btintel_pcie_in_iml(data)) {
   			submit_rx = true;
+			signal_waitq = true;
   			data->alive_intr_ctxt = BTINTEL_PCIE_FW_DL;
   			break;
   		}
@@ -1985,8 +1987,9 @@ static int btintel_pcie_send_frame(struct hci_dev

*hdev,

Quoted 2 lines
Quoted 2 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev · line 1988

Quoted 2 lines
drivers/bluetooth/btintel_pcie.c +0 -0
   			if (opcode == 0xfc01)
   				btintel_pcie_inject_cmd_complete(hdev,

opcode);

Quoted 5 lines
Quoted 5 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev,

Quoted 5 lines
drivers/bluetooth/btintel_pcie.c +2 -2
   		}
-		/* Firmware raises alive interrupt on HCI_OP_RESET */
-		if (opcode == HCI_OP_RESET)
+
+		/* Firmware raises alive interrupt on HCI_OP_RESET or

0xfc01*/

Quoted 8 lines
Quoted 2 lines

A space is missing before */.

Ack.

Quoted 3 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 1992

Quoted 1 line
drivers/bluetooth/btintel_pcie.c +1 -0
+		if (opcode == HCI_OP_RESET || opcode == 0xfc01)

Please define a macro for the magic number.

Quoted 5 lines
Quoted 3 lines

This is vendor specific opcode and is also shared across btintel.c, btusb.c and hci_intel.c. Would it be acceptable to submit a separate patch for this change alone?

Sure. Fine by me.

Thanks.

Quoted 47 lines
Quoted 5 lines
Quoted 5 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct

Quoted 5 lines
drivers/bluetooth/btintel_pcie.c +0 -0
   			data->gp0_received = false;
 
   		hdev->stat.cmd_tx++;
@@ -2025,17 +2028,15 @@ static int btintel_pcie_send_frame(struct

hci_dev *hdev,

Quoted 1 line
Quoted 1 line

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct · line 2028

Quoted 1 line
drivers/bluetooth/btintel_pcie.c +0 -0
   		bt_dev_dbg(data->hdev, "sent cmd: 0x%4.4x alive context
changed: %s  ->  %s",
>>>    			   opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
>>>    			   btintel_pcie_alivectxt_state2str(data -

alive_intr_ctxt));

Quoted 4 lines
Quoted 4 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev,

Quoted 4 lines
drivers/bluetooth/btintel_pcie.c +0 -4
-		if (opcode == HCI_OP_RESET) {
-			ret = wait_event_timeout(data->gp0_wait_q,
-						 data->gp0_received,
-

msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));

Quoted 3 lines
Quoted 3 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev,

Quoted 3 lines
drivers/bluetooth/btintel_pcie.c +0 -3
-			if (!ret) {
-				hdev->stat.err_tx++;
-				bt_dev_err(hdev, "No alive interrupt received

for %s",

Quoted 8 lines
Quoted 1 line

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct · line 2033

Quoted 1 line
drivers/bluetooth/btintel_pcie.c +0 -1
-					   btintel_pcie_alivectxt_state2str(data-

alive_intr_ctxt));

Quoted 6 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev,

Quoted 6 lines
drivers/bluetooth/btintel_pcie.c +3 -3
-				ret = -ETIME;
-				goto exit_error;
-			}
+		ret = wait_event_timeout(data->gp0_wait_q,
+					 data->gp0_received,
+

msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));

Quoted 8 lines
Quoted 4 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev,

Quoted 4 lines
drivers/bluetooth/btintel_pcie.c +4 -0
+		if (!ret) {
+			hdev->stat.err_tx++;
+			bt_dev_err(hdev, "No alive interrupt received for %s",
+				   btintel_pcie_alivectxt_state2str(data-

alive_intr_ctxt));

Quoted 3 lines

In a follow-up patch, the log message could be improved by also adding the timeout value to it.

Quoted 7 lines

Ack.

Quoted 5 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 2042

Quoted 5 lines
drivers/bluetooth/btintel_pcie.c +2 -0
+			ret = -ETIME;
+			goto exit_error;
   		}
   	}
   	hdev->stat.byte_tx += skb->len;

Kind regards,

Quoted 1 line

Paul

Regards,
Kiran

author
#14 lore raw
In reply to Luiz Augusto von Dentz

Hi Luiz,

Quoted 82 lines

Subject: Re: [PATCH v1 1/2] Bluetooth: btintel_pcie: Make driver wait for alive interrupt

Hi Kiran,

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_msix_gp0_handler(struct

Quoted 19 lines · Kiran K

Firmware raises an alive interrupt upon receiving the 0xfc01 (Intel reset) command. This change fixes the driver to properly wait for the alive interrupt.

Fixes 05c200c8f029 ("Bluetooth: btintel_pcie: Add handshake between

driver and firmware")

---
 drivers/bluetooth/btintel_pcie.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)
drivers/bluetooth/btintel_pcie.c +0 -0
index 1113a6310bd0..f893ad6fc87a 100644
@@ -947,11 +947,13 @@ static void btintel_pcie_msix_gp0_handler(struct

btintel_pcie_data *data)

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev

Quoted 14 lines
drivers/bluetooth/btintel_pcie.c +2 -0
        case BTINTEL_PCIE_INTEL_HCI_RESET1:
                if (btintel_pcie_in_op(data)) {
                        submit_rx = true;
+                       signal_waitq = true;
                        break;
                }
 
                if (btintel_pcie_in_iml(data)) {
                        submit_rx = true;
+                       signal_waitq = true;
                        data->alive_intr_ctxt = BTINTEL_PCIE_FW_DL;
                        break;
                }
@@ -1985,8 +1987,9 @@ static int btintel_pcie_send_frame(struct hci_dev

*hdev,

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev

Quoted 12 lines
drivers/bluetooth/btintel_pcie.c +3 -2
                        if (opcode == 0xfc01)
                                btintel_pcie_inject_cmd_complete(hdev, opcode);
                }
-               /* Firmware raises alive interrupt on HCI_OP_RESET */
-               if (opcode == HCI_OP_RESET)
+
+               /* Firmware raises alive interrupt on HCI_OP_RESET or 0xfc01*/
+               if (opcode == HCI_OP_RESET || opcode == 0xfc01)
                        data->gp0_received = false;
 
                hdev->stat.cmd_tx++;
@@ -2025,17 +2028,15 @@ static int btintel_pcie_send_frame(struct hci_dev

*hdev,

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev · line 2028

Quoted 1 line
drivers/bluetooth/btintel_pcie.c +0 -0
                bt_dev_dbg(data->hdev, "sent cmd: 0x%4.4x alive context changed:

%s -> %s",

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev,

Quoted 6 lines
drivers/bluetooth/btintel_pcie.c +0 -4
                           opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
                           btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
-               if (opcode == HCI_OP_RESET) {
-                       ret = wait_event_timeout(data->gp0_wait_q,
-                                                data->gp0_received,
-

msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev,

Quoted 11 lines
drivers/bluetooth/btintel_pcie.c +3 -7
-                       if (!ret) {
-                               hdev->stat.err_tx++;
-                               bt_dev_err(hdev, "No alive interrupt received for %s",
-                                          btintel_pcie_alivectxt_state2str(data-
 alive_intr_ctxt));
-                               ret = -ETIME;
-                               goto exit_error;
-                       }
+               ret = wait_event_timeout(data->gp0_wait_q,
+                                        data->gp0_received,
+

msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 2039

Quoted 6 lines
drivers/bluetooth/btintel_pcie.c +6 -0
+               if (!ret) {
+                       hdev->stat.err_tx++;
+                       bt_dev_err(hdev, "No alive interrupt received for %s",
+                                  btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
+                       ret = -ETIME;
+                       goto exit_error;
Quoted 7 lines

This should probably go into btintel_pcie_send_sync instead of doing a post handling as above, also if I read this right then we have to wait on 2 interrupts when it comes to HCI_Reset and 0xfc01?
btintel_pcie_send_sync already waits on URBD0 this also adds GP0, having 2 interrupts means proper ordering needs to be enforced, otherwise if GP0 happens before URBD0 this will probably timeout, if this is done on purpose let document why we think it is ok to do it.

The URBD0 interrupt is raised immediately after packet reception, while the Alive interrupt is triggered after the firmware initializes and enables the data path for receiving TX packets. This order is guaranteed by firmware.

Quoted 12 lines
Quoted 8 lines
drivers/bluetooth/btintel_pcie.c +0 -0
                }
        }
        hdev->stat.byte_tx += skb->len;

--
2.43.0

--
Luiz Augusto von Dentz

author
#7 lore raw

RE: [PATCH v1 2/2] Bluetooth: btintel_pcie: Fix alive context state handling

In reply to Luiz Augusto von Dentz

Hi Luiz,

Quoted 13 lines

Subject: Re: [PATCH v1 2/2] Bluetooth: btintel_pcie: Fix alive context state handling

Hi Kiran,

Quoted 6 lines · Kiran K

Firmware raises alive interrpt on sending 0xfc01 command. Alive context maintained in driver needs to be updated before sending 0xfc01 (Intel
Reset) or 0x03c0 (HCI Reset) to avoid the potential race condition where the context is also updated in threaded irq.

Quoted 3 lines

This should be a little more specific, like explaining what is alive interrupt supposed to mean or if we cannot do any communication wheel these are pending?

Ack. I will update the commit message.

Quoted 31 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev

Quoted 15 lines
Fixes 05c200c8f029 ("Bluetooth: btintel_pcie: Add handshake between

driver and firmware")

---
 drivers/bluetooth/btintel_pcie.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/bluetooth/btintel_pcie.c +0 -0
index f893ad6fc87a..d29103b102e4 100644
@@ -1988,10 +1988,6 @@ static int btintel_pcie_send_frame(struct hci_dev

*hdev,

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev

Quoted 11 lines
drivers/bluetooth/btintel_pcie.c +0 -4
                                btintel_pcie_inject_cmd_complete(hdev, opcode);
                }
 
-               /* Firmware raises alive interrupt on HCI_OP_RESET or 0xfc01*/
-               if (opcode == HCI_OP_RESET || opcode == 0xfc01)
-                       data->gp0_received = false;
-
                hdev->stat.cmd_tx++;
                break;
        case HCI_ACLDATA_PKT:
@@ -2012,6 +2008,20 @@ static int btintel_pcie_send_frame(struct hci_dev

*hdev,

Quoted 3 lines
drivers/bluetooth/btintel_pcie.c +0 -0
        memcpy(skb_push(skb, BTINTEL_PCIE_HCI_TYPE_LEN), &type,
               BTINTEL_PCIE_HCI_TYPE_LEN);
 
Quoted 8 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 2014

Quoted 4 lines
drivers/bluetooth/btintel_pcie.c +4 -0
+       if (type == BTINTEL_PCIE_HCI_CMD_PKT) {
+               /* Firmware raises alive interrupt on HCI_OP_RESET or 0xfc01*/
+               if (opcode == HCI_OP_RESET || opcode == 0xfc01) {
+                       data->gp0_received = false;

This type of flags should really be made into atomic flags so they can be checked atomically, anyway this shouldn't block these fixes but something I very much look forward to be changed.

Ack.

Quoted 38 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev,

Quoted 6 lines
drivers/bluetooth/btintel_pcie.c +5 -0
+                       old_ctxt = data->alive_intr_ctxt;
+                       data->alive_intr_ctxt =
+                               (opcode == 0xfc01 ? BTINTEL_PCIE_INTEL_HCI_RESET1 :
+                                       BTINTEL_PCIE_HCI_RESET);
+                       bt_dev_dbg(data->hdev, "sending cmd: 0x%4.4x alive context

changed: %s -> %s",

Quoted 9 lines
drivers/bluetooth/btintel_pcie.c +5 -0
+                                  opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
+                                  btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
+               }
+       }
+
        ret = btintel_pcie_send_sync(data, skb);
        if (ret) {
                hdev->stat.err_tx++;

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct · line 2029

Quoted 9 lines
drivers/bluetooth/btintel_pcie.c +0 -5
@@ -2021,13 +2031,6 @@ static int btintel_pcie_send_frame(struct
 hci_dev *hdev,
 
        if (type == BTINTEL_PCIE_HCI_CMD_PKT &&
            (opcode == HCI_OP_RESET || opcode == 0xfc01)) {
-               old_ctxt = data->alive_intr_ctxt;
-               data->alive_intr_ctxt =
-                       (opcode == 0xfc01 ? BTINTEL_PCIE_INTEL_HCI_RESET1 :
-                               BTINTEL_PCIE_HCI_RESET);
-               bt_dev_dbg(data->hdev, "sent cmd: 0x%4.4x alive context changed:

%s -> %s",

Quoted 10 lines
drivers/bluetooth/btintel_pcie.c +0 -2
-                          opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
-                          btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
                ret = wait_event_timeout(data->gp0_wait_q,
                                         data->gp0_received,

msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS)); --
2.43.0

Quoted 2 lines

--
Luiz Augusto von Dentz

Thanks,
Kiran

author
#5 lore raw

RE: [PATCH v1 2/2] Bluetooth: btintel_pcie: Fix alive context state handling

In reply to Paul Menzel

Hi Paul,

Quoted 19 lines

Subject: Re: [PATCH v1 2/2] Bluetooth: btintel_pcie: Fix alive context state handling

Dear Kiran,

Thank you for your reply.

Am 08.07.25 um 14:30 schrieb K, Kiran:

Quoted 9 lines
Quoted 9 lines

Subject: Re: [PATCH v1 2/2] Bluetooth: btintel_pcie: Fix alive context state handling

Am 07.07.25 um 05:46 schrieb Kiran K:

Quoted 2 lines

Firmware raises alive interrpt on sending 0xfc01 command. Alive context

interr*u*pt

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

(I would have hoped, two developers would spot such a typo, a spell checker also highlights.)

Ack. Unfortunately 'interrpt' was missing in my codespell dictionary. I have updated the same. Thanks.

hunspell or a/ispell should find it by defautl.

Ack.

Quoted 11 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

maintained in driver needs to be updated before sending 0xfc01 (Intel
Reset) or 0x03c0 (HCI Reset) to avoid the potential race condition where the context is also updated in threaded irq.

Do you have a reproducer for the issue?

Yes. Issue was reproduced in stress reboot scenario although reproduction

rate is less - 1/25.

It’d be great if you added that to the commit message, and what scripts/commands you run for this stress reboot scenario.

Ack. I will update the commit message.

Quoted 11 lines
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Fixes 05c200c8f029 ("Bluetooth: btintel_pcie: Add handshake between

driver and firmware")

I’d add the Fixes tag before the Signed-off-by lines.

Ack.

There is one more comment below.

Sorry. I missed this one. I will fix it in the v2 version of the patch.

Quoted 15 lines
Quoted 10 lines
Quoted 10 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct

Quoted 10 lines
---
   drivers/bluetooth/btintel_pcie.c | 25 ++++++++++++++-----------
   1 file changed, 14 insertions(+), 11 deletions(-)
drivers/bluetooth/btintel_pcie.c +0 -0
index f893ad6fc87a..d29103b102e4 100644
@@ -1988,10 +1988,6 @@ static int btintel_pcie_send_frame(struct

hci_dev *hdev,

Quoted 1 line
Quoted 1 line

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct · line 1988

Quoted 1 line
drivers/bluetooth/btintel_pcie.c +0 -0
   				btintel_pcie_inject_cmd_complete(hdev,

opcode);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/bluetooth/btintel_pcie.c +0 -0
   		}
 
Quoted 18 lines
Quoted 8 lines
Quoted 8 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct

Quoted 8 lines
drivers/bluetooth/btintel_pcie.c +0 -4
-		/* Firmware raises alive interrupt on HCI_OP_RESET or 0xfc01*/
-		if (opcode == HCI_OP_RESET || opcode == 0xfc01)
-			data->gp0_received = false;
-
   		hdev->stat.cmd_tx++;
   		break;
   	case HCI_ACLDATA_PKT:
@@ -2012,6 +2008,20 @@ static int btintel_pcie_send_frame(struct

hci_dev *hdev,

Quoted 9 lines
Quoted 9 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 2013

Quoted 6 lines
drivers/bluetooth/btintel_pcie.c +3 -0
   	memcpy(skb_push(skb, BTINTEL_PCIE_HCI_TYPE_LEN), &type,
   	       BTINTEL_PCIE_HCI_TYPE_LEN);
 
+	if (type == BTINTEL_PCIE_HCI_CMD_PKT) {
+		/* Firmware raises alive interrupt on HCI_OP_RESET or 0xfc01*/
+		if (opcode == HCI_OP_RESET || opcode == 0xfc01) {

Why not keep the form of just one if statement with && in the condition? as below?

Ack.

Quoted 34 lines
Quoted 5 lines
Quoted 5 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev,

Quoted 5 lines
drivers/bluetooth/btintel_pcie.c +4 -0
+			data->gp0_received = false;
+			old_ctxt = data->alive_intr_ctxt;
+			data->alive_intr_ctxt =
+				(opcode == 0xfc01 ?

BTINTEL_PCIE_INTEL_HCI_RESET1 :

Quoted 2 lines
Quoted 2 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct · line 2019

Quoted 2 lines
drivers/bluetooth/btintel_pcie.c +2 -0
+					BTINTEL_PCIE_HCI_RESET);
+			bt_dev_dbg(data->hdev, "sending cmd: 0x%4.4x alive

context changed: %s -> %s",

Quoted 1 line
Quoted 1 line

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct · line 2020

Quoted 1 line
drivers/bluetooth/btintel_pcie.c +1 -0
+				   opcode,

btintel_pcie_alivectxt_state2str(old_ctxt),

Quoted 11 lines
Quoted 1 line

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct · line 2021

Quoted 1 line
drivers/bluetooth/btintel_pcie.c +1 -0
+				   btintel_pcie_alivectxt_state2str(data-

alive_intr_ctxt));

Quoted 9 lines
Quoted 9 lines
drivers/bluetooth/btintel_pcie.c +3 -0
+		}
+	}
+
   	ret = btintel_pcie_send_sync(data, skb);
   	if (ret) {
   		hdev->stat.err_tx++;
@@ -2021,13 +2031,6 @@ static int btintel_pcie_send_frame(struct
 hci_dev *hdev,
 
Quoted 8 lines
Quoted 8 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev,

Quoted 5 lines
drivers/bluetooth/btintel_pcie.c +0 -3
   	if (type == BTINTEL_PCIE_HCI_CMD_PKT &&
   	    (opcode == HCI_OP_RESET || opcode == 0xfc01)) {
-		old_ctxt = data->alive_intr_ctxt;
-		data->alive_intr_ctxt =
-			(opcode == 0xfc01 ? BTINTEL_PCIE_INTEL_HCI_RESET1

:

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct · line 2029

Quoted 2 lines
drivers/bluetooth/btintel_pcie.c +0 -2
-				BTINTEL_PCIE_HCI_RESET);
-		bt_dev_dbg(data->hdev, "sent cmd: 0x%4.4x alive context

changed: %s -> %s",

Quoted 3 lines
Quoted 2 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct · line 2031

Quoted 2 lines
drivers/bluetooth/btintel_pcie.c +0 -2
-			   opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
-			   btintel_pcie_alivectxt_state2str(data-

alive_intr_ctxt));

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_send_frame(struct hci_dev *hdev, · line 2035

Quoted 3 lines
drivers/bluetooth/btintel_pcie.c +0 -0
   		ret = wait_event_timeout(data->gp0_wait_q,
   					 data->gp0_received,

msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));

Kind regards,

Paul

Thanks,
Kiran