From mboxrd@z Thu Jan 1 00:00:00 1970 From: Luciano Coelho Subject: Re: [PATCH 3/3] iwlwifi: Load firmware exclusively for Intel WiFi Date: Wed, 03 Oct 2018 10:24:44 +0300 Message-ID: <2787bccf20b6f647de9f4cafae5fd223e771b167.camel@intel.com> References: <20181003071513.13004-3-kai.heng.feng@canonical.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Johannes Berg , Emmanuel Grumbach , Intel Linux Wireless , Kalle Valo , "David S. Miller" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org To: Kai-Heng Feng , linux-kernel@vger.kernel.org Return-path: In-Reply-To: <20181003071513.13004-3-kai.heng.feng@canonical.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Wed, 2018-10-03 at 15:15 +0800, Kai-Heng Feng wrote: > 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 > --- Where is this coming from? Can you explain what "the firmware loading race" is? > .../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 I don't see this upstream. Is it something that was recently added? Looks odd... Regardless, this should also be protected on CONFIG_BT_INTEL. > #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. > */ > + Stray empty line. > 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); > I'm not sure I like adding this BT-specific stuff here, especially not without a detailed explanation. Did you also send the other patches in this series to linux-wireless? I can't see them... -- Cheers, Luca.