diff mbox series

[01/10] wifi: ath12k: rearrange IRQ enable/disable in reset path

Message ID 20240412060620.27519-2-quic_bqiang@quicinc.com (mailing list archive)
State Accepted
Commit c7b2da3c0a57cc038ffaf7d82deca70373d46645
Delegated to: Kalle Valo
Headers show
Series wifi: ath12k: support suspend/resume | expand

Commit Message

Baochen Qiang April 12, 2024, 6:06 a.m. UTC
For non-WoW suspend/resume, ath12k host powers down whole hardware
when suspend and powers up it when resume, the code path it goes
through is very like the ath12k reset logic.

In order to reuse that logic, rearrange IRQ handling in the reset
path.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Sidhanta Sahu April 12, 2024, 6:24 p.m. UTC | #1
On 4/11/2024 11:06 PM, Baochen Qiang wrote:
> For non-WoW suspend/resume, ath12k host powers down whole hardware
> when suspend and powers up it when resume, the code path it goes
> through is very like the ath12k reset logic.
> 
> In order to reuse that logic, rearrange IRQ handling in the reset
> path.
> 
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
> ---
>   drivers/net/wireless/ath/ath12k/core.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
> index 3c522a4b3e9b..28663cf4db30 100644
> --- a/drivers/net/wireless/ath/ath12k/core.c
> +++ b/drivers/net/wireless/ath/ath12k/core.c
> @@ -879,9 +879,8 @@ static int ath12k_core_reconfigure_on_crash(struct ath12k_base *ab)
>   	int ret;
>   
>   	mutex_lock(&ab->core_lock);
> -	ath12k_hif_irq_disable(ab);
>   	ath12k_dp_pdev_free(ab);
> -	ath12k_hif_stop(ab);
> +	ath12k_ce_cleanup_pipes(ab);
>   	ath12k_wmi_detach(ab);
>   	ath12k_dp_rx_pdev_reo_cleanup(ab);
>   	mutex_unlock(&ab->core_lock);
> @@ -1136,6 +1135,9 @@ static void ath12k_core_reset(struct work_struct *work)
>   	time_left = wait_for_completion_timeout(&ab->recovery_start,
>   						ATH12K_RECOVER_START_TIMEOUT_HZ);
>   
> +	ath12k_hif_irq_disable(ab);
> +	ath12k_hif_ce_irq_disable(ab);
> +

This core reset is called due to a fatal error. In case of an unlikely 
scenario, when there are consecutive fatal errors notification before 
the first fatal error is handled, then we will be disabling same irqs 
again. Shall we have a check here to see if ab's already in reset using 
ab->is_reset.

>   	ath12k_hif_power_down(ab);
>   	ath12k_qmi_free_resource(ab);
>   	ath12k_hif_power_up(ab);
Baochen Qiang April 15, 2024, 5:38 a.m. UTC | #2
On 4/13/2024 2:24 AM, Sidhanta Sahu wrote:
>
>
> On 4/11/2024 11:06 PM, Baochen Qiang wrote:
>> For non-WoW suspend/resume, ath12k host powers down whole hardware
>> when suspend and powers up it when resume, the code path it goes
>> through is very like the ath12k reset logic.
>>
>> In order to reuse that logic, rearrange IRQ handling in the reset
>> path.
>>
>> Tested-on: WCN7850 hw2.0 PCI 
>> WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
>> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
>>
>> Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
>> ---
>>   drivers/net/wireless/ath/ath12k/core.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath12k/core.c 
>> b/drivers/net/wireless/ath/ath12k/core.c
>> index 3c522a4b3e9b..28663cf4db30 100644
>> --- a/drivers/net/wireless/ath/ath12k/core.c
>> +++ b/drivers/net/wireless/ath/ath12k/core.c
>> @@ -879,9 +879,8 @@ static int 
>> ath12k_core_reconfigure_on_crash(struct ath12k_base *ab)
>>       int ret;
>>         mutex_lock(&ab->core_lock);
>> -    ath12k_hif_irq_disable(ab);
>>       ath12k_dp_pdev_free(ab);
>> -    ath12k_hif_stop(ab);
>> +    ath12k_ce_cleanup_pipes(ab);
>>       ath12k_wmi_detach(ab);
>>       ath12k_dp_rx_pdev_reo_cleanup(ab);
>>       mutex_unlock(&ab->core_lock);
>> @@ -1136,6 +1135,9 @@ static void ath12k_core_reset(struct 
>> work_struct *work)
>>       time_left = wait_for_completion_timeout(&ab->recovery_start,
>>                           ATH12K_RECOVER_START_TIMEOUT_HZ);
>>   +    ath12k_hif_irq_disable(ab);
>> +    ath12k_hif_ce_irq_disable(ab);
>> +
>
> This core reset is called due to a fatal error. In case of an unlikely 
> scenario, when there are consecutive fatal errors notification before 
> the first fatal error is handled, then we will be disabling same irqs 
> again. Shall we have a check here to see if ab's already in reset 
> using ab->is_reset.
There is similar logic using ab->reset_count in ath12k_core_reset().
>
>>       ath12k_hif_power_down(ab);
>>       ath12k_qmi_free_resource(ab);
>>       ath12k_hif_power_up(ab);
Jeff Johnson April 22, 2024, 5:51 p.m. UTC | #3
On 4/11/2024 11:06 PM, Baochen Qiang wrote:
> For non-WoW suspend/resume, ath12k host powers down whole hardware
> when suspend and powers up it when resume, the code path it goes
> through is very like the ath12k reset logic.
> 
> In order to reuse that logic, rearrange IRQ handling in the reset
> path.
> 
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Kalle Valo April 23, 2024, 9:27 a.m. UTC | #4
Baochen Qiang <quic_bqiang@quicinc.com> wrote:

> For non-WoW suspend/resume, ath12k host powers down whole hardware
> when suspend and powers up it when resume, the code path it goes
> through is very like the ath12k reset logic.
> 
> In order to reuse that logic, rearrange IRQ handling in the reset
> path.
> 
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

10 patches applied to ath-next branch of ath.git, thanks.

c7b2da3c0a57 wifi: ath12k: rearrange IRQ enable/disable in reset path
b8b50a489d51 wifi: ath12k: remove MHI LOOPBACK channels
8591b2baaee4 wifi: ath12k: do not dump SRNG statistics during resume
1623bf78c846 wifi: ath12k: fix warning on DMA ring capabilities event
7b3d4eb283d2 wifi: ath12k: decrease MHI channel buffer length to 8KB
692921ead832 wifi: ath12k: flush all packets before suspend
b1c9992c675b wifi: ath12k: no need to handle pktlog during suspend/resume
2652f6b472ff wifi: ath12k: avoid stopping mac80211 queues in ath12k_core_restart()
8d5f4da8d70b wifi: ath12k: support suspend/resume
2b0028458996 wifi: ath12k: change supports_suspend to true for WCN7850
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
index 3c522a4b3e9b..28663cf4db30 100644
--- a/drivers/net/wireless/ath/ath12k/core.c
+++ b/drivers/net/wireless/ath/ath12k/core.c
@@ -879,9 +879,8 @@  static int ath12k_core_reconfigure_on_crash(struct ath12k_base *ab)
 	int ret;
 
 	mutex_lock(&ab->core_lock);
-	ath12k_hif_irq_disable(ab);
 	ath12k_dp_pdev_free(ab);
-	ath12k_hif_stop(ab);
+	ath12k_ce_cleanup_pipes(ab);
 	ath12k_wmi_detach(ab);
 	ath12k_dp_rx_pdev_reo_cleanup(ab);
 	mutex_unlock(&ab->core_lock);
@@ -1136,6 +1135,9 @@  static void ath12k_core_reset(struct work_struct *work)
 	time_left = wait_for_completion_timeout(&ab->recovery_start,
 						ATH12K_RECOVER_START_TIMEOUT_HZ);
 
+	ath12k_hif_irq_disable(ab);
+	ath12k_hif_ce_irq_disable(ab);
+
 	ath12k_hif_power_down(ab);
 	ath12k_qmi_free_resource(ab);
 	ath12k_hif_power_up(ab);