Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3562078rdb; Wed, 13 Sep 2023 16:29:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG1so397b1J/+AcNLBHnkc8ccngjCX7coT2tsTTSkqN/HEddxpTjHFONc6ojOye1eeQ3yXp X-Received: by 2002:a05:6a00:b95:b0:68b:f529:a329 with SMTP id g21-20020a056a000b9500b0068bf529a329mr4567605pfj.5.1694647773593; Wed, 13 Sep 2023 16:29:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694647773; cv=none; d=google.com; s=arc-20160816; b=gkac0M71bPPNXIrIVz3Ce24kMo7oBkpRF5pxFUAycJ126USK2jG4t+m55VoryCQBME gOBq2yyhuSL0/Hnzh7pY5xbnKX5mNRO1SOt0v4kxMi1XyWfspXmWHzumeTIyw7SJo+mI 9Iq7SMZ+QBnLhGEt0UULxjJfi/IhwyET4V6oYvp0iDnJbG2dPsRF9GvQ3aDI4HQc1VZ+ ctxDNQP5VZ6Wua1iP2mGZDgH3s4kPGC7njh34HY88wVsI/6Px8AYjv4hLxU/111t/aq2 HUldNocAoq54Ac2TO3n+33QDt+nJrR35I+mjiRC4pAOQxwow5kya+4bxkUcULrN/Mj2M RrRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=h6WUgzdE38dXiZJMXEbceihz1qMqvCmJBwO98t2Zo6I=; fh=Y2IfAqdjkYQAx7XZcGq/8JceY1atOOwfX771vvMvH7o=; b=0OsVz4Aa2tJbPenMEUFctraQm6RnMDzF9RJYxJEmFfYsEtqvDitG+T2TUblr0qSVZ7 RRa3snqDrq9mokT1ClrtPxyoiBIzYTVkMGC9DyNTVeiVIl0lMJm7fQKTSHijjlQiA4Wq DsSNu34C7IbeZpfM7eBhOmqexq6S3gBMNnFz+ooa7gjRCqvPJtkQMYcvlmIFTKgjBLkk ULiIsQ0fkq/1wMC6WkA2Hiqjh6N8QUh2EO7GWq9ORvAB5PrMiv5qxhNWWjRFpQunPQCN t8Ma9SDYhJuDTw+R6atp6yk4xKRmeFJMZiqIyWuebVqZ0HNxj+mHzXCPpxJ/fSm2KnaO huZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MOasZ0Aw; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id k20-20020aa788d4000000b006880a2ca0fasi281965pff.312.2023.09.13.16.29.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 16:29:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MOasZ0Aw; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 17784804F63C; Wed, 13 Sep 2023 04:57:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240574AbjIML5a (ORCPT + 56 others); Wed, 13 Sep 2023 07:57:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240569AbjIML52 (ORCPT ); Wed, 13 Sep 2023 07:57:28 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CC561996 for ; Wed, 13 Sep 2023 04:57:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694606245; x=1726142245; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3IbK+NHECKuiCqmsqBlma+RcigcZLxmypRF41ZalybI=; b=MOasZ0Awb3pdyQgbVGktKANarp1h0LlbTxdcJRI7XjrzFf2QMa9JghOn cs5msO82Y3zVvUr6xgjzKzcdTGi0TQ+Cz2BANjL/SuG2wmeWVS+n80KIK vRZnQpRKTHG5WAJeMjoGlRCKz/9ZwzZCJDq71/Myav+wNzvq/uyd2hk4e 6FXnBXVh3vXOj/y/cTf8jBVTf/bUFaLdlmZ7lHOHWsJselUtW8brpIAxk qty55BMAH9Dd763CKbZxP1pNxGp9xK0AIKxbYgnZ7L3a1/fhTqXr5cZ4h pPFyoqZZc4qeRynuMZCnRk9LMsw0+aWwzmrT783Ggohp2EqsdMWKAXqyg w==; X-IronPort-AV: E=McAfee;i="6600,9927,10831"; a="368903048" X-IronPort-AV: E=Sophos;i="6.02,143,1688454000"; d="scan'208";a="368903048" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2023 04:57:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10831"; a="737470952" X-IronPort-AV: E=Sophos;i="6.02,143,1688454000"; d="scan'208";a="737470952" Received: from ggreenma-mobl2.jer.intel.com ([10.13.17.40]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2023 04:57:23 -0700 From: gregory.greenman@intel.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg , Gregory Greenman Subject: [PATCH 07/15] wifi: iwlwifi: mvm: make "pldr_sync" mode effective Date: Wed, 13 Sep 2023 14:56:43 +0300 Message-Id: <20230913145231.45a94d480e56.Id9277f1df6a63ab0dfca0d0c0f448c759e1b8e73@changeid> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230913115651.190558-1-gregory.greenman@intel.com> References: <20230913115651.190558-1-gregory.greenman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Sep 2023 04:57:32 -0700 (PDT) From: Johannes Berg If the device initialized with ME active, this would indeed work, since the NVM information would be obtained from ME. However, in the much more likely case that ME isn't active and the firmware takes actions requiring the sync, this was not working correctly when the firmware is only run at init to obtain NVM data, since mac80211 isn't even initialized. Fix this by moving the 'pldr_sync' handling to a different place. Signed-off-by: Johannes Berg Signed-off-by: Gregory Greenman --- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 20 +++++++++++++------ .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 12 +---------- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 3 +++ 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c index f682c9067abb..567b02754a43 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c @@ -583,6 +583,7 @@ static int iwl_run_unified_mvm_ucode(struct iwl_mvm *mvm) static const u16 init_complete[] = { INIT_COMPLETE_NOTIF, }; + u32 sb_cfg; int ret; if (mvm->trans->cfg->tx_with_siso_diversity) @@ -592,6 +593,12 @@ static int iwl_run_unified_mvm_ucode(struct iwl_mvm *mvm) mvm->rfkill_safe_init_done = false; + sb_cfg = iwl_read_umac_prph(mvm->trans, SB_MODIFY_CFG_FLAG); + /* if needed, we'll reset this on our way out later */ + mvm->pldr_sync = !(sb_cfg & SB_CFG_RESIDES_IN_OTP_MASK); + if (mvm->pldr_sync && iwl_mei_pldr_req()) + return -EBUSY; + iwl_init_notification_wait(&mvm->notif_wait, &init_wait, init_complete, @@ -605,6 +612,13 @@ static int iwl_run_unified_mvm_ucode(struct iwl_mvm *mvm) ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_REGULAR); if (ret) { IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret); + + /* if we needed reset then fail here, but notify and remove */ + if (mvm->pldr_sync) { + iwl_mei_alive_notif(false); + iwl_trans_pcie_remove(mvm->trans, true); + } + goto error; } iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_AFTER_ALIVE, @@ -1502,7 +1516,6 @@ int iwl_mvm_up(struct iwl_mvm *mvm) struct ieee80211_channel *chan; struct cfg80211_chan_def chandef; struct ieee80211_supported_band *sband = NULL; - u32 sb_cfg; lockdep_assert_held(&mvm->mutex); @@ -1510,11 +1523,6 @@ int iwl_mvm_up(struct iwl_mvm *mvm) if (ret) return ret; - sb_cfg = iwl_read_umac_prph(mvm->trans, SB_MODIFY_CFG_FLAG); - mvm->pldr_sync = !(sb_cfg & SB_CFG_RESIDES_IN_OTP_MASK); - if (mvm->pldr_sync && iwl_mei_pldr_req()) - return -EBUSY; - ret = iwl_mvm_load_rt_fw(mvm); if (ret) { IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index a4ac178d76b3..93223f8c07b4 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -1169,18 +1169,8 @@ int iwl_mvm_mac_start(struct ieee80211_hw *hw) for (retry = 0; retry <= max_retry; retry++) { ret = __iwl_mvm_mac_start(mvm); - if (!ret) - break; - - /* - * In PLDR sync PCI re-enumeration is needed. no point to retry - * mac start before that. - */ - if (mvm->pldr_sync) { - iwl_mei_alive_notif(false); - iwl_trans_pcie_remove(mvm->trans, true); + if (!ret || mvm->pldr_sync) break; - } IWL_ERR(mvm, "mac start retry %d\n", retry); } diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index d4983abd9f97..1c21a313f8f1 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -790,6 +790,9 @@ static int iwl_mvm_start_get_nvm(struct iwl_mvm *mvm) if (ret) IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", ret); + /* no longer need this regardless of failure or not */ + mvm->pldr_sync = false; + return ret; } -- 2.38.1