wifi: iwlwifi: mei: don't send SAP commands if AMT is disabled
We should not send any SAP command to CSME if AMT is disabled.
Reported-by: Toke Høiland-Jørgensen <toke@toke.dk>
Fixes: 2da4366f9e
("iwlwifi: mei: add the driver to allow cooperation with CSME")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20221030191011.ea222d41c781.Ifc90ddc3e35187683ff7f59371d792b61c8854c8@changeid
This commit is contained in:
parent
5aa7ce31bd
commit
95170a46b7
1 changed files with 44 additions and 41 deletions
|
@ -596,8 +596,6 @@ iwl_mei_handle_rx_start_ok(struct mei_cl_device *cldev,
|
||||||
const struct iwl_sap_me_msg_start_ok *rsp,
|
const struct iwl_sap_me_msg_start_ok *rsp,
|
||||||
ssize_t len)
|
ssize_t len)
|
||||||
{
|
{
|
||||||
struct iwl_mei *mei = mei_cldev_get_drvdata(cldev);
|
|
||||||
|
|
||||||
if (len != sizeof(*rsp)) {
|
if (len != sizeof(*rsp)) {
|
||||||
dev_err(&cldev->dev,
|
dev_err(&cldev->dev,
|
||||||
"got invalid SAP_ME_MSG_START_OK from CSME firmware\n");
|
"got invalid SAP_ME_MSG_START_OK from CSME firmware\n");
|
||||||
|
@ -616,13 +614,10 @@ iwl_mei_handle_rx_start_ok(struct mei_cl_device *cldev,
|
||||||
|
|
||||||
mutex_lock(&iwl_mei_mutex);
|
mutex_lock(&iwl_mei_mutex);
|
||||||
set_bit(IWL_MEI_STATUS_SAP_CONNECTED, &iwl_mei_status);
|
set_bit(IWL_MEI_STATUS_SAP_CONNECTED, &iwl_mei_status);
|
||||||
/* wifi driver has registered already */
|
/*
|
||||||
if (iwl_mei_cache.ops) {
|
* We'll receive AMT_STATE SAP message in a bit and
|
||||||
iwl_mei_send_sap_msg(mei->cldev,
|
* that will continue the flow
|
||||||
SAP_MSG_NOTIF_WIFIDR_UP);
|
*/
|
||||||
iwl_mei_cache.ops->sap_connected(iwl_mei_cache.priv);
|
|
||||||
}
|
|
||||||
|
|
||||||
mutex_unlock(&iwl_mei_mutex);
|
mutex_unlock(&iwl_mei_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -715,6 +710,13 @@ static void iwl_mei_set_init_conf(struct iwl_mei *mei)
|
||||||
.val = cpu_to_le32(iwl_mei_cache.rf_kill),
|
.val = cpu_to_le32(iwl_mei_cache.rf_kill),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* wifi driver has registered already */
|
||||||
|
if (iwl_mei_cache.ops) {
|
||||||
|
iwl_mei_send_sap_msg(mei->cldev,
|
||||||
|
SAP_MSG_NOTIF_WIFIDR_UP);
|
||||||
|
iwl_mei_cache.ops->sap_connected(iwl_mei_cache.priv);
|
||||||
|
}
|
||||||
|
|
||||||
iwl_mei_send_sap_msg(mei->cldev, SAP_MSG_NOTIF_WHO_OWNS_NIC);
|
iwl_mei_send_sap_msg(mei->cldev, SAP_MSG_NOTIF_WHO_OWNS_NIC);
|
||||||
|
|
||||||
if (iwl_mei_cache.conn_info) {
|
if (iwl_mei_cache.conn_info) {
|
||||||
|
@ -1420,10 +1422,7 @@ void iwl_mei_host_associated(const struct iwl_mei_conn_info *conn_info,
|
||||||
|
|
||||||
mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
|
mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
|
||||||
|
|
||||||
if (!mei)
|
if (!mei && !mei->amt_enabled)
|
||||||
goto out;
|
|
||||||
|
|
||||||
if (!mei->amt_enabled)
|
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
iwl_mei_send_sap_msg_payload(mei->cldev, &msg.hdr);
|
iwl_mei_send_sap_msg_payload(mei->cldev, &msg.hdr);
|
||||||
|
@ -1452,7 +1451,7 @@ void iwl_mei_host_disassociated(void)
|
||||||
|
|
||||||
mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
|
mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
|
||||||
|
|
||||||
if (!mei)
|
if (!mei && !mei->amt_enabled)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
iwl_mei_send_sap_msg_payload(mei->cldev, &msg.hdr);
|
iwl_mei_send_sap_msg_payload(mei->cldev, &msg.hdr);
|
||||||
|
@ -1488,7 +1487,7 @@ void iwl_mei_set_rfkill_state(bool hw_rfkill, bool sw_rfkill)
|
||||||
|
|
||||||
mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
|
mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
|
||||||
|
|
||||||
if (!mei)
|
if (!mei && !mei->amt_enabled)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
iwl_mei_send_sap_msg_payload(mei->cldev, &msg.hdr);
|
iwl_mei_send_sap_msg_payload(mei->cldev, &msg.hdr);
|
||||||
|
@ -1517,7 +1516,7 @@ void iwl_mei_set_nic_info(const u8 *mac_address, const u8 *nvm_address)
|
||||||
|
|
||||||
mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
|
mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
|
||||||
|
|
||||||
if (!mei)
|
if (!mei && !mei->amt_enabled)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
iwl_mei_send_sap_msg_payload(mei->cldev, &msg.hdr);
|
iwl_mei_send_sap_msg_payload(mei->cldev, &msg.hdr);
|
||||||
|
@ -1545,7 +1544,7 @@ void iwl_mei_set_country_code(u16 mcc)
|
||||||
|
|
||||||
mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
|
mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
|
||||||
|
|
||||||
if (!mei)
|
if (!mei && !mei->amt_enabled)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
iwl_mei_send_sap_msg_payload(mei->cldev, &msg.hdr);
|
iwl_mei_send_sap_msg_payload(mei->cldev, &msg.hdr);
|
||||||
|
@ -1571,7 +1570,7 @@ void iwl_mei_set_power_limit(const __le16 *power_limit)
|
||||||
|
|
||||||
mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
|
mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
|
||||||
|
|
||||||
if (!mei)
|
if (!mei && !mei->amt_enabled)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
memcpy(msg.sar_chain_info_table, power_limit, sizeof(msg.sar_chain_info_table));
|
memcpy(msg.sar_chain_info_table, power_limit, sizeof(msg.sar_chain_info_table));
|
||||||
|
@ -1678,9 +1677,10 @@ int iwl_mei_register(void *priv, const struct iwl_mei_ops *ops)
|
||||||
|
|
||||||
/* we have already a SAP connection */
|
/* we have already a SAP connection */
|
||||||
if (iwl_mei_is_connected()) {
|
if (iwl_mei_is_connected()) {
|
||||||
|
if (mei->amt_enabled)
|
||||||
iwl_mei_send_sap_msg(mei->cldev,
|
iwl_mei_send_sap_msg(mei->cldev,
|
||||||
SAP_MSG_NOTIF_WIFIDR_UP);
|
SAP_MSG_NOTIF_WIFIDR_UP);
|
||||||
ops->rfkill(priv, mei->link_prot_state);
|
ops->rfkill(priv, mei->link_prot_state, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -1931,6 +1931,7 @@ static void iwl_mei_remove(struct mei_cl_device *cldev)
|
||||||
|
|
||||||
mutex_lock(&iwl_mei_mutex);
|
mutex_lock(&iwl_mei_mutex);
|
||||||
|
|
||||||
|
if (mei->amt_enabled) {
|
||||||
/*
|
/*
|
||||||
* Tell CSME that we are going down so that it won't access the
|
* Tell CSME that we are going down so that it won't access the
|
||||||
* memory anymore, make sure this message goes through immediately.
|
* memory anymore, make sure this message goes through immediately.
|
||||||
|
@ -1943,17 +1944,19 @@ static void iwl_mei_remove(struct mei_cl_device *cldev)
|
||||||
if (!iwl_mei_host_to_me_data_pending(mei))
|
if (!iwl_mei_host_to_me_data_pending(mei))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
msleep(5);
|
msleep(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we couldn't make sure that CSME saw the HOST_GOES_DOWN message,
|
* If we couldn't make sure that CSME saw the HOST_GOES_DOWN
|
||||||
* it means that it will probably keep reading memory that we are going
|
* message, it means that it will probably keep reading memory
|
||||||
* to unmap and free, expect IOMMU error messages.
|
* that we are going to unmap and free, expect IOMMU error
|
||||||
|
* messages.
|
||||||
*/
|
*/
|
||||||
if (i == SEND_SAP_MAX_WAIT_ITERATION)
|
if (i == SEND_SAP_MAX_WAIT_ITERATION)
|
||||||
dev_err(&mei->cldev->dev,
|
dev_err(&mei->cldev->dev,
|
||||||
"Couldn't get ACK from CSME on HOST_GOES_DOWN message\n");
|
"Couldn't get ACK from CSME on HOST_GOES_DOWN message\n");
|
||||||
|
}
|
||||||
|
|
||||||
mutex_unlock(&iwl_mei_mutex);
|
mutex_unlock(&iwl_mei_mutex);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue