Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3972996pxb; Tue, 2 Mar 2021 03:32:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzyv6b/CjooaHEi08xK54mDd2rhxLDLU+5WTs/qWWKwiU8Etq9rScgumi1lc51OaXCTCXUJ X-Received: by 2002:a17:906:c210:: with SMTP id d16mr20256187ejz.187.1614684723187; Tue, 02 Mar 2021 03:32:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614684723; cv=none; d=google.com; s=arc-20160816; b=ETB/vPq9OUeZok8gymgO9JJ5AUVf5L8+PfSsBxs8Lulzs8fKNFwcjQthaYHSjQjeJp 57Sea5fTRyELAd1DBMovl+PbJtYFQagaz92PNPtx9rM7Z49EJe9hHnCOYVhUVJvX2e7X be4yh5UBUy+pf8IbzHJW2HX6kU3YCuTka9XKlbGKcj8xIP4gWyngGIqj1LP9TIwHxtAc S7jPyjLvQGN5DCAD3cKE/RvLE0n9T89gmtmxRPU7owgDOVEHnKUgO1RQ1JKcCI+oUC4C 9PIBFKZwlOtasRvUwoHQiPFjJFvATZWqyS1bV2qn52cuBRp0Z4cQS0veGMQ9oL2fjUxk Tv/w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9Hxwl4Py7AGJctR+BVv2BJN7KZpzd84HMd0PYrDb5xQ=; b=0M+gPJPTWjdVC63WlgYE6BNRm6LEBsGLkR/LGePUdXIUh17FRoaCeRYgjPB08ikt+I aEinPv4b2eneUEJfMgvW6190Gk+D2kEFSQ2KR51YKdUnK4LJLF/TxgDFw56X4GzDR6sM Apt0tQGcGq9StoBsDWQwenspldgoWXEv3sNxK/QkUB7VNBrkQzUpksuI5bdtWDZWD9DK l8CxRSoWSZiqfkYjVLmXoVtlMiXclcqARiN7IfZO5Z0+X4gNEU8cOMzHvveCXq27R5HF TS4bWK5xRDMqrZPo7ZyounzsaxI6rAFxYCGe8g2o/5YVn6IYGCsyGFrspSGwbxDe6woE F/Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mT3fmVqn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s9si8433863ejh.211.2021.03.02.03.31.37; Tue, 02 Mar 2021 03:32:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mT3fmVqn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380851AbhCBB4I (ORCPT + 99 others); Mon, 1 Mar 2021 20:56:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:50864 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241664AbhCATcz (ORCPT ); Mon, 1 Mar 2021 14:32:55 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 17C2A65175; Mon, 1 Mar 2021 17:07:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614618458; bh=5ygZ6FyAJ1USmTKIKruYMs6mh9pzQDZ+fFXuClVAgNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mT3fmVqnX/5WF8n0s+Alk0z5c2+tsewVcyUcu84Cox8iThHLWMvm3Xwb8HLjdWVpW GEPfVVjh/eIjKqN+oX2wl6rPsKVzlfd0yNVykn3lFURLXlGgrPtyYzh0WgxubLtzQs UhvYC6UWpV0Ula/DLfWmB96RUlHiIJ0kRR+iL2Q0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luca Coelho , Sasha Levin Subject: [PATCH 5.10 093/663] iwlwifi: pnvm: set the PNVM again if it was already loaded Date: Mon, 1 Mar 2021 17:05:41 +0100 Message-Id: <20210301161146.332430072@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161141.760350206@linuxfoundation.org> References: <20210301161141.760350206@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Luca Coelho [ Upstream commit 4a81598f0f39cffbf1c29c4a184063d513661c4a ] When the interface goes up, we have already loaded the PNVM during init, so we don't load it anymore. But we still need to set the PNVM values in the context so that the FW can load it again. Call set_pnvm when the PNVM is already loaded and change the trans_pcie implementation to accept a second call to set_pnvm when we have already allocated and, in this case, only set the values without allocating again. Signed-off-by: Luca Coelho Fixes: 6972592850c0 ("iwlwifi: read and parse PNVM file") Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20210210172142.622546a3566f.I659a8b9aa944d213c4ba446e142d74f3f6db9c64@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin --- drivers/net/wireless/intel/iwlwifi/fw/pnvm.c | 7 ++++++- .../intel/iwlwifi/pcie/ctxt-info-gen3.c | 21 +++++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c b/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c index 895a907acdf0f..1e16f83b402b8 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c @@ -227,6 +227,7 @@ int iwl_pnvm_load(struct iwl_trans *trans, struct iwl_notification_wait pnvm_wait; static const u16 ntf_cmds[] = { WIDE_ID(REGULATORY_AND_NVM_GROUP, PNVM_INIT_COMPLETE_NTFY) }; + int ret; /* if the SKU_ID is empty, there's nothing to do */ if (!trans->sku_id[0] && !trans->sku_id[1] && !trans->sku_id[2]) @@ -236,7 +237,6 @@ int iwl_pnvm_load(struct iwl_trans *trans, if (!trans->pnvm_loaded) { const struct firmware *pnvm; char pnvm_name[64]; - int ret; /* * The prefix unfortunately includes a hyphen at the end, so @@ -264,6 +264,11 @@ int iwl_pnvm_load(struct iwl_trans *trans, release_firmware(pnvm); } + } else { + /* if we already loaded, we need to set it again */ + ret = iwl_trans_set_pnvm(trans, NULL, 0); + if (ret) + return ret; } iwl_init_notification_wait(notif_wait, &pnvm_wait, diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c index 2d43899fbdd7a..81ef4fc8d7831 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c @@ -345,17 +345,20 @@ int iwl_trans_pcie_ctx_info_gen3_set_pnvm(struct iwl_trans *trans, if (trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_AX210) return 0; - ret = iwl_pcie_ctxt_info_alloc_dma(trans, data, len, - &trans_pcie->pnvm_dram); - if (ret < 0) { - IWL_DEBUG_FW(trans, "Failed to allocate PNVM DMA %d.\n", - ret); - return ret; + /* only allocate the DRAM if not allocated yet */ + if (!trans->pnvm_loaded) { + if (WARN_ON(prph_sc_ctrl->pnvm_cfg.pnvm_size)) + return -EBUSY; + + ret = iwl_pcie_ctxt_info_alloc_dma(trans, data, len, + &trans_pcie->pnvm_dram); + if (ret < 0) { + IWL_DEBUG_FW(trans, "Failed to allocate PNVM DMA %d.\n", + ret); + return ret; + } } - if (WARN_ON(prph_sc_ctrl->pnvm_cfg.pnvm_size)) - return -EBUSY; - prph_sc_ctrl->pnvm_cfg.pnvm_base_addr = cpu_to_le64(trans_pcie->pnvm_dram.physical); prph_sc_ctrl->pnvm_cfg.pnvm_size = -- 2.27.0