From 19f4eb9bb6bebf3ced399f756bec75748cbdf5d4 Mon Sep 17 00:00:00 2001 From: Bapiraju Alla Date: Tue, 15 Dec 2020 16:17:47 +0530 Subject: [PATCH] qcacld-3.0: Request stats over qmi only when target suspend is success Currently, Stats request commands are sent over qmi right from the target suspend request is sent to FW. This is leading to a crash in FW since it is trying to access PCI when it is in suspend state. To address this, send stats request over QMI only after the ack is received for the target suspend command. Change-Id: I1b2b6a60c5d8c7ec4375d328e58a66d749794e3f CRs-Fixed: 2835903 --- .../pmo/core/src/wlan_pmo_suspend_resume.c | 14 ++++++++------ .../inc/wlan_pmo_obj_mgmt_public_struct.h | 4 +++- .../pmo/dispatcher/inc/wlan_pmo_tgt_api.h | 17 ++++++++++++++--- .../src/wlan_pmo_tgt_suspend_resume.c | 15 ++++++++++++++- components/target_if/pmo/inc/target_if_pmo.h | 16 ++++++++++++++-- .../target_if/pmo/src/target_if_pmo_main.c | 4 +++- .../pmo/src/target_if_pmo_suspend_resume.c | 15 +++++++++++++++ 7 files changed, 71 insertions(+), 14 deletions(-) diff --git a/components/pmo/core/src/wlan_pmo_suspend_resume.c b/components/pmo/core/src/wlan_pmo_suspend_resume.c index 524010d6fc..f21bd9e4e9 100644 --- a/components/pmo/core/src/wlan_pmo_suspend_resume.c +++ b/components/pmo/core/src/wlan_pmo_suspend_resume.c @@ -847,6 +847,8 @@ pmo_core_enable_wow_in_fw(struct wlan_objmgr_psoc *psoc, goto out; } + pmo_tgt_update_target_suspend_acked_flag(psoc, true); + host_credits = pmo_tgt_psoc_get_host_credits(psoc); wmi_pending_cmds = pmo_tgt_psoc_get_pending_cmnds(psoc); @@ -895,6 +897,8 @@ QDF_STATUS pmo_core_psoc_suspend_target(struct wlan_objmgr_psoc *psoc, pmo_tgt_update_target_suspend_flag(psoc, false); if (!psoc_ctx->wow.target_suspend.force_set) qdf_trigger_self_recovery(psoc, QDF_SUSPEND_TIMEOUT); + } else { + pmo_tgt_update_target_suspend_acked_flag(psoc, true); } out: @@ -1232,10 +1236,9 @@ QDF_STATUS pmo_core_psoc_send_host_wakeup_ind_to_fw( qdf_trigger_self_recovery(psoc, QDF_RESUME_TIMEOUT); } else { pmo_debug("Host wakeup received"); - } - - if (status == QDF_STATUS_SUCCESS) pmo_tgt_update_target_suspend_flag(psoc, false); + pmo_tgt_update_target_suspend_acked_flag(psoc, false); + } out: pmo_exit(); @@ -1305,10 +1308,9 @@ QDF_STATUS pmo_core_psoc_resume_target(struct wlan_objmgr_psoc *psoc, qdf_trigger_self_recovery(psoc, QDF_RESUME_TIMEOUT); } else { pmo_debug("Host wakeup received"); - } - - if (status == QDF_STATUS_SUCCESS) pmo_tgt_update_target_suspend_flag(psoc, false); + pmo_tgt_update_target_suspend_acked_flag(psoc, false); + } out: pmo_exit(); diff --git a/components/pmo/dispatcher/inc/wlan_pmo_obj_mgmt_public_struct.h b/components/pmo/dispatcher/inc/wlan_pmo_obj_mgmt_public_struct.h index 2e394fe5b7..4fb2a5db02 100644 --- a/components/pmo/dispatcher/inc/wlan_pmo_obj_mgmt_public_struct.h +++ b/components/pmo/dispatcher/inc/wlan_pmo_obj_mgmt_public_struct.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -209,6 +209,8 @@ struct wlan_pmo_tx_ops { struct wlan_objmgr_psoc *psoc); void (*update_target_suspend_flag)( struct wlan_objmgr_psoc *psoc, uint8_t value); + void (*update_target_suspend_acked_flag)( + struct wlan_objmgr_psoc *psoc, uint8_t value); bool (*is_target_suspended)(struct wlan_objmgr_psoc *psoc); QDF_STATUS (*psoc_send_wow_enable_req)(struct wlan_objmgr_psoc *psoc, struct pmo_wow_cmd_params *param); diff --git a/components/pmo/dispatcher/inc/wlan_pmo_tgt_api.h b/components/pmo/dispatcher/inc/wlan_pmo_tgt_api.h index e08560b0e3..128fb038c1 100644 --- a/components/pmo/dispatcher/inc/wlan_pmo_tgt_api.h +++ b/components/pmo/dispatcher/inc/wlan_pmo_tgt_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -377,10 +377,21 @@ int pmo_tgt_psoc_get_pending_cmnds(struct wlan_objmgr_psoc *psoc); * @psoc: objmgr psoc * @val: true on suspend false for resume * - * Return: Pending WMI commands on success else EAGAIN on error + * Return: None */ void pmo_tgt_update_target_suspend_flag(struct wlan_objmgr_psoc *psoc, - uint8_t val); + uint8_t val); + +/** + * pmo_tgt_update_target_suspend_acked_flag() - Set WMI target Suspend acked + * flag + * @psoc: objmgr psoc + * @val: true on suspend false for resume + * + * Return: None + */ +void pmo_tgt_update_target_suspend_acked_flag(struct wlan_objmgr_psoc *psoc, + uint8_t val); /** * pmo_tgt_is_target_suspended() - Get WMI target Suspend flag diff --git a/components/pmo/dispatcher/src/wlan_pmo_tgt_suspend_resume.c b/components/pmo/dispatcher/src/wlan_pmo_tgt_suspend_resume.c index 1c08a0de9f..753705affb 100644 --- a/components/pmo/dispatcher/src/wlan_pmo_tgt_suspend_resume.c +++ b/components/pmo/dispatcher/src/wlan_pmo_tgt_suspend_resume.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -131,6 +131,19 @@ void pmo_tgt_update_target_suspend_flag(struct wlan_objmgr_psoc *psoc, pmo_tx_ops.update_target_suspend_flag(psoc, val); } +void pmo_tgt_update_target_suspend_acked_flag(struct wlan_objmgr_psoc *psoc, + uint8_t val) +{ + struct wlan_pmo_tx_ops pmo_tx_ops; + + pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc); + if (!pmo_tx_ops.update_target_suspend_acked_flag) { + pmo_err("update_target_suspend_acked_flag is null"); + return; + } + pmo_tx_ops.update_target_suspend_acked_flag(psoc, val); +} + bool pmo_tgt_is_target_suspended(struct wlan_objmgr_psoc *psoc) { struct wlan_pmo_tx_ops pmo_tx_ops; diff --git a/components/target_if/pmo/inc/target_if_pmo.h b/components/target_if/pmo/inc/target_if_pmo.h index d2991ea429..c858bcb4db 100644 --- a/components/target_if/pmo/inc/target_if_pmo.h +++ b/components/target_if/pmo/inc/target_if_pmo.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -382,11 +382,23 @@ int target_if_pmo_psoc_get_pending_cmnds(struct wlan_objmgr_psoc *psoc); * @psoc: objmgr psoc * @value: value * - * Return: return wmi pending commands + * Return: None */ void target_if_pmo_update_target_suspend_flag(struct wlan_objmgr_psoc *psoc, uint8_t value); +/** + * target_if_pmo_update_target_suspend_acked_flag() - set wmi target suspend + * acked flag + * @psoc: objmgr psoc + * @value: value + * + * Return: None + */ +void target_if_pmo_update_target_suspend_acked_flag( + struct wlan_objmgr_psoc *psoc, + uint8_t value); + /** * target_if_pmo_is_target_suspended() - get wmi target suspend flag * @psoc: objmgr psoc diff --git a/components/target_if/pmo/src/target_if_pmo_main.c b/components/target_if/pmo/src/target_if_pmo_main.c index c769ce4682..a0134d0828 100644 --- a/components/target_if/pmo/src/target_if_pmo_main.c +++ b/components/target_if/pmo/src/target_if_pmo_main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -103,6 +103,8 @@ void target_if_pmo_register_tx_ops(struct wlan_pmo_tx_ops *pmo_tx_ops) target_if_pmo_psoc_get_pending_cmnds; pmo_tx_ops->update_target_suspend_flag = target_if_pmo_update_target_suspend_flag; + pmo_tx_ops->update_target_suspend_acked_flag = + target_if_pmo_update_target_suspend_acked_flag; pmo_tx_ops->is_target_suspended = target_if_pmo_is_target_suspended; pmo_tx_ops->psoc_send_wow_enable_req = diff --git a/components/target_if/pmo/src/target_if_pmo_suspend_resume.c b/components/target_if/pmo/src/target_if_pmo_suspend_resume.c index 77f2974cfe..9263469e9e 100644 --- a/components/target_if/pmo/src/target_if_pmo_suspend_resume.c +++ b/components/target_if/pmo/src/target_if_pmo_suspend_resume.c @@ -201,6 +201,21 @@ void target_if_pmo_update_target_suspend_flag(struct wlan_objmgr_psoc *psoc, wmi_set_target_suspend(wmi_handle, value); } +void target_if_pmo_update_target_suspend_acked_flag( + struct wlan_objmgr_psoc *psoc, + uint8_t value) +{ + wmi_unified_t wmi_handle; + + wmi_handle = get_wmi_unified_hdl_from_psoc(psoc); + if (!wmi_handle) { + target_if_err("Invalid wmi handle"); + return; + } + + wmi_set_target_suspend_acked(wmi_handle, value); +} + bool target_if_pmo_is_target_suspended(struct wlan_objmgr_psoc *psoc) { wmi_unified_t wmi_handle;