mirror of
https://github.com/dikeckaan/mu300-linux.git
synced 2026-12-05 08:02:40 +00:00
Wi-Fi PCIe post-init, after review: the failed channel is undone too, and a channel without a pool deinits safely
The unwind took 0 .. chn-1 and left the channel that failed registered with half its EDMA state (mchn_init sets ops before edma_chn_init). It takes chn .. 0 now. Deinit of a channel whose EDMA init failed after an earlier power cycle met a pool with no memory but that cycle's size, and memset(NULL) oopsed: mbuf_pool_deinit returns at once then (wcn_bsp; 5.4: sprdwcn-mbuf-pool-deinit-null.patch). Both 5.4 patches checked to apply and to compile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DqKKtBQZCfxYnHuBCuDqqn
This commit is contained in:
1 parent
6e616abfa4
commit
1196cf229b
5 files changed
+29
-8
No files matched your search
+1
-1
@@ -45,7 +45,7 @@ echo "==> sources"
|
||||
fetch /src/zte-u30air "$KERNEL_REPO" "$KERNEL_REV"
|
||||
cd /src/zte-u30air
|
||||
# the tree is the pinned commit plus exactly these patches: reapply from a clean checkout whenever they change
|
||||
KPATCHES="bluetooth-marlin3-link-policy of-reserved-mem-skip of-reserved-mem-add regdb-wens-certificate sipa-delegate-einprogress wcn-pcie-scan-timeout sipc-base-addr-attr sipa-delegate-pm-runtime sipc-debug-once"
|
||||
KPATCHES="bluetooth-marlin3-link-policy of-reserved-mem-skip of-reserved-mem-add regdb-wens-certificate sipa-delegate-einprogress wcn-pcie-scan-timeout sipc-base-addr-attr sipa-delegate-pm-runtime sipc-debug-once sprdwcn-mbuf-pool-deinit-null"
|
||||
sum=$(cd /work/patches && cat $(for p in $KPATCHES; do echo $p.patch; done) | sha256sum | cut -d" " -f1)
|
||||
if [ "$(cat .mu300-patches 2>/dev/null)" != "$sum" ]; then
|
||||
git checkout -q -f "$KERNEL_REV" && git clean -q -fdx -e .mu300-patches
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
sprdwcn: mbuf_pool_deinit() on a channel without a pool does nothing
|
||||
|
||||
Same fix as upstream/modules/wcn_bsp: the Wi-Fi post-init error path deinitialises the channel that failed. When
|
||||
its EDMA init failed after an earlier power cycle, its pool has no memory (freed then) but keeps that cycle's size,
|
||||
and the memset of NULL oopsed.
|
||||
|
||||
--- a/drivers/unisoc_platform/sprdwcn/pcie/mchn.c
|
||||
+++ b/drivers/unisoc_platform/sprdwcn/pcie/mchn.c
|
||||
@@ -140,6 +140,9 @@
|
||||
|
||||
int mbuf_pool_deinit(struct buffer_pool *pool)
|
||||
{
|
||||
+ /* MU300: a channel whose EDMA init failed has no pool this time (its size is still the last one's) */
|
||||
+ if (!pool->mem)
|
||||
+ return 0;
|
||||
memset(pool->mem, 0x00, (sizeof(struct mbuf_t) +
|
||||
pool->payload) * pool->size);
|
||||
kfree(pool->mem);
|
||||
@@ -3,7 +3,7 @@ sprd_wlan_combo: restore the PCIe channel table on every power-on (from kanoqwq/
|
||||
The vendor error path clears sc2355_hif.mchn_ops. A later WCN power-on can call post_init without rerunning
|
||||
pcie_init, which passes NULL to mchn_init and leaves Wi-Fi unusable until the next reboot. The table is static;
|
||||
restore its pointer when registering the channels. The same error path deinitialised the channel that failed and
|
||||
never channel 0; it undoes 0 .. chn-1 now.
|
||||
never channel 0; it undoes chn .. 0 now.
|
||||
|
||||
--- a/sc2355/pcie.c
|
||||
+++ b/sc2355/pcie.c
|
||||
@@ -27,9 +27,9 @@ never channel 0; it undoes 0 .. chn-1 now.
|
||||
pr_err("%s: unregister %d ops\n", __func__, sc2355_hif.max_num);
|
||||
|
||||
- for (; chn > 0; chn--)
|
||||
+ /* MU300: undo the channels that were set up, 0 .. chn-1 (the vendor loop took chn, which failed, and
|
||||
+ * never 0) */
|
||||
+ while (chn-- > 0)
|
||||
+ /* MU300: undo the channels that were set up and the one that failed, chn .. 0 (the vendor loop stopped at
|
||||
+ * 1; a failed channel can be registered with half its EDMA state, and deinit skips one never registered) */
|
||||
+ for (; chn >= 0; chn--)
|
||||
sprdwcn_bus_chn_deinit(&sc2355_hif.mchn_ops[chn]);
|
||||
sc2355_hif.mchn_ops = NULL;
|
||||
sc2355_hif.max_num = 0;
|
||||
@@ -2049,9 +2049,9 @@ int pcie_post_init(struct sprd_hif *hif)
|
||||
err:
|
||||
pr_err("%s: unregister %d ops\n", __func__, sc2355_hif.max_num);
|
||||
|
||||
/* MU300: undo the channels that were set up, 0 .. chn-1 (the vendor loop took chn, which failed, and
|
||||
* never 0) */
|
||||
while (chn-- > 0)
|
||||
/* MU300: undo the channels that were set up and the one that failed, chn .. 0 (the vendor loop stopped at
|
||||
* 1; a failed channel can be registered with half its EDMA state, and deinit skips one never registered) */
|
||||
for (; chn >= 0; chn--)
|
||||
sprdwcn_bus_chn_deinit(&sc2355_hif.mchn_ops[chn]);
|
||||
sc2355_hif.mchn_ops = NULL;
|
||||
sc2355_hif.max_num = 0;
|
||||
|
||||
@@ -140,6 +140,9 @@ int mbuf_pool_init(struct buffer_pool *pool, int size, int payload)
|
||||
|
||||
int mbuf_pool_deinit(struct buffer_pool *pool)
|
||||
{
|
||||
/* MU300: a channel whose EDMA init failed has no pool this time (its size is still the last one's) */
|
||||
if (!pool->mem)
|
||||
return 0;
|
||||
memset(pool->mem, 0x00, (sizeof(struct mbuf_t) +
|
||||
pool->payload) * pool->size);
|
||||
kfree(pool->mem);
|
||||
|
||||
Reference in new issue
Block a user