From patchwork Sat Oct 30 16:58:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hauke Mehrtens X-Patchwork-Id: 1548550 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=jASdZVFl; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=hauke-m.de header.i=@hauke-m.de header.a=rsa-sha256 header.s=MBO0001 header.b=1Wm0Gr2B; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HhQd73cKLz9sXM for ; Sun, 31 Oct 2021 04:04:27 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ighXtheeFV9Tp2WeQaIYovdWCk5URG5BZAl1AR6uMc8=; b=jASdZVFl0++QFs Zqp/7ZktNZHUTUxcpfZLNF9svDMPdnNNkW+oiD7KGhflmdT2JLfmoy0EZhd4W25zRlapEOaBHBCYa swjWuw7DSbHFD2DnJCHQQHuY5+VgGs55RZlIiBT994Q9EhBoav68yQ2aEQYX1i1srFKKtlOfFB3JH +fehEdNguZEcUj92mRPNuFCMQ8U/lbp7i++ZdLJelDxBa1NRnM6tSqFkAj5L8dg4s7DaFLlprvSzR wFxN+zD5FzLr150sy9MWUye0S3vxyM32OmXurDtgtIHrLoKKkplkMOgKrQcvl6YOoq2/4O5aKZj0Y uIsTVbvxOlPO7uDS1KiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgrhI-00DGFy-US; Sat, 30 Oct 2021 16:59:13 +0000 Received: from mout-p-102.mailbox.org ([2001:67c:2050::465:102]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgrhE-00DGFN-OX for openwrt-devel@lists.openwrt.org; Sat, 30 Oct 2021 16:59:10 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:105:465:1:3:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4HhQVw07nvzQk3W; Sat, 30 Oct 2021 18:59:04 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hauke-m.de; s=MBO0001; t=1635613141; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Y7FKDGLkmAwMKOY46E99Wy32Y/Xz6sWRX2R6Xs2Nfuw=; b=1Wm0Gr2BV5TN4Qd59l97L+mqCKcjtmAF9spjMJtCGi7u685FLvla//auCsh9MBCkiNjhu0 2GR5/3tanODlT68WMsXDRJh7tKRRuCFeqgU+aLQmsNGJ8BoEvQwApt0s0oQUhZc5ozABO0 WUrnfNoMUHcTB+KXTtOMHsFbFUZVvd5VY7zTfOZ9UJq+wcOW97HXunyQgBLGqpNVwgHYtX C9TR4TX2WlCdUuLHHfff+Q2/Q+q2I1WY63DvTre5csEA1gWgiJiQtCK0uft7jc2+1klIZY A4TEVwjEYWaAj7KmN3MhJzBUTlsaedVWDdpkzazJ9u9c9x0OE1o7X4ZEv2B91w== From: Hauke Mehrtens To: openwrt-devel@lists.openwrt.org Cc: Hauke Mehrtens Subject: [PATCH] mac80211: ath10k: Fix crash of QCA9984 Date: Sat, 30 Oct 2021 18:58:43 +0200 Message-Id: <20211030165843.45195-1-hauke@hauke-m.de> MIME-Version: 1.0 X-Rspamd-Queue-Id: E1BD426A X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211030_095908_982853_193646CF X-CRM114-Status: GOOD ( 23.41 ) X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This backports an upstream fix which is currently pending in the ath git repository for inclusion into the mainline kernel. This was reported in the forum: https://forum.openwrt.org/t/build-for-netgear-r7800/316/3211 Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2001:67c:2050:0:0:0:465:102 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org This backports an upstream fix which is currently pending in the ath git repository for inclusion into the mainline kernel. This was reported in the forum: https://forum.openwrt.org/t/build-for-netgear-r7800/316/3211 Signed-off-by: Hauke Mehrtens --- I have only compile tested this patch, could someone test it with a QCA9984 and report back if this fixes the crash. ...e-load-regression-with-iram-recovery.patch | 121 ++++++++++++++++++ ...21-ath10k_init_devices_synchronously.patch | 2 +- ...rolling-support-for-various-chipsets.patch | 6 +- ...h10k-Try-to-get-mac-address-from-dts.patch | 2 +- 4 files changed, 126 insertions(+), 5 deletions(-) create mode 100644 package/kernel/mac80211/patches/ath10k/090-ath10k-fix-module-load-regression-with-iram-recovery.patch diff --git a/package/kernel/mac80211/patches/ath10k/090-ath10k-fix-module-load-regression-with-iram-recovery.patch b/package/kernel/mac80211/patches/ath10k/090-ath10k-fix-module-load-regression-with-iram-recovery.patch new file mode 100644 index 000000000000..8984d879cccb --- /dev/null +++ b/package/kernel/mac80211/patches/ath10k/090-ath10k-fix-module-load-regression-with-iram-recovery.patch @@ -0,0 +1,121 @@ +From 6f8c8bf4c7c9be1c42088689fd4370e06b46608a Mon Sep 17 00:00:00 2001 +From: Abinaya Kalaiselvan +Date: Wed, 20 Oct 2021 11:59:07 +0300 +Subject: [PATCH] ath10k: fix module load regression with iram-recovery feature + +Commit 9af7c32ceca8 ("ath10k: add target IRAM recovery feature support") +introduced a new firmware feature flag ATH10K_FW_FEATURE_IRAM_RECOVERY. But +this caused ath10k_pci module load to fail if ATH10K_FW_CRASH_DUMP_RAM_DATA bit +was not enabled in the ath10k coredump_mask module parameter: + +[ 2209.328190] ath10k_pci 0000:02:00.0: qca9984/qca9994 hw1.0 target 0x01000000 chip_id 0x00000000 sub 168c:cafe +[ 2209.434414] ath10k_pci 0000:02:00.0: kconfig debug 1 debugfs 1 tracing 1 dfs 1 testmode 1 +[ 2209.547191] ath10k_pci 0000:02:00.0: firmware ver 10.4-3.9.0.2-00099 api 5 features no-p2p,mfp,peer-flow-ctrl,btcoex-param,allows-mesh-bcast,no-ps,peer-fixed-rate,iram-recovery crc32 cbade90a +[ 2210.896485] ath10k_pci 0000:02:00.0: board_file api 1 bmi_id 0:1 crc32 a040efc2 +[ 2213.603339] ath10k_pci 0000:02:00.0: failed to copy target iram contents: -12 +[ 2213.839027] ath10k_pci 0000:02:00.0: could not init core (-12) +[ 2213.933910] ath10k_pci 0000:02:00.0: could not probe fw (-12) + +And by default coredump_mask does not have ATH10K_FW_CRASH_DUMP_RAM_DATA +enabled so anyone using a firmware with iram-recovery feature would fail. To my +knowledge only QCA9984 firmwares starting from release 10.4-3.9.0.2-00099 +enabled the feature. + +The reason for regression was that ath10k_core_copy_target_iram() used +ath10k_coredump_get_mem_layout() to get the memory layout, but when +ATH10K_FW_CRASH_DUMP_RAM_DATA was disabled it would get just NULL and bail out +with an error. + +While looking at all this I noticed another bug: if CONFIG_DEV_COREDUMP is +disabled but the firmware has iram-recovery enabled the module load fails with +similar error messages. I fixed that by returning 0 from +ath10k_core_copy_target_iram() when _ath10k_coredump_get_mem_layout() returns +NULL. + +Tested-on: QCA9984 hw2.0 PCI 10.4-3.9.0.2-00139 + +Fixes: 9af7c32ceca8 ("ath10k: add target IRAM recovery feature support") +Signed-off-by: Abinaya Kalaiselvan +Signed-off-by: Jouni Malinen +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20211020075054.23061-1-kvalo@codeaurora.org +--- + drivers/net/wireless/ath/ath10k/core.c | 11 +++++++++-- + drivers/net/wireless/ath/ath10k/coredump.c | 11 ++++++++--- + drivers/net/wireless/ath/ath10k/coredump.h | 7 +++++++ + 3 files changed, 24 insertions(+), 5 deletions(-) + +--- a/drivers/net/wireless/ath/ath10k/core.c ++++ b/drivers/net/wireless/ath/ath10k/core.c +@@ -2690,9 +2690,16 @@ static int ath10k_core_copy_target_iram( + int i, ret; + u32 len, remaining_len; + +- hw_mem = ath10k_coredump_get_mem_layout(ar); ++ /* copy target iram feature must work also when ++ * ATH10K_FW_CRASH_DUMP_RAM_DATA is disabled, so ++ * _ath10k_coredump_get_mem_layout() to accomplist that ++ */ ++ hw_mem = _ath10k_coredump_get_mem_layout(ar); + if (!hw_mem) +- return -ENOMEM; ++ /* if CONFIG_DEV_COREDUMP is disabled we get NULL, then ++ * just silently disable the feature by doing nothing ++ */ ++ return 0; + + for (i = 0; i < hw_mem->region_table.size; i++) { + tmp = &hw_mem->region_table.regions[i]; +--- a/drivers/net/wireless/ath/ath10k/coredump.c ++++ b/drivers/net/wireless/ath/ath10k/coredump.c +@@ -1447,11 +1447,17 @@ static u32 ath10k_coredump_get_ramdump_s + + const struct ath10k_hw_mem_layout *ath10k_coredump_get_mem_layout(struct ath10k *ar) + { +- int i; +- + if (!test_bit(ATH10K_FW_CRASH_DUMP_RAM_DATA, &ath10k_coredump_mask)) + return NULL; + ++ return _ath10k_coredump_get_mem_layout(ar); ++} ++EXPORT_SYMBOL(ath10k_coredump_get_mem_layout); ++ ++const struct ath10k_hw_mem_layout *_ath10k_coredump_get_mem_layout(struct ath10k *ar) ++{ ++ int i; ++ + if (WARN_ON(ar->target_version == 0)) + return NULL; + +@@ -1464,7 +1470,6 @@ const struct ath10k_hw_mem_layout *ath10 + + return NULL; + } +-EXPORT_SYMBOL(ath10k_coredump_get_mem_layout); + + struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar) + { +--- a/drivers/net/wireless/ath/ath10k/coredump.h ++++ b/drivers/net/wireless/ath/ath10k/coredump.h +@@ -176,6 +176,7 @@ int ath10k_coredump_register(struct ath1 + void ath10k_coredump_unregister(struct ath10k *ar); + void ath10k_coredump_destroy(struct ath10k *ar); + ++const struct ath10k_hw_mem_layout *_ath10k_coredump_get_mem_layout(struct ath10k *ar); + const struct ath10k_hw_mem_layout *ath10k_coredump_get_mem_layout(struct ath10k *ar); + + #else /* CONFIG_DEV_COREDUMP */ +@@ -213,6 +214,12 @@ ath10k_coredump_get_mem_layout(struct at + { + return NULL; + } ++ ++static inline const struct ath10k_hw_mem_layout * ++_ath10k_coredump_get_mem_layout(struct ath10k *ar) ++{ ++ return NULL; ++} + + #endif /* CONFIG_DEV_COREDUMP */ + diff --git a/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch index 7648ec3b7a35..9ff1224c4342 100644 --- a/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch +++ b/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -3345,6 +3345,16 @@ int ath10k_core_register(struct ath10k * +@@ -3352,6 +3352,16 @@ int ath10k_core_register(struct ath10k * queue_work(ar->workqueue, &ar->register_work); diff --git a/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch index d815ba2742e3..69491fc6535c 100644 --- a/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch +++ b/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch @@ -172,7 +172,7 @@ v13: .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -3060,6 +3066,10 @@ int ath10k_core_start(struct ath10k *ar, +@@ -3067,6 +3073,10 @@ int ath10k_core_start(struct ath10k *ar, goto err_hif_stop; } @@ -183,7 +183,7 @@ v13: return 0; err_hif_stop: -@@ -3318,9 +3328,18 @@ static void ath10k_core_register_work(st +@@ -3325,9 +3335,18 @@ static void ath10k_core_register_work(st goto err_spectral_destroy; } @@ -202,7 +202,7 @@ v13: err_spectral_destroy: ath10k_spectral_destroy(ar); err_debug_destroy: -@@ -3366,6 +3385,8 @@ void ath10k_core_unregister(struct ath10 +@@ -3373,6 +3392,8 @@ void ath10k_core_unregister(struct ath10 if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) return; diff --git a/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch b/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch index e9d3ac6560de..ce3ebcc2a692 100644 --- a/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch +++ b/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch @@ -26,7 +26,7 @@ Signed-off-by: Ansuel Smith #include #include #include -@@ -3236,6 +3237,8 @@ static int ath10k_core_probe_fw(struct a +@@ -3243,6 +3244,8 @@ static int ath10k_core_probe_fw(struct a device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr));