* [PATCH ath-next] wifi: ath10k: snoc: use memcpy_fromio() for MSA ramdump
@ 2026-07-27 7:26 Linghui Wu
2026-07-27 8:38 ` Baochen Qiang
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Linghui Wu @ 2026-07-27 7:26 UTC (permalink / raw)
To: ath10k; +Cc: linux-wireless, jjohnson, linux-kernel, Linghui Wu
On WCN3990/SNOC the MSA region is mapped with devm_memremap(MEMREMAP_WT).
On arm64 such a mapping is not Normal-cacheable, so unaligned accesses to
it are not permitted. ath10k_msa_dump_memory() copies the region with a
plain memcpy(), whose optimized __pi_memcpy_generic implementation issues
wide/unaligned loads. This triggers an alignment fault (FSC=0x21) Oops in
ath10k_snoc_fw_crashed_dump() while collecting the devcoredump:
Unable to handle kernel paging request ... FSC=0x21: alignment fault
pc : __pi_memcpy_generic
lr : ath10k_snoc_fw_crashed_dump [ath10k_snoc]
The Oops both leaves the firmware RAM dump buffer zeroed (no dump is
captured) and crashes the kernel, which in turn breaks modem SSR
recovery.
Use memcpy_fromio(), which only performs accesses that are valid for such
a device-memory mapping. The generic memcpy_fromio() implementation aligns
the source before issuing word-sized reads and stores the destination with
put_unaligned(), so it is also safe for the coherent DMA allocation used on
the non-reserved-memory path. ath11k and ath12k use the same pattern
when copying target memory into crash dumps, so call it unconditionally
here too.
The MEMREMAP_WT pointer is a plain void *, so an explicit __iomem cast is
needed; use __force to keep sparse happy.
Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.3.7.c5-00107-QCAHLSWMTPL-1
Fixes: 3f14b73c3843 ("ath10k: Enable MSA region dump support for WCN3990")
Signed-off-by: Linghui Wu <linghui.wu@oss.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/snoc.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c
index 310650227..695473eb0 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -7,6 +7,7 @@
#include <linux/bits.h>
#include <linux/clk.h>
+#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
@@ -1475,11 +1476,15 @@ static void ath10k_msa_dump_memory(struct ath10k *ar,
hdr->length = cpu_to_le32(ar->msa.mem_size);
if (current_region->len < ar->msa.mem_size) {
- memcpy(buf, ar->msa.vaddr, current_region->len);
+ memcpy_fromio(buf,
+ (const void __iomem __force *)ar->msa.vaddr,
+ current_region->len);
ath10k_warn(ar, "msa dump length is less than msa size %x, %x\n",
current_region->len, ar->msa.mem_size);
} else {
- memcpy(buf, ar->msa.vaddr, ar->msa.mem_size);
+ memcpy_fromio(buf,
+ (const void __iomem __force *)ar->msa.vaddr,
+ ar->msa.mem_size);
}
}
base-commit: 913998f903fb1432c0046c33003db38a9e8bedb1
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH ath-next] wifi: ath10k: snoc: use memcpy_fromio() for MSA ramdump
2026-07-27 7:26 [PATCH ath-next] wifi: ath10k: snoc: use memcpy_fromio() for MSA ramdump Linghui Wu
@ 2026-07-27 8:38 ` Baochen Qiang
2026-07-31 5:54 ` Rameshkumar Sundaram
2026-08-01 15:55 ` Jeff Johnson
2 siblings, 0 replies; 4+ messages in thread
From: Baochen Qiang @ 2026-07-27 8:38 UTC (permalink / raw)
To: Linghui Wu, ath10k; +Cc: linux-wireless, jjohnson, linux-kernel
On 7/27/2026 3:26 PM, Linghui Wu wrote:
> On WCN3990/SNOC the MSA region is mapped with devm_memremap(MEMREMAP_WT).
> On arm64 such a mapping is not Normal-cacheable, so unaligned accesses to
> it are not permitted. ath10k_msa_dump_memory() copies the region with a
> plain memcpy(), whose optimized __pi_memcpy_generic implementation issues
> wide/unaligned loads. This triggers an alignment fault (FSC=0x21) Oops in
> ath10k_snoc_fw_crashed_dump() while collecting the devcoredump:
>
> Unable to handle kernel paging request ... FSC=0x21: alignment fault
> pc : __pi_memcpy_generic
> lr : ath10k_snoc_fw_crashed_dump [ath10k_snoc]
>
> The Oops both leaves the firmware RAM dump buffer zeroed (no dump is
> captured) and crashes the kernel, which in turn breaks modem SSR
> recovery.
>
> Use memcpy_fromio(), which only performs accesses that are valid for such
> a device-memory mapping. The generic memcpy_fromio() implementation aligns
> the source before issuing word-sized reads and stores the destination with
> put_unaligned(), so it is also safe for the coherent DMA allocation used on
> the non-reserved-memory path. ath11k and ath12k use the same pattern
> when copying target memory into crash dumps, so call it unconditionally
> here too.
> The MEMREMAP_WT pointer is a plain void *, so an explicit __iomem cast is
> needed; use __force to keep sparse happy.
>
> Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.3.7.c5-00107-QCAHLSWMTPL-1
>
> Fixes: 3f14b73c3843 ("ath10k: Enable MSA region dump support for WCN3990")
> Signed-off-by: Linghui Wu <linghui.wu@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH ath-next] wifi: ath10k: snoc: use memcpy_fromio() for MSA ramdump
2026-07-27 7:26 [PATCH ath-next] wifi: ath10k: snoc: use memcpy_fromio() for MSA ramdump Linghui Wu
2026-07-27 8:38 ` Baochen Qiang
@ 2026-07-31 5:54 ` Rameshkumar Sundaram
2026-08-01 15:55 ` Jeff Johnson
2 siblings, 0 replies; 4+ messages in thread
From: Rameshkumar Sundaram @ 2026-07-31 5:54 UTC (permalink / raw)
To: Linghui Wu, ath10k; +Cc: linux-wireless, jjohnson, linux-kernel
On 7/27/2026 12:56 PM, Linghui Wu wrote:
> On WCN3990/SNOC the MSA region is mapped with devm_memremap(MEMREMAP_WT).
> On arm64 such a mapping is not Normal-cacheable, so unaligned accesses to
> it are not permitted. ath10k_msa_dump_memory() copies the region with a
> plain memcpy(), whose optimized __pi_memcpy_generic implementation issues
> wide/unaligned loads. This triggers an alignment fault (FSC=0x21) Oops in
> ath10k_snoc_fw_crashed_dump() while collecting the devcoredump:
>
> Unable to handle kernel paging request ... FSC=0x21: alignment fault
> pc : __pi_memcpy_generic
> lr : ath10k_snoc_fw_crashed_dump [ath10k_snoc]
>
> The Oops both leaves the firmware RAM dump buffer zeroed (no dump is
> captured) and crashes the kernel, which in turn breaks modem SSR
> recovery.
>
> Use memcpy_fromio(), which only performs accesses that are valid for such
> a device-memory mapping. The generic memcpy_fromio() implementation aligns
> the source before issuing word-sized reads and stores the destination with
> put_unaligned(), so it is also safe for the coherent DMA allocation used on
> the non-reserved-memory path. ath11k and ath12k use the same pattern
> when copying target memory into crash dumps, so call it unconditionally
> here too.
> The MEMREMAP_WT pointer is a plain void *, so an explicit __iomem cast is
> needed; use __force to keep sparse happy.
>
> Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.3.7.c5-00107-QCAHLSWMTPL-1
>
> Fixes: 3f14b73c3843 ("ath10k: Enable MSA region dump support for WCN3990")
> Signed-off-by: Linghui Wu <linghui.wu@oss.qualcomm.com>
Reviewed-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH ath-next] wifi: ath10k: snoc: use memcpy_fromio() for MSA ramdump
2026-07-27 7:26 [PATCH ath-next] wifi: ath10k: snoc: use memcpy_fromio() for MSA ramdump Linghui Wu
2026-07-27 8:38 ` Baochen Qiang
2026-07-31 5:54 ` Rameshkumar Sundaram
@ 2026-08-01 15:55 ` Jeff Johnson
2 siblings, 0 replies; 4+ messages in thread
From: Jeff Johnson @ 2026-08-01 15:55 UTC (permalink / raw)
To: ath10k, Linghui Wu; +Cc: linux-wireless, jjohnson, linux-kernel
On Mon, 27 Jul 2026 12:56:29 +0530, Linghui Wu wrote:
> On WCN3990/SNOC the MSA region is mapped with devm_memremap(MEMREMAP_WT).
> On arm64 such a mapping is not Normal-cacheable, so unaligned accesses to
> it are not permitted. ath10k_msa_dump_memory() copies the region with a
> plain memcpy(), whose optimized __pi_memcpy_generic implementation issues
> wide/unaligned loads. This triggers an alignment fault (FSC=0x21) Oops in
> ath10k_snoc_fw_crashed_dump() while collecting the devcoredump:
>
> [...]
Applied, thanks!
[1/1] wifi: ath10k: snoc: use memcpy_fromio() for MSA ramdump
commit: 4f25071afe9218aaae1c63fbf75e229aa6405319
Best regards,
--
Jeff Johnson <jeff.johnson@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-01 15:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-27 7:26 [PATCH ath-next] wifi: ath10k: snoc: use memcpy_fromio() for MSA ramdump Linghui Wu
2026-07-27 8:38 ` Baochen Qiang
2026-07-31 5:54 ` Rameshkumar Sundaram
2026-08-01 15:55 ` Jeff Johnson
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®