* [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI
@ 2025-07-16 7:50 Alexander Wilhelm
2025-07-16 7:50 ` [PATCH 01/11] wifi: ath12k: fix endianness handling in QMI host capability request Alexander Wilhelm
` (11 more replies)
0 siblings, 12 replies; 17+ messages in thread
From: Alexander Wilhelm @ 2025-07-16 7:50 UTC (permalink / raw)
To: Jeff Johnson, Bjorn Andersson, Konrad Dybcio
Cc: linux-wireless, ath12k, linux-kernel, linux-arm-msm
Fix endianness handling in QMI firmware transfer on big-endian
platforms. Without this fix, the firmware download fails due to
misinterpreted data structures exchanged between the host and the
wireless module.
The issue occurs during early bring-up on big endian systems, where QMI
messages are not correctly parsed by the driver, leading to failed
initialization sequences. Ensure all relevant fields are properly
converted between CPU and little-endian format in request and response
messages, as expected by the firmware. Attached logs showing the failure
before the fix:
ath12k_pci 0001:01:00.0: BAR 0: assigned [mem 0xc00000000-0xc001fffff 64bit]
ath12k_pci 0001:01:00.0: boot pci_mem 0xcd4148e9
ath12k_pci 0001:01:00.0: pci probe 17cb:1109 17cb:1109
ath12k_pci 0001:01:00.0: pci tcsr_soc_hw_version major 2 minor 0
ath12k_pci 0001:01:00.0: request MSI one vector
ath12k_pci 0001:01:00.0: MSI vectors: 1
ath12k_pci 0001:01:00.0: msi base data is 0
ath12k_pci 0001:01:00.0: Hardware name: qcn9274 hw2.0
ath12k_pci 0001:01:00.0: boot firmware request ath12k/QCN9274/hw2.0/firmware-2.bin size 15134776
ath12k_pci 0001:01:00.0: found fw timestamp 1722934582
ath12k_pci 0001:01:00.0: found m3 image ie (421880 B)
ath12k_pci 0001:01:00.0: found fw image ie (7229440 B)
ath12k_pci 0001:01:00.0: found dualmac fw image ie (7483392 B)
ath12k_pci 0001:01:00.0: found firmware features ie (1 B)
ath12k_pci 0001:01:00.0: features
ath12k_pci 0001:01:00.0: using fw api 2
ath12k_pci 0001:01:00.0: dualmac fw selected for board id: 1005
ath12k_pci 0001:01:00.0: Assign MSI to user: MHI, num_vectors: 3, user_base_data: 0, base_vector: 0
ath12k_pci 0001:01:00.0: Number of assigned MSI for MHI is 3, base vector is 0
ath12k_pci 0001:01:00.0: Assign MSI to user: CE, num_vectors: 1, user_base_data: 0, base_vector: 0
ath12k_pci 0001:01:00.0: Assign MSI to user: DP, num_vectors: 1, user_base_data: 0, base_vector: 0
ath12k_pci 0001:01:00.0: irq:18 group:0
ath12k_pci 0001:01:00.0: irq:18 group:1
ath12k_pci 0001:01:00.0: irq:18 group:2
ath12k_pci 0001:01:00.0: irq:18 group:3
ath12k_pci 0001:01:00.0: irq:18 group:4
ath12k_pci 0001:01:00.0: irq:18 group:5
ath12k_pci 0001:01:00.0: irq:18 group:6
ath12k_pci 0001:01:00.0: irq:18 group:7
ath12k_pci 0001:01:00.0: pci after request_irq msi_ep_base_data 0
ath12k_pci 0001:01:00.0: cookie:0x0
ath12k_pci 0001:01:00.0: WLAON_WARM_SW_ENTRY 0x2
ath12k_pci 0001:01:00.0: WLAON_WARM_SW_ENTRY 0x2
ath12k_pci 0001:01:00.0: soc reset cause:0
ath12k_pci 0001:01:00.0: MHISTATUS 0xff04
ath12k_pci 0001:01:00.0: pci link_ctl 0x0000 L0s 0 L1 0
ath12k_pci 0001:01:00.0: pci reg 0x3164 instance 0x11 read val 0x11
ath12k_pci 0001:01:00.0: setting mhi state: INIT(0)
ath12k_pci 0001:01:00.0: setting mhi state: POWER_ON(2)
ath12k_pci 0001:01:00.0: mhi notify status reason UNKNOWN
ath12k_pci 0001:01:00.0: mhi notify status reason MHI_CB_EE_MISSION_MODE
ath12k_pci 0001:01:00.0: qmi wifi fw qmi service connected
ath12k_pci 0001:01:00.0: phy capability resp valid 1 num_phy 2 valid 1 board_id 84934656 valid 1 single_chip_mlo_support 0
ath12k_pci 0001:01:00.0: intra device MLO is disabled hence skip QMI MLO cap
Alexander Wilhelm (11):
wifi: ath12k: fix endianness handling in QMI host capability request
wifi: ath12k: fix endianness handling in QMI phy capability response
wifi: ath12k: fix endianness handling in QMI firmware indication
wifi: ath12k: fix endianness handling in QMI firmware memory indication
wifi: ath12k: fix endianness handling in QMI respond firmware memory
wifi: ath12k: fix endianness handling in QMI firmware capabilities
wifi: ath12k: fix endianness handling in QMI bdf download
wifi: ath12k: fix endianness handling in QMI firmware m3 info
wifi: ath12k: fix endianness handling in QMI firmware wlan mode
wifi: ath12k: fix endianness handling in QMI wlan configuration
wifi: ath12k: fix endianness handling in QMI response
drivers/net/wireless/ath/ath12k/qmi.c | 149 ++++++++++++++------------
drivers/net/wireless/ath/ath12k/qmi.h | 106 +++++++++---------
include/linux/soc/qcom/qmi.h | 4 +-
3 files changed, 136 insertions(+), 123 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 01/11] wifi: ath12k: fix endianness handling in QMI host capability request
2025-07-16 7:50 [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI Alexander Wilhelm
@ 2025-07-16 7:50 ` Alexander Wilhelm
2025-07-16 7:50 ` [PATCH 02/11] wifi: ath12k: fix endianness handling in QMI phy capability response Alexander Wilhelm
` (10 subsequent siblings)
11 siblings, 0 replies; 17+ messages in thread
From: Alexander Wilhelm @ 2025-07-16 7:50 UTC (permalink / raw)
To: Jeff Johnson, Bjorn Andersson, Konrad Dybcio
Cc: linux-wireless, ath12k, linux-kernel, linux-arm-msm
Ensure proper endianness support for big-endian platforms by correcting
data types in the QMI host capability request message and its associated
structures. 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 | 9 +++++----
drivers/net/wireless/ath/ath12k/qmi.h | 24 ++++++++++++------------
2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index 7c611a1fd6d0..2287ed87dae8 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -2073,14 +2073,14 @@ static int ath12k_host_cap_parse_mlo(struct ath12k_base *ab,
req->mlo_capable_valid = 1;
req->mlo_capable = 1;
req->mlo_chip_id_valid = 1;
- req->mlo_chip_id = ab->device_id;
+ req->mlo_chip_id = cpu_to_le16(ab->device_id);
req->mlo_group_id_valid = 1;
req->mlo_group_id = ag->id;
req->max_mlo_peer_valid = 1;
/* Max peer number generally won't change for the same device
* but needs to be synced with host driver.
*/
- req->max_mlo_peer = ab->hw_params->max_mlo_peer;
+ req->max_mlo_peer = cpu_to_le16(ab->hw_params->max_mlo_peer);
req->mlo_num_chips_valid = 1;
req->mlo_num_chips = ag->num_devices;
@@ -2164,7 +2164,7 @@ int ath12k_qmi_host_cap_send(struct ath12k_base *ab)
int ret = 0;
req.num_clients_valid = 1;
- req.num_clients = 1;
+ req.num_clients = cpu_to_le32(1);
req.mem_cfg_mode = ab->qmi.target_mem_mode;
req.mem_cfg_mode_valid = 1;
req.bdf_support_valid = 1;
@@ -2182,7 +2182,8 @@ int ath12k_qmi_host_cap_send(struct ath12k_base *ab)
if (ab->hw_params->qmi_cnss_feature_bitmap) {
req.feature_list_valid = 1;
- req.feature_list = ab->hw_params->qmi_cnss_feature_bitmap;
+ req.feature_list =
+ cpu_to_le64(ab->hw_params->qmi_cnss_feature_bitmap);
}
/* BRINGUP: here we are piggybacking a lot of stuff using
diff --git a/drivers/net/wireless/ath/ath12k/qmi.h b/drivers/net/wireless/ath/ath12k/qmi.h
index abdaade3b542..ed7808fe2b71 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.h
+++ b/drivers/net/wireless/ath/ath12k/qmi.h
@@ -164,8 +164,8 @@ struct ath12k_qmi {
#define QMI_WLANFW_MAX_HOST_DDR_RANGE_SIZE_V01 3
struct qmi_wlanfw_host_ddr_range {
- u64 start;
- u64 size;
+ __le64 start;
+ __le64 size;
};
enum ath12k_qmi_target_mem {
@@ -205,12 +205,12 @@ enum ath12k_qmi_cnss_feature {
struct qmi_wlanfw_host_cap_req_msg_v01 {
u8 num_clients_valid;
- u32 num_clients;
+ __le32 num_clients;
u8 wake_msi_valid;
- u32 wake_msi;
+ __le32 wake_msi;
u8 gpios_valid;
- u32 gpios_len;
- u32 gpios[QMI_WLFW_MAX_NUM_GPIO_V01];
+ __le32 gpios_len;
+ __le32 gpios[QMI_WLFW_MAX_NUM_GPIO_V01];
u8 nm_modem_valid;
u8 nm_modem;
u8 bdf_support_valid;
@@ -228,31 +228,31 @@ struct qmi_wlanfw_host_cap_req_msg_v01 {
u8 cal_done_valid;
u8 cal_done;
u8 mem_bucket_valid;
- u32 mem_bucket;
+ __le32 mem_bucket;
u8 mem_cfg_mode_valid;
u8 mem_cfg_mode;
u8 cal_duration_valid;
- u16 cal_duraiton;
+ __le16 cal_duraiton;
u8 platform_name_valid;
char platform_name[QMI_WLANFW_MAX_PLATFORM_NAME_LEN_V01 + 1];
u8 ddr_range_valid;
struct qmi_wlanfw_host_ddr_range ddr_range[QMI_WLANFW_MAX_HOST_DDR_RANGE_SIZE_V01];
u8 host_build_type_valid;
- enum qmi_wlanfw_host_build_type host_build_type;
+ __le32 host_build_type;
u8 mlo_capable_valid;
u8 mlo_capable;
u8 mlo_chip_id_valid;
- u16 mlo_chip_id;
+ __le16 mlo_chip_id;
u8 mlo_group_id_valid;
u8 mlo_group_id;
u8 max_mlo_peer_valid;
- u16 max_mlo_peer;
+ __le16 max_mlo_peer;
u8 mlo_num_chips_valid;
u8 mlo_num_chips;
u8 mlo_chip_info_valid;
struct wlfw_host_mlo_chip_info_s_v01 mlo_chip_info[QMI_WLFW_MAX_NUM_MLO_CHIPS_V01];
u8 feature_list_valid;
- u64 feature_list;
+ __le64 feature_list;
};
--
2.34.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 02/11] wifi: ath12k: fix endianness handling in QMI phy capability response
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 ` Alexander Wilhelm
2025-07-16 7:50 ` [PATCH 03/11] wifi: ath12k: fix endianness handling in QMI firmware indication Alexander Wilhelm
` (9 subsequent siblings)
11 siblings, 0 replies; 17+ messages in thread
From: Alexander Wilhelm @ 2025-07-16 7:50 UTC (permalink / raw)
To: Jeff Johnson, Bjorn Andersson, Konrad Dybcio
Cc: linux-wireless, ath12k, linux-kernel, linux-arm-msm
Ensure proper endianness support for big-endian platforms by correcting
data types in the QMI phy capability response message. Add missing byte
swaps wherever this structure is accessed or modified.
Fixes: 53a65445c144 ("wifi: ath12k: add QMI PHY capability learn support")
Signed-off-by: Alexander Wilhelm <alexander.wilhelm@westermo.com>
---
drivers/net/wireless/ath/ath12k/qmi.c | 2 +-
drivers/net/wireless/ath/ath12k/qmi.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index 2287ed87dae8..2973edd2735b 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -2283,7 +2283,7 @@ static void ath12k_qmi_phy_cap_send(struct ath12k_base *ab)
"phy capability resp valid %d single_chip_mlo_support %d valid %d num_phy %d valid %d board_id %d\n",
resp.single_chip_mlo_support_valid, resp.single_chip_mlo_support,
resp.num_phy_valid, resp.num_phy,
- resp.board_id_valid, resp.board_id);
+ resp.board_id_valid, le32_to_cpu(resp.board_id));
return;
diff --git a/drivers/net/wireless/ath/ath12k/qmi.h b/drivers/net/wireless/ath/ath12k/qmi.h
index ed7808fe2b71..abe2fba25d13 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.h
+++ b/drivers/net/wireless/ath/ath12k/qmi.h
@@ -273,7 +273,7 @@ struct qmi_wlanfw_phy_cap_resp_msg_v01 {
u8 num_phy_valid;
u8 num_phy;
u8 board_id_valid;
- u32 board_id;
+ __le32 board_id;
u8 single_chip_mlo_support_valid;
u8 single_chip_mlo_support;
};
--
2.34.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 03/11] wifi: ath12k: fix endianness handling in QMI firmware indication
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 ` Alexander Wilhelm
2025-07-16 7:50 ` [PATCH 04/11] wifi: ath12k: fix endianness handling in QMI firmware memory indication Alexander Wilhelm
` (8 subsequent siblings)
11 siblings, 0 replies; 17+ messages in thread
From: Alexander Wilhelm @ 2025-07-16 7:50 UTC (permalink / raw)
To: Jeff Johnson, Bjorn Andersson, Konrad Dybcio
Cc: linux-wireless, ath12k, linux-kernel, linux-arm-msm
Ensure proper endianness support for big-endian platforms by correcting
data types in the QMI firmware indication request and response messages
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 | 2 +-
drivers/net/wireless/ath/ath12k/qmi.h | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index 2973edd2735b..cf05c76cc112 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -2315,7 +2315,7 @@ static int ath12k_qmi_fw_ind_register_send(struct ath12k_base *ab)
}
req->client_id_valid = 1;
- req->client_id = QMI_WLANFW_CLIENT_ID;
+ req->client_id = cpu_to_le32(QMI_WLANFW_CLIENT_ID);
req->fw_ready_enable_valid = 1;
req->fw_ready_enable = 1;
req->request_mem_enable_valid = 1;
diff --git a/drivers/net/wireless/ath/ath12k/qmi.h b/drivers/net/wireless/ath/ath12k/qmi.h
index abe2fba25d13..026dc33a39d8 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.h
+++ b/drivers/net/wireless/ath/ath12k/qmi.h
@@ -296,7 +296,7 @@ struct qmi_wlanfw_ind_register_req_msg_v01 {
u8 pin_connect_result_enable_valid;
u8 pin_connect_result_enable;
u8 client_id_valid;
- u32 client_id;
+ __le32 client_id;
u8 request_mem_enable_valid;
u8 request_mem_enable;
u8 fw_mem_ready_enable_valid;
@@ -304,7 +304,7 @@ struct qmi_wlanfw_ind_register_req_msg_v01 {
u8 fw_init_done_enable_valid;
u8 fw_init_done_enable;
u8 rejuvenate_enable_valid;
- u32 rejuvenate_enable;
+ __le32 rejuvenate_enable;
u8 xo_cal_enable_valid;
u8 xo_cal_enable;
u8 cal_done_enable_valid;
@@ -314,7 +314,7 @@ struct qmi_wlanfw_ind_register_req_msg_v01 {
struct qmi_wlanfw_ind_register_resp_msg_v01 {
struct qmi_response_type_v01 resp;
u8 fw_status_valid;
- u64 fw_status;
+ __le64 fw_status;
};
#define QMI_WLANFW_REQUEST_MEM_IND_MSG_V01_MAX_LEN 1824
--
2.34.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 04/11] wifi: ath12k: fix endianness handling in QMI firmware memory indication
2025-07-16 7:50 [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI Alexander Wilhelm
` (2 preceding siblings ...)
2025-07-16 7:50 ` [PATCH 03/11] wifi: ath12k: fix endianness handling in QMI firmware indication Alexander Wilhelm
@ 2025-07-16 7:50 ` Alexander Wilhelm
2025-07-16 7:50 ` [PATCH 05/11] wifi: ath12k: fix endianness handling in QMI respond firmware memory Alexander Wilhelm
` (7 subsequent siblings)
11 siblings, 0 replies; 17+ messages in thread
From: Alexander Wilhelm @ 2025-07-16 7:50 UTC (permalink / raw)
To: Jeff Johnson, Bjorn Andersson, Konrad Dybcio
Cc: linux-wireless, ath12k, linux-kernel, linux-arm-msm
Ensure proper endianness support for big-endian platforms by correcting
data types in the QMI firmware memory indication request 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 | 15 ++++++++-------
drivers/net/wireless/ath/ath12k/qmi.h | 12 ++++++------
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index cf05c76cc112..146e9e1c4834 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -3637,18 +3637,19 @@ static void ath12k_qmi_msg_mem_request_cb(struct qmi_handle *qmi_hdl,
ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi firmware request memory request\n");
- if (msg->mem_seg_len == 0 ||
- msg->mem_seg_len > ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01)
+ if (le32_to_cpu(msg->mem_seg_len) == 0 ||
+ le32_to_cpu(msg->mem_seg_len) > ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01)
ath12k_warn(ab, "Invalid memory segment length: %u\n",
- msg->mem_seg_len);
+ le32_to_cpu(msg->mem_seg_len));
- ab->qmi.mem_seg_count = msg->mem_seg_len;
+ ab->qmi.mem_seg_count = le32_to_cpu(msg->mem_seg_len);
for (i = 0; i < qmi->mem_seg_count ; i++) {
- ab->qmi.target_mem[i].type = msg->mem_seg[i].type;
- ab->qmi.target_mem[i].size = msg->mem_seg[i].size;
+ ab->qmi.target_mem[i].type = le32_to_cpu(msg->mem_seg[i].type);
+ ab->qmi.target_mem[i].size = le32_to_cpu(msg->mem_seg[i].size);
ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi mem seg type %d size %d\n",
- msg->mem_seg[i].type, msg->mem_seg[i].size);
+ le32_to_cpu(msg->mem_seg[i].type),
+ le32_to_cpu(msg->mem_seg[i].size));
}
if (test_bit(ATH12K_FLAG_FIXED_MEM_REGION, &ab->dev_flags)) {
diff --git a/drivers/net/wireless/ath/ath12k/qmi.h b/drivers/net/wireless/ath/ath12k/qmi.h
index 026dc33a39d8..92993c85cec9 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.h
+++ b/drivers/net/wireless/ath/ath12k/qmi.h
@@ -327,8 +327,8 @@ struct qmi_wlanfw_ind_register_resp_msg_v01 {
#define QMI_WLANFW_MAX_STR_LEN_V01 16
struct qmi_wlanfw_mem_cfg_s_v01 {
- u64 offset;
- u32 size;
+ __le64 offset;
+ __le32 size;
u8 secure_flag;
};
@@ -344,14 +344,14 @@ enum qmi_wlanfw_mem_type_enum_v01 {
};
struct qmi_wlanfw_mem_seg_s_v01 {
- u32 size;
- enum qmi_wlanfw_mem_type_enum_v01 type;
- u32 mem_cfg_len;
+ __le32 size;
+ __le32 type;
+ __le32 mem_cfg_len;
struct qmi_wlanfw_mem_cfg_s_v01 mem_cfg[QMI_WLANFW_MAX_NUM_MEM_CFG_V01];
};
struct qmi_wlanfw_request_mem_ind_msg_v01 {
- u32 mem_seg_len;
+ __le32 mem_seg_len;
struct qmi_wlanfw_mem_seg_s_v01 mem_seg[ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01];
};
--
2.34.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 05/11] wifi: ath12k: fix endianness handling in QMI respond firmware memory
2025-07-16 7:50 [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI Alexander Wilhelm
` (3 preceding siblings ...)
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 ` Alexander Wilhelm
2025-07-16 7:50 ` [PATCH 06/11] wifi: ath12k: fix endianness handling in QMI firmware capabilities Alexander Wilhelm
` (6 subsequent siblings)
11 siblings, 0 replies; 17+ messages in thread
From: Alexander Wilhelm @ 2025-07-16 7:50 UTC (permalink / raw)
To: Jeff Johnson, Bjorn Andersson, Konrad Dybcio
Cc: linux-wireless, ath12k, linux-kernel, linux-arm-msm
Ensure proper endianness support for big-endian platforms by correcting
data types in the QMI respond firmware memory request 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 | 10 +++++-----
drivers/net/wireless/ath/ath12k/qmi.h | 8 ++++----
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index 146e9e1c4834..2d00ea54e478 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -2392,11 +2392,11 @@ int ath12k_qmi_respond_fw_mem_request(struct ath12k_base *ab)
ab->qmi.mem_seg_count);
} else {
delayed = false;
- req->mem_seg_len = ab->qmi.mem_seg_count;
- for (i = 0; i < req->mem_seg_len ; i++) {
- req->mem_seg[i].addr = ab->qmi.target_mem[i].paddr;
- req->mem_seg[i].size = ab->qmi.target_mem[i].size;
- req->mem_seg[i].type = ab->qmi.target_mem[i].type;
+ req->mem_seg_len = cpu_to_le32(ab->qmi.mem_seg_count);
+ for (i = 0; i < ab->qmi.mem_seg_count; i++) {
+ req->mem_seg[i].addr = cpu_to_le64(ab->qmi.target_mem[i].paddr);
+ req->mem_seg[i].size = cpu_to_le32(ab->qmi.target_mem[i].size);
+ req->mem_seg[i].type = cpu_to_le32(ab->qmi.target_mem[i].type);
ath12k_dbg(ab, ATH12K_DBG_QMI,
"qmi req mem_seg[%d] %pad %u %u\n", i,
&ab->qmi.target_mem[i].paddr,
diff --git a/drivers/net/wireless/ath/ath12k/qmi.h b/drivers/net/wireless/ath/ath12k/qmi.h
index 92993c85cec9..bd715bca8f23 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.h
+++ b/drivers/net/wireless/ath/ath12k/qmi.h
@@ -356,14 +356,14 @@ struct qmi_wlanfw_request_mem_ind_msg_v01 {
};
struct qmi_wlanfw_mem_seg_resp_s_v01 {
- u64 addr;
- u32 size;
- enum qmi_wlanfw_mem_type_enum_v01 type;
+ __le64 addr;
+ __le32 size;
+ __le32 type;
u8 restore;
};
struct qmi_wlanfw_respond_mem_req_msg_v01 {
- u32 mem_seg_len;
+ __le32 mem_seg_len;
struct qmi_wlanfw_mem_seg_resp_s_v01 mem_seg[ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01];
};
--
2.34.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 06/11] wifi: ath12k: fix endianness handling in QMI firmware capabilities
2025-07-16 7:50 [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI Alexander Wilhelm
` (4 preceding siblings ...)
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
2025-07-16 7:50 ` [PATCH 07/11] wifi: ath12k: fix endianness handling in QMI bdf download Alexander Wilhelm
` (5 subsequent siblings)
11 siblings, 0 replies; 17+ messages in thread
From: Alexander Wilhelm @ 2025-07-16 7:50 UTC (permalink / raw)
To: Jeff Johnson, Bjorn Andersson, Konrad Dybcio
Cc: linux-wireless, ath12k, linux-kernel, linux-arm-msm
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
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 07/11] wifi: ath12k: fix endianness handling in QMI bdf download
2025-07-16 7:50 [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI Alexander Wilhelm
` (5 preceding siblings ...)
2025-07-16 7:50 ` [PATCH 06/11] wifi: ath12k: fix endianness handling in QMI firmware capabilities Alexander Wilhelm
@ 2025-07-16 7:50 ` 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
` (4 subsequent siblings)
11 siblings, 1 reply; 17+ messages in thread
From: Alexander Wilhelm @ 2025-07-16 7:50 UTC (permalink / raw)
To: Jeff Johnson, Bjorn Andersson, Konrad Dybcio
Cc: linux-wireless, ath12k, linux-kernel, linux-arm-msm
Ensure proper endianness support for big-endian platforms by correcting
data types in the QMI board data file download request message. Add
missing byte swaps wherever this structure is 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 | 18 +++++++++---------
drivers/net/wireless/ath/ath12k/qmi.h | 8 ++++----
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index 0bcfb9281d01..d18ffb86f7bc 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -2934,9 +2934,9 @@ static int ath12k_qmi_load_file_target_mem(struct ath12k_base *ab,
while (remaining) {
req->valid = 1;
req->file_id_valid = 1;
- req->file_id = ab->qmi.target.board_id;
+ req->file_id = cpu_to_le32(ab->qmi.target.board_id);
req->total_size_valid = 1;
- req->total_size = remaining;
+ req->total_size = cpu_to_le32(remaining);
req->seg_id_valid = 1;
req->data_valid = 1;
req->bdf_type = type;
@@ -2945,18 +2945,18 @@ static int ath12k_qmi_load_file_target_mem(struct ath12k_base *ab,
req->end = 0;
if (remaining > QMI_WLANFW_MAX_DATA_SIZE_V01) {
- req->data_len = QMI_WLANFW_MAX_DATA_SIZE_V01;
+ req->data_len = cpu_to_le32(QMI_WLANFW_MAX_DATA_SIZE_V01);
} else {
- req->data_len = remaining;
+ req->data_len = cpu_to_le32(remaining);
req->end = 1;
}
if (type == ATH12K_QMI_FILE_TYPE_EEPROM) {
req->data_valid = 0;
req->end = 1;
- req->data_len = ATH12K_QMI_MAX_BDF_FILE_NAME_SIZE;
+ req->data_len = cpu_to_le32(ATH12K_QMI_MAX_BDF_FILE_NAME_SIZE);
} else {
- memcpy(req->data, temp, req->data_len);
+ memcpy(req->data, temp, le32_to_cpu(req->data_len));
}
ret = qmi_txn_init(&ab->qmi.handle, &txn,
@@ -2991,9 +2991,9 @@ static int ath12k_qmi_load_file_target_mem(struct ath12k_base *ab,
if (type == ATH12K_QMI_FILE_TYPE_EEPROM) {
remaining = 0;
} else {
- remaining -= req->data_len;
- temp += req->data_len;
- req->seg_id++;
+ remaining -= le32_to_cpu(req->data_len);
+ temp += le32_to_cpu(req->data_len);
+ req->seg_id += cpu_to_le32(1);
ath12k_dbg(ab, ATH12K_DBG_QMI,
"qmi bdf download request remaining %i\n",
remaining);
diff --git a/drivers/net/wireless/ath/ath12k/qmi.h b/drivers/net/wireless/ath/ath12k/qmi.h
index 114324157e84..a48850ec0296 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.h
+++ b/drivers/net/wireless/ath/ath12k/qmi.h
@@ -504,13 +504,13 @@ struct qmi_wlanfw_cap_req_msg_v01 {
struct qmi_wlanfw_bdf_download_req_msg_v01 {
u8 valid;
u8 file_id_valid;
- enum qmi_wlanfw_cal_temp_id_enum_v01 file_id;
+ __le32 file_id;
u8 total_size_valid;
- u32 total_size;
+ __le32 total_size;
u8 seg_id_valid;
- u32 seg_id;
+ __le32 seg_id;
u8 data_valid;
- u32 data_len;
+ __le32 data_len;
u8 data[QMI_WLANFW_MAX_DATA_SIZE_V01];
u8 end_valid;
u8 end;
--
2.34.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 08/11] wifi: ath12k: fix endianness handling in QMI firmware m3 info
2025-07-16 7:50 [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI Alexander Wilhelm
` (6 preceding siblings ...)
2025-07-16 7:50 ` [PATCH 07/11] wifi: ath12k: fix endianness handling in QMI bdf download Alexander Wilhelm
@ 2025-07-16 7:50 ` Alexander Wilhelm
2025-07-16 7:50 ` [PATCH 09/11] wifi: ath12k: fix endianness handling in QMI firmware wlan mode Alexander Wilhelm
` (3 subsequent siblings)
11 siblings, 0 replies; 17+ messages in thread
From: Alexander Wilhelm @ 2025-07-16 7:50 UTC (permalink / raw)
To: Jeff Johnson, Bjorn Andersson, Konrad Dybcio
Cc: linux-wireless, ath12k, linux-kernel, linux-arm-msm
Ensure proper endianness support for big-endian platforms by correcting
data types in the QMI firmware M3 info request message. Add missing byte
swaps wherever this structure is 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 | 4 ++--
drivers/net/wireless/ath/ath12k/qmi.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index d18ffb86f7bc..5043d0c39b56 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -3198,8 +3198,8 @@ int ath12k_qmi_wlanfw_m3_info_send(struct ath12k_base *ab)
ath12k_err(ab, "failed to load m3 firmware: %d", ret);
return ret;
}
- req.addr = m3_mem->paddr;
- req.size = m3_mem->size;
+ req.addr = cpu_to_le64(m3_mem->paddr);
+ req.size = cpu_to_le32(m3_mem->size);
}
ret = qmi_txn_init(&ab->qmi.handle, &txn,
diff --git a/drivers/net/wireless/ath/ath12k/qmi.h b/drivers/net/wireless/ath/ath12k/qmi.h
index a48850ec0296..101d91131ef0 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.h
+++ b/drivers/net/wireless/ath/ath12k/qmi.h
@@ -529,8 +529,8 @@ struct qmi_wlanfw_bdf_download_resp_msg_v01 {
#define QMI_WLANFW_M3_INFO_REQ_V01 0x003C
struct qmi_wlanfw_m3_info_req_msg_v01 {
- u64 addr;
- u32 size;
+ __le64 addr;
+ __le32 size;
};
struct qmi_wlanfw_m3_info_resp_msg_v01 {
--
2.34.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 09/11] wifi: ath12k: fix endianness handling in QMI firmware wlan mode
2025-07-16 7:50 [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI Alexander Wilhelm
` (7 preceding siblings ...)
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 ` Alexander Wilhelm
2025-07-16 7:50 ` [PATCH 10/11] wifi: ath12k: fix endianness handling in QMI wlan configuration Alexander Wilhelm
` (2 subsequent siblings)
11 siblings, 0 replies; 17+ messages in thread
From: Alexander Wilhelm @ 2025-07-16 7:50 UTC (permalink / raw)
To: Jeff Johnson, Bjorn Andersson, Konrad Dybcio
Cc: linux-wireless, ath12k, linux-kernel, linux-arm-msm
Ensure proper endianness support for big-endian platforms by correcting
data types in the QMI firmware wlan mode request message. Add missing
byte swaps wherever this structure is 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 | 2 +-
drivers/net/wireless/ath/ath12k/qmi.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index 5043d0c39b56..2fdd5eb128d2 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -3242,7 +3242,7 @@ static int ath12k_qmi_wlanfw_mode_send(struct ath12k_base *ab,
struct qmi_txn txn;
int ret = 0;
- req.mode = mode;
+ req.mode = cpu_to_le32(mode);
req.hw_debug_valid = 1;
req.hw_debug = 0;
diff --git a/drivers/net/wireless/ath/ath12k/qmi.h b/drivers/net/wireless/ath/ath12k/qmi.h
index 101d91131ef0..d05cd9b47911 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.h
+++ b/drivers/net/wireless/ath/ath12k/qmi.h
@@ -552,7 +552,7 @@ struct qmi_wlanfw_m3_info_resp_msg_v01 {
#define QMI_WLANFW_MAX_NUM_SHADOW_REG_V3_V01 60
struct qmi_wlanfw_wlan_mode_req_msg_v01 {
- u32 mode;
+ __le32 mode;
u8 hw_debug_valid;
u8 hw_debug;
};
--
2.34.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 10/11] wifi: ath12k: fix endianness handling in QMI wlan configuration
2025-07-16 7:50 [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI Alexander Wilhelm
` (8 preceding siblings ...)
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 ` Alexander Wilhelm
2025-07-16 7:51 ` [PATCH 11/11] wifi: ath12k: fix endianness handling in QMI response Alexander Wilhelm
2025-07-16 15:13 ` [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI Jeff Johnson
11 siblings, 0 replies; 17+ messages in thread
From: Alexander Wilhelm @ 2025-07-16 7:50 UTC (permalink / raw)
To: Jeff Johnson, Bjorn Andersson, Konrad Dybcio
Cc: linux-wireless, ath12k, linux-kernel, linux-arm-msm
Ensure proper endianness support for big-endian platforms by correcting
data types in the QMI firmware wlan configuration request 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 | 22 ++++++++++++----------
drivers/net/wireless/ath/ath12k/qmi.h | 14 +++++++-------
2 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index 2fdd5eb128d2..71cf6408c6fb 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -3291,7 +3291,7 @@ static int ath12k_qmi_wlanfw_wlan_cfg_send(struct ath12k_base *ab)
struct ce_pipe_config *ce_cfg;
struct service_to_pipe *svc_cfg;
struct qmi_txn txn;
- int ret = 0, pipe_num;
+ int ret = 0, pipe_num, sr, len;
ce_cfg = (struct ce_pipe_config *)ab->qmi.ce_cfg.tgt_ce;
svc_cfg = (struct service_to_pipe *)ab->qmi.ce_cfg.svc_to_ce_map;
@@ -3306,8 +3306,8 @@ static int ath12k_qmi_wlanfw_wlan_cfg_send(struct ath12k_base *ab)
req->tgt_cfg_valid = 1;
/* This is number of CE configs */
- req->tgt_cfg_len = ab->qmi.ce_cfg.tgt_ce_len;
- for (pipe_num = 0; pipe_num < req->tgt_cfg_len ; pipe_num++) {
+ req->tgt_cfg_len = cpu_to_le32(ab->qmi.ce_cfg.tgt_ce_len);
+ for (pipe_num = 0; pipe_num < ab->qmi.ce_cfg.tgt_ce_len; pipe_num++) {
req->tgt_cfg[pipe_num].pipe_num = ce_cfg[pipe_num].pipenum;
req->tgt_cfg[pipe_num].pipe_dir = ce_cfg[pipe_num].pipedir;
req->tgt_cfg[pipe_num].nentries = ce_cfg[pipe_num].nentries;
@@ -3317,8 +3317,8 @@ static int ath12k_qmi_wlanfw_wlan_cfg_send(struct ath12k_base *ab)
req->svc_cfg_valid = 1;
/* This is number of Service/CE configs */
- req->svc_cfg_len = ab->qmi.ce_cfg.svc_to_ce_map_len;
- for (pipe_num = 0; pipe_num < req->svc_cfg_len; pipe_num++) {
+ req->svc_cfg_len = cpu_to_le32(ab->qmi.ce_cfg.svc_to_ce_map_len);
+ for (pipe_num = 0; pipe_num < ab->qmi.ce_cfg.svc_to_ce_map_len; pipe_num++) {
req->svc_cfg[pipe_num].service_id = svc_cfg[pipe_num].service_id;
req->svc_cfg[pipe_num].pipe_dir = svc_cfg[pipe_num].pipedir;
req->svc_cfg[pipe_num].pipe_num = svc_cfg[pipe_num].pipenum;
@@ -3327,11 +3327,13 @@ static int ath12k_qmi_wlanfw_wlan_cfg_send(struct ath12k_base *ab)
/* set shadow v3 configuration */
if (ab->hw_params->supports_shadow_regs) {
req->shadow_reg_v3_valid = 1;
- req->shadow_reg_v3_len = min_t(u32,
- ab->qmi.ce_cfg.shadow_reg_v3_len,
- QMI_WLANFW_MAX_NUM_SHADOW_REG_V3_V01);
- memcpy(&req->shadow_reg_v3, ab->qmi.ce_cfg.shadow_reg_v3,
- sizeof(u32) * req->shadow_reg_v3_len);
+ len = min_t(u32,
+ ab->qmi.ce_cfg.shadow_reg_v3_len,
+ QMI_WLANFW_MAX_NUM_SHADOW_REG_V3_V01);
+ req->shadow_reg_v3_len = cpu_to_le32(len);
+
+ for (sr = 0; sr < len; sr++)
+ req->shadow_reg_v3[sr].addr = cpu_to_le32(ab->qmi.ce_cfg.shadow_reg_v3[sr]);
} else {
req->shadow_reg_v3_valid = 0;
}
diff --git a/drivers/net/wireless/ath/ath12k/qmi.h b/drivers/net/wireless/ath/ath12k/qmi.h
index d05cd9b47911..37840d015a5c 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.h
+++ b/drivers/net/wireless/ath/ath12k/qmi.h
@@ -406,12 +406,12 @@ struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01 {
};
struct qmi_wlanfw_shadow_reg_cfg_s_v01 {
- u16 id;
- u16 offset;
+ __le16 id;
+ __le16 offset;
};
struct qmi_wlanfw_shadow_reg_v3_cfg_s_v01 {
- u32 addr;
+ __le32 addr;
};
struct qmi_wlanfw_memory_region_info_s_v01 {
@@ -565,19 +565,19 @@ struct qmi_wlanfw_wlan_cfg_req_msg_v01 {
u8 host_version_valid;
char host_version[QMI_WLANFW_MAX_STR_LEN_V01 + 1];
u8 tgt_cfg_valid;
- u32 tgt_cfg_len;
+ __le32 tgt_cfg_len;
struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01
tgt_cfg[QMI_WLANFW_MAX_NUM_CE_V01];
u8 svc_cfg_valid;
- u32 svc_cfg_len;
+ __le32 svc_cfg_len;
struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01
svc_cfg[QMI_WLANFW_MAX_NUM_SVC_V01];
u8 shadow_reg_valid;
- u32 shadow_reg_len;
+ __le32 shadow_reg_len;
struct qmi_wlanfw_shadow_reg_cfg_s_v01
shadow_reg[QMI_WLANFW_MAX_NUM_SHADOW_REG_V01];
u8 shadow_reg_v3_valid;
- u32 shadow_reg_v3_len;
+ __le32 shadow_reg_v3_len;
struct qmi_wlanfw_shadow_reg_v3_cfg_s_v01
shadow_reg_v3[QMI_WLANFW_MAX_NUM_SHADOW_REG_V3_V01];
};
--
2.34.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 11/11] wifi: ath12k: fix endianness handling in QMI response
2025-07-16 7:50 [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI Alexander Wilhelm
` (9 preceding siblings ...)
2025-07-16 7:50 ` [PATCH 10/11] wifi: ath12k: fix endianness handling in QMI wlan configuration Alexander Wilhelm
@ 2025-07-16 7:51 ` 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
11 siblings, 1 reply; 17+ messages in thread
From: Alexander Wilhelm @ 2025-07-16 7:51 UTC (permalink / raw)
To: Jeff Johnson, Bjorn Andersson, Konrad Dybcio
Cc: linux-wireless, ath12k, linux-kernel, linux-arm-msm
Ensure proper endianness support for big-endian platforms by correcting
data types in the QMI response. Add missing byte swaps wherever this
structure is accessed or modified.
Fixes: 9b8a11e82615 ("soc: qcom: Introduce QMI encoder/decoder")
Signed-off-by: Alexander Wilhelm <alexander.wilhelm@westermo.com>
---
drivers/net/wireless/ath/ath12k/qmi.c | 49 ++++++++++++++++-----------
include/linux/soc/qcom/qmi.h | 4 +--
2 files changed, 31 insertions(+), 22 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index 71cf6408c6fb..d421e7b3fc87 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -2227,9 +2227,10 @@ int ath12k_qmi_host_cap_send(struct ath12k_base *ab)
if (ret < 0)
goto out;
- if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
+ if (le16_to_cpu(resp.resp.result) != QMI_RESULT_SUCCESS_V01) {
ath12k_warn(ab, "Host capability request failed, result: %d, err: %d\n",
- resp.resp.result, resp.resp.error);
+ le16_to_cpu(resp.resp.result),
+ le16_to_cpu(resp.resp.error));
ret = -EINVAL;
goto out;
}
@@ -2264,7 +2265,7 @@ static void ath12k_qmi_phy_cap_send(struct ath12k_base *ab)
if (ret < 0)
goto out;
- if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
+ if (le16_to_cpu(resp.resp.result) != QMI_RESULT_SUCCESS_V01) {
ret = -EOPNOTSUPP;
goto out;
}
@@ -2352,9 +2353,10 @@ static int ath12k_qmi_fw_ind_register_send(struct ath12k_base *ab)
goto out;
}
- if (resp->resp.result != QMI_RESULT_SUCCESS_V01) {
+ if (le16_to_cpu(resp->resp.result) != QMI_RESULT_SUCCESS_V01) {
ath12k_warn(ab, "FW Ind register request failed, result: %d, err: %d\n",
- resp->resp.result, resp->resp.error);
+ le16_to_cpu(resp->resp.result),
+ le16_to_cpu(resp->resp.error));
ret = -EINVAL;
goto out;
}
@@ -2427,15 +2429,16 @@ int ath12k_qmi_respond_fw_mem_request(struct ath12k_base *ab)
goto out;
}
- if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
+ if (le16_to_cpu(resp.resp.result) != QMI_RESULT_SUCCESS_V01) {
/* the error response is expected when
* target_mem_delayed is true.
*/
- if (delayed && resp.resp.error == 0)
+ if (delayed && le16_to_cpu(resp.resp.error) == 0)
goto out;
ath12k_warn(ab, "Respond mem req failed, result: %d, err: %d\n",
- resp.resp.result, resp.resp.error);
+ le16_to_cpu(resp.resp.result),
+ le16_to_cpu(resp.resp.error));
ret = -EINVAL;
goto out;
}
@@ -2842,9 +2845,10 @@ int ath12k_qmi_request_target_cap(struct ath12k_base *ab)
goto out;
}
- if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
+ if (le16_to_cpu(resp.resp.result) != QMI_RESULT_SUCCESS_V01) {
ath12k_warn(ab, "qmi targetcap req failed, result: %d, err: %d\n",
- resp.resp.result, resp.resp.error);
+ le16_to_cpu(resp.resp.result),
+ le16_to_cpu(resp.resp.error));
ret = -EINVAL;
goto out;
}
@@ -2981,9 +2985,10 @@ static int ath12k_qmi_load_file_target_mem(struct ath12k_base *ab,
if (ret < 0)
goto out;
- if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
+ if (le16_to_cpu(resp.resp.result) != QMI_RESULT_SUCCESS_V01) {
ath12k_warn(ab, "qmi BDF download failed, result: %d, err: %d\n",
- resp.resp.result, resp.resp.error);
+ le16_to_cpu(resp.resp.result),
+ le16_to_cpu(resp.resp.error));
ret = -EINVAL;
goto out;
}
@@ -3224,9 +3229,10 @@ int ath12k_qmi_wlanfw_m3_info_send(struct ath12k_base *ab)
goto out;
}
- if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
+ if (le16_to_cpu(resp.resp.result) != QMI_RESULT_SUCCESS_V01) {
ath12k_warn(ab, "qmi M3 info request failed, result: %d, err: %d\n",
- resp.resp.result, resp.resp.error);
+ le16_to_cpu(resp.resp.result),
+ le16_to_cpu(resp.resp.error));
ret = -EINVAL;
goto out;
}
@@ -3273,9 +3279,10 @@ static int ath12k_qmi_wlanfw_mode_send(struct ath12k_base *ab,
goto out;
}
- if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
+ if (le16_to_cpu(resp.resp.result) != QMI_RESULT_SUCCESS_V01) {
ath12k_warn(ab, "Mode request failed, mode: %d, result: %d err: %d\n",
- mode, resp.resp.result, resp.resp.error);
+ mode, le16_to_cpu(resp.resp.result),
+ le16_to_cpu(resp.resp.error));
ret = -EINVAL;
goto out;
}
@@ -3360,9 +3367,10 @@ static int ath12k_qmi_wlanfw_wlan_cfg_send(struct ath12k_base *ab)
goto out;
}
- if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
+ if (le16_to_cpu(resp.resp.result) != QMI_RESULT_SUCCESS_V01) {
ath12k_warn(ab, "qmi wlan config request failed, result: %d, err: %d\n",
- resp.resp.result, resp.resp.error);
+ le16_to_cpu(resp.resp.result),
+ le16_to_cpu(resp.resp.error));
ret = -EINVAL;
goto out;
}
@@ -3404,9 +3412,10 @@ static int ath12k_qmi_wlanfw_wlan_ini_send(struct ath12k_base *ab)
goto out;
}
- if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
+ if (le16_to_cpu(resp.resp.result) != QMI_RESULT_SUCCESS_V01) {
ath12k_warn(ab, "QMI wlan ini response failure: %d %d\n",
- resp.resp.result, resp.resp.error);
+ le16_to_cpu(resp.resp.result),
+ le16_to_cpu(resp.resp.error));
ret = -EINVAL;
goto out;
}
diff --git a/include/linux/soc/qcom/qmi.h b/include/linux/soc/qcom/qmi.h
index 469e02d2aa0d..a487b724abd2 100644
--- a/include/linux/soc/qcom/qmi.h
+++ b/include/linux/soc/qcom/qmi.h
@@ -98,8 +98,8 @@ struct qmi_elem_info {
* @error: error value, when @result is QMI_RESULT_FAILURE_V01
*/
struct qmi_response_type_v01 {
- u16 result;
- u16 error;
+ __le16 result;
+ __le16 error;
};
extern const struct qmi_elem_info qmi_response_type_v01_ei[];
--
2.34.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI
2025-07-16 7:50 [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI Alexander Wilhelm
` (10 preceding siblings ...)
2025-07-16 7:51 ` [PATCH 11/11] wifi: ath12k: fix endianness handling in QMI response Alexander Wilhelm
@ 2025-07-16 15:13 ` Jeff Johnson
2025-07-20 4:24 ` Bjorn Andersson
11 siblings, 1 reply; 17+ messages in thread
From: Jeff Johnson @ 2025-07-16 15:13 UTC (permalink / raw)
To: Alexander Wilhelm, Jeff Johnson, Bjorn Andersson, Konrad Dybcio
Cc: linux-wireless, ath12k, linux-kernel, linux-arm-msm
On 7/16/2025 12:50 AM, Alexander Wilhelm wrote:
> Fix endianness handling in QMI firmware transfer on big-endian
> platforms. Without this fix, the firmware download fails due to
> misinterpreted data structures exchanged between the host and the
> wireless module.
>
> The issue occurs during early bring-up on big endian systems, where QMI
> messages are not correctly parsed by the driver, leading to failed
> initialization sequences. Ensure all relevant fields are properly
> converted between CPU and little-endian format in request and response
> messages, as expected by the firmware. Attached logs showing the failure
> before the fix:
>
> ath12k_pci 0001:01:00.0: BAR 0: assigned [mem 0xc00000000-0xc001fffff 64bit]
> ath12k_pci 0001:01:00.0: boot pci_mem 0xcd4148e9
> ath12k_pci 0001:01:00.0: pci probe 17cb:1109 17cb:1109
> ath12k_pci 0001:01:00.0: pci tcsr_soc_hw_version major 2 minor 0
> ath12k_pci 0001:01:00.0: request MSI one vector
> ath12k_pci 0001:01:00.0: MSI vectors: 1
> ath12k_pci 0001:01:00.0: msi base data is 0
> ath12k_pci 0001:01:00.0: Hardware name: qcn9274 hw2.0
> ath12k_pci 0001:01:00.0: boot firmware request ath12k/QCN9274/hw2.0/firmware-2.bin size 15134776
> ath12k_pci 0001:01:00.0: found fw timestamp 1722934582
> ath12k_pci 0001:01:00.0: found m3 image ie (421880 B)
> ath12k_pci 0001:01:00.0: found fw image ie (7229440 B)
> ath12k_pci 0001:01:00.0: found dualmac fw image ie (7483392 B)
> ath12k_pci 0001:01:00.0: found firmware features ie (1 B)
> ath12k_pci 0001:01:00.0: features
> ath12k_pci 0001:01:00.0: using fw api 2
> ath12k_pci 0001:01:00.0: dualmac fw selected for board id: 1005
> ath12k_pci 0001:01:00.0: Assign MSI to user: MHI, num_vectors: 3, user_base_data: 0, base_vector: 0
> ath12k_pci 0001:01:00.0: Number of assigned MSI for MHI is 3, base vector is 0
> ath12k_pci 0001:01:00.0: Assign MSI to user: CE, num_vectors: 1, user_base_data: 0, base_vector: 0
> ath12k_pci 0001:01:00.0: Assign MSI to user: DP, num_vectors: 1, user_base_data: 0, base_vector: 0
> ath12k_pci 0001:01:00.0: irq:18 group:0
> ath12k_pci 0001:01:00.0: irq:18 group:1
> ath12k_pci 0001:01:00.0: irq:18 group:2
> ath12k_pci 0001:01:00.0: irq:18 group:3
> ath12k_pci 0001:01:00.0: irq:18 group:4
> ath12k_pci 0001:01:00.0: irq:18 group:5
> ath12k_pci 0001:01:00.0: irq:18 group:6
> ath12k_pci 0001:01:00.0: irq:18 group:7
> ath12k_pci 0001:01:00.0: pci after request_irq msi_ep_base_data 0
> ath12k_pci 0001:01:00.0: cookie:0x0
> ath12k_pci 0001:01:00.0: WLAON_WARM_SW_ENTRY 0x2
> ath12k_pci 0001:01:00.0: WLAON_WARM_SW_ENTRY 0x2
> ath12k_pci 0001:01:00.0: soc reset cause:0
> ath12k_pci 0001:01:00.0: MHISTATUS 0xff04
> ath12k_pci 0001:01:00.0: pci link_ctl 0x0000 L0s 0 L1 0
> ath12k_pci 0001:01:00.0: pci reg 0x3164 instance 0x11 read val 0x11
> ath12k_pci 0001:01:00.0: setting mhi state: INIT(0)
> ath12k_pci 0001:01:00.0: setting mhi state: POWER_ON(2)
> ath12k_pci 0001:01:00.0: mhi notify status reason UNKNOWN
> ath12k_pci 0001:01:00.0: mhi notify status reason MHI_CB_EE_MISSION_MODE
> ath12k_pci 0001:01:00.0: qmi wifi fw qmi service connected
> ath12k_pci 0001:01:00.0: phy capability resp valid 1 num_phy 2 valid 1 board_id 84934656 valid 1 single_chip_mlo_support 0
> ath12k_pci 0001:01:00.0: intra device MLO is disabled hence skip QMI MLO cap
>
> Alexander Wilhelm (11):
> wifi: ath12k: fix endianness handling in QMI host capability request
> wifi: ath12k: fix endianness handling in QMI phy capability response
> wifi: ath12k: fix endianness handling in QMI firmware indication
> wifi: ath12k: fix endianness handling in QMI firmware memory indication
> wifi: ath12k: fix endianness handling in QMI respond firmware memory
> wifi: ath12k: fix endianness handling in QMI firmware capabilities
> wifi: ath12k: fix endianness handling in QMI bdf download
> wifi: ath12k: fix endianness handling in QMI firmware m3 info
> wifi: ath12k: fix endianness handling in QMI firmware wlan mode
> wifi: ath12k: fix endianness handling in QMI wlan configuration
> wifi: ath12k: fix endianness handling in QMI response
>
> drivers/net/wireless/ath/ath12k/qmi.c | 149 ++++++++++++++------------
> drivers/net/wireless/ath/ath12k/qmi.h | 106 +++++++++---------
> include/linux/soc/qcom/qmi.h | 4 +-
> 3 files changed, 136 insertions(+), 123 deletions(-)
>
Frankly I'm shocked that the low-level QMI encode/decode is not doing the
endian conversion. Since the Qualcomm internal tool that generates the data
structures has always generated structs with cpu endianess (i.e. u8, u16, u32,
etc) I just assumed that endian conversion was handled at a low level.
So should this issue be pushed down to the QMI encode/decode rather than foist
it upon every client's read & write?
/jeff
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 11/11] wifi: ath12k: fix endianness handling in QMI response
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
0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2025-07-17 8:33 UTC (permalink / raw)
To: Alexander Wilhelm, Jeff Johnson, Bjorn Andersson, Konrad Dybcio
Cc: oe-kbuild-all, linux-wireless, ath12k, linux-kernel,
linux-arm-msm
Hi Alexander,
kernel test robot noticed the following build warnings:
[auto build test WARNING on ath/ath-next]
[also build test WARNING on linus/master v6.16-rc6 next-20250716]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Alexander-Wilhelm/wifi-ath12k-fix-endianness-handling-in-QMI-host-capability-request/20250716-162058
base: https://git.kernel.org/pub/scm/linux/kernel/git/ath/ath.git ath-next
patch link: https://lore.kernel.org/r/20250716075100.1447352-12-alexander.wilhelm%40westermo.com
patch subject: [PATCH 11/11] wifi: ath12k: fix endianness handling in QMI response
config: mips-randconfig-r123-20250717 (https://download.01.org/0day-ci/archive/20250717/202507171640.30pUvpPv-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 8.5.0
reproduce: (https://download.01.org/0day-ci/archive/20250717/202507171640.30pUvpPv-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507171640.30pUvpPv-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/soc/qcom/pdr_interface.c:612:22: sparse: sparse: restricted __le16 degrades to integer
drivers/soc/qcom/pdr_interface.c:613:22: sparse: sparse: restricted __le16 degrades to integer
vim +612 drivers/soc/qcom/pdr_interface.c
fbe639b44a8275 Sibi Sankar 2020-03-12 549
fbe639b44a8275 Sibi Sankar 2020-03-12 550 /**
fbe639b44a8275 Sibi Sankar 2020-03-12 551 * pdr_restart_pd() - restart PD
fbe639b44a8275 Sibi Sankar 2020-03-12 552 * @pdr: PDR client handle
fbe639b44a8275 Sibi Sankar 2020-03-12 553 * @pds: PD service handle
fbe639b44a8275 Sibi Sankar 2020-03-12 554 *
fbe639b44a8275 Sibi Sankar 2020-03-12 555 * Restarts the PD tracked by the PDR client handle for a given service path.
fbe639b44a8275 Sibi Sankar 2020-03-12 556 *
fbe639b44a8275 Sibi Sankar 2020-03-12 557 * Return: 0 on success, negative errno on failure.
fbe639b44a8275 Sibi Sankar 2020-03-12 558 */
fbe639b44a8275 Sibi Sankar 2020-03-12 559 int pdr_restart_pd(struct pdr_handle *pdr, struct pdr_service *pds)
fbe639b44a8275 Sibi Sankar 2020-03-12 560 {
fbe639b44a8275 Sibi Sankar 2020-03-12 561 struct servreg_restart_pd_resp resp;
a161ffe4b87772 Tom Rix 2020-08-19 562 struct servreg_restart_pd_req req = { 0 };
fbe639b44a8275 Sibi Sankar 2020-03-12 563 struct sockaddr_qrtr addr;
fbe639b44a8275 Sibi Sankar 2020-03-12 564 struct pdr_service *tmp;
fbe639b44a8275 Sibi Sankar 2020-03-12 565 struct qmi_txn txn;
fbe639b44a8275 Sibi Sankar 2020-03-12 566 int ret;
fbe639b44a8275 Sibi Sankar 2020-03-12 567
fbe639b44a8275 Sibi Sankar 2020-03-12 568 if (IS_ERR_OR_NULL(pdr) || IS_ERR_OR_NULL(pds))
fbe639b44a8275 Sibi Sankar 2020-03-12 569 return -EINVAL;
fbe639b44a8275 Sibi Sankar 2020-03-12 570
fbe639b44a8275 Sibi Sankar 2020-03-12 571 mutex_lock(&pdr->list_lock);
fbe639b44a8275 Sibi Sankar 2020-03-12 572 list_for_each_entry(tmp, &pdr->lookups, node) {
fbe639b44a8275 Sibi Sankar 2020-03-12 573 if (tmp != pds)
fbe639b44a8275 Sibi Sankar 2020-03-12 574 continue;
fbe639b44a8275 Sibi Sankar 2020-03-12 575
fbe639b44a8275 Sibi Sankar 2020-03-12 576 if (!pds->service_connected)
fbe639b44a8275 Sibi Sankar 2020-03-12 577 break;
fbe639b44a8275 Sibi Sankar 2020-03-12 578
fbe639b44a8275 Sibi Sankar 2020-03-12 579 /* Prepare req message */
26bc7a6a0beed8 Len Baker 2021-08-08 580 strscpy(req.service_path, pds->service_path, sizeof(req.service_path));
fbe639b44a8275 Sibi Sankar 2020-03-12 581 addr = pds->addr;
fbe639b44a8275 Sibi Sankar 2020-03-12 582 break;
fbe639b44a8275 Sibi Sankar 2020-03-12 583 }
fbe639b44a8275 Sibi Sankar 2020-03-12 584 mutex_unlock(&pdr->list_lock);
fbe639b44a8275 Sibi Sankar 2020-03-12 585
fbe639b44a8275 Sibi Sankar 2020-03-12 586 if (!req.service_path[0])
fbe639b44a8275 Sibi Sankar 2020-03-12 587 return -EINVAL;
fbe639b44a8275 Sibi Sankar 2020-03-12 588
fbe639b44a8275 Sibi Sankar 2020-03-12 589 ret = qmi_txn_init(&pdr->notifier_hdl, &txn,
fbe639b44a8275 Sibi Sankar 2020-03-12 590 servreg_restart_pd_resp_ei,
fbe639b44a8275 Sibi Sankar 2020-03-12 591 &resp);
fbe639b44a8275 Sibi Sankar 2020-03-12 592 if (ret < 0)
fbe639b44a8275 Sibi Sankar 2020-03-12 593 return ret;
fbe639b44a8275 Sibi Sankar 2020-03-12 594
fbe639b44a8275 Sibi Sankar 2020-03-12 595 ret = qmi_send_request(&pdr->notifier_hdl, &addr,
fbe639b44a8275 Sibi Sankar 2020-03-12 596 &txn, SERVREG_RESTART_PD_REQ,
fbe639b44a8275 Sibi Sankar 2020-03-12 597 SERVREG_RESTART_PD_REQ_MAX_LEN,
fbe639b44a8275 Sibi Sankar 2020-03-12 598 servreg_restart_pd_req_ei, &req);
fbe639b44a8275 Sibi Sankar 2020-03-12 599 if (ret < 0) {
fbe639b44a8275 Sibi Sankar 2020-03-12 600 qmi_txn_cancel(&txn);
fbe639b44a8275 Sibi Sankar 2020-03-12 601 return ret;
fbe639b44a8275 Sibi Sankar 2020-03-12 602 }
fbe639b44a8275 Sibi Sankar 2020-03-12 603
fbe639b44a8275 Sibi Sankar 2020-03-12 604 ret = qmi_txn_wait(&txn, 5 * HZ);
fbe639b44a8275 Sibi Sankar 2020-03-12 605 if (ret < 0) {
fbe639b44a8275 Sibi Sankar 2020-03-12 606 pr_err("PDR: %s PD restart txn wait failed: %d\n",
fbe639b44a8275 Sibi Sankar 2020-03-12 607 req.service_path, ret);
fbe639b44a8275 Sibi Sankar 2020-03-12 608 return ret;
fbe639b44a8275 Sibi Sankar 2020-03-12 609 }
fbe639b44a8275 Sibi Sankar 2020-03-12 610
fbe639b44a8275 Sibi Sankar 2020-03-12 611 /* Check response if PDR is disabled */
fbe639b44a8275 Sibi Sankar 2020-03-12 @612 if (resp.resp.result == QMI_RESULT_FAILURE_V01 &&
fbe639b44a8275 Sibi Sankar 2020-03-12 613 resp.resp.error == QMI_ERR_DISABLED_V01) {
fbe639b44a8275 Sibi Sankar 2020-03-12 614 pr_err("PDR: %s PD restart is disabled: 0x%x\n",
fbe639b44a8275 Sibi Sankar 2020-03-12 615 req.service_path, resp.resp.error);
fbe639b44a8275 Sibi Sankar 2020-03-12 616 return -EOPNOTSUPP;
fbe639b44a8275 Sibi Sankar 2020-03-12 617 }
fbe639b44a8275 Sibi Sankar 2020-03-12 618
fbe639b44a8275 Sibi Sankar 2020-03-12 619 /* Check the response for other error case*/
fbe639b44a8275 Sibi Sankar 2020-03-12 620 if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
fbe639b44a8275 Sibi Sankar 2020-03-12 621 pr_err("PDR: %s request for PD restart failed: 0x%x\n",
fbe639b44a8275 Sibi Sankar 2020-03-12 622 req.service_path, resp.resp.error);
fbe639b44a8275 Sibi Sankar 2020-03-12 623 return -EREMOTEIO;
fbe639b44a8275 Sibi Sankar 2020-03-12 624 }
fbe639b44a8275 Sibi Sankar 2020-03-12 625
fbe639b44a8275 Sibi Sankar 2020-03-12 626 return 0;
fbe639b44a8275 Sibi Sankar 2020-03-12 627 }
9b09c0f289c5a8 Unnathi Chalicheemala 2023-09-22 628 EXPORT_SYMBOL_GPL(pdr_restart_pd);
fbe639b44a8275 Sibi Sankar 2020-03-12 629
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 07/11] wifi: ath12k: fix endianness handling in QMI bdf download
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
0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2025-07-17 15:59 UTC (permalink / raw)
To: Alexander Wilhelm, Jeff Johnson, Bjorn Andersson, Konrad Dybcio
Cc: oe-kbuild-all, linux-wireless, ath12k, linux-kernel,
linux-arm-msm
Hi Alexander,
kernel test robot noticed the following build warnings:
[auto build test WARNING on ath/ath-next]
[also build test WARNING on linus/master v6.16-rc6 next-20250717]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Alexander-Wilhelm/wifi-ath12k-fix-endianness-handling-in-QMI-host-capability-request/20250716-162058
base: https://git.kernel.org/pub/scm/linux/kernel/git/ath/ath.git ath-next
patch link: https://lore.kernel.org/r/20250716075100.1447352-8-alexander.wilhelm%40westermo.com
patch subject: [PATCH 07/11] wifi: ath12k: fix endianness handling in QMI bdf download
config: alpha-randconfig-r122-20250717 (https://download.01.org/0day-ci/archive/20250717/202507172333.LZcmFwWs-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 8.5.0
reproduce: (https://download.01.org/0day-ci/archive/20250717/202507172333.LZcmFwWs-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507172333.LZcmFwWs-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/net/wireless/ath/ath12k/qmi.c:2996:37: sparse: sparse: bad assignment (+=) to restricted __le32
vim +2996 drivers/net/wireless/ath/ath12k/qmi.c
2919
2920 static int ath12k_qmi_load_file_target_mem(struct ath12k_base *ab,
2921 const u8 *data, u32 len, u8 type)
2922 {
2923 struct qmi_wlanfw_bdf_download_req_msg_v01 *req;
2924 struct qmi_wlanfw_bdf_download_resp_msg_v01 resp = {};
2925 struct qmi_txn txn;
2926 const u8 *temp = data;
2927 int ret = 0;
2928 u32 remaining = len;
2929
2930 req = kzalloc(sizeof(*req), GFP_KERNEL);
2931 if (!req)
2932 return -ENOMEM;
2933
2934 while (remaining) {
2935 req->valid = 1;
2936 req->file_id_valid = 1;
2937 req->file_id = cpu_to_le32(ab->qmi.target.board_id);
2938 req->total_size_valid = 1;
2939 req->total_size = cpu_to_le32(remaining);
2940 req->seg_id_valid = 1;
2941 req->data_valid = 1;
2942 req->bdf_type = type;
2943 req->bdf_type_valid = 1;
2944 req->end_valid = 1;
2945 req->end = 0;
2946
2947 if (remaining > QMI_WLANFW_MAX_DATA_SIZE_V01) {
2948 req->data_len = cpu_to_le32(QMI_WLANFW_MAX_DATA_SIZE_V01);
2949 } else {
2950 req->data_len = cpu_to_le32(remaining);
2951 req->end = 1;
2952 }
2953
2954 if (type == ATH12K_QMI_FILE_TYPE_EEPROM) {
2955 req->data_valid = 0;
2956 req->end = 1;
2957 req->data_len = cpu_to_le32(ATH12K_QMI_MAX_BDF_FILE_NAME_SIZE);
2958 } else {
2959 memcpy(req->data, temp, le32_to_cpu(req->data_len));
2960 }
2961
2962 ret = qmi_txn_init(&ab->qmi.handle, &txn,
2963 qmi_wlanfw_bdf_download_resp_msg_v01_ei,
2964 &resp);
2965 if (ret < 0)
2966 goto out;
2967
2968 ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi bdf download req fixed addr type %d\n",
2969 type);
2970
2971 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn,
2972 QMI_WLANFW_BDF_DOWNLOAD_REQ_V01,
2973 QMI_WLANFW_BDF_DOWNLOAD_REQ_MSG_V01_MAX_LEN,
2974 qmi_wlanfw_bdf_download_req_msg_v01_ei, req);
2975 if (ret < 0) {
2976 qmi_txn_cancel(&txn);
2977 goto out;
2978 }
2979
2980 ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS));
2981 if (ret < 0)
2982 goto out;
2983
2984 if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
2985 ath12k_warn(ab, "qmi BDF download failed, result: %d, err: %d\n",
2986 resp.resp.result, resp.resp.error);
2987 ret = -EINVAL;
2988 goto out;
2989 }
2990
2991 if (type == ATH12K_QMI_FILE_TYPE_EEPROM) {
2992 remaining = 0;
2993 } else {
2994 remaining -= le32_to_cpu(req->data_len);
2995 temp += le32_to_cpu(req->data_len);
> 2996 req->seg_id += cpu_to_le32(1);
2997 ath12k_dbg(ab, ATH12K_DBG_QMI,
2998 "qmi bdf download request remaining %i\n",
2999 remaining);
3000 }
3001 }
3002
3003 out:
3004 kfree(req);
3005 return ret;
3006 }
3007
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI
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
0 siblings, 1 reply; 17+ messages in thread
From: Bjorn Andersson @ 2025-07-20 4:24 UTC (permalink / raw)
To: Jeff Johnson
Cc: Alexander Wilhelm, Jeff Johnson, Konrad Dybcio, linux-wireless,
ath12k, linux-kernel, linux-arm-msm
On Wed, Jul 16, 2025 at 08:13:20AM -0700, Jeff Johnson wrote:
> On 7/16/2025 12:50 AM, Alexander Wilhelm wrote:
> > Fix endianness handling in QMI firmware transfer on big-endian
> > platforms. Without this fix, the firmware download fails due to
> > misinterpreted data structures exchanged between the host and the
> > wireless module.
> >
> > The issue occurs during early bring-up on big endian systems, where QMI
> > messages are not correctly parsed by the driver, leading to failed
> > initialization sequences. Ensure all relevant fields are properly
> > converted between CPU and little-endian format in request and response
> > messages, as expected by the firmware. Attached logs showing the failure
> > before the fix:
> >
> > ath12k_pci 0001:01:00.0: BAR 0: assigned [mem 0xc00000000-0xc001fffff 64bit]
> > ath12k_pci 0001:01:00.0: boot pci_mem 0xcd4148e9
> > ath12k_pci 0001:01:00.0: pci probe 17cb:1109 17cb:1109
> > ath12k_pci 0001:01:00.0: pci tcsr_soc_hw_version major 2 minor 0
> > ath12k_pci 0001:01:00.0: request MSI one vector
> > ath12k_pci 0001:01:00.0: MSI vectors: 1
> > ath12k_pci 0001:01:00.0: msi base data is 0
> > ath12k_pci 0001:01:00.0: Hardware name: qcn9274 hw2.0
> > ath12k_pci 0001:01:00.0: boot firmware request ath12k/QCN9274/hw2.0/firmware-2.bin size 15134776
> > ath12k_pci 0001:01:00.0: found fw timestamp 1722934582
> > ath12k_pci 0001:01:00.0: found m3 image ie (421880 B)
> > ath12k_pci 0001:01:00.0: found fw image ie (7229440 B)
> > ath12k_pci 0001:01:00.0: found dualmac fw image ie (7483392 B)
> > ath12k_pci 0001:01:00.0: found firmware features ie (1 B)
> > ath12k_pci 0001:01:00.0: features
> > ath12k_pci 0001:01:00.0: using fw api 2
> > ath12k_pci 0001:01:00.0: dualmac fw selected for board id: 1005
> > ath12k_pci 0001:01:00.0: Assign MSI to user: MHI, num_vectors: 3, user_base_data: 0, base_vector: 0
> > ath12k_pci 0001:01:00.0: Number of assigned MSI for MHI is 3, base vector is 0
> > ath12k_pci 0001:01:00.0: Assign MSI to user: CE, num_vectors: 1, user_base_data: 0, base_vector: 0
> > ath12k_pci 0001:01:00.0: Assign MSI to user: DP, num_vectors: 1, user_base_data: 0, base_vector: 0
> > ath12k_pci 0001:01:00.0: irq:18 group:0
> > ath12k_pci 0001:01:00.0: irq:18 group:1
> > ath12k_pci 0001:01:00.0: irq:18 group:2
> > ath12k_pci 0001:01:00.0: irq:18 group:3
> > ath12k_pci 0001:01:00.0: irq:18 group:4
> > ath12k_pci 0001:01:00.0: irq:18 group:5
> > ath12k_pci 0001:01:00.0: irq:18 group:6
> > ath12k_pci 0001:01:00.0: irq:18 group:7
> > ath12k_pci 0001:01:00.0: pci after request_irq msi_ep_base_data 0
> > ath12k_pci 0001:01:00.0: cookie:0x0
> > ath12k_pci 0001:01:00.0: WLAON_WARM_SW_ENTRY 0x2
> > ath12k_pci 0001:01:00.0: WLAON_WARM_SW_ENTRY 0x2
> > ath12k_pci 0001:01:00.0: soc reset cause:0
> > ath12k_pci 0001:01:00.0: MHISTATUS 0xff04
> > ath12k_pci 0001:01:00.0: pci link_ctl 0x0000 L0s 0 L1 0
> > ath12k_pci 0001:01:00.0: pci reg 0x3164 instance 0x11 read val 0x11
> > ath12k_pci 0001:01:00.0: setting mhi state: INIT(0)
> > ath12k_pci 0001:01:00.0: setting mhi state: POWER_ON(2)
> > ath12k_pci 0001:01:00.0: mhi notify status reason UNKNOWN
> > ath12k_pci 0001:01:00.0: mhi notify status reason MHI_CB_EE_MISSION_MODE
> > ath12k_pci 0001:01:00.0: qmi wifi fw qmi service connected
> > ath12k_pci 0001:01:00.0: phy capability resp valid 1 num_phy 2 valid 1 board_id 84934656 valid 1 single_chip_mlo_support 0
> > ath12k_pci 0001:01:00.0: intra device MLO is disabled hence skip QMI MLO cap
> >
> > Alexander Wilhelm (11):
> > wifi: ath12k: fix endianness handling in QMI host capability request
> > wifi: ath12k: fix endianness handling in QMI phy capability response
> > wifi: ath12k: fix endianness handling in QMI firmware indication
> > wifi: ath12k: fix endianness handling in QMI firmware memory indication
> > wifi: ath12k: fix endianness handling in QMI respond firmware memory
> > wifi: ath12k: fix endianness handling in QMI firmware capabilities
> > wifi: ath12k: fix endianness handling in QMI bdf download
> > wifi: ath12k: fix endianness handling in QMI firmware m3 info
> > wifi: ath12k: fix endianness handling in QMI firmware wlan mode
> > wifi: ath12k: fix endianness handling in QMI wlan configuration
> > wifi: ath12k: fix endianness handling in QMI response
> >
> > drivers/net/wireless/ath/ath12k/qmi.c | 149 ++++++++++++++------------
> > drivers/net/wireless/ath/ath12k/qmi.h | 106 +++++++++---------
> > include/linux/soc/qcom/qmi.h | 4 +-
> > 3 files changed, 136 insertions(+), 123 deletions(-)
> >
>
> Frankly I'm shocked that the low-level QMI encode/decode is not doing the
> endian conversion. Since the Qualcomm internal tool that generates the data
> structures has always generated structs with cpu endianess (i.e. u8, u16, u32,
> etc) I just assumed that endian conversion was handled at a low level.
>
I'm suspecting that those tools, just like this implementation, is
exclusively tested on little endian machines...
> So should this issue be pushed down to the QMI encode/decode rather than foist
> it upon every client's read & write?
>
It's been a while since I looked at the implementation, but conceptually
I'm in favor of this.
Regards,
Bjorn
> /jeff
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI
2025-07-20 4:24 ` Bjorn Andersson
@ 2025-07-21 7:36 ` Alexander Wilhelm
0 siblings, 0 replies; 17+ messages in thread
From: Alexander Wilhelm @ 2025-07-21 7:36 UTC (permalink / raw)
To: Bjorn Andersson
Cc: Jeff Johnson, Jeff Johnson, Konrad Dybcio, linux-wireless, ath12k,
linux-kernel, linux-arm-msm
Am Sat, Jul 19, 2025 at 11:24:51PM -0500 schrieb Bjorn Andersson:
> On Wed, Jul 16, 2025 at 08:13:20AM -0700, Jeff Johnson wrote:
> > On 7/16/2025 12:50 AM, Alexander Wilhelm wrote:
> > > Fix endianness handling in QMI firmware transfer on big-endian
> > > platforms. Without this fix, the firmware download fails due to
> > > misinterpreted data structures exchanged between the host and the
> > > wireless module.
> > >
> > > The issue occurs during early bring-up on big endian systems, where QMI
> > > messages are not correctly parsed by the driver, leading to failed
> > > initialization sequences. Ensure all relevant fields are properly
> > > converted between CPU and little-endian format in request and response
> > > messages, as expected by the firmware. Attached logs showing the failure
> > > before the fix:
> > >
> > > ath12k_pci 0001:01:00.0: BAR 0: assigned [mem 0xc00000000-0xc001fffff 64bit]
> > > ath12k_pci 0001:01:00.0: boot pci_mem 0xcd4148e9
> > > ath12k_pci 0001:01:00.0: pci probe 17cb:1109 17cb:1109
> > > ath12k_pci 0001:01:00.0: pci tcsr_soc_hw_version major 2 minor 0
> > > ath12k_pci 0001:01:00.0: request MSI one vector
> > > ath12k_pci 0001:01:00.0: MSI vectors: 1
> > > ath12k_pci 0001:01:00.0: msi base data is 0
> > > ath12k_pci 0001:01:00.0: Hardware name: qcn9274 hw2.0
> > > ath12k_pci 0001:01:00.0: boot firmware request ath12k/QCN9274/hw2.0/firmware-2.bin size 15134776
> > > ath12k_pci 0001:01:00.0: found fw timestamp 1722934582
> > > ath12k_pci 0001:01:00.0: found m3 image ie (421880 B)
> > > ath12k_pci 0001:01:00.0: found fw image ie (7229440 B)
> > > ath12k_pci 0001:01:00.0: found dualmac fw image ie (7483392 B)
> > > ath12k_pci 0001:01:00.0: found firmware features ie (1 B)
> > > ath12k_pci 0001:01:00.0: features
> > > ath12k_pci 0001:01:00.0: using fw api 2
> > > ath12k_pci 0001:01:00.0: dualmac fw selected for board id: 1005
> > > ath12k_pci 0001:01:00.0: Assign MSI to user: MHI, num_vectors: 3, user_base_data: 0, base_vector: 0
> > > ath12k_pci 0001:01:00.0: Number of assigned MSI for MHI is 3, base vector is 0
> > > ath12k_pci 0001:01:00.0: Assign MSI to user: CE, num_vectors: 1, user_base_data: 0, base_vector: 0
> > > ath12k_pci 0001:01:00.0: Assign MSI to user: DP, num_vectors: 1, user_base_data: 0, base_vector: 0
> > > ath12k_pci 0001:01:00.0: irq:18 group:0
> > > ath12k_pci 0001:01:00.0: irq:18 group:1
> > > ath12k_pci 0001:01:00.0: irq:18 group:2
> > > ath12k_pci 0001:01:00.0: irq:18 group:3
> > > ath12k_pci 0001:01:00.0: irq:18 group:4
> > > ath12k_pci 0001:01:00.0: irq:18 group:5
> > > ath12k_pci 0001:01:00.0: irq:18 group:6
> > > ath12k_pci 0001:01:00.0: irq:18 group:7
> > > ath12k_pci 0001:01:00.0: pci after request_irq msi_ep_base_data 0
> > > ath12k_pci 0001:01:00.0: cookie:0x0
> > > ath12k_pci 0001:01:00.0: WLAON_WARM_SW_ENTRY 0x2
> > > ath12k_pci 0001:01:00.0: WLAON_WARM_SW_ENTRY 0x2
> > > ath12k_pci 0001:01:00.0: soc reset cause:0
> > > ath12k_pci 0001:01:00.0: MHISTATUS 0xff04
> > > ath12k_pci 0001:01:00.0: pci link_ctl 0x0000 L0s 0 L1 0
> > > ath12k_pci 0001:01:00.0: pci reg 0x3164 instance 0x11 read val 0x11
> > > ath12k_pci 0001:01:00.0: setting mhi state: INIT(0)
> > > ath12k_pci 0001:01:00.0: setting mhi state: POWER_ON(2)
> > > ath12k_pci 0001:01:00.0: mhi notify status reason UNKNOWN
> > > ath12k_pci 0001:01:00.0: mhi notify status reason MHI_CB_EE_MISSION_MODE
> > > ath12k_pci 0001:01:00.0: qmi wifi fw qmi service connected
> > > ath12k_pci 0001:01:00.0: phy capability resp valid 1 num_phy 2 valid 1 board_id 84934656 valid 1 single_chip_mlo_support 0
> > > ath12k_pci 0001:01:00.0: intra device MLO is disabled hence skip QMI MLO cap
> > >
> > > Alexander Wilhelm (11):
> > > wifi: ath12k: fix endianness handling in QMI host capability request
> > > wifi: ath12k: fix endianness handling in QMI phy capability response
> > > wifi: ath12k: fix endianness handling in QMI firmware indication
> > > wifi: ath12k: fix endianness handling in QMI firmware memory indication
> > > wifi: ath12k: fix endianness handling in QMI respond firmware memory
> > > wifi: ath12k: fix endianness handling in QMI firmware capabilities
> > > wifi: ath12k: fix endianness handling in QMI bdf download
> > > wifi: ath12k: fix endianness handling in QMI firmware m3 info
> > > wifi: ath12k: fix endianness handling in QMI firmware wlan mode
> > > wifi: ath12k: fix endianness handling in QMI wlan configuration
> > > wifi: ath12k: fix endianness handling in QMI response
> > >
> > > drivers/net/wireless/ath/ath12k/qmi.c | 149 ++++++++++++++------------
> > > drivers/net/wireless/ath/ath12k/qmi.h | 106 +++++++++---------
> > > include/linux/soc/qcom/qmi.h | 4 +-
> > > 3 files changed, 136 insertions(+), 123 deletions(-)
> > >
> >
> > Frankly I'm shocked that the low-level QMI encode/decode is not doing the
> > endian conversion. Since the Qualcomm internal tool that generates the data
> > structures has always generated structs with cpu endianess (i.e. u8, u16, u32,
> > etc) I just assumed that endian conversion was handled at a low level.
> >
>
> I'm suspecting that those tools, just like this implementation, is
> exclusively tested on little endian machines...
>
> > So should this issue be pushed down to the QMI encode/decode rather than foist
> > it upon every client's read & write?
> >
>
> It's been a while since I looked at the implementation, but conceptually
> I'm in favor of this.
I could certainly implement the endianness fixes in the QMI code. However, I’m
concerned that other drivers might depend on the current behavior. These changes
could potentially introduce regressions, which I would want to avoid.
Additionally, I’m already seeing some Sparse warnings, and I’m not entirely sure
how to handle them properly at this point.
Best regards
Alexander Wilhelm
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2025-07-21 7:37 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 06/11] wifi: ath12k: fix endianness handling in QMI firmware capabilities Alexander Wilhelm
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).