Skip to content

Commit ea045a0

Browse files
panjaneyMiriam-Rachel
authored andcommitted
wifi: iwlwifi: add support for accepting raw DSM tables by firmware
Firmware would assert on undefined bits in DSM-originated DWs. With this change, Firmware introduces a fail-safe mechanism and removes the assert behavior. This ensures robustness when handling raw DSM table data. Signed-off-by: Pagadala Yesu Anjaneyulu <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://patch.msgid.link/20250710212632.eee871df03c9.I2be2eaa16437e84aa1be0c6c95ec334034ce7e50@changeid
1 parent 8513096 commit ea045a0

File tree

6 files changed

+63
-16
lines changed

6 files changed

+63
-16
lines changed

drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,7 @@ struct iwl_lari_config_change_cmd {
787787
/* Activate UNII-1 (5.2GHz) for World Wide */
788788
#define ACTIVATE_5G2_IN_WW_MASK BIT(4)
789789
#define CHAN_STATE_ACTIVE_BITMAP_CMD_V11 0x1F
790+
#define CHAN_STATE_ACTIVE_BITMAP_CMD_V12 0x7F
790791

791792
/**
792793
* struct iwl_pnvm_init_complete_ntfy - PNVM initialization complete

drivers/net/wireless/intel/iwlwifi/fw/debugfs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,12 @@ static int iwl_dbgfs_fw_info_seq_show(struct seq_file *seq, void *v)
389389
" %d: %d\n",
390390
IWL_UCODE_TLV_CAPA_CHINA_22_REG_SUPPORT,
391391
has_capa);
392+
has_capa = fw_has_capa(&fw->ucode_capa,
393+
IWL_UCODE_TLV_CAPA_FW_ACCEPTS_RAW_DSM_TABLE) ? 1 : 0;
394+
seq_printf(seq,
395+
" %d: %d\n",
396+
IWL_UCODE_TLV_CAPA_FW_ACCEPTS_RAW_DSM_TABLE,
397+
has_capa);
392398
seq_puts(seq, "fw_api_ver:\n");
393399
}
394400

drivers/net/wireless/intel/iwlwifi/fw/file.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,8 @@ typedef unsigned int __bitwise iwl_ucode_tlv_capa_t;
407407
* for CA from BIOS.
408408
* @IWL_UCODE_TLV_CAPA_UHB_CANADA_TAS_SUPPORT: supports %TAS_UHB_ALLOWED_CANADA
409409
* @IWL_UCODE_TLV_CAPA_EXT_FSEQ_IMAGE_SUPPORT: external FSEQ image support
410+
* @IWL_UCODE_TLV_CAPA_FW_ACCEPTS_RAW_DSM_TABLE: Firmware has capability of
411+
* handling raw DSM table data.
410412
*
411413
* @NUM_IWL_UCODE_TLV_CAPA: number of bits used
412414
*/
@@ -517,6 +519,7 @@ enum iwl_ucode_tlv_capa {
517519
* during assert handling even if the dump isn't split
518520
*/
519521
IWL_UCODE_TLV_CAPA_RESET_DURING_ASSERT = (__force iwl_ucode_tlv_capa_t)(4 * 32 + 0),
522+
IWL_UCODE_TLV_CAPA_FW_ACCEPTS_RAW_DSM_TABLE = (__force iwl_ucode_tlv_capa_t)(4 * 32 + 1),
520523
NUM_IWL_UCODE_TLV_CAPA
521524
/*
522525
* This construction make both sparse (which cannot increment the previous

drivers/net/wireless/intel/iwlwifi/fw/regulatory.c

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,8 @@ int iwl_fill_lari_config(struct iwl_fw_runtime *fwrt,
579579
{
580580
int ret;
581581
u32 value;
582+
bool has_raw_dsm_capa = fw_has_capa(&fwrt->fw->ucode_capa,
583+
IWL_UCODE_TLV_CAPA_FW_ACCEPTS_RAW_DSM_TABLE);
582584
u8 cmd_ver = iwl_fw_lookup_cmd_ver(fwrt->fw,
583585
WIDE_ID(REGULATORY_AND_NVM_GROUP,
584586
LARI_CONFIG_CHANGE), 1);
@@ -593,17 +595,22 @@ int iwl_fill_lari_config(struct iwl_fw_runtime *fwrt,
593595
cmd->config_bitmap = iwl_get_lari_config_bitmap(fwrt);
594596

595597
ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_11AX_ENABLEMENT, &value);
596-
if (!ret)
598+
if (!ret) {
599+
if (!has_raw_dsm_capa)
600+
value &= DSM_11AX_ALLOW_BITMAP;
597601
cmd->oem_11ax_allow_bitmap = cpu_to_le32(value);
602+
}
598603

599604
ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_ENABLE_UNII4_CHAN, &value);
600605
if (!ret) {
601-
value &= DSM_UNII4_ALLOW_BITMAP;
606+
if (!has_raw_dsm_capa)
607+
value &= DSM_UNII4_ALLOW_BITMAP;
602608

603609
/* Since version 9, bits 4 and 5 are supported
604-
* regardless of this capability.
610+
* regardless of this capability, By pass this masking
611+
* if firmware has capability of accepting raw DSM table.
605612
*/
606-
if (cmd_ver < 9 &&
613+
if (!has_raw_dsm_capa && cmd_ver < 9 &&
607614
!fw_has_capa(&fwrt->fw->ucode_capa,
608615
IWL_UCODE_TLV_CAPA_BIOS_OVERRIDE_5G9_FOR_CA))
609616
value &= ~(DSM_VALUE_UNII4_CANADA_OVERRIDE_MSK |
@@ -614,13 +621,17 @@ int iwl_fill_lari_config(struct iwl_fw_runtime *fwrt,
614621

615622
ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_ACTIVATE_CHANNEL, &value);
616623
if (!ret) {
617-
if (cmd_ver < 8)
624+
if (!has_raw_dsm_capa)
625+
value &= CHAN_STATE_ACTIVE_BITMAP_CMD_V12;
626+
627+
if (!has_raw_dsm_capa && cmd_ver < 8)
618628
value &= ~ACTIVATE_5G2_IN_WW_MASK;
619629

620630
/* Since version 12, bits 5 and 6 are supported
621-
* regardless of this capability.
631+
* regardless of this capability, By pass this masking
632+
* if firmware has capability of accepting raw DSM table.
622633
*/
623-
if (cmd_ver < 12 &&
634+
if (!has_raw_dsm_capa && cmd_ver < 12 &&
624635
!fw_has_capa(&fwrt->fw->ucode_capa,
625636
IWL_UCODE_TLV_CAPA_BIOS_OVERRIDE_UNII4_US_CA))
626637
value &= CHAN_STATE_ACTIVE_BITMAP_CMD_V11;
@@ -633,13 +644,19 @@ int iwl_fill_lari_config(struct iwl_fw_runtime *fwrt,
633644
cmd->oem_uhb_allow_bitmap = cpu_to_le32(value);
634645

635646
ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_FORCE_DISABLE_CHANNELS, &value);
636-
if (!ret)
647+
if (!ret) {
648+
if (!has_raw_dsm_capa)
649+
value &= DSM_FORCE_DISABLE_CHANNELS_ALLOWED_BITMAP;
637650
cmd->force_disable_channels_bitmap = cpu_to_le32(value);
651+
}
638652

639653
ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_ENERGY_DETECTION_THRESHOLD,
640654
&value);
641-
if (!ret)
655+
if (!ret) {
656+
if (!has_raw_dsm_capa)
657+
value &= DSM_EDT_ALLOWED_BITMAP;
642658
cmd->edt_bitmap = cpu_to_le32(value);
659+
}
643660

644661
ret = iwl_bios_get_wbem(fwrt, &value);
645662
if (!ret)

drivers/net/wireless/intel/iwlwifi/fw/regulatory.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ enum iwl_dsm_unii4_bitmap {
159159
DSM_VALUE_UNII4_CANADA_OVERRIDE_MSK |\
160160
DSM_VALUE_UNII4_CANADA_EN_MSK)
161161

162+
#define DSM_11AX_ALLOW_BITMAP 0xF
163+
#define DSM_EDT_ALLOWED_BITMAP 0x7ffff0
164+
#define DSM_FORCE_DISABLE_CHANNELS_ALLOWED_BITMAP 0x7FF
165+
162166
enum iwl_dsm_values_rfi {
163167
DSM_VALUE_RFI_DLVR_DISABLE = BIT(0),
164168
DSM_VALUE_RFI_DDR_DISABLE = BIT(1),

drivers/net/wireless/intel/iwlwifi/mld/regulatory.c

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,34 +238,50 @@ void iwl_mld_configure_lari(struct iwl_mld *mld)
238238
struct iwl_lari_config_change_cmd cmd = {
239239
.config_bitmap = iwl_get_lari_config_bitmap(fwrt),
240240
};
241+
bool has_raw_dsm_capa = fw_has_capa(&fwrt->fw->ucode_capa,
242+
IWL_UCODE_TLV_CAPA_FW_ACCEPTS_RAW_DSM_TABLE);
241243
int ret;
242244
u32 value;
243245

244246
ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_11AX_ENABLEMENT, &value);
245-
if (!ret)
247+
if (!ret) {
248+
if (!has_raw_dsm_capa)
249+
value &= DSM_11AX_ALLOW_BITMAP;
246250
cmd.oem_11ax_allow_bitmap = cpu_to_le32(value);
251+
}
247252

248253
ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_ENABLE_UNII4_CHAN, &value);
249-
if (!ret)
250-
cmd.oem_unii4_allow_bitmap =
251-
cpu_to_le32(value &= DSM_UNII4_ALLOW_BITMAP);
254+
if (!ret) {
255+
if (!has_raw_dsm_capa)
256+
value &= DSM_UNII4_ALLOW_BITMAP;
257+
cmd.oem_unii4_allow_bitmap = cpu_to_le32(value);
258+
}
252259

253260
ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_ACTIVATE_CHANNEL, &value);
254-
if (!ret)
261+
if (!ret) {
262+
if (!has_raw_dsm_capa)
263+
value &= CHAN_STATE_ACTIVE_BITMAP_CMD_V12;
255264
cmd.chan_state_active_bitmap = cpu_to_le32(value);
265+
}
256266

257267
ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_ENABLE_6E, &value);
258268
if (!ret)
259269
cmd.oem_uhb_allow_bitmap = cpu_to_le32(value);
260270

261271
ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_FORCE_DISABLE_CHANNELS, &value);
262-
if (!ret)
272+
if (!ret) {
273+
if (!has_raw_dsm_capa)
274+
value &= DSM_FORCE_DISABLE_CHANNELS_ALLOWED_BITMAP;
263275
cmd.force_disable_channels_bitmap = cpu_to_le32(value);
276+
}
264277

265278
ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_ENERGY_DETECTION_THRESHOLD,
266279
&value);
267-
if (!ret)
280+
if (!ret) {
281+
if (!has_raw_dsm_capa)
282+
value &= DSM_EDT_ALLOWED_BITMAP;
268283
cmd.edt_bitmap = cpu_to_le32(value);
284+
}
269285

270286
ret = iwl_bios_get_wbem(fwrt, &value);
271287
if (!ret)

0 commit comments

Comments
 (0)