Re: [PATCH] wifi: ath11k: clear shared SRNG pointer state on restart
Kyle Farnung <[email protected]> Thu, 14 May 2026 18:08:12 -0700
| Newsgroups | org.infradead.lists.ath11k,org.kernel.vger.linux-kernel,org.kernel.vger.linux-wireless,org.kernel.vger.stable |
|---|---|
| Message-ID | <CAOPSVF3RgoV0e2EGbpy8t36mPKnn95_KWGt4_xSL7B9m6pv_RQ@mail.gmail.com> |
On Thu, May 14, 2026 at 8:16 AM Jeff Johnson <[email protected]> wrote: > > On 5/13/2026 9:52 PM, Kyle Farnung via B4 Relay wrote: > > From: Kyle Farnung <[email protected]> > > > > LMAC rings reuse the shared rdp/wrp pointer buffers without going > > through the normal SRNG hw-init path that zeros non-LMAC ring > > pointers. After restart, ath11k_hal_srng_clear() can therefore hand > > stale hp/tp state from the previous firmware instance back to the new > > one. > > > > Clear the shared pointer buffers while keeping the allocations in > > place so restart still avoids reallocating SRNG DMA memory, but starts > > with fresh ring-pointer state. > > > > Fixes: 32be3ca4cf78b ("wifi: ath11k: HAL SRNG: don't deinitialize and re-initialize again") > > Cc: [email protected] > > Link: https://lore.kernel.org/all/CAOPSVF04q6uvVdq8GTRLHBrVMdpt9=o9wVcFMc6f-yhmSBcZqQ@mail.gmail.com/ > > I'm going to change this to a Closes: tag in my pending branch Thanks, that all makes sense. I'm still running the fix locally and haven't seen the issue again after 9 suspend/resume cycles. > > > Signed-off-by: Kyle Farnung <[email protected]> > > --- > > This patch is the result of investigating suspend/resume failures on a > > Lenovo ThinkPad P14s Gen 5 AMD with ath11k. > > > > I originally proposed extending the existing ath11k PM quirk for this > > platform, but after discussion in [1] and bisection the issue appears to > > be a regression introduced by [2]. There is also a parallel report in [3] > > that appears consistent with the same root cause. This patch keeps the > > intended no-reallocation behavior from that change, but clears the > > preserved shared SRNG pointer state so restart begins from a clean state. > > > > Testing so far has been limited to local suspend/resume cycling on the > > affected system. The issue was originally reproduced on v7.0.4, and the > > patch was also built and tested on top of ath-current with repeated > > suspend/resume cycles on a Lenovo ThinkPad P14s Gen 5 AMD. > > > > [1] https://lore.kernel.org/all/CAOPSVF04q6uvVdq8GTRLHBrVMdpt9=o9wVcFMc6f-yhmSBcZqQ@mail.gmail.com/ > > [2] 32be3ca4cf78b ("wifi: ath11k: HAL SRNG: don't deinitialize and re-initialize again") > > [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1132343 > > --- > > drivers/net/wireless/ath/ath11k/hal.c | 13 ++++++++++--- > > 1 file changed, 10 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/net/wireless/ath/ath11k/hal.c b/drivers/net/wireless/ath/ath11k/hal.c > > index e821e5a62c1c0..0c0aeb803018e 100644 > > --- a/drivers/net/wireless/ath/ath11k/hal.c > > +++ b/drivers/net/wireless/ath/ath11k/hal.c > > @@ -1387,14 +1387,21 @@ EXPORT_SYMBOL(ath11k_hal_srng_deinit); > > > > void ath11k_hal_srng_clear(struct ath11k_base *ab) > > { > > - /* No need to memset rdp and wrp memory since each individual > > - * segment would get cleared in ath11k_hal_srng_src_hw_init() > > - * and ath11k_hal_srng_dst_hw_init(). > > + /* Preserve the shared pointer buffers, but clear the previous > > Since you are touching it I'm going to change this from the obsolete > networking block comment style to the universal block comment style with > /* on a line by itself > > > + * firmware instance's hp/tp state before handing them back to FW. > > + * LMAC rings reuse this shared memory without going through the > > + * normal SRNG hw-init path that zeros non-LMAC ring pointers. > > */ > > memset(ab->hal.srng_list, 0, > > sizeof(ab->hal.srng_list)); > > memset(ab->hal.shadow_reg_addr, 0, > > sizeof(ab->hal.shadow_reg_addr)); > > + if (ab->hal.rdp.vaddr) > > + memset(ab->hal.rdp.vaddr, 0, > > + sizeof(*ab->hal.rdp.vaddr) * HAL_SRNG_RING_ID_MAX); > > + if (ab->hal.wrp.vaddr) > > + memset(ab->hal.wrp.vaddr, 0, > > + sizeof(*ab->hal.wrp.vaddr) * HAL_SRNG_NUM_LMAC_RINGS); > > ab->hal.avail_blk_resource = 0; > > ab->hal.current_blk_index = 0; > > ab->hal.num_shadow_reg_configured = 0; > > > > --- > > base-commit: 54a5b38e4396530e5b2f12b54d3844e860ab6784 > > change-id: 20260513-kfarnung-ath11k-srng-clear-pointer-state-91d8ab07e5e2 > > > > Best regards, >