linux-stable/drivers/net
Youghandhar Chintala c4bedc3cda wifi: ath10k: Delay the unmapping of the buffer
[ Upstream commit acd4324e5f ]

On WCN3990, we are seeing a rare scenario where copy engine hardware is
sending a copy complete interrupt to the host driver while still
processing the buffer that the driver has sent, this is leading into an
SMMU fault triggering kernel panic. This is happening on copy engine
channel 3 (CE3) where the driver normally enqueues WMI commands to the
firmware. Upon receiving a copy complete interrupt, host driver will
immediately unmap and frees the buffer presuming that hardware has
processed the buffer. In the issue case, upon receiving copy complete
interrupt, host driver will unmap and free the buffer but since hardware
is still accessing the buffer (which in this case got unmapped in
parallel), SMMU hardware will trigger an SMMU fault resulting in a
kernel panic.

In order to avoid this, as a work around, add a delay before unmapping
the copy engine source DMA buffer. This is conditionally done for
WCN3990 and only for the CE3 channel where issue is seen.

Below is the crash signature:

wifi smmu error: kernel: [ 10.120965] arm-smmu 15000000.iommu: Unhandled
context fault: fsr=0x402, iova=0x7fdfd8ac0,
fsynr=0x500003,cbfrsynra=0xc1, cb=6 arm-smmu 15000000.iommu: Unhandled
context fault:fsr=0x402, iova=0x7fe06fdc0, fsynr=0x710003,
cbfrsynra=0xc1, cb=6 qcom-q6v5-mss 4080000.remoteproc: fatal error
received: err_qdi.c:1040:EF:wlan_process:0x1:WLAN RT:0x2091:
cmnos_thread.c:3998:Asserted in copy_engine.c:AXI_ERROR_DETECTED:2149
remoteproc remoteproc0: crash detected in
4080000.remoteproc: type fatal error <3> remoteproc remoteproc0:
handling crash #1 in 4080000.remoteproc

pc : __arm_lpae_unmap+0x500/0x514
lr : __arm_lpae_unmap+0x4bc/0x514
sp : ffffffc011ffb530
x29: ffffffc011ffb590 x28: 0000000000000000
x27: 0000000000000000 x26: 0000000000000004
x25: 0000000000000003 x24: ffffffc011ffb890
x23: ffffffa762ef9be0 x22: ffffffa77244ef00
x21: 0000000000000009 x20: 00000007fff7c000
x19: 0000000000000003 x18: 0000000000000000
x17: 0000000000000004 x16: ffffffd7a357d9f0
x15: 0000000000000000 x14: 00fd5d4fa7ffffff
x13: 000000000000000e x12: 0000000000000000
x11: 00000000ffffffff x10: 00000000fffffe00
x9 : 000000000000017c x8 : 000000000000000c
x7 : 0000000000000000 x6 : ffffffa762ef9000
x5 : 0000000000000003 x4 : 0000000000000004
x3 : 0000000000001000 x2 : 00000007fff7c000
x1 : ffffffc011ffb890 x0 : 0000000000000000 Call trace:
__arm_lpae_unmap+0x500/0x514
__arm_lpae_unmap+0x4bc/0x514
__arm_lpae_unmap+0x4bc/0x514
arm_lpae_unmap_pages+0x78/0xa4
arm_smmu_unmap_pages+0x78/0x104
__iommu_unmap+0xc8/0x1e4
iommu_unmap_fast+0x38/0x48
__iommu_dma_unmap+0x84/0x104
iommu_dma_free+0x34/0x50
dma_free_attrs+0xa4/0xd0
ath10k_htt_rx_free+0xc4/0xf4 [ath10k_core] ath10k_core_stop+0x64/0x7c
[ath10k_core]
ath10k_halt+0x11c/0x180 [ath10k_core]
ath10k_stop+0x54/0x94 [ath10k_core]
drv_stop+0x48/0x1c8 [mac80211]
ieee80211_do_open+0x638/0x77c [mac80211] ieee80211_open+0x48/0x5c
[mac80211]
__dev_open+0xb4/0x174
__dev_change_flags+0xc4/0x1dc
dev_change_flags+0x3c/0x7c
devinet_ioctl+0x2b4/0x580
inet_ioctl+0xb0/0x1b4
sock_do_ioctl+0x4c/0x16c
compat_ifreq_ioctl+0x1cc/0x35c
compat_sock_ioctl+0x110/0x2ac
__arm64_compat_sys_ioctl+0xf4/0x3e0
el0_svc_common+0xb4/0x17c
el0_svc_compat_handler+0x2c/0x58
el0_svc_compat+0x8/0x2c

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.2.0-01387-QCAHLSWMTPLZ-1

Tested-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Youghandhar Chintala <quic_youghand@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20221012142733.32420-1-quic_youghand@quicinc.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-12-31 13:26:42 +01:00
..
appletalk
arcnet arcnet: fix potential memory leak in com20020_probe() 2022-12-02 17:43:08 +01:00
bonding bonding: do failover when high prio link up 2022-12-31 13:26:37 +01:00
caif
can can: tcan4x5x: Fix use of register error status mask 2022-12-31 13:26:14 +01:00
dsa net: dsa: mv88e6xxx: avoid reg_lock deadlock in mv88e6xxx_setup_port() 2022-12-31 13:26:38 +01:00
ethernet myri10ge: Fix an error handling path in myri10ge_probe() 2022-12-31 13:26:39 +01:00
fddi net: defxx: Fix missing err handling in dfx_init() 2022-12-31 13:26:12 +01:00
fjes
hamradio hamradio: don't call dev_kfree_skb() under spin_lock_irqsave() 2022-12-31 13:26:13 +01:00
hippi net: hippi: Add missing pci_disable_device() in rr_init_one() 2022-09-26 13:22:39 -07:00
hyperv hv_netvsc: Fix race between VF offering and VF association message from host 2022-10-21 12:37:34 +02:00
ieee802154 ca8210: Fix crash by zero initializing data 2022-12-14 11:40:56 +01:00
ipa net: ipa: properly limit modem routing table use 2022-09-20 08:11:13 -07:00
ipvlan ipvlan: hold lower dev to avoid possible use-after-free 2022-12-02 17:43:04 +01:00
mctp mctp: serial: Fix starting value for frame check sequence 2022-12-31 13:26:39 +01:00
mdio net: mdio: fix unbalanced fwnode reference count in mdio_device_release() 2022-12-14 11:41:03 +01:00
netdevsim netdevsim: Fix memory leak of nsim_dev->fa_cookie 2022-11-26 09:27:40 +01:00
pcs
phy net: phy: mxl-gpy: add MDINT workaround 2022-12-14 11:41:05 +01:00
plip net: plip: don't call kfree_skb/dev_kfree_skb() under spin_lock_irq() 2022-12-14 11:41:05 +01:00
ppp
slip
team net: team: Unsync device addresses on ndo_stop 2022-09-16 14:34:01 +01:00
usb net: usb: qmi_wwan: add u-blox 0x1342 composition 2022-12-14 11:40:49 +01:00
vmxnet3 vmxnet3: use correct intrConf reference when using extended queues 2022-12-14 11:40:58 +01:00
vxlan
wan net: farsync: Fix kmemleak when rmmods farsync 2022-12-31 13:26:13 +01:00
wireguard wireguard: netlink: avoid variable-sized memcpy on sockaddr 2022-09-20 11:26:14 -07:00
wireless wifi: ath10k: Delay the unmapping of the buffer 2022-12-31 13:26:42 +01:00
wwan net: wwan: iosm: fix memory leak in ipc_mux_init() 2022-12-14 11:41:02 +01:00
xen-netback xen/netback: fix build warning 2022-12-14 11:41:04 +01:00
Kconfig
LICENSE.SRC
Makefile
Space.c
amt.c
bareudp.c
dummy.c
eql.c
geneve.c
gtp.c
ifb.c
loopback.c net: loopback: use NET_NAME_PREDICTABLE for name_assign_type 2022-12-21 17:41:15 +01:00
macsec.c net: macsec: fix net device access prior to holding a lock 2022-12-31 13:26:37 +01:00
macvlan.c macvlan: enforce a consistent minimal mtu 2022-11-26 09:27:54 +01:00
macvtap.c
mdio.c
mhi_net.c net: mhi: Fix memory leak in mhi_net_dellink() 2022-11-26 09:27:36 +01:00
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c ntb_netdev: Use dev_kfree_skb_any() in interrupt context 2022-12-31 13:26:14 +01:00
rionet.c
sb1000.c
sungem_phy.c
tap.c
thunderbolt.c net: thunderbolt: fix memory leak in tbnet_open() 2022-12-14 11:41:05 +01:00
tun.c net: tun: Fix use-after-free in tun_detach() 2022-12-08 11:30:18 +01:00
veth.c
virtio_net.c virtio_net: Fix probe failed when modprobe virtio_net 2022-12-02 17:43:09 +01:00
vrf.c
vsockmon.c
xen-netfront.c xen-netfront: Fix NULL sring after live migration 2022-12-14 11:41:01 +01:00