* [PATCH v11] Bluetooth: hci_qca: Fix SSR (SubSystem Restart) fail when BT_EN is pulled up by hw
@ 2025-08-27 10:25 Shuai Zhang
2025-08-27 11:01 ` [v11] " bluez.test.bot
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Shuai Zhang @ 2025-08-27 10:25 UTC (permalink / raw)
To: dmitry.baryshkov, marcel, luiz.dentz
Cc: linux-bluetooth, stable, linux-arm-msm, linux-kernel,
quic_chejiang, Shuai Zhang
When the host actively triggers SSR and collects coredump data,
the Bluetooth stack sends a reset command to the controller. However, due
to the inability to clear the QCA_SSR_TRIGGERED and QCA_IBS_DISABLED bits,
the reset command times out.
To address this, this patch clears the QCA_SSR_TRIGGERED and
QCA_IBS_DISABLED flags and adds a 50ms delay after SSR, but only when
HCI_QUIRK_NON_PERSISTENT_SETUP is not set. This ensures the controller
completes the SSR process when BT_EN is always high due to hardware.
For the purpose of HCI_QUIRK_NON_PERSISTENT_SETUP, please refer to
the comment in `include/net/bluetooth/hci.h`.
The HCI_QUIRK_NON_PERSISTENT_SETUP quirk is associated with BT_EN,
and its presence can be used to determine whether BT_EN is defined in DTS.
After SSR, host will not download the firmware, causing
controller to remain in the IBS_WAKE state. Host needs
to synchronize with the controller to maintain proper operation.
Multiple triggers of SSR only first generate coredump file,
due to memcoredump_flag no clear.
add clear coredump flag when ssr completed.
When the SSR duration exceeds 2 seconds, it triggers
host tx_idle_timeout, which sets host TX state to sleep. due to the
hardware pulling up bt_en, the firmware is not downloaded after the SSR.
As a result, the controller does not enter sleep mode. Consequently,
when the host sends a command afterward, it sends 0xFD to the controller,
but the controller does not respond, leading to a command timeout.
So reset tx_idle_timer after SSR to prevent host enter TX IBS_Sleep mode.
---
Changs since v10:
-- Update base patch to latest patch.
Changs since v8-v9:
-- Update base patch to latest patch.
-- add Cc stable@vger.kernel.org on signed-of.
Changes since v6-7:
- Merge the changes into a single patch.
- Update commit.
Changes since v1-5:
- Add an explanation for HCI_QUIRK_NON_PERSISTENT_SETUP.
- Add commments for msleep(50).
- Update format and commit.
Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com>
Cc: stable@vger.kernel.org
---
drivers/bluetooth/hci_qca.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 4cff4d9be..2d6560482 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1653,6 +1653,39 @@ static void qca_hw_error(struct hci_dev *hdev, u8 code)
skb_queue_purge(&qca->rx_memdump_q);
}
+ /*
+ * If the BT chip's bt_en pin is connected to a 3.3V power supply via
+ * hardware and always stays high, driver cannot control the bt_en pin.
+ * As a result, during SSR (SubSystem Restart), QCA_SSR_TRIGGERED and
+ * QCA_IBS_DISABLED flags cannot be cleared, which leads to a reset
+ * command timeout.
+ * Add an msleep delay to ensure controller completes the SSR process.
+ *
+ * Host will not download the firmware after SSR, controller to remain
+ * in the IBS_WAKE state, and the host needs to synchronize with it
+ *
+ * Since the bluetooth chip has been reset, clear the memdump state.
+ */
+ if (!hci_test_quirk(hu->hdev, HCI_QUIRK_NON_PERSISTENT_SETUP)) {
+ /*
+ * When the SSR (SubSystem Restart) duration exceeds 2 seconds,
+ * it triggers host tx_idle_delay, which sets host TX state
+ * to sleep. Reset tx_idle_timer after SSR to prevent
+ * host enter TX IBS_Sleep mode.
+ */
+ mod_timer(&qca->tx_idle_timer, jiffies +
+ msecs_to_jiffies(qca->tx_idle_delay));
+
+ /* Controller reset completion time is 50ms */
+ msleep(50);
+
+ clear_bit(QCA_SSR_TRIGGERED, &qca->flags);
+ clear_bit(QCA_IBS_DISABLED, &qca->flags);
+
+ qca->tx_ibs_state = HCI_IBS_TX_AWAKE;
+ qca->memdump_state = QCA_MEMDUMP_IDLE;
+ }
+
clear_bit(QCA_HW_ERROR_EVENT, &qca->flags);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [v11] Bluetooth: hci_qca: Fix SSR (SubSystem Restart) fail when BT_EN is pulled up by hw
2025-08-27 10:25 [PATCH v11] Bluetooth: hci_qca: Fix SSR (SubSystem Restart) fail when BT_EN is pulled up by hw Shuai Zhang
@ 2025-08-27 11:01 ` bluez.test.bot
2025-09-15 3:04 ` [PATCH v11] " Shuai Zhang
2025-09-15 12:45 ` Dmitry Baryshkov
2 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2025-08-27 11:01 UTC (permalink / raw)
To: linux-bluetooth, quic_shuaz
[-- Attachment #1: Type: text/plain, Size: 2296 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=995987
---Test result---
Test Summary:
CheckPatch PENDING 0.36 seconds
GitLint PENDING 0.29 seconds
SubjectPrefix PASS 0.08 seconds
BuildKernel PASS 24.84 seconds
CheckAllWarning PASS 27.37 seconds
CheckSparse PASS 30.82 seconds
BuildKernel32 PASS 24.93 seconds
TestRunnerSetup PASS 488.73 seconds
TestRunner_l2cap-tester PASS 25.32 seconds
TestRunner_iso-tester PASS 43.66 seconds
TestRunner_bnep-tester PASS 6.05 seconds
TestRunner_mgmt-tester FAIL 127.60 seconds
TestRunner_rfcomm-tester PASS 9.32 seconds
TestRunner_sco-tester PASS 14.72 seconds
TestRunner_ioctl-tester PASS 10.09 seconds
TestRunner_mesh-tester FAIL 11.42 seconds
TestRunner_smp-tester PASS 8.54 seconds
TestRunner_userchan-tester PASS 6.28 seconds
IncrementalBuild PENDING 0.89 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: 485 (99.0%), Failed: 1, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.098 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.093 seconds
Mesh - Send cancel - 2 Timed out 1.997 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v11] Bluetooth: hci_qca: Fix SSR (SubSystem Restart) fail when BT_EN is pulled up by hw
2025-08-27 10:25 [PATCH v11] Bluetooth: hci_qca: Fix SSR (SubSystem Restart) fail when BT_EN is pulled up by hw Shuai Zhang
2025-08-27 11:01 ` [v11] " bluez.test.bot
@ 2025-09-15 3:04 ` Shuai Zhang
2025-09-15 12:45 ` Dmitry Baryshkov
2 siblings, 0 replies; 5+ messages in thread
From: Shuai Zhang @ 2025-09-15 3:04 UTC (permalink / raw)
To: dmitry.baryshkov, marcel, luiz.dentz
Cc: linux-bluetooth, stable, linux-arm-msm, linux-kernel,
quic_chejiang
Hi
On 8/27/2025 6:25 PM, Shuai Zhang wrote:
> When the host actively triggers SSR and collects coredump data,
> the Bluetooth stack sends a reset command to the controller. However, due
> to the inability to clear the QCA_SSR_TRIGGERED and QCA_IBS_DISABLED bits,
> the reset command times out.
>
> To address this, this patch clears the QCA_SSR_TRIGGERED and
> QCA_IBS_DISABLED flags and adds a 50ms delay after SSR, but only when
> HCI_QUIRK_NON_PERSISTENT_SETUP is not set. This ensures the controller
> completes the SSR process when BT_EN is always high due to hardware.
>
> For the purpose of HCI_QUIRK_NON_PERSISTENT_SETUP, please refer to
> the comment in `include/net/bluetooth/hci.h`.
>
> The HCI_QUIRK_NON_PERSISTENT_SETUP quirk is associated with BT_EN,
> and its presence can be used to determine whether BT_EN is defined in DTS.
>
> After SSR, host will not download the firmware, causing
> controller to remain in the IBS_WAKE state. Host needs
> to synchronize with the controller to maintain proper operation.
>
> Multiple triggers of SSR only first generate coredump file,
> due to memcoredump_flag no clear.
>
> add clear coredump flag when ssr completed.
>
> When the SSR duration exceeds 2 seconds, it triggers
> host tx_idle_timeout, which sets host TX state to sleep. due to the
> hardware pulling up bt_en, the firmware is not downloaded after the SSR.
> As a result, the controller does not enter sleep mode. Consequently,
> when the host sends a command afterward, it sends 0xFD to the controller,
> but the controller does not respond, leading to a command timeout.
>
> So reset tx_idle_timer after SSR to prevent host enter TX IBS_Sleep mode.
>
> ---
> Changs since v10:
> -- Update base patch to latest patch.
>
> Changs since v8-v9:
> -- Update base patch to latest patch.
> -- add Cc stable@vger.kernel.org on signed-of.
>
> Changes since v6-7:
> - Merge the changes into a single patch.
> - Update commit.
>
> Changes since v1-5:
> - Add an explanation for HCI_QUIRK_NON_PERSISTENT_SETUP.
> - Add commments for msleep(50).
> - Update format and commit.
>
> Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com>
> Cc: stable@vger.kernel.org
> ---
> drivers/bluetooth/hci_qca.c | 33 +++++++++++++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 4cff4d9be..2d6560482 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -1653,6 +1653,39 @@ static void qca_hw_error(struct hci_dev *hdev, u8 code)
> skb_queue_purge(&qca->rx_memdump_q);
> }
>
> + /*
> + * If the BT chip's bt_en pin is connected to a 3.3V power supply via
> + * hardware and always stays high, driver cannot control the bt_en pin.
> + * As a result, during SSR (SubSystem Restart), QCA_SSR_TRIGGERED and
> + * QCA_IBS_DISABLED flags cannot be cleared, which leads to a reset
> + * command timeout.
> + * Add an msleep delay to ensure controller completes the SSR process.
> + *
> + * Host will not download the firmware after SSR, controller to remain
> + * in the IBS_WAKE state, and the host needs to synchronize with it
> + *
> + * Since the bluetooth chip has been reset, clear the memdump state.
> + */
> + if (!hci_test_quirk(hu->hdev, HCI_QUIRK_NON_PERSISTENT_SETUP)) {
> + /*
> + * When the SSR (SubSystem Restart) duration exceeds 2 seconds,
> + * it triggers host tx_idle_delay, which sets host TX state
> + * to sleep. Reset tx_idle_timer after SSR to prevent
> + * host enter TX IBS_Sleep mode.
> + */
> + mod_timer(&qca->tx_idle_timer, jiffies +
> + msecs_to_jiffies(qca->tx_idle_delay));
> +
> + /* Controller reset completion time is 50ms */
> + msleep(50);
> +
> + clear_bit(QCA_SSR_TRIGGERED, &qca->flags);
> + clear_bit(QCA_IBS_DISABLED, &qca->flags);
> +
> + qca->tx_ibs_state = HCI_IBS_TX_AWAKE;
> + qca->memdump_state = QCA_MEMDUMP_IDLE;
> + }
> +
> clear_bit(QCA_HW_ERROR_EVENT, &qca->flags);
> }
>
is there any update?
BR,
Shuai
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v11] Bluetooth: hci_qca: Fix SSR (SubSystem Restart) fail when BT_EN is pulled up by hw
2025-08-27 10:25 [PATCH v11] Bluetooth: hci_qca: Fix SSR (SubSystem Restart) fail when BT_EN is pulled up by hw Shuai Zhang
2025-08-27 11:01 ` [v11] " bluez.test.bot
2025-09-15 3:04 ` [PATCH v11] " Shuai Zhang
@ 2025-09-15 12:45 ` Dmitry Baryshkov
2025-09-16 14:02 ` Shuai Zhang
2 siblings, 1 reply; 5+ messages in thread
From: Dmitry Baryshkov @ 2025-09-15 12:45 UTC (permalink / raw)
To: Shuai Zhang
Cc: marcel, luiz.dentz, linux-bluetooth, stable, linux-arm-msm,
linux-kernel, quic_chejiang
On Wed, Aug 27, 2025 at 06:25:19PM +0800, Shuai Zhang wrote:
> When the host actively triggers SSR and collects coredump data,
> the Bluetooth stack sends a reset command to the controller. However, due
> to the inability to clear the QCA_SSR_TRIGGERED and QCA_IBS_DISABLED bits,
> the reset command times out.
Why? Does it apply to all platforms (as it seems from your text)?
Please write the commit message in the form that is easy to
udnerstand for somebody who doesn't know Qualcomm _specifics_.
- Decribe the issue first. The actual issue, not just the symtoms.
Provide enough details to understand whether the issue applies to one
platform, to a set of platforms or to all platforms.
- Describe what needs to be done. Use imperative language (see
Documentation/process/submitting-patches.rst). Don't use phrases like
'This patch does' or 'This change does'.
>
> To address this, this patch clears the QCA_SSR_TRIGGERED and
> QCA_IBS_DISABLED flags and adds a 50ms delay after SSR, but only when
> HCI_QUIRK_NON_PERSISTENT_SETUP is not set. This ensures the controller
> completes the SSR process when BT_EN is always high due to hardware.
>
> For the purpose of HCI_QUIRK_NON_PERSISTENT_SETUP, please refer to
> the comment in `include/net/bluetooth/hci.h`.
Which comment?
>
> The HCI_QUIRK_NON_PERSISTENT_SETUP quirk is associated with BT_EN,
> and its presence can be used to determine whether BT_EN is defined in DTS.
>
> After SSR, host will not download the firmware, causing
> controller to remain in the IBS_WAKE state. Host needs
> to synchronize with the controller to maintain proper operation.
>
> Multiple triggers of SSR only first generate coredump file,
> due to memcoredump_flag no clear.
>
> add clear coredump flag when ssr completed.
>
> When the SSR duration exceeds 2 seconds, it triggers
> host tx_idle_timeout, which sets host TX state to sleep. due to the
> hardware pulling up bt_en, the firmware is not downloaded after the SSR.
> As a result, the controller does not enter sleep mode. Consequently,
> when the host sends a command afterward, it sends 0xFD to the controller,
> but the controller does not respond, leading to a command timeout.
>
> So reset tx_idle_timer after SSR to prevent host enter TX IBS_Sleep mode.
The whole commit message can be formulated as:
On XYZ there is no way to control BT_EN pin and as such trigger a cold
reset in case of firmware crash. The BT chip performs a warm restart on
its own (without reloading the firmware, foo, bar baz). This triggers
bar baz foo in the driver. Tell the driver that the BT controller has
undergone a proper restart sequence:
- Foo
- Bar
- Baz
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v11] Bluetooth: hci_qca: Fix SSR (SubSystem Restart) fail when BT_EN is pulled up by hw
2025-09-15 12:45 ` Dmitry Baryshkov
@ 2025-09-16 14:02 ` Shuai Zhang
0 siblings, 0 replies; 5+ messages in thread
From: Shuai Zhang @ 2025-09-16 14:02 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: marcel, luiz.dentz, linux-bluetooth, stable, linux-arm-msm,
linux-kernel, quic_chejiang
Hi Dmitry
On 9/15/2025 8:45 PM, Dmitry Baryshkov wrote:
> On Wed, Aug 27, 2025 at 06:25:19PM +0800, Shuai Zhang wrote:
>> When the host actively triggers SSR and collects coredump data,
>> the Bluetooth stack sends a reset command to the controller. However, due
>> to the inability to clear the QCA_SSR_TRIGGERED and QCA_IBS_DISABLED bits,
>> the reset command times out.
>
> Why? Does it apply to all platforms (as it seems from your text)?
>
> Please write the commit message in the form that is easy to
> udnerstand for somebody who doesn't know Qualcomm _specifics_.
>
> - Decribe the issue first. The actual issue, not just the symtoms.
> Provide enough details to understand whether the issue applies to one
> platform, to a set of platforms or to all platforms.
>
> - Describe what needs to be done. Use imperative language (see
> Documentation/process/submitting-patches.rst). Don't use phrases like
> 'This patch does' or 'This change does'.
>
>>
>> To address this, this patch clears the QCA_SSR_TRIGGERED and
>> QCA_IBS_DISABLED flags and adds a 50ms delay after SSR, but only when
>> HCI_QUIRK_NON_PERSISTENT_SETUP is not set. This ensures the controller
>> completes the SSR process when BT_EN is always high due to hardware.
>>
>> For the purpose of HCI_QUIRK_NON_PERSISTENT_SETUP, please refer to
>> the comment in `include/net/bluetooth/hci.h`.
>
> Which comment?
>
>>
>> The HCI_QUIRK_NON_PERSISTENT_SETUP quirk is associated with BT_EN,
>> and its presence can be used to determine whether BT_EN is defined in DTS.
>>
>> After SSR, host will not download the firmware, causing
>> controller to remain in the IBS_WAKE state. Host needs
>> to synchronize with the controller to maintain proper operation.
>>
>> Multiple triggers of SSR only first generate coredump file,
>> due to memcoredump_flag no clear.
>>
>> add clear coredump flag when ssr completed.
>>
>> When the SSR duration exceeds 2 seconds, it triggers
>> host tx_idle_timeout, which sets host TX state to sleep. due to the
>> hardware pulling up bt_en, the firmware is not downloaded after the SSR.
>> As a result, the controller does not enter sleep mode. Consequently,
>> when the host sends a command afterward, it sends 0xFD to the controller,
>> but the controller does not respond, leading to a command timeout.
>>
>> So reset tx_idle_timer after SSR to prevent host enter TX IBS_Sleep mode.
>
> The whole commit message can be formulated as:
>
> On XYZ there is no way to control BT_EN pin and as such trigger a cold
> reset in case of firmware crash. The BT chip performs a warm restart on
> its own (without reloading the firmware, foo, bar baz). This triggers
> bar baz foo in the driver. Tell the driver that the BT controller has
> undergone a proper restart sequence:
>
> - Foo
>
> - Bar
>
> - Baz
>
Appreciate your patient guidance. I have implemented and integrated
the proposed changes into v12, and it awaits your review.
BR,
Shuai
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-09-16 14:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-27 10:25 [PATCH v11] Bluetooth: hci_qca: Fix SSR (SubSystem Restart) fail when BT_EN is pulled up by hw Shuai Zhang
2025-08-27 11:01 ` [v11] " bluez.test.bot
2025-09-15 3:04 ` [PATCH v11] " Shuai Zhang
2025-09-15 12:45 ` Dmitry Baryshkov
2025-09-16 14:02 ` Shuai Zhang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.