From: Alexander Wilhelm <alexander.wilhelm@westermo.com>
To: Jeff Johnson <jjohnson@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>
Cc: linux-wireless@vger.kernel.org, ath12k@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: [PATCH 06/11] wifi: ath12k: fix endianness handling in QMI firmware capabilities
Date: Wed, 16 Jul 2025 09:50:55 +0200 [thread overview]
Message-ID: <20250716075100.1447352-7-alexander.wilhelm@westermo.com> (raw)
In-Reply-To: <20250716075100.1447352-1-alexander.wilhelm@westermo.com>
Ensure proper endianness support for big-endian platforms by correcting
data types in the QMI firmware capabilities response message and its
associated structures as well. Add missing byte swaps wherever these
structures are accessed or modified.
Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Signed-off-by: Alexander Wilhelm <alexander.wilhelm@westermo.com>
---
drivers/net/wireless/ath/ath12k/qmi.c | 16 ++++++++--------
drivers/net/wireless/ath/ath12k/qmi.h | 26 +++++++++++++-------------
2 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index 2d00ea54e478..0bcfb9281d01 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -2850,20 +2850,20 @@ int ath12k_qmi_request_target_cap(struct ath12k_base *ab)
}
if (resp.chip_info_valid) {
- ab->qmi.target.chip_id = resp.chip_info.chip_id;
- ab->qmi.target.chip_family = resp.chip_info.chip_family;
+ ab->qmi.target.chip_id = le32_to_cpu(resp.chip_info.chip_id);
+ ab->qmi.target.chip_family = le32_to_cpu(resp.chip_info.chip_family);
}
if (resp.board_info_valid)
- ab->qmi.target.board_id = resp.board_info.board_id;
+ ab->qmi.target.board_id = le32_to_cpu(resp.board_info.board_id);
else
ab->qmi.target.board_id = board_id;
if (resp.soc_info_valid)
- ab->qmi.target.soc_id = resp.soc_info.soc_id;
+ ab->qmi.target.soc_id = le32_to_cpu(resp.soc_info.soc_id);
if (resp.fw_version_info_valid) {
- ab->qmi.target.fw_version = resp.fw_version_info.fw_version;
+ ab->qmi.target.fw_version = le32_to_cpu(resp.fw_version_info.fw_version);
strscpy(ab->qmi.target.fw_build_timestamp,
resp.fw_version_info.fw_build_timestamp,
sizeof(ab->qmi.target.fw_build_timestamp));
@@ -2876,9 +2876,9 @@ int ath12k_qmi_request_target_cap(struct ath12k_base *ab)
if (resp.dev_mem_info_valid) {
for (i = 0; i < ATH12K_QMI_WLFW_MAX_DEV_MEM_NUM_V01; i++) {
ab->qmi.dev_mem[i].start =
- resp.dev_mem[i].start;
+ le64_to_cpu(resp.dev_mem[i].start);
ab->qmi.dev_mem[i].size =
- resp.dev_mem[i].size;
+ le64_to_cpu(resp.dev_mem[i].size);
ath12k_dbg(ab, ATH12K_DBG_QMI,
"devmem [%d] start 0x%llx size %llu\n", i,
ab->qmi.dev_mem[i].start,
@@ -2887,7 +2887,7 @@ int ath12k_qmi_request_target_cap(struct ath12k_base *ab)
}
if (resp.eeprom_caldata_read_timeout_valid) {
- ab->qmi.target.eeprom_caldata = resp.eeprom_caldata_read_timeout;
+ ab->qmi.target.eeprom_caldata = le32_to_cpu(resp.eeprom_caldata_read_timeout);
ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi cal data supported from eeprom\n");
}
diff --git a/drivers/net/wireless/ath/ath12k/qmi.h b/drivers/net/wireless/ath/ath12k/qmi.h
index bd715bca8f23..114324157e84 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.h
+++ b/drivers/net/wireless/ath/ath12k/qmi.h
@@ -421,26 +421,26 @@ struct qmi_wlanfw_memory_region_info_s_v01 {
};
struct qmi_wlanfw_rf_chip_info_s_v01 {
- u32 chip_id;
- u32 chip_family;
+ __le32 chip_id;
+ __le32 chip_family;
};
struct qmi_wlanfw_rf_board_info_s_v01 {
- u32 board_id;
+ __le32 board_id;
};
struct qmi_wlanfw_soc_info_s_v01 {
- u32 soc_id;
+ __le32 soc_id;
};
struct qmi_wlanfw_fw_version_info_s_v01 {
- u32 fw_version;
+ __le32 fw_version;
char fw_build_timestamp[ATH12K_QMI_WLANFW_MAX_TIMESTAMP_LEN_V01 + 1];
};
struct qmi_wlanfw_dev_mem_info_s_v01 {
- u64 start;
- u64 size;
+ __le64 start;
+ __le64 size;
};
enum qmi_wlanfw_cal_temp_id_enum_v01 {
@@ -475,17 +475,17 @@ struct qmi_wlanfw_cap_resp_msg_v01 {
u8 num_macs_valid;
u8 num_macs;
u8 voltage_mv_valid;
- u32 voltage_mv;
+ __le32 voltage_mv;
u8 time_freq_hz_valid;
- u32 time_freq_hz;
+ __le32 time_freq_hz;
u8 otp_version_valid;
- u32 otp_version;
+ __le32 otp_version;
u8 eeprom_caldata_read_timeout_valid;
- u32 eeprom_caldata_read_timeout;
+ __le32 eeprom_caldata_read_timeout;
u8 fw_caps_valid;
- u64 fw_caps;
+ __le64 fw_caps;
u8 rd_card_chain_cap_valid;
- enum qmi_wlanfw_rd_card_chain_cap_v01 rd_card_chain_cap;
+ __le32 rd_card_chain_cap;
u8 dev_mem_info_valid;
struct qmi_wlanfw_dev_mem_info_s_v01 dev_mem[ATH12K_QMI_WLFW_MAX_DEV_MEM_NUM_V01];
};
--
2.34.1
next prev parent reply other threads:[~2025-07-16 8:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 7:50 [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI Alexander Wilhelm
2025-07-16 7:50 ` [PATCH 01/11] wifi: ath12k: fix endianness handling in QMI host capability request Alexander Wilhelm
2025-07-16 7:50 ` [PATCH 02/11] wifi: ath12k: fix endianness handling in QMI phy capability response Alexander Wilhelm
2025-07-16 7:50 ` [PATCH 03/11] wifi: ath12k: fix endianness handling in QMI firmware indication Alexander Wilhelm
2025-07-16 7:50 ` [PATCH 04/11] wifi: ath12k: fix endianness handling in QMI firmware memory indication Alexander Wilhelm
2025-07-16 7:50 ` [PATCH 05/11] wifi: ath12k: fix endianness handling in QMI respond firmware memory Alexander Wilhelm
2025-07-16 7:50 ` Alexander Wilhelm [this message]
2025-07-16 7:50 ` [PATCH 07/11] wifi: ath12k: fix endianness handling in QMI bdf download Alexander Wilhelm
2025-07-17 15:59 ` kernel test robot
2025-07-16 7:50 ` [PATCH 08/11] wifi: ath12k: fix endianness handling in QMI firmware m3 info Alexander Wilhelm
2025-07-16 7:50 ` [PATCH 09/11] wifi: ath12k: fix endianness handling in QMI firmware wlan mode Alexander Wilhelm
2025-07-16 7:50 ` [PATCH 10/11] wifi: ath12k: fix endianness handling in QMI wlan configuration Alexander Wilhelm
2025-07-16 7:51 ` [PATCH 11/11] wifi: ath12k: fix endianness handling in QMI response Alexander Wilhelm
2025-07-17 8:33 ` kernel test robot
2025-07-16 15:13 ` [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI Jeff Johnson
2025-07-20 4:24 ` Bjorn Andersson
2025-07-21 7:36 ` Alexander Wilhelm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250716075100.1447352-7-alexander.wilhelm@westermo.com \
--to=alexander.wilhelm@westermo.com \
--cc=andersson@kernel.org \
--cc=ath12k@lists.infradead.org \
--cc=jjohnson@kernel.org \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®