diff mbox series

[06/11] iwlwifi: mvm: Add list of OEMs allowed to use TAS

Message ID iwlwifi.20211210090244.27fe6abf2e4c.I806e4b47dabddaa8ac27172e7cfa3d719c100e8f@changeid (mailing list archive)
State Accepted
Commit 55fd9a800fb9cae971bd2e487a6dd5187a47d67d
Delegated to: Luca Coelho
Headers show
Series iwlwifi: updates intended for v5.17 2021-12-10 part 1 | expand

Commit Message

Luca Coelho Dec. 10, 2021, 7:06 a.m. UTC
From: Ayala Barazani <ayala.barazani@intel.com>

Add list of vendors that are allowed to use TAS and check it
against the value provided in the SMBIOS manufacturer field.
Initially add the following approved vendors: HP, Dell, Lenovo and Samsung.

Signed-off-by: Ayala Barazani <ayala.barazani@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 45 +++++++++++++++++++++
 1 file changed, 45 insertions(+)
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 72227c87c6b9..19a18b626069 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -1153,11 +1153,38 @@  static int iwl_mvm_ppag_init(struct iwl_mvm *mvm)
 	return iwl_mvm_ppag_send_cmd(mvm);
 }
 
+static const struct dmi_system_id dmi_tas_approved_list[] = {
+	{ .ident = "HP",
+	  .matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+		},
+	},
+	{ .ident = "SAMSUNG",
+	  .matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD"),
+		},
+	},
+		{ .ident = "LENOVO",
+	  .matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Lenovo"),
+		},
+	},
+	{ .ident = "DELL",
+	  .matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+		},
+	},
+
+	/* keep last */
+	{}
+};
+
 static void iwl_mvm_tas_init(struct iwl_mvm *mvm)
 {
 	int ret;
 	struct iwl_tas_config_cmd_v3 cmd = {};
 	int cmd_size;
+	const struct ieee80211_regdomain *regd;
 
 	BUILD_BUG_ON(ARRAY_SIZE(cmd.block_list_array) <
 		     APCI_WTAS_BLACK_LIST_MAX);
@@ -1167,6 +1194,24 @@  static void iwl_mvm_tas_init(struct iwl_mvm *mvm)
 		return;
 	}
 
+	/* Get the MCC from cfg80211 */
+	regd = wiphy_dereference(mvm->hw->wiphy, mvm->hw->wiphy->regd);
+
+	if (!regd) {
+		IWL_DEBUG_RADIO(mvm, "MCC is unavailable\n");
+		return;
+	}
+
+	if ((regd->alpha2[0] == 'U' && regd->alpha2[1] == 'S') ||
+	    (regd->alpha2[0] == 'C' && regd->alpha2[1] == 'A')) {
+		if (!dmi_check_system(dmi_tas_approved_list)) {
+			IWL_DEBUG_RADIO(mvm,
+					"System vendor '%s' is not in the approved list, disabling TAS.\n",
+					dmi_get_system_info(DMI_SYS_VENDOR));
+			return;
+		}
+	}
+
 	ret = iwl_acpi_get_tas(&mvm->fwrt, &cmd);
 	if (ret < 0) {
 		IWL_DEBUG_RADIO(mvm,