diff mbox series

[1/5] wifi: rtw89: 8922a: configure CRASH_TRIGGER FW feature

Message ID 20231204080751.15354-2-pkshih@realtek.com (mailing list archive)
State Accepted
Commit c5ece8d84303c1956b18d2aba03c4b4fc856f53e
Delegated to: Kalle Valo
Headers show
Series wifi: rtw89: 8922a: add SER related stuff | expand

Commit Message

Ping-Ke Shih Dec. 4, 2023, 8:07 a.m. UTC
From: Zong-Zhe Yang <kevin_yang@realtek.com>

RTL8922A FW supports CRASH_TRIGGER feature from v0.34.30.0.
After it, debugfs fw_crash can accept type 1 on RTL8922A to
trigger firmware crash and verify L2 recovery.

Besides, RTL8922A sync address offset of reserved payload engine.
And, SER (system error recovery) tweaks conversion from WCPU address
to indirect access address for RTL8922A. The new conversion works
for all supported chips.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw89/fw.c  |  1 +
 drivers/net/wireless/realtek/rtw89/fw.h  |  2 --
 drivers/net/wireless/realtek/rtw89/ser.c | 10 +++++++++-
 3 files changed, 10 insertions(+), 3 deletions(-)

Comments

Kalle Valo Dec. 7, 2023, 4:22 p.m. UTC | #1
Ping-Ke Shih <pkshih@realtek.com> wrote:

> From: Zong-Zhe Yang <kevin_yang@realtek.com>
> 
> RTL8922A FW supports CRASH_TRIGGER feature from v0.34.30.0.
> After it, debugfs fw_crash can accept type 1 on RTL8922A to
> trigger firmware crash and verify L2 recovery.
> 
> Besides, RTL8922A sync address offset of reserved payload engine.
> And, SER (system error recovery) tweaks conversion from WCPU address
> to indirect access address for RTL8922A. The new conversion works
> for all supported chips.
> 
> Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>

5 patches applied to wireless-next.git, thanks.

c5ece8d84303 wifi: rtw89: 8922a: configure CRASH_TRIGGER FW feature
2a68a27cd27a wifi: rtw89: fw: extend program counter dump for Wi-Fi 7 chip
eeb8cbb58b82 wifi: rtw89: 8922a: add SER IMR tables
6f8d36552bab wifi: rtw89: 8922a: dump MAC registers when SER occurs
db7fac15eaf0 wifi: rtw89: mac: refine SER setting during WiFi CPU power on
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
index b11ed35e265d..0b9c3c76b273 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.c
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
@@ -453,6 +453,7 @@  static const struct __fw_feat_cfg fw_feat_tbl[] = {
 	__CFG_FW_FEAT(RTL8852C, ge, 0, 27, 36, 0, SCAN_OFFLOAD),
 	__CFG_FW_FEAT(RTL8852C, ge, 0, 27, 40, 0, CRASH_TRIGGER),
 	__CFG_FW_FEAT(RTL8852C, ge, 0, 27, 56, 10, BEACON_FILTER),
+	__CFG_FW_FEAT(RTL8922A, ge, 0, 34, 30, 0, CRASH_TRIGGER),
 };
 
 static void rtw89_fw_iterate_feature_cfg(struct rtw89_fw_info *fw,
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
index d4db9ab0b5e8..2b2d14284465 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.h
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
@@ -3651,8 +3651,6 @@  struct rtw89_fw_h2c_rf_get_mccch {
 
 #define RTW89_FW_RSVD_PLE_SIZE 0x800
 
-#define RTW89_WCPU_BASE_MASK GENMASK(27, 0)
-
 #define RTW89_FW_BACKTRACE_INFO_SIZE 8
 #define RTW89_VALID_FW_BACKTRACE_SIZE(_size) \
 	((_size) % RTW89_FW_BACKTRACE_INFO_SIZE == 0)
diff --git a/drivers/net/wireless/realtek/rtw89/ser.c b/drivers/net/wireless/realtek/rtw89/ser.c
index 1e4a79a3b814..99896d85d2f8 100644
--- a/drivers/net/wireless/realtek/rtw89/ser.c
+++ b/drivers/net/wireless/realtek/rtw89/ser.c
@@ -590,6 +590,14 @@  struct __fw_backtrace_info {
 static_assert(RTW89_FW_BACKTRACE_INFO_SIZE ==
 	      sizeof(struct __fw_backtrace_info));
 
+static u32 convert_addr_from_wcpu(u32 wcpu_addr)
+{
+	if (wcpu_addr < 0x30000000)
+		return wcpu_addr;
+
+	return wcpu_addr & GENMASK(28, 0);
+}
+
 static int rtw89_ser_fw_backtrace_dump(struct rtw89_dev *rtwdev, u8 *buf,
 				       const struct __fw_backtrace_entry *ent)
 {
@@ -597,7 +605,7 @@  static int rtw89_ser_fw_backtrace_dump(struct rtw89_dev *rtwdev, u8 *buf,
 	const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
 	u32 filter_model_addr = mac->filter_model_addr;
 	u32 indir_access_addr = mac->indir_access_addr;
-	u32 fwbt_addr = ent->wcpu_addr & RTW89_WCPU_BASE_MASK;
+	u32 fwbt_addr = convert_addr_from_wcpu(ent->wcpu_addr);
 	u32 fwbt_size = ent->size;
 	u32 fwbt_key = ent->key;
 	u32 i;