Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v1 1/3] Revert "Bluetooth: btintel_pcie: sync mbox tlv parsing with GP0 alive interrupt"
@ 2026-11-23  6:55 Kiran K
  2026-11-23  6:55 ` [PATCH v1 2/3] Bluetooth: btintel_pcie: Serialize doorbell writes and target reads Kiran K
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Kiran K @ 2026-11-23  6:55 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: chethan.tumkur.narayan, chandrashekar.devegowda, ravindra,
	Kiran K

This reverts commit d572ea4b621ce60279da5179a0c338660c8b7331.

That commit worked around invalid mbox TLV reads by making the mbox
worker wait for the GP0 alive interrupt before the target access. The
controller must not see an access to HBUS_TARG_WRPTR at the same time as
an access to the PRPH_DEV_ADDR/PRPH_DEV_RD register pair. Waiting for GP0
is not exhaustive: it only narrows the window for the mbox worker, and
there are other cases where these accesses overlap, such as the other
users of target access (hwexp, fwtrigger, coredump) and the TX doorbell.

The next patch serializes these accesses with a lock, which covers all
of them. Drop the handshake as it is no longer needed.

Also drop the handshake completion that commit 4f6ead67b93b
("Bluetooth: btintel_pcie: verify and serialize D-state transitions")
added to the set_dxstate() D0 fallback path, since the flags and wait
queue it relied on no longer exist.

Assisted-by: Copilot:claude-sonnet-5.5
Signed-off-by: Kiran K <kiran.k@intel.com>
---
 drivers/bluetooth/btintel_pcie.c | 51 ++------------------------------
 drivers/bluetooth/btintel_pcie.h |  7 -----
 2 files changed, 3 insertions(+), 55 deletions(-)

diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 55454900322b..d95127327c71 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -1986,25 +1986,6 @@ static int btintel_parse_mbox_tlv(struct btintel_pcie_data *data)
 	struct mbox_tlv *tlv;
 	struct btintel_data *cnvi_data = hci_get_priv(data->hdev);
 	u8 hw_variant = INTEL_HW_VARIANT(cnvi_data->cnvi_bt);
-	long t;
-
-	/* Wait for GP0 alive interrupt to post RX buffers */
-	t = wait_event_timeout(data->mbox_parse_wait_q,
-			       test_bit(BTINTEL_PCIE_MBOX_PARSE_READY, &data->flags),
-			       msecs_to_jiffies(BTINTEL_PCIE_MBOX_INTR_TIMEOUT_MS));
-	if (!t) {
-		bt_dev_warn(data->hdev,
-			    "Timeout (%u ms) waiting for alive interrupt before mbox TLV parse; skipping",
-			    BTINTEL_PCIE_MBOX_INTR_TIMEOUT_MS);
-		return 0;
-	}
-	clear_bit(BTINTEL_PCIE_MBOX_PARSE_READY, &data->flags);
-
-	if (data->log_mask & BTINTEL_PCIE_LOG_MBOX)
-		bt_dev_info(data->hdev,
-			    "mbox TLV parse started at %lld ns (%lld us after mbox interrupt)",
-			    ktime_to_ns(ktime_get()),
-			    ktime_to_us(ktime_sub(ktime_get(), data->mbox_intr_ts)));
 
 	memset(&data->dump_info, 0, sizeof(data->dump_info));
 
@@ -2288,23 +2269,12 @@ static void btintel_pcie_msix_gp1_handler(struct btintel_pcie_data *data)
 	if (target_access &&
 	    !test_and_set_bit(BTINTEL_PCIE_MAIL_BOX_INTR,
 				   &data->flags)) {
-		/* Arm the mbox<->alive handshake */
-		clear_bit(BTINTEL_PCIE_MBOX_PARSE_READY, &data->flags);
-		set_bit(BTINTEL_PCIE_MBOX_PARSE_PENDING, &data->flags);
-		data->mbox_intr_ts = ktime_get();
-
-		if (data->log_mask & BTINTEL_PCIE_LOG_MBOX)
-			bt_dev_info(data->hdev,
-				    "mbox interrupt received at %lld ns; queuing mbox_work",
-				    ktime_to_ns(data->mbox_intr_ts));
-
 		WRITE_ONCE(data->debug_table_addr, addr);
 		WRITE_ONCE(data->debug_table_size, size);
 		if (!queue_work(data->dump_workqueue,
-				&data->mbox_work)) {
-			clear_bit(BTINTEL_PCIE_MAIL_BOX_INTR, &data->flags);
-			clear_bit(BTINTEL_PCIE_MBOX_PARSE_PENDING, &data->flags);
-		}
+				&data->mbox_work))
+			clear_bit(BTINTEL_PCIE_MAIL_BOX_INTR,
+				  &data->flags);
 	}
 
 	/* Mailbox is read, ack to FW */
@@ -2421,12 +2391,6 @@ static void btintel_pcie_msix_gp0_handler(struct btintel_pcie_data *data)
 	if (submit_rx) {
 		btintel_pcie_reset_ia(data);
 		btintel_pcie_start_rx(data);
-
-		/* Complete the mbox<->alive handshake */
-		if (test_and_clear_bit(BTINTEL_PCIE_MBOX_PARSE_PENDING, &data->flags)) {
-			set_bit(BTINTEL_PCIE_MBOX_PARSE_READY, &data->flags);
-			wake_up(&data->mbox_parse_wait_q);
-		}
 	}
 
 	if (signal_waitq) {
@@ -4911,8 +4875,6 @@ static int btintel_pcie_probe(struct pci_dev *pdev,
 	init_waitqueue_head(&data->rfkill_wait_q);
 	data->rfkill_wait_done = false;
 
-	init_waitqueue_head(&data->mbox_parse_wait_q);
-
 	data->workqueue = alloc_ordered_workqueue(KBUILD_MODNAME, WQ_HIGHPRI);
 	if (!data->workqueue)
 		return -ENOMEM;
@@ -5261,13 +5223,6 @@ static int btintel_pcie_set_dxstate(struct btintel_pcie_data *data, u32 dxstate)
 				if (err)
 					return err;
 
-				/* Complete the mbox<->alive handshake */
-				if (test_and_clear_bit(BTINTEL_PCIE_MBOX_PARSE_PENDING,
-						       &data->flags)) {
-					set_bit(BTINTEL_PCIE_MBOX_PARSE_READY, &data->flags);
-					wake_up(&data->mbox_parse_wait_q);
-				}
-
 				return 0;
 			}
 		} else {
diff --git a/drivers/bluetooth/btintel_pcie.h b/drivers/bluetooth/btintel_pcie.h
index 28acc20eefdf..6b7cf3819f25 100644
--- a/drivers/bluetooth/btintel_pcie.h
+++ b/drivers/bluetooth/btintel_pcie.h
@@ -174,8 +174,6 @@ enum {
 	BTINTEL_PCIE_HW_RFKILL_STATE_CHECK,
 	BTINTEL_PCIE_SETUP_DONE,
 	BTINTEL_PCIE_MAIL_BOX_INTR,
-	BTINTEL_PCIE_MBOX_PARSE_PENDING,
-	BTINTEL_PCIE_MBOX_PARSE_READY,
 	BTINTEL_PCIE_FATAL_ERR_POST_SETUP_PENDING,
 };
 
@@ -237,7 +235,6 @@ enum btintel_pcie_mbox_msg {
 
 /* Default interrupt timeout in msec */
 #define BTINTEL_DEFAULT_INTR_TIMEOUT_MS	3000
-#define BTINTEL_PCIE_MBOX_INTR_TIMEOUT_MS	500
 
 #define BTINTEL_PCIE_DX_TRANSITION_MAX_RETRIES	3
 
@@ -842,10 +839,6 @@ struct btintel_pcie_data {
 	struct btintel_pcie_mbox	mbox;
 	atomic64_t	last_dump_jiffies64;
 
-	/* Wait queue for mbox_worker to wait for GP0 alive interrupt */
-	wait_queue_head_t	mbox_parse_wait_q;
-	/* Timestamp captured in GP1 handler when mbox interrupt is received */
-	ktime_t	mbox_intr_ts;
 	bool		pcie_alloc_init;
 };
 
-- 
2.54.0


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

end of thread, other threads:[~2026-11-23 20:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23  6:55 [PATCH v1 1/3] Revert "Bluetooth: btintel_pcie: sync mbox tlv parsing with GP0 alive interrupt" Kiran K
2026-11-23  6:55 ` [PATCH v1 2/3] Bluetooth: btintel_pcie: Serialize doorbell writes and target reads Kiran K
2026-11-23  6:55 ` [PATCH v1 3/3] Bluetooth: btintel_pcie: Serialize MAC access requests Kiran K
2026-11-23 20:44   ` kernel test robot
2026-11-23 11:56 ` [v1,1/3] Revert "Bluetooth: btintel_pcie: sync mbox tlv parsing with GP0 alive interrupt" bluez.test.bot
2026-11-23 19:40 ` [PATCH v1 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