* [PATCH] ath11k/qmi: Use memcpy_toio() function on I/O memory
@ 2019-05-08 11:54 Vasanthakumar Thiagarajan
2019-05-13 14:03 ` Sven Eckelmann
2019-05-13 14:48 ` [PATCH] ath11k: qmi: " Kalle Valo
0 siblings, 2 replies; 3+ messages in thread
From: Vasanthakumar Thiagarajan @ 2019-05-08 11:54 UTC (permalink / raw)
To: ath11k
The usage of memcpy() function on I/O memory is not recommended
when doing a bulk data copy. Instead use memcpy_toio() function
while copying bulk data to I/O memory. Using the right function
takes care of platform specific alignment requirement as well
in arm64. This fixes the below kernel crash due to unaligned
memory access in 64-bit arm during memory copy of board data to I/O
memory.
[ 15.672513] ath11k c000000.wifi1: Downloading BDF: IPQ8074/board-2.bin, size: 917972
[ 15.672635] Unhandled fault: alignment fault (0x96000061) at 0xffffff8007200004
[ 15.680449] Internal error: : 96000061 [#1] PREEMPT SMP
[ 15.946227] CPU: 0 PID: 890 Comm: kworker/u8:5 Tainted: P
[ 15.968272] task: ffffffc03cae9f80 ti: ffffffc03cae9f80 task.ti: ffffffc03cae9f80
[ 15.968552] PC is at __efistub_memcpy+0x48/0x180
[ 15.976011] LR is at ath11k_ce_get_attr_flags+0xc14/0x1594 [ath11k]
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org>
---
drivers/net/wireless/ath/ath11k/qmi.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
index b862fa9..0bec067 100644
--- a/drivers/net/wireless/ath/ath11k/qmi.c
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
@@ -1795,7 +1795,7 @@ static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)
static int
ath11k_qmi_prepare_bdf_download(struct ath11k_base *ab, int type,
struct qmi_wlanfw_bdf_download_req_msg_v01 *req,
- void *bdf_addr)
+ void __iomem *bdf_addr)
{
struct device *dev = ab->dev;
char filename[ATH11K_QMI_MAX_BDF_FILE_NAME_SIZE];
@@ -1813,7 +1813,7 @@ static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)
}
fw_size = min_t(u32, ab->hw_params.fw.board_size, bd.len);
- memcpy(bdf_addr, bd.data, fw_size);
+ memcpy_toio(bdf_addr, bd.data, fw_size);
ath11k_core_free_bdf(ab, &bd);
break;
case ATH11K_QMI_FILE_TYPE_CALDATA:
@@ -1828,7 +1828,8 @@ static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)
fw_size = min_t(u32, ab->hw_params.fw.board_size,
fw_entry->size);
- memcpy(bdf_addr + ATH11K_QMI_CALDATA_OFFSET, fw_entry->data, fw_size);
+ memcpy_toio(bdf_addr + ATH11K_QMI_CALDATA_OFFSET,
+ fw_entry->data, fw_size);
ath11k_info(ab, "qmi downloading BDF: %s, size: %zu\n",
filename, fw_entry->size);
--
1.9.1
_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ath11k/qmi: Use memcpy_toio() function on I/O memory
2019-05-08 11:54 [PATCH] ath11k/qmi: Use memcpy_toio() function on I/O memory Vasanthakumar Thiagarajan
@ 2019-05-13 14:03 ` Sven Eckelmann
2019-05-13 14:48 ` [PATCH] ath11k: qmi: " Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Sven Eckelmann @ 2019-05-13 14:03 UTC (permalink / raw)
To: ath11k; +Cc: Vasanthakumar Thiagarajan
[-- Attachment #1.1: Type: text/plain, Size: 2588 bytes --]
On Wednesday, 8 May 2019 13:54:43 CEST Vasanthakumar Thiagarajan wrote:
> The usage of memcpy() function on I/O memory is not recommended
> when doing a bulk data copy. Instead use memcpy_toio() function
> while copying bulk data to I/O memory. Using the right function
> takes care of platform specific alignment requirement as well
> in arm64. This fixes the below kernel crash due to unaligned
> memory access in 64-bit arm during memory copy of board data to I/O
> memory.
>
> [ 15.672513] ath11k c000000.wifi1: Downloading BDF: IPQ8074/board-2.bin, size: 917972
> [ 15.672635] Unhandled fault: alignment fault (0x96000061) at 0xffffff8007200004
> [ 15.680449] Internal error: : 96000061 [#1] PREEMPT SMP
> [ 15.946227] CPU: 0 PID: 890 Comm: kworker/u8:5 Tainted: P
> [ 15.968272] task: ffffffc03cae9f80 ti: ffffffc03cae9f80 task.ti: ffffffc03cae9f80
> [ 15.968552] PC is at __efistub_memcpy+0x48/0x180
> [ 15.976011] LR is at ath11k_ce_get_attr_flags+0xc14/0x1594 [ath11k]
>
> Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org>
> ---
Tested-by: Sven Eckelmann <sven@narfation.org>
I was able to load WLAN.HK.2.1.0.1-00056-QCAHKSWPL_SILICONZ-1.
But the newest firmware still crashes directly after it got loaded:
[ 9.943342] ath11k c000000.wifi: Target: chip_id: 0x0, chip_family: 0x0, board_id: 0x211, soc_id: 0xffffffff, fw_version: 0x30e84a5
[ 9.944161] ath11k c000000.wifi: Downloading BDF: IPQ8074/board-2.bin, size: 917972
[ 9.955302] ath11k c000000.wifi: Direct firmware load for IPQ8074/caldata.bin failed with error -2
[ 9.961605] ath11k c000000.wifi: Falling back to user helper
[ 10.217235] ath11k c000000.wifi: Downloading BDF: IPQ8074/caldata.bin, size: 131072
[ 10.218209] Fatal error received from wcss software!:
[ 10.218209] QC Image Version: QC_IMAGE_VERSION_STRING=WLAN.HK.2.1.0.1-00410-QCAHKSWPL_SILICONZ-2
[ 10.218209] Image Variant : IMAGE_VARIANT_STRING=8074.wlanfw.eval_v2Q
[ 10.218209]
[ 10.218209] :Excep :0 Exception detectedparam0 :zero, param1 :zero, param2 :zero.
[ 10.218209] Thread ID : 0x00000071 Thread name : wlan_platform Process ID : 0
[ 10.218209] Register:
[ 10.218209] SP : 0x4b658a00
[ 10.218209] FP : 0x4b658a18
[ 10.218209] PC : 0x4b38a0d4
[ 10.218209] SSR : 0x00000003
[ 10.218209] BADVA : 0x4b0c0009
[ 10.218209] LR : 0x4b2ba2e4
[ 10.218209]
[ 10.218209] Stack Dump
[ 10.218209] from : 0x4b658a00
[ 10.218209] to : 0x4b658d20
Kind regards,
Sven
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 146 bytes --]
_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ath11k: qmi: Use memcpy_toio() function on I/O memory
2019-05-08 11:54 [PATCH] ath11k/qmi: Use memcpy_toio() function on I/O memory Vasanthakumar Thiagarajan
2019-05-13 14:03 ` Sven Eckelmann
@ 2019-05-13 14:48 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2019-05-13 14:48 UTC (permalink / raw)
To: Vasanthakumar Thiagarajan; +Cc: ath11k
Vasanthakumar Thiagarajan <vthiagar@codeaurora.org> wrote:
> The usage of memcpy() function on I/O memory is not recommended
> when doing a bulk data copy. Instead use memcpy_toio() function
> while copying bulk data to I/O memory. Using the right function
> takes care of platform specific alignment requirement as well
> in arm64. This fixes the below kernel crash due to unaligned
> memory access in 64-bit arm during memory copy of board data to I/O
> memory.
>
> [ 15.672513] ath11k c000000.wifi1: Downloading BDF: IPQ8074/board-2.bin, size: 917972
> [ 15.672635] Unhandled fault: alignment fault (0x96000061) at 0xffffff8007200004
> [ 15.680449] Internal error: : 96000061 [#1] PREEMPT SMP
> [ 15.946227] CPU: 0 PID: 890 Comm: kworker/u8:5 Tainted: P
> [ 15.968272] task: ffffffc03cae9f80 ti: ffffffc03cae9f80 task.ti: ffffffc03cae9f80
> [ 15.968552] PC is at __efistub_memcpy+0x48/0x180
> [ 15.976011] LR is at ath11k_ce_get_attr_flags+0xc14/0x1594 [ath11k]
>
> Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org>
> Tested-by: Sven Eckelmann <sven@narfation.org>
Patch applied to ath.git, thanks.
83ac6fc1f56d ath11k: qmi: Use memcpy_toio() function on I/O memory
--
https://patchwork.kernel.org/patch/10935537/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-13 14:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-08 11:54 [PATCH] ath11k/qmi: Use memcpy_toio() function on I/O memory Vasanthakumar Thiagarajan
2019-05-13 14:03 ` Sven Eckelmann
2019-05-13 14:48 ` [PATCH] ath11k: qmi: " Kalle Valo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.