Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2239566imm; Wed, 3 Oct 2018 00:16:20 -0700 (PDT) X-Google-Smtp-Source: ACcGV61LYUAFvsuvySXGpHPp49lQ1AOc0p19iZ9aZ52g+BY2Y2bl2HWVXsdTRc8W2GHbws5fNqeU X-Received: by 2002:a17:902:a504:: with SMTP id s4-v6mr164982plq.101.1538550980131; Wed, 03 Oct 2018 00:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538550980; cv=none; d=google.com; s=arc-20160816; b=q9GZYZODBQtEUaD9kcUjhItN/fxo7qslyRq2pufxtw0OSW/EyQWjuWjnofrH8rdoC9 wwMzAneusU55BPfZlNqyDb53t5RCKxMXKcdtZG72KTN8Sw67c1e3Mmjz+Mo0dwtBagn4 ZkTrod5DUFL+kDM3+oAxKG8GEyXIjwxLpmQNeC7RwtdZcPSUiB2Wkyv3QAGkRHo6CnVi IEJmw8kd7xzmE0e/BgzZ1g2Yz2kBAvGh41ZppDq5rmKEPwHxiD+kShxiDNSLR+eYe9GC WNSlGO1Rrv9RwYxa59TQakOFpfMI+IL51Mn5jtRISyxUj4Zd6VLMkiKfNKWi6qqgXdkJ GGmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=xo5owgirpofX4jW0m7VBKObxGC4aDW91RFCa/7S88jE=; b=cPMu36/maq487k7c2m6gfQ2TXzMnVyssfFMU1/hWOzJp+q2Odrmg66HJ+RveYwHO26 J3VzjlvmlWdUZY0MOsk9gT95HrGhtHTBtQG2lmJi2+GgdZlhr59ezzfFi+yKfNE3ONFL 3rnMQeEw7wH90aVE7l7kuH6ByPFGP3W5F0wyCyh+UEmWmMHHVEIpIJwa7N8OajtAhNWU 5Q5GQSMYbswGulcnn3SSegnLPiUxI4fKcwp8ijvOZIo5W3j3zYl98u/wrKpqLD/jzHNj +0wNAiju5WtPrtdiLC12z90dvryJcC89mPTckRN6DDabBiJeL4mLMAHnp6pTnk3hg4+q va8Q== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10-v6si578907pgi.223.2018.10.03.00.16.04; Wed, 03 Oct 2018 00:16:20 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726907AbeJCOCt (ORCPT + 99 others); Wed, 3 Oct 2018 10:02:49 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:55887 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726521AbeJCOCs (ORCPT ); Wed, 3 Oct 2018 10:02:48 -0400 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1g7bNj-0007CY-9j; Wed, 03 Oct 2018 07:15:40 +0000 From: Kai-Heng Feng To: linux-kernel@vger.kernel.org Cc: Kai-Heng Feng , Johannes Berg , Emmanuel Grumbach , Luca Coelho , Intel Linux Wireless , Kalle Valo , "David S. Miller" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 3/3] iwlwifi: Load firmware exclusively for Intel WiFi Date: Wed, 3 Oct 2018 15:15:12 +0800 Message-Id: <20181003071513.13004-3-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To avoid the firmware loading race between Bluetooth and WiFi on Intel 8260, load firmware exclusively when BT_INTEL is enabled. Signed-off-by: Kai-Heng Feng --- .../net/wireless/intel/iwlwifi/pcie/trans.c | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c index cc8c53dc0ab6..c30d3989e2a8 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c @@ -71,6 +71,7 @@ #include #include #include +#include #include "iwl-drv.h" #include "iwl-trans.h" @@ -1335,6 +1336,10 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans, bool hw_rfkill; int ret; +#if IS_ENABLED(CONFIG_BT_INTEL) + void (*firmware_lock_func)(void); + void (*firmware_unlock_func)(void); +#endif /* This may fail if AMT took ownership of the device */ if (iwl_pcie_prepare_card_hw(trans)) { IWL_WARN(trans, "Exit HW not ready\n"); @@ -1394,6 +1399,7 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans, * RF-Kill switch is toggled, we will find out after having loaded * the firmware and return the proper value to the caller. */ + iwl_enable_fw_load_int(trans); /* really make sure rfkill handshake bits are cleared */ @@ -1401,8 +1407,37 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans, iwl_write32(trans, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); /* Load the given image to the HW */ - if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_8000) + if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_8000) { +#if IS_ENABLED(CONFIG_BT_INTEL) + firmware_lock_func = symbol_request(btintel_firmware_lock); + firmware_unlock_func = symbol_request(btintel_firmware_unlock); + if (!firmware_lock_func || !firmware_unlock_func) { + if (firmware_lock_func) { + symbol_put(btintel_firmware_lock); + firmware_lock_func = NULL; + } + + if (firmware_unlock_func) { + symbol_put(btintel_firmware_unlock); + firmware_unlock_func = NULL; + } + } + + if (firmware_lock_func) + firmware_lock_func(); +#endif ret = iwl_pcie_load_given_ucode_8000(trans, fw); + +#if IS_ENABLED(CONFIG_BT_INTEL) + if (firmware_unlock_func) { + firmware_unlock_func(); + symbol_put(btintel_firmware_lock); + firmware_lock_func = NULL; + symbol_put(btintel_firmware_unlock); + firmware_unlock_func = NULL; + } +#endif + } else ret = iwl_pcie_load_given_ucode(trans, fw); -- 2.17.1