wifi: iwlwifi: updates intended for v6.6 2023-08-22
cover wifi: iwlwifi: updates intended for v6.6 2023-08-22
From: Gregory Greenman <[email protected]>
Hi,
This patch set includes iwlwifi patches intended for v6.6.
A few iwlmei fixes and a related PCIe fix.
Thanks,
Gregory
Avraham Stern (5):
wifi: iwlwifi: pcie: avoid a warning in case prepare card failed
wifi: iwlmei: don't send SAP messages if AMT is disabled
wifi: iwlmei: send HOST_GOES_DOWN message even if wiamt is disabled
wifi: iwlmei: send driver down SAP message only if wiamt is enabled
wifi: iwlmei: don't send nic info with invalid mac address
drivers/net/wireless/intel/iwlwifi/mei/main.c | 70 ++++++++++--------- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 11 +-- 2 files changed, 37 insertions(+), 44 deletions(-)
Signature · 1 line
2.38.1
PATCH 1/5 wifi: iwlwifi: pcie: avoid a warning in case prepare card failed
From: Avraham Stern <[email protected]>
In case CSME holds the NIC and SAP connection is already established, iwl_pcie_prepare_card_hw() during iwl_pci_probe() will fail (which is fine since CSME will release the nic later when asked with a SAP message). In this case tring to grab nic access to read the crf ids will fail with a warning.
Avoid the warning by only trying to read the crf ids in case prepare card succeeded.
--- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/net/wireless/intel/iwlwifi/pcie/drv.c +1 -10
@@ -1132,12 +1132,6 @@ static int get_crf_id(struct iwl_trans *iwl_trans)else sd_reg_ver_addr =SD_REG_VER ; -if (!iwl_trans_grab_nic_access (iwl_trans)) { -IWL_ERR (iwl_trans,"Failed to grab nic access before reading crf id\n" ); - ret = -EIO ; - goto out; - } -/* Enable access to peripheral registers */ val =iwl_read_umac_prph_no_grab (iwl_trans,WFPM_CTRL_REG ); val |=ENABLE_WFPM ;
@@ -1157,9 +1151,6 @@ static int get_crf_id(struct iwl_trans *iwl_trans) iwl_trans->hw_crf_id, iwl_trans->hw_cnv_id, iwl_trans->hw_wfpm_id); -iwl_trans_release_nic_access (iwl_trans); - -out:return ret; }
@@ -1351,6 +1342,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (ret) goto out_free_trans;if (iwl_trans_grab_nic_access (iwl_trans)) { +get_crf_id (iwl_trans);/* all good */ iwl_trans_release_nic_access (iwl_trans); }else {
@@ -1360,7 +1352,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } iwl_trans->hw_rf_id =iwl_read32 (iwl_trans,CSR_HW_RF_ID ); -get_crf_id (iwl_trans);/* * The RF_ID is set to zero in blank OTP so read version to
Signature · 1 line
2.38.1
PATCH 2/5 wifi: iwlmei: don't send SAP messages if AMT is disabled
In reply to [email protected]From: Avraham Stern <[email protected]>
SAP messages should not be sent when AMT is disabled.
--- drivers/net/wireless/intel/iwlwifi/mei/main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/wireless/intel/iwlwifi/mei/main.c +7 -7
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0-only /* -* Copyright (C) 2021-2022 Intel Corporation +* Copyright (C) 2021-2023 Intel Corporation */ #include <linux/etherdevice.h>
@@ -1532,7 +1532,7 @@ void iwl_mei_host_associated(const struct iwl_mei_conn_info *conn_info, mei =mei_cldev_get_drvdata (iwl_mei_global_cldev); -if (!mei && !mei->amt_enabled) +if (!mei || !mei->amt_enabled) goto out;iwl_mei_send_sap_msg_payload (mei->cldev, &msg.hdr);
@@ -1561,7 +1561,7 @@ void iwl_mei_host_disassociated(void) mei =mei_cldev_get_drvdata (iwl_mei_global_cldev); -if (!mei && !mei->amt_enabled) +if (!mei || !mei->amt_enabled) goto out;iwl_mei_send_sap_msg_payload (mei->cldev, &msg.hdr);
@@ -1597,7 +1597,7 @@ void iwl_mei_set_rfkill_state(bool hw_rfkill, bool sw_rfkill) mei =mei_cldev_get_drvdata (iwl_mei_global_cldev); -if (!mei && !mei->amt_enabled) +if (!mei || !mei->amt_enabled) goto out;iwl_mei_send_sap_msg_payload (mei->cldev, &msg.hdr);
@@ -1626,7 +1626,7 @@ void iwl_mei_set_nic_info(const u8 *mac_address, const u8 *nvm_address) mei =mei_cldev_get_drvdata (iwl_mei_global_cldev); -if (!mei && !mei->amt_enabled) +if (!mei || !mei->amt_enabled) goto out;iwl_mei_send_sap_msg_payload (mei->cldev, &msg.hdr);
@@ -1654,7 +1654,7 @@ void iwl_mei_set_country_code(u16 mcc) mei =mei_cldev_get_drvdata (iwl_mei_global_cldev); -if (!mei && !mei->amt_enabled) +if (!mei || !mei->amt_enabled) goto out;iwl_mei_send_sap_msg_payload (mei->cldev, &msg.hdr);
@@ -1680,7 +1680,7 @@ void iwl_mei_set_power_limit(const __le16 *power_limit) mei =mei_cldev_get_drvdata (iwl_mei_global_cldev); -if (!mei && !mei->amt_enabled) +if (!mei || !mei->amt_enabled) goto out;memcpy (msg.sar_chain_info_table, power_limit,sizeof (msg.sar_chain_info_table));
Signature · 1 line
2.38.1
PATCH 3/5 wifi: iwlmei: send HOST_GOES_DOWN message even if wiamt is disabled
In reply to [email protected]From: Avraham Stern <[email protected]>
The HOST_GOES_DOWN message should be sent even if wiamt is disabled. Otherwise wiamt may still use the shared memory (e.g. if enabled later) while it's no longer valid.
--- drivers/net/wireless/intel/iwlwifi/mei/main.c | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-)
drivers/net/wireless/intel/iwlwifi/mei/main.c +19 -23
@@ -2070,33 +2070,29 @@ static void iwl_mei_remove(struct mei_cl_device *cldev)mutex_lock (&iwl_mei_mutex); -if (mei->amt_enabled) { -/* -* Tell CSME that we are going down so that it won't access the -* memory anymore, make sure this message goes through immediately. -*/ - mei->csa_throttled = false; -iwl_mei_send_sap_msg (mei->cldev, -SAP_MSG_NOTIF_HOST_GOES_DOWN ); - -for (i =0 ; i <SEND_SAP_MAX_WAIT_ITERATION ; i++) { -if (!iwl_mei_host_to_me_data_pending (mei)) -break ; +/* Tell CSME that we are going down so that it won't access the +* memory anymore, make sure this message goes through immediately. +*/ + mei->csa_throttled = false; +iwl_mei_send_sap_msg (mei->cldev, +SAP_MSG_NOTIF_HOST_GOES_DOWN ); -msleep (20 ); - } +for (i =0 ; i <SEND_SAP_MAX_WAIT_ITERATION ; i++) { +if (!iwl_mei_host_to_me_data_pending (mei)) +break ; -/* -* If we couldn't make sure that CSME saw the HOST_GOES_DOWN -* message, it means that it will probably keep reading memory -* that we are going to unmap and free, expect IOMMU error -* messages. -*/ -if (i ==SEND_SAP_MAX_WAIT_ITERATION ) -dev_err (&mei->cldev->dev, -"Couldn't get ACK from CSME on HOST_GOES_DOWN message\n" ); +msleep (20 ); } +/* If we couldn't make sure that CSME saw the HOST_GOES_DOWN +* message, it means that it will probably keep reading memory +* that we are going to unmap and free, expect IOMMU error +* messages. +*/ +if (i ==SEND_SAP_MAX_WAIT_ITERATION ) +dev_err (&mei->cldev->dev, +"Couldn't get ACK from CSME on HOST_GOES_DOWN message\n" ); +mutex_unlock (&iwl_mei_mutex);/*
Signature · 1 line
2.38.1
PATCH 4/5 wifi: iwlmei: send driver down SAP message only if wiamt is enabled
In reply to [email protected]From: Avraham Stern <[email protected]>
When wiamt is disabled the driver up SAP message is not sent, so there is no need to send the driver down message as well.
--- drivers/net/wireless/intel/iwlwifi/mei/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mei/main.c +3 -1
@@ -1832,7 +1832,9 @@ void iwl_mei_unregister_complete(void)struct iwl_mei *mei =mei_cldev_get_drvdata (iwl_mei_global_cldev); -iwl_mei_send_sap_msg (mei->cldev,SAP_MSG_NOTIF_WIFIDR_DOWN ); +if (mei->amt_enabled) +iwl_mei_send_sap_msg (mei->cldev, +SAP_MSG_NOTIF_WIFIDR_DOWN ); mei->got_ownership = false; }
Signature · 1 line
2.38.1
PATCH 5/5 wifi: iwlmei: don't send nic info with invalid mac address
In reply to [email protected]From: Avraham Stern <[email protected]>
In case the SAP connection is established before the interface is added, the mac address is still not set. Don't send the nic info SAP message in this case since it will result in sending an invalid mac address. The nic info message will be sent with a valid mac address when the interface is added.
--- drivers/net/wireless/intel/iwlwifi/mei/main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mei/main.c +7 -3
@@ -774,9 +774,13 @@ static void iwl_mei_set_init_conf(struct iwl_mei *mei)iwl_mei_send_sap_msg_payload (mei->cldev, &sar_msg.hdr); } -ether_addr_copy (nic_info_msg.mac_address, iwl_mei_cache.mac_address); -ether_addr_copy (nic_info_msg.nvm_address, iwl_mei_cache.nvm_address); -iwl_mei_send_sap_msg_payload (mei->cldev, &nic_info_msg.hdr); +if (is_valid_ether_addr (iwl_mei_cache.mac_address)) { +ether_addr_copy (nic_info_msg.mac_address, + iwl_mei_cache.mac_address); +ether_addr_copy (nic_info_msg.nvm_address, + iwl_mei_cache.nvm_address); +iwl_mei_send_sap_msg_payload (mei->cldev, &nic_info_msg.hdr); + }iwl_mei_send_sap_msg_payload (mei->cldev, &rfkill_msg.hdr); }
Signature · 1 line
2.38.1