wifi: iwlwifi: pcie: move ME check data to pcie
authorJohannes Berg <johannes.berg@intel.com>
Sat, 3 May 2025 19:44:21 +0000 (22:44 +0300)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Wed, 7 May 2025 03:08:00 +0000 (06:08 +0300)
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
drivers/net/wireless/intel/iwlwifi/iwl-trans.h
drivers/net/wireless/intel/iwlwifi/pcie/drv.c
drivers/net/wireless/intel/iwlwifi/pcie/internal.h
drivers/net/wireless/intel/iwlwifi/pcie/trans.c

index 0f161deb0ec753f219e21ab906ce20f0f2f958b3..aa32305e05f643d3683ce58f910953f9064cd306 100644 (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;
 
index 6bb7de8c43fe214202bf6c19a512eadca2ab41df..27023baa6565f99b51ad294e580dde96d3bc5b93 100644 (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);
 
index c0a670994ce7ab224bde4c68f9341d3ca303483e..2cf2936dbf2d1b2f8fc8bd77dadcdf235a886a8c 100644 (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 *
index b28aaf891bb5cb57cbd673d38450c8a24b941e68..5b8db061792f482c5815a8dc3a915d4f6afd83ec 100644 (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";