cnss_utils: Wait for initialization of daemon config

There is scenario where cnss-daemon is got connected with
cnss-plat-ipc module but message to initialize daemon
config is not yet received from cnss-daemon. At the same
time cnss2 module checks for DMS support in daemon config
which is not yet initialized. As use-nv-mac is set from DTSI,
DMS support must be enabled. Since it is not found enabled,
cnss2 asserts.
To fix this, along with cnss-daemon connection check also
wait for message from cnss-daemon which initializes daemon
config.

Change-Id: I2579e7e9040c0ea7286c265488e2050652c5cc21
CRs-Fixed: 3517692
This commit is contained in:
Naman Padhiar
2023-06-02 03:10:46 -07:00
parent 1551c1bbe3
commit b1be304dfc
2 changed files with 17 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* Copyright (c) 2021, The Linux Foundation. All rights reserved. * Copyright (c) 2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2021, 2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
@@ -26,6 +26,8 @@
#define QMI_INIT_RETRY_MAX_TIMES 240 #define QMI_INIT_RETRY_MAX_TIMES 240
#define QMI_INIT_RETRY_DELAY_MS 250 #define QMI_INIT_RETRY_DELAY_MS 250
#define NUM_LOG_PAGES 10 #define NUM_LOG_PAGES 10
#define CNSS_DAEMON_CFG_WAIT_RETRY 200
#define CNSS_DAEMON_CFG_WAIT_MS 50
/** /**
* struct cnss_plat_ipc_file_data: File transfer context data * struct cnss_plat_ipc_file_data: File transfer context data
@@ -591,6 +593,7 @@ cnss_plat_ipc_qmi_init_setup_req_handler(struct qmi_handle *handle,
cfg->dms_mac_addr_supported = req_msg->dms_mac_addr_supported; cfg->dms_mac_addr_supported = req_msg->dms_mac_addr_supported;
cfg->qdss_hw_trace_override = req_msg->qdss_hw_trace_override; cfg->qdss_hw_trace_override = req_msg->qdss_hw_trace_override;
cfg->cal_file_available_bitmask = req_msg->cal_file_available_bitmask; cfg->cal_file_available_bitmask = req_msg->cal_file_available_bitmask;
cfg->initialized = 1;
ret = qmi_send_response ret = qmi_send_response
(svc->svc_hdl, sq, txn, (svc->svc_hdl, sq, txn,
@@ -776,6 +779,7 @@ static struct qmi_msg_handler cnss_plat_ipc_qmi_req_handlers[] = {
*/ */
struct cnss_plat_ipc_daemon_config *cnss_plat_ipc_qmi_daemon_config(void) struct cnss_plat_ipc_daemon_config *cnss_plat_ipc_qmi_daemon_config(void)
{ {
int i;
struct cnss_plat_ipc_qmi_svc_ctx *svc = &plat_ipc_qmi_svc; struct cnss_plat_ipc_qmi_svc_ctx *svc = &plat_ipc_qmi_svc;
struct cnss_plat_ipc_qmi_client_ctx *qmi_client = struct cnss_plat_ipc_qmi_client_ctx *qmi_client =
&svc->qmi_client_ctx[CNSS_PLAT_IPC_DAEMON_QMI_CLIENT_V01]; &svc->qmi_client_ctx[CNSS_PLAT_IPC_DAEMON_QMI_CLIENT_V01];
@@ -783,6 +787,13 @@ struct cnss_plat_ipc_daemon_config *cnss_plat_ipc_qmi_daemon_config(void)
if (!qmi_client->client_connected) if (!qmi_client->client_connected)
return NULL; return NULL;
for (i = 0; i < CNSS_DAEMON_CFG_WAIT_RETRY; i++) {
if (daemon_cfg.initialized == 1)
break;
msleep(CNSS_DAEMON_CFG_WAIT_MS);
}
return &daemon_cfg; return &daemon_cfg;
} }
EXPORT_SYMBOL(cnss_plat_ipc_qmi_daemon_config); EXPORT_SYMBOL(cnss_plat_ipc_qmi_daemon_config);

View File

@@ -1,5 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. */ /* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef _CNSS_PLAT_IPC_QMI_H #ifndef _CNSS_PLAT_IPC_QMI_H
#define _CNSS_PLAT_IPC_QMI_H #define _CNSS_PLAT_IPC_QMI_H
@@ -15,11 +17,13 @@
/** /**
* cnss_plat_ipc_daemon_config: Config options provided by cnss-daemon * cnss_plat_ipc_daemon_config: Config options provided by cnss-daemon
* @initialized: Set when daemon configs are initialized
* @dms_mac_addr_supported: DMS MAC address provisioning support * @dms_mac_addr_supported: DMS MAC address provisioning support
* @qdss_hw_trace_override: QDSS config for HW trace enable * @qdss_hw_trace_override: QDSS config for HW trace enable
* @cal_file_available_bitmask: Calibration file available * @cal_file_available_bitmask: Calibration file available
*/ */
struct cnss_plat_ipc_daemon_config { struct cnss_plat_ipc_daemon_config {
u8 initialized;
u8 dms_mac_addr_supported; u8 dms_mac_addr_supported;
u8 qdss_hw_trace_override; u8 qdss_hw_trace_override;
u32 cal_file_available_bitmask; u32 cal_file_available_bitmask;