Skip to content

Commit 4d79f6f

Browse files
youghandharkvalo
authored andcommitted
wifi: ath10k: Store WLAN firmware version in SMEM image table
In a SoC based solution, it would be useful to know the versions of the various binary firmware blobs the system is running on. On a QCOM based SoC, this info can be obtained from socinfo debugfs infrastructure. For this to work, respective subsystem drivers have to export the firmware version information to an SMEM based version information table. Having firmware version information at one place will help quickly figure out the firmware versions of various subsystems on the device instead of going through builds/logs in an event of a system crash. Fill WLAN firmware version information in SMEM version table to be printed as part of socinfo debugfs infrastructure on a Qualcomm based SoC. This change is applicable only for SNOC/QMI based targets. Example: cat /sys/kernel/debug/qcom_socinfo/cnss/name QC_IMAGE_VERSION_STRING=WLAN.HL.3.2.2.c10-00754-QCAHLSWMTPL-1 Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.2.2.c10-00754-QCAHLSWMTPL-1 Signed-off-by: Youghandhar Chintala <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d9e3835 commit 4d79f6f

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

drivers/net/wireless/ath/ath10k/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ config ATH10K_SNOC
4444
tristate "Qualcomm ath10k SNOC support"
4545
depends on ATH10K
4646
depends on ARCH_QCOM || COMPILE_TEST
47+
select QCOM_SMEM
4748
select QCOM_SCM
4849
select QCOM_QMI_HELPERS
4950
help

drivers/net/wireless/ath/ath10k/qmi.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/net.h>
1515
#include <linux/platform_device.h>
1616
#include <linux/qcom_scm.h>
17+
#include <linux/soc/qcom/smem.h>
1718
#include <linux/string.h>
1819
#include <net/sock.h>
1920

@@ -22,6 +23,10 @@
2223

2324
#define ATH10K_QMI_CLIENT_ID 0x4b4e454c
2425
#define ATH10K_QMI_TIMEOUT 30
26+
#define SMEM_IMAGE_VERSION_TABLE 469
27+
#define SMEM_IMAGE_TABLE_CNSS_INDEX 13
28+
#define SMEM_IMAGE_VERSION_ENTRY_SIZE 128
29+
#define SMEM_IMAGE_VERSION_NAME_SIZE 75
2530

2631
static int ath10k_qmi_map_msa_permission(struct ath10k_qmi *qmi,
2732
struct ath10k_msa_mem_info *mem_info)
@@ -536,6 +541,33 @@ int ath10k_qmi_wlan_disable(struct ath10k *ar)
536541
return ath10k_qmi_mode_send_sync_msg(ar, QMI_WLFW_OFF_V01);
537542
}
538543

544+
static void ath10k_qmi_add_wlan_ver_smem(struct ath10k *ar, const char *fw_build_id)
545+
{
546+
u8 *table_ptr;
547+
size_t smem_item_size;
548+
const u32 smem_img_idx_wlan = SMEM_IMAGE_TABLE_CNSS_INDEX *
549+
SMEM_IMAGE_VERSION_ENTRY_SIZE;
550+
551+
table_ptr = qcom_smem_get(QCOM_SMEM_HOST_ANY,
552+
SMEM_IMAGE_VERSION_TABLE,
553+
&smem_item_size);
554+
555+
if (IS_ERR(table_ptr)) {
556+
ath10k_err(ar, "smem image version table not found\n");
557+
return;
558+
}
559+
560+
if (smem_img_idx_wlan + SMEM_IMAGE_VERSION_ENTRY_SIZE >
561+
smem_item_size) {
562+
ath10k_err(ar, "smem block size too small: %zu\n",
563+
smem_item_size);
564+
return;
565+
}
566+
567+
strscpy(table_ptr + smem_img_idx_wlan, fw_build_id,
568+
SMEM_IMAGE_VERSION_NAME_SIZE);
569+
}
570+
539571
static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi)
540572
{
541573
struct wlfw_cap_resp_msg_v01 *resp;
@@ -606,6 +638,9 @@ static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi)
606638
qmi->fw_version, qmi->fw_build_timestamp, qmi->fw_build_id);
607639
}
608640

641+
if (resp->fw_build_id_valid)
642+
ath10k_qmi_add_wlan_ver_smem(ar, qmi->fw_build_id);
643+
609644
kfree(resp);
610645
return 0;
611646

0 commit comments

Comments
 (0)