wifi: iwlwifi: pcie: move ME check data to pcie

There's no reason for this data to be in the generic transport
struct, so move it to pcie.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250503224231.0b74726b2651.I2c6bff6945b9288eadf242895906ab1c2cb76389@changeid
This commit is contained in:
Johannes Berg
2025-05-03 22:44:21 +03:00
committed by Miri Korenblit
parent 6a2808a566
commit cd6d6de694
4 changed files with 22 additions and 18 deletions

View File

@@ -885,9 +885,6 @@ struct iwl_txq {
* @restart.wk: restart worker
* @restart.mode: reset/restart error mode information
* @restart.during_reset: error occurred during previous software reset
* @me_recheck_wk: worker to recheck WiAMT/CSME presence
* @me_present: WiAMT/CSME is detected as present (1), not present (0)
* or unknown (-1, so can still use it as a boolean safely)
* @trans_specific: data for the specific transport this is allocated for/with
* @dsbr_urm_fw_dependent: switch to URM based on fw settings
* @dsbr_urm_permanent: switch to URM permanently
@@ -973,9 +970,6 @@ struct iwl_trans {
bool during_reset;
} restart;
struct delayed_work me_recheck_wk;
s8 me_present;
u8 request_top_reset:1,
do_top_reset:1;

View File

@@ -1719,21 +1719,23 @@ EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_pci_find_dev_info);
static void iwl_pcie_recheck_me_status(struct work_struct *wk)
{
struct iwl_trans *trans = container_of(wk, typeof(*trans),
me_recheck_wk.work);
struct iwl_trans_pcie *trans_pcie = container_of(wk,
typeof(*trans_pcie),
me_recheck_wk.work);
u32 val;
val = iwl_read32(trans, CSR_HW_IF_CONFIG_REG);
trans->me_present = !!(val & CSR_HW_IF_CONFIG_REG_IAMT_UP);
val = iwl_read32(trans_pcie->trans, CSR_HW_IF_CONFIG_REG);
trans_pcie->me_present = !!(val & CSR_HW_IF_CONFIG_REG_IAMT_UP);
}
static void iwl_pcie_check_me_status(struct iwl_trans *trans)
{
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
u32 val;
trans->me_present = -1;
trans_pcie->me_present = -1;
INIT_DELAYED_WORK(&trans->me_recheck_wk,
INIT_DELAYED_WORK(&trans_pcie->me_recheck_wk,
iwl_pcie_recheck_me_status);
/* we don't have a good way of determining this until BZ */
@@ -1742,7 +1744,7 @@ static void iwl_pcie_check_me_status(struct iwl_trans *trans)
val = iwl_read_prph(trans, CNVI_SCU_REG_FOR_ECO_1);
if (val & CNVI_SCU_REG_FOR_ECO_1_WIAMT_KNOWN) {
trans->me_present =
trans_pcie->me_present =
!!(val & CNVI_SCU_REG_FOR_ECO_1_WIAMT_PRESENT);
return;
}
@@ -1750,12 +1752,12 @@ static void iwl_pcie_check_me_status(struct iwl_trans *trans)
val = iwl_read32(trans, CSR_HW_IF_CONFIG_REG);
if (val & (CSR_HW_IF_CONFIG_REG_ME_OWN |
CSR_HW_IF_CONFIG_REG_IAMT_UP)) {
trans->me_present = 1;
trans_pcie->me_present = 1;
return;
}
/* recheck again later, ME might still be initializing */
schedule_delayed_work(&trans->me_recheck_wk, HZ);
schedule_delayed_work(&trans_pcie->me_recheck_wk, HZ);
}
static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
@@ -1904,11 +1906,12 @@ out_free_trans:
static void iwl_pci_remove(struct pci_dev *pdev)
{
struct iwl_trans *trans = pci_get_drvdata(pdev);
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
if (!trans)
return;
cancel_delayed_work_sync(&trans->me_recheck_wk);
cancel_delayed_work_sync(&trans_pcie->me_recheck_wk);
iwl_drv_stop(trans->drv);

View File

@@ -420,6 +420,9 @@ struct iwl_pcie_txqs {
* @isr_stats: interrupt statistics
* @napi_dev: (fake) netdev for NAPI registration
* @txqs: transport tx queues data.
* @me_present: WiAMT/CSME is detected as present (1), not present (0)
* or unknown (-1, so can still use it as a boolean safely)
* @me_recheck_wk: worker to recheck WiAMT/CSME presence
*/
struct iwl_trans_pcie {
struct iwl_rxq *rxq;
@@ -519,6 +522,9 @@ struct iwl_trans_pcie {
char rf_name[32];
struct iwl_pcie_txqs txqs;
s8 me_present;
struct delayed_work me_recheck_wk;
};
static inline struct iwl_trans_pcie *

View File

@@ -2348,6 +2348,7 @@ out:
void iwl_trans_pcie_reset(struct iwl_trans *trans, enum iwl_reset_mode mode)
{
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
struct iwl_trans_pcie_removal *removal;
char _msg = 0, *msg = &_msg;
@@ -2357,9 +2358,9 @@ void iwl_trans_pcie_reset(struct iwl_trans *trans, enum iwl_reset_mode mode)
if (test_bit(STATUS_TRANS_DEAD, &trans->status))
return;
if (trans->me_present && mode == IWL_RESET_MODE_PROD_RESET) {
if (trans_pcie->me_present && mode == IWL_RESET_MODE_PROD_RESET) {
mode = IWL_RESET_MODE_FUNC_RESET;
if (trans->me_present < 0)
if (trans_pcie->me_present < 0)
msg = " instead of product reset as ME may be present";
else
msg = " instead of product reset as ME is present";