diff mbox series

[01/16] iwlwifi: mvm: don't send GEO_TX_POWER_LIMIT on version < 41

Message ID 20190720102545.5952-2-luca@coelho.fi (mailing list archive)
State Accepted
Delegated to: Luca Coelho
Headers show
Series iwlwifi: fixes intended for 5.3 2019-07-20 | expand

Commit Message

Luca Coelho July 20, 2019, 10:25 a.m. UTC
From: Luca Coelho <luciano.coelho@intel.com>

Firmware versions before 41 don't support the GEO_TX_POWER_LIMIT
command, and sending it to the firmware will cause a firmware crash.
We allow this via debugfs, so we need to return an error value in case
it's not supported.

This had already been fixed during init, when we send the command if
the ACPI WGDS table is present.  Fix it also for the other,
userspace-triggered case.

Cc: stable@vger.kernel.org
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 22 ++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

Comments

Luca Coelho Aug. 5, 2019, 9:45 a.m. UTC | #1
On Sat, 2019-07-20 at 12:23 +0000, Sasha Levin wrote:
> Hi,
> 
> [This is an automated email]
> 
> This commit has been processed because it contains a -stable tag.
> The stable tag indicates that it's relevant for the following trees: all
> 
> The bot has tested the following trees: v5.2.1, v5.1.18, v4.19.59, v4.14.133, v4.9.185, v4.4.185.
> 
> v5.2.1: Build OK!
> v5.1.18: Build OK!
> v4.19.59: Build OK!
> v4.14.133: Build OK!
> v4.9.185: Failed to apply! Possible dependencies:
>     1f3706508395 ("iwlwifi: mvm: support unification of INIT and RT images")
>     42ce76d615e7 ("iwlwifi: mvm: spin off SAR profile selection function")
>     6996490501ed ("iwlwifi: mvm: add support for EWRD (Dynamic SAR) ACPI table")
>     7fe90e0e3d60 ("iwlwifi: mvm: refactor geo init")
>     a6bff3cb19b7 ("iwlwifi: mvm: add GEO_TX_POWER_LIMIT cmd for geographic tx power table")
>     c386dacb4ed6 ("iwlwifi: mvm: refactor SAR init to prepare for dynamic SAR")
> 
> v4.4.185: Failed to apply! Possible dependencies:
>     13555e8ba2f4 ("iwlwifi: mvm: add 9000-series RX API")
>     1a616dd2f171 ("iwlwifi: dump prph registers in a common place for all transports")
>     2f89a5d7d377 ("iwlwifi: mvm: move fw-dbg code to separate file")
>     321c2104f2f1 ("iwlwifi: mvm: Support setting continuous recording debug mode")
>     39bdb17ebb5b ("iwlwifi: update host command messages to new format")
>     42ce76d615e7 ("iwlwifi: mvm: spin off SAR profile selection function")
>     43413a975d06 ("iwlwifi: mvm: support rss queues configuration command")
>     4707fde5cdef ("iwlwifi: mvm: use build-time assertion for fw trigger ID")
>     6c4fbcbc1c95 ("iwlwifi: add support for 12K Receive Buffers")
>     854d773e4ab5 ("iwlwifi: mvm: improve RSS configuration")
>     92fe83430b89 ("iwlwifi: uninline iwl_trans_send_cmd")
>     9e7dce286595 ("iwlwifi: mvm: allow to limit the A-MSDU from debugfs")
>     da2830acf15a ("iwlwifi: mvm: read SAR BIOS table from ACPI")
>     dcbb4746286a ("iwlwifi: trans: support a callback for ASYNC commands")
>     dd4d3161d0f2 ("iwlwifi: mvm: fix RSS key sizing")
> 
> 
> NOTE: The patch will not be queued to stable trees until it is upstream.
> 
> How should we proceed with this patch?

Hi Sasha,

In this specific case, the patch does not have to be applied on 4.9 and
4.4.  What is the right way to handle these cases? Should I simply
ignore them, so they won't go into those kernels by default or do you
want me to follow up somehow and let you know that those kernels can be
ignore?

--
Cheers,
Luca.
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 1d608e9e9101..a837cf40afde 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -880,6 +880,17 @@  int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b)
 	return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0, len, &cmd);
 }
 
+static bool iwl_mvm_sar_geo_support(struct iwl_mvm *mvm)
+{
+	/*
+	 * The GEO_TX_POWER_LIMIT command is not supported on earlier
+	 * firmware versions.  Unfortunately, we don't have a TLV API
+	 * flag to rely on, so rely on the major version which is in
+	 * the first byte of ucode_ver.
+	 */
+	return IWL_UCODE_SERIAL(mvm->fw->ucode_ver) >= 41;
+}
+
 int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm)
 {
 	struct iwl_geo_tx_power_profiles_resp *resp;
@@ -909,6 +920,9 @@  int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm)
 		.data = { data },
 	};
 
+	if (!iwl_mvm_sar_geo_support(mvm))
+		return -EOPNOTSUPP;
+
 	ret = iwl_mvm_send_cmd(mvm, &cmd);
 	if (ret) {
 		IWL_ERR(mvm, "Failed to get geographic profile info %d\n", ret);
@@ -934,13 +948,7 @@  static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm)
 	int ret, i, j;
 	u16 cmd_wide_id =  WIDE_ID(PHY_OPS_GROUP, GEO_TX_POWER_LIMIT);
 
-	/*
-	 * This command is not supported on earlier firmware versions.
-	 * Unfortunately, we don't have a TLV API flag to rely on, so
-	 * rely on the major version which is in the first byte of
-	 * ucode_ver.
-	 */
-	if (IWL_UCODE_SERIAL(mvm->fw->ucode_ver) < 41)
+	if (!iwl_mvm_sar_geo_support(mvm))
 		return 0;
 
 	ret = iwl_mvm_sar_get_wgds_table(mvm);