Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1392387pxb; Wed, 10 Feb 2021 07:25:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJxcaI0Oz6Y/WpZZbCs0tUijQOFWiPjmOhtk5b/UbNzvO7dcFCh4jcLjbVGtnMxmyiweb1ac X-Received: by 2002:aa7:ce15:: with SMTP id d21mr3708407edv.246.1612970742992; Wed, 10 Feb 2021 07:25:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612970742; cv=none; d=google.com; s=arc-20160816; b=XzlDkjELKusZ2NT54Y7SXNNF1EVKKPm7ekisK+Kg8caGn+j5wityy/8vgMoCJjaaDp 4P8bx9lesva7JNSAoWtVMuUh8s4fEB0OUJNxhCKhRCYQ2shKpU1gw6gj7Y5ANMWqsgC+ wCtdMvWXpRRHTFVuR4UfTNrKU9x+Jzs9h1uXPbe+FxRviVXL+Uk7XukgxnNkTwcq2wRE qKZt2+shvD1Lcz8gEmf8yvUl7MPxwcgy7T8U18sKubEYXkzEyq6JcDU/a/+LNGkwaaPL V2lPBPiT8fDBnkuhVi3CCsUvRvTsrPY4gCmr731wmFhyOybH6lAYC8Mnts0me/DgjGyO Di2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from; bh=ikcfDIsyV0UgxlGj24k90ZjT7lkPQ/pQlPdH/qydeYs=; b=ySPuH5KKaFbVlKVwnChWePkcTwoAMeJUpAYFurUqQmvLup3u/BhAreiDvu4cgtBhJ7 DzAZLkylKciGy2reYJO40VWZM9zxPGF55eqDppjrp5d8jU7FfOFRlRooav8kjA5nWrtr uC12+EXo5kqfH2ReRYE8SMcq37mVdj8cag4wn+8GLen1POT/mz8d79ME8CO1JqM21XGy z8AQZiy/j8B+7xueIWmcq1quz13GLVb023zyJg26fTJghqCAPZi8+/90IYsWFLMqh9Cr +LHmVbLoJRQgjbIMtcV008gypjhOLqo+IrzlQYm1hUonuTzrxsaNle/A3d5dU+k/DUMO hc9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k20si1595146ejb.501.2021.02.10.07.25.20; Wed, 10 Feb 2021 07:25:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231909AbhBJPZA (ORCPT + 99 others); Wed, 10 Feb 2021 10:25:00 -0500 Received: from paleale.coelho.fi ([176.9.41.70]:45348 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231690AbhBJPYq (ORCPT ); Wed, 10 Feb 2021 10:24:46 -0500 Received: from 91-156-6-193.elisa-laajakaista.fi ([91.156.6.193] helo=redipa.ger.corp.intel.com) by farmhouse.coelho.fi with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1l9rLS-0049nr-8r; Wed, 10 Feb 2021 17:23:58 +0200 From: Luca Coelho To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org Date: Wed, 10 Feb 2021 17:23:50 +0200 Message-Id: X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210210152355.419776-1-luca@coelho.fi> References: <20210210152355.419776-1-luca@coelho.fi> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on farmhouse.coelho.fi X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, TVD_RCVD_IP autolearn=ham autolearn_force=no version=3.4.4 Subject: [PATCH 3/8] iwlwifi: pnvm: set the PNVM again if it was already loaded Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Luca Coelho 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 --- 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 895a907acdf0..1e16f83b402b 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 5b5134dd49af..8fba190e84cf 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c @@ -298,17 +298,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.30.0