Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1081523ybl; Wed, 14 Aug 2019 10:23:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyicxRj2wqGteU2WjakNLOAeRfGI1ThCWkO1GCOdtTfO1QHLEXzBNm+4fUmKwjMVyJhZnCT X-Received: by 2002:aa7:97b7:: with SMTP id d23mr1061761pfq.203.1565803422535; Wed, 14 Aug 2019 10:23:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565803422; cv=none; d=google.com; s=arc-20160816; b=m5DX7uYs09aXy0qsJnH1Quq5UfDR0+6KLLqLucKa3xRcQuqubLx+gDc6pipMDfv0+J RLsGFFPZL3zrjvwpIVkAVozZhfkLsSP8yo94kiDgCVhk8idL6NgcI30qbWJKHOue6Gr0 A+dAmvVuLUc2WRUAucL6X8oxBjxqPFqBkUjg18p93P82OAi3G4N9oJZjVRk7hNK6WtRL 3ktiOxox/yUIFts822fj0Lu1Jx8cGsbjAcz9ZZod18Ji6MYbbt+y/ZnNovSzxZgrE/RQ FJV8l/GO4cQvlHUVq5It3Hy1aeeDwx/jZ4T2mNazUJvqACRs6jVVyjR1PZQotsEnkIBf Y6Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jc/WvCftb5yw1Ec1vO/Y9eE6/NdDkHqsir+NF2Ecw+M=; b=s2L3N/1cgMe98nXYuqZ7oIk2fNoPuCCpr61ld9Gj068pgdNC9jPMqjC0C0iPpMuSJv K0olZfLw10lf69TiBGIG12kLFDmzRjkL5WEgPWPGxpf3LJc6A03fgzPQ5trxc1t5c7vq gOvdBY237Gva9BWbha9wqlCKH3CUfFc7l5Klqqocz0bNmd4eOlOo7m/Frv8ubIBhOunR 6lTlwxzCuSXouGbVuvvREigK/PQ+IdNyyAksZQuzWOpF/ey8TyLd6qAbBPWGTHq0Kfl7 rIteWBDVY+lqanOeulfKr1JJwKTQ1a+ulfKHvqX+XbykFc84/4LlGav19rjuBWvov2R8 fjRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Xos01wi/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d4si227809pjj.28.2019.08.14.10.23.26; Wed, 14 Aug 2019 10:23:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Xos01wi/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730141AbfHNRI2 (ORCPT + 99 others); Wed, 14 Aug 2019 13:08:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:58470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726585AbfHNRI0 (ORCPT ); Wed, 14 Aug 2019 13:08:26 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3AB392084D; Wed, 14 Aug 2019 17:08:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802505; bh=1oYxQGPaHNjVLDTcSpfGfO2FZLfD0ONYzzODml0ub1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xos01wi/3bNgeELrYDG03swLn3wGH8zL8biyirXHRvwjUIvOIis7riyGHrWqkv9Ab iEovgZZ+4pbkJwqWQJCOESe/Oodph2pC5C1vJlcS8rFEvuucex5RirfRSPqmxqlgsw 4i7RPu3U4Lbuz38WfQUqFiZiF6MhgXIx7jSh6KFY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luca Coelho , Johannes Berg Subject: [PATCH 5.2 143/144] iwlwifi: mvm: dont send GEO_TX_POWER_LIMIT on version < 41 Date: Wed, 14 Aug 2019 19:01:39 +0200 Message-Id: <20190814165805.951560164@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165759.466811854@linuxfoundation.org> References: <20190814165759.466811854@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Luca Coelho commit 39bd984c203e86f3109b49c2a2e20677c4d3ab65 upstream. 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 Fixes: 7fe90e0e3d60 ("iwlwifi: mvm: refactor geo init") Signed-off-by: Luca Coelho Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c @@ -874,6 +874,17 @@ int iwl_mvm_sar_select_profile(struct iw 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; @@ -889,6 +900,9 @@ int iwl_mvm_get_sar_geo_profile(struct i .data = { &geo_cmd }, }; + 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); @@ -914,13 +928,7 @@ static int iwl_mvm_sar_geo_init(struct i 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);