]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: debug: support SER L0/L1 simulation via halt H2C
authorZong-Zhe Yang <kevin_yang@realtek.com>
Tue, 23 Dec 2025 03:06:47 +0000 (11:06 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Fri, 26 Dec 2025 02:59:41 +0000 (10:59 +0800)
Original methods of SER (system error recovery) L0/L1 simulations need
to leave PS mode before working. Introduce new methods to simulate SER
L0/L1 and they can work under PS. Since new methods require FW support,
so add a FW feature flag and configure the supported chips.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20251223030651.480633-9-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.h
drivers/net/wireless/realtek/rtw89/debug.c
drivers/net/wireless/realtek/rtw89/fw.c
drivers/net/wireless/realtek/rtw89/mac.h

index 4c35b968ac369e82f2bb4e0954ce843970c19ab5..64e7b241074b1d42d9678acc4cf680015fca3433 100644 (file)
@@ -4683,6 +4683,7 @@ enum rtw89_fw_feature {
        RTW89_FW_FEATURE_BEACON_TRACKING,
        RTW89_FW_FEATURE_ADDR_CAM_V0,
        RTW89_FW_FEATURE_SER_L1_BY_EVENT,
+       RTW89_FW_FEATURE_SIM_SER_L0L1_BY_HALT_H2C,
 };
 
 struct rtw89_fw_suit {
index 0d9a158f6df1843075d10df67e43e68b4c918885..2b48ccea27fb27e656e6484cd6ea173c4347becf 100644 (file)
@@ -3538,6 +3538,14 @@ out:
        return count;
 }
 
+static int rtw89_dbg_trigger_ctrl_error_by_halt_h2c(struct rtw89_dev *rtwdev)
+{
+       if (!test_bit(RTW89_FLAG_FW_RDY, rtwdev->flags))
+               return -EBUSY;
+
+       return rtw89_mac_set_err_status(rtwdev, MAC_AX_ERR_L1_RESET_FORCE);
+}
+
 static int rtw89_dbg_trigger_ctrl_error(struct rtw89_dev *rtwdev)
 {
        const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
@@ -3545,6 +3553,9 @@ static int rtw89_dbg_trigger_ctrl_error(struct rtw89_dev *rtwdev)
        u16 pkt_id;
        int ret;
 
+       if (RTW89_CHK_FW_FEATURE(SIM_SER_L0L1_BY_HALT_H2C, &rtwdev->fw))
+               return rtw89_dbg_trigger_ctrl_error_by_halt_h2c(rtwdev);
+
        rtw89_leave_ps_mode(rtwdev);
 
        ret = mac->dle_buf_req(rtwdev, 0x20, true, &pkt_id);
@@ -3601,10 +3612,21 @@ static int rtw89_dbg_trigger_mac_error_be(struct rtw89_dev *rtwdev)
        return 0;
 }
 
+static int rtw89_dbg_trigger_mac_error_by_halt_h2c(struct rtw89_dev *rtwdev)
+{
+       if (!test_bit(RTW89_FLAG_FW_RDY, rtwdev->flags))
+               return -EBUSY;
+
+       return rtw89_mac_set_err_status(rtwdev, MAC_AX_ERR_L0_RESET_FORCE);
+}
+
 static int rtw89_dbg_trigger_mac_error(struct rtw89_dev *rtwdev)
 {
        const struct rtw89_chip_info *chip = rtwdev->chip;
 
+       if (RTW89_CHK_FW_FEATURE(SIM_SER_L0L1_BY_HALT_H2C, &rtwdev->fw))
+               return rtw89_dbg_trigger_mac_error_by_halt_h2c(rtwdev);
+
        rtw89_leave_ps_mode(rtwdev);
 
        switch (chip->chip_gen) {
index 7150892a62745e076ea6357d28c4c09150a8c01f..4e51ffb5be21d16252605979a6d97639d800ce4c 100644 (file)
@@ -827,6 +827,7 @@ static const struct __fw_feat_cfg fw_feat_tbl[] = {
        __CFG_FW_FEAT(RTL8851B, ge, 0, 29, 37, 1, SCAN_OFFLOAD),
        __CFG_FW_FEAT(RTL8851B, ge, 0, 29, 41, 0, CRASH_TRIGGER_TYPE_0),
        __CFG_FW_FEAT(RTL8851B, ge, 0, 29, 127, 0, SER_L1_BY_EVENT),
+       __CFG_FW_FEAT(RTL8851B, ge, 0, 29, 130, 0, SIM_SER_L0L1_BY_HALT_H2C),
        __CFG_FW_FEAT(RTL8852A, le, 0, 13, 29, 0, OLD_HT_RA_FORMAT),
        __CFG_FW_FEAT(RTL8852A, ge, 0, 13, 35, 0, SCAN_OFFLOAD),
        __CFG_FW_FEAT(RTL8852A, ge, 0, 13, 35, 0, TX_WAKE),
@@ -845,6 +846,7 @@ static const struct __fw_feat_cfg fw_feat_tbl[] = {
        __CFG_FW_FEAT(RTL8852B, ge, 0, 29, 128, 0, CRASH_TRIGGER_TYPE_1),
        __CFG_FW_FEAT(RTL8852B, ge, 0, 29, 128, 0, SCAN_OFFLOAD_EXTRA_OP),
        __CFG_FW_FEAT(RTL8852B, ge, 0, 29, 128, 0, BEACON_TRACKING),
+       __CFG_FW_FEAT(RTL8852B, ge, 0, 29, 130, 0, SIM_SER_L0L1_BY_HALT_H2C),
        __CFG_FW_FEAT(RTL8852BT, ge, 0, 29, 74, 0, NO_LPS_PG),
        __CFG_FW_FEAT(RTL8852BT, ge, 0, 29, 74, 0, TX_WAKE),
        __CFG_FW_FEAT(RTL8852BT, ge, 0, 29, 90, 0, CRASH_TRIGGER_TYPE_0),
@@ -855,6 +857,7 @@ static const struct __fw_feat_cfg fw_feat_tbl[] = {
        __CFG_FW_FEAT(RTL8852BT, ge, 0, 29, 127, 0, LPS_DACK_BY_C2H_REG),
        __CFG_FW_FEAT(RTL8852BT, ge, 0, 29, 127, 0, CRASH_TRIGGER_TYPE_1),
        __CFG_FW_FEAT(RTL8852BT, ge, 0, 29, 127, 0, SER_L1_BY_EVENT),
+       __CFG_FW_FEAT(RTL8852BT, ge, 0, 29, 130, 0, SIM_SER_L0L1_BY_HALT_H2C),
        __CFG_FW_FEAT(RTL8852C, le, 0, 27, 33, 0, NO_DEEP_PS),
        __CFG_FW_FEAT(RTL8852C, ge, 0, 0, 0, 0, RFK_NTFY_MCC_V0),
        __CFG_FW_FEAT(RTL8852C, ge, 0, 27, 34, 0, TX_WAKE),
@@ -867,6 +870,7 @@ static const struct __fw_feat_cfg fw_feat_tbl[] = {
        __CFG_FW_FEAT(RTL8852C, ge, 0, 27, 128, 0, CRASH_TRIGGER_TYPE_1),
        __CFG_FW_FEAT(RTL8852C, ge, 0, 27, 129, 1, BEACON_TRACKING),
        __CFG_FW_FEAT(RTL8852C, ge, 0, 29, 94, 0, SER_L1_BY_EVENT),
+       __CFG_FW_FEAT(RTL8852C, ge, 0, 29, 130, 0, SIM_SER_L0L1_BY_HALT_H2C),
        __CFG_FW_FEAT(RTL8922A, ge, 0, 34, 30, 0, CRASH_TRIGGER_TYPE_0),
        __CFG_FW_FEAT(RTL8922A, ge, 0, 34, 11, 0, MACID_PAUSE_SLEEP),
        __CFG_FW_FEAT(RTL8922A, ge, 0, 34, 35, 0, SCAN_OFFLOAD),
index 9941d500bc6898c54edaca6900bb9fb754227c8f..9d0c491f053fd5fb59fb5a516c9a51a7c38fcb80 100644 (file)
@@ -914,6 +914,9 @@ enum mac_ax_err_info {
        MAC_AX_ERR_L0_CFG_DIS_NOTIFY = 0x0011,
        MAC_AX_ERR_L0_CFG_HANDSHAKE = 0x0012,
        MAC_AX_ERR_L0_RCVY_EN = 0x0013,
+       MAC_AX_ERR_L0_RESET_FORCE = 0x0020,
+       MAC_AX_ERR_L0_RESET_FORCE_C1 = 0x0021,
+       MAC_AX_ERR_L1_RESET_FORCE = 0x0022,
        MAC_AX_SET_ERR_MAX,
 };