mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-01 00:58:39 +02:00 
			
		
		
		
	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 <pagadala.yesu.anjaneyulu@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://patch.msgid.link/20250710212632.eee871df03c9.I2be2eaa16437e84aa1be0c6c95ec334034ce7e50@changeid
This commit is contained in:
		
							parent
							
								
									8513096a34
								
							
						
					
					
						commit
						ea045a0de3
					
				
					 6 changed files with 63 additions and 16 deletions
				
			
		|  | @ -787,6 +787,7 @@ struct iwl_lari_config_change_cmd { | |||
| /* Activate UNII-1 (5.2GHz) for World Wide */ | ||||
| #define ACTIVATE_5G2_IN_WW_MASK			BIT(4) | ||||
| #define CHAN_STATE_ACTIVE_BITMAP_CMD_V11	0x1F | ||||
| #define CHAN_STATE_ACTIVE_BITMAP_CMD_V12	0x7F | ||||
| 
 | ||||
| /**
 | ||||
|  * struct iwl_pnvm_init_complete_ntfy - PNVM initialization complete | ||||
|  |  | |||
|  | @ -389,6 +389,12 @@ static int iwl_dbgfs_fw_info_seq_show(struct seq_file *seq, void *v) | |||
| 			   "    %d: %d\n", | ||||
| 			   IWL_UCODE_TLV_CAPA_CHINA_22_REG_SUPPORT, | ||||
| 			   has_capa); | ||||
| 		has_capa = fw_has_capa(&fw->ucode_capa, | ||||
| 				       IWL_UCODE_TLV_CAPA_FW_ACCEPTS_RAW_DSM_TABLE) ? 1 : 0; | ||||
| 		seq_printf(seq, | ||||
| 			   "    %d: %d\n", | ||||
| 			   IWL_UCODE_TLV_CAPA_FW_ACCEPTS_RAW_DSM_TABLE, | ||||
| 			   has_capa); | ||||
| 		seq_puts(seq, "fw_api_ver:\n"); | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
|  | @ -407,6 +407,8 @@ typedef unsigned int __bitwise iwl_ucode_tlv_capa_t; | |||
|  *	for CA from BIOS. | ||||
|  * @IWL_UCODE_TLV_CAPA_UHB_CANADA_TAS_SUPPORT: supports %TAS_UHB_ALLOWED_CANADA | ||||
|  * @IWL_UCODE_TLV_CAPA_EXT_FSEQ_IMAGE_SUPPORT: external FSEQ image support | ||||
|  * @IWL_UCODE_TLV_CAPA_FW_ACCEPTS_RAW_DSM_TABLE: Firmware has capability of | ||||
|  *	handling raw DSM table data. | ||||
|  * | ||||
|  * @NUM_IWL_UCODE_TLV_CAPA: number of bits used | ||||
|  */ | ||||
|  | @ -517,6 +519,7 @@ enum iwl_ucode_tlv_capa { | |||
| 	 *	during assert handling even if the dump isn't split | ||||
| 	 */ | ||||
| 	IWL_UCODE_TLV_CAPA_RESET_DURING_ASSERT		= (__force iwl_ucode_tlv_capa_t)(4 * 32 +  0), | ||||
| 	IWL_UCODE_TLV_CAPA_FW_ACCEPTS_RAW_DSM_TABLE 	= (__force iwl_ucode_tlv_capa_t)(4 * 32 + 1), | ||||
| 	NUM_IWL_UCODE_TLV_CAPA | ||||
| /*
 | ||||
|  * This construction make both sparse (which cannot increment the previous | ||||
|  |  | |||
|  | @ -579,6 +579,8 @@ int iwl_fill_lari_config(struct iwl_fw_runtime *fwrt, | |||
| { | ||||
| 	int ret; | ||||
| 	u32 value; | ||||
| 	bool has_raw_dsm_capa = fw_has_capa(&fwrt->fw->ucode_capa, | ||||
| 					    IWL_UCODE_TLV_CAPA_FW_ACCEPTS_RAW_DSM_TABLE); | ||||
| 	u8 cmd_ver = iwl_fw_lookup_cmd_ver(fwrt->fw, | ||||
| 					   WIDE_ID(REGULATORY_AND_NVM_GROUP, | ||||
| 						   LARI_CONFIG_CHANGE), 1); | ||||
|  | @ -593,17 +595,22 @@ int iwl_fill_lari_config(struct iwl_fw_runtime *fwrt, | |||
| 	cmd->config_bitmap = iwl_get_lari_config_bitmap(fwrt); | ||||
| 
 | ||||
| 	ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_11AX_ENABLEMENT, &value); | ||||
| 	if (!ret) | ||||
| 	if (!ret) { | ||||
| 		if (!has_raw_dsm_capa) | ||||
| 			value &= DSM_11AX_ALLOW_BITMAP; | ||||
| 		cmd->oem_11ax_allow_bitmap = cpu_to_le32(value); | ||||
| 	} | ||||
| 
 | ||||
| 	ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_ENABLE_UNII4_CHAN, &value); | ||||
| 	if (!ret) { | ||||
| 		value &= DSM_UNII4_ALLOW_BITMAP; | ||||
| 		if (!has_raw_dsm_capa) | ||||
| 			value &= DSM_UNII4_ALLOW_BITMAP; | ||||
| 
 | ||||
| 		/* Since version 9, bits 4 and 5 are supported
 | ||||
| 		 * regardless of this capability. | ||||
| 		 * regardless of this capability, By pass this masking | ||||
| 		 * if firmware has capability of accepting raw DSM table. | ||||
| 		 */ | ||||
| 		if (cmd_ver < 9 && | ||||
| 		if (!has_raw_dsm_capa && cmd_ver < 9 && | ||||
| 		    !fw_has_capa(&fwrt->fw->ucode_capa, | ||||
| 				 IWL_UCODE_TLV_CAPA_BIOS_OVERRIDE_5G9_FOR_CA)) | ||||
| 			value &= ~(DSM_VALUE_UNII4_CANADA_OVERRIDE_MSK | | ||||
|  | @ -614,13 +621,17 @@ int iwl_fill_lari_config(struct iwl_fw_runtime *fwrt, | |||
| 
 | ||||
| 	ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_ACTIVATE_CHANNEL, &value); | ||||
| 	if (!ret) { | ||||
| 		if (cmd_ver < 8) | ||||
| 		if (!has_raw_dsm_capa) | ||||
| 			value &= CHAN_STATE_ACTIVE_BITMAP_CMD_V12; | ||||
| 
 | ||||
| 		if (!has_raw_dsm_capa && cmd_ver < 8) | ||||
| 			value &= ~ACTIVATE_5G2_IN_WW_MASK; | ||||
| 
 | ||||
| 		/* Since version 12, bits 5 and 6 are supported
 | ||||
| 		 * regardless of this capability. | ||||
| 		 * regardless of this capability, By pass this masking | ||||
| 		 * if firmware has capability of accepting raw DSM table. | ||||
| 		 */ | ||||
| 		if (cmd_ver < 12 && | ||||
| 		if (!has_raw_dsm_capa && cmd_ver < 12 && | ||||
| 		    !fw_has_capa(&fwrt->fw->ucode_capa, | ||||
| 				 IWL_UCODE_TLV_CAPA_BIOS_OVERRIDE_UNII4_US_CA)) | ||||
| 			value &= CHAN_STATE_ACTIVE_BITMAP_CMD_V11; | ||||
|  | @ -633,13 +644,19 @@ int iwl_fill_lari_config(struct iwl_fw_runtime *fwrt, | |||
| 		cmd->oem_uhb_allow_bitmap = cpu_to_le32(value); | ||||
| 
 | ||||
| 	ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_FORCE_DISABLE_CHANNELS, &value); | ||||
| 	if (!ret) | ||||
| 	if (!ret) { | ||||
| 		if (!has_raw_dsm_capa) | ||||
| 			value &= DSM_FORCE_DISABLE_CHANNELS_ALLOWED_BITMAP; | ||||
| 		cmd->force_disable_channels_bitmap = cpu_to_le32(value); | ||||
| 	} | ||||
| 
 | ||||
| 	ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_ENERGY_DETECTION_THRESHOLD, | ||||
| 			       &value); | ||||
| 	if (!ret) | ||||
| 	if (!ret) { | ||||
| 		if (!has_raw_dsm_capa) | ||||
| 			value &= DSM_EDT_ALLOWED_BITMAP; | ||||
| 		cmd->edt_bitmap = cpu_to_le32(value); | ||||
| 	} | ||||
| 
 | ||||
| 	ret = iwl_bios_get_wbem(fwrt, &value); | ||||
| 	if (!ret) | ||||
|  |  | |||
|  | @ -159,6 +159,10 @@ enum iwl_dsm_unii4_bitmap { | |||
| 				DSM_VALUE_UNII4_CANADA_OVERRIDE_MSK	|\ | ||||
| 				DSM_VALUE_UNII4_CANADA_EN_MSK) | ||||
| 
 | ||||
| #define DSM_11AX_ALLOW_BITMAP				0xF | ||||
| #define DSM_EDT_ALLOWED_BITMAP				0x7ffff0 | ||||
| #define DSM_FORCE_DISABLE_CHANNELS_ALLOWED_BITMAP	0x7FF | ||||
| 
 | ||||
| enum iwl_dsm_values_rfi { | ||||
| 	DSM_VALUE_RFI_DLVR_DISABLE	= BIT(0), | ||||
| 	DSM_VALUE_RFI_DDR_DISABLE	= BIT(1), | ||||
|  |  | |||
|  | @ -238,34 +238,50 @@ void iwl_mld_configure_lari(struct iwl_mld *mld) | |||
| 	struct iwl_lari_config_change_cmd cmd = { | ||||
| 		.config_bitmap = iwl_get_lari_config_bitmap(fwrt), | ||||
| 	}; | ||||
| 	bool has_raw_dsm_capa = fw_has_capa(&fwrt->fw->ucode_capa, | ||||
| 					    IWL_UCODE_TLV_CAPA_FW_ACCEPTS_RAW_DSM_TABLE); | ||||
| 	int ret; | ||||
| 	u32 value; | ||||
| 
 | ||||
| 	ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_11AX_ENABLEMENT, &value); | ||||
| 	if (!ret) | ||||
| 	if (!ret) { | ||||
| 		if (!has_raw_dsm_capa) | ||||
| 			value &= DSM_11AX_ALLOW_BITMAP; | ||||
| 		cmd.oem_11ax_allow_bitmap = cpu_to_le32(value); | ||||
| 	} | ||||
| 
 | ||||
| 	ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_ENABLE_UNII4_CHAN, &value); | ||||
| 	if (!ret) | ||||
| 		cmd.oem_unii4_allow_bitmap = | ||||
| 			cpu_to_le32(value &= DSM_UNII4_ALLOW_BITMAP); | ||||
| 	if (!ret) { | ||||
| 		if (!has_raw_dsm_capa) | ||||
| 			value &= DSM_UNII4_ALLOW_BITMAP; | ||||
| 		cmd.oem_unii4_allow_bitmap = cpu_to_le32(value); | ||||
| 	} | ||||
| 
 | ||||
| 	ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_ACTIVATE_CHANNEL, &value); | ||||
| 	if (!ret) | ||||
| 	if (!ret) { | ||||
| 		if (!has_raw_dsm_capa) | ||||
| 			value &= CHAN_STATE_ACTIVE_BITMAP_CMD_V12; | ||||
| 		cmd.chan_state_active_bitmap = cpu_to_le32(value); | ||||
| 	} | ||||
| 
 | ||||
| 	ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_ENABLE_6E, &value); | ||||
| 	if (!ret) | ||||
| 		cmd.oem_uhb_allow_bitmap = cpu_to_le32(value); | ||||
| 
 | ||||
| 	ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_FORCE_DISABLE_CHANNELS, &value); | ||||
| 	if (!ret) | ||||
| 	if (!ret) { | ||||
| 		if (!has_raw_dsm_capa) | ||||
| 			value &= DSM_FORCE_DISABLE_CHANNELS_ALLOWED_BITMAP; | ||||
| 		cmd.force_disable_channels_bitmap = cpu_to_le32(value); | ||||
| 	} | ||||
| 
 | ||||
| 	ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_ENERGY_DETECTION_THRESHOLD, | ||||
| 			       &value); | ||||
| 	if (!ret) | ||||
| 	if (!ret) { | ||||
| 		if (!has_raw_dsm_capa) | ||||
| 			value &= DSM_EDT_ALLOWED_BITMAP; | ||||
| 		cmd.edt_bitmap = cpu_to_le32(value); | ||||
| 	} | ||||
| 
 | ||||
| 	ret = iwl_bios_get_wbem(fwrt, &value); | ||||
| 	if (!ret) | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Pagadala Yesu Anjaneyulu
						Pagadala Yesu Anjaneyulu