Browse Source

cnss2: move pci/mhi register dump after rddm mode trigger

Move pci/mhi register dump after rddm mode trigger
in case of smmu fault.

Change-Id: I3e2c4c5725f614b7b12e95d3a13ec0250a631608
CRs-Fixed: 3291781
Sandeep Singh 2 years ago
parent
commit
eeed8341c6
3 changed files with 23 additions and 6 deletions
  1. 21 6
      cnss2/pci.c
  2. 1 0
      cnss2/pci.h
  3. 1 0
      cnss2/pci_qcom.c

+ 21 - 6
cnss2/pci.c

@@ -4755,6 +4755,16 @@ static int cnss_pci_assert_host_sol(struct cnss_pci_data *pci_priv)
 	return 0;
 }
 
+static void cnss_pci_mhi_reg_dump(struct cnss_pci_data *pci_priv)
+{
+	if (!cnss_pci_check_link_status(pci_priv))
+		cnss_mhi_debug_reg_dump(pci_priv);
+
+	cnss_pci_soc_scratch_reg_dump(pci_priv);
+	cnss_pci_dump_misc_reg(pci_priv);
+	cnss_pci_dump_shadow_reg(pci_priv);
+}
+
 int cnss_pci_force_fw_assert_hdlr(struct cnss_pci_data *pci_priv)
 {
 	int ret;
@@ -4773,12 +4783,8 @@ int cnss_pci_force_fw_assert_hdlr(struct cnss_pci_data *pci_priv)
 
 	cnss_auto_resume(&pci_priv->pci_dev->dev);
 
-	if (!cnss_pci_check_link_status(pci_priv))
-		cnss_mhi_debug_reg_dump(pci_priv);
-
-	cnss_pci_soc_scratch_reg_dump(pci_priv);
-	cnss_pci_dump_misc_reg(pci_priv);
-	cnss_pci_dump_shadow_reg(pci_priv);
+	if (!pci_priv->is_smmu_fault)
+		cnss_pci_mhi_reg_dump(pci_priv);
 
 	/* If link is still down here, directly trigger link down recovery */
 	ret = cnss_pci_check_link_status(pci_priv);
@@ -4789,6 +4795,10 @@ int cnss_pci_force_fw_assert_hdlr(struct cnss_pci_data *pci_priv)
 
 	ret = cnss_pci_set_mhi_state(pci_priv, CNSS_MHI_TRIGGER_RDDM);
 	if (ret) {
+		if (pci_priv->is_smmu_fault) {
+			cnss_pci_mhi_reg_dump(pci_priv);
+			pci_priv->is_smmu_fault = false;
+		}
 		if (!test_bit(CNSS_MHI_POWER_ON, &pci_priv->mhi_state) ||
 		    test_bit(CNSS_MHI_POWERING_OFF, &pci_priv->mhi_state)) {
 			cnss_pr_dbg("MHI is not powered on, ignore RDDM failure\n");
@@ -4803,6 +4813,11 @@ int cnss_pci_force_fw_assert_hdlr(struct cnss_pci_data *pci_priv)
 		return ret;
 	}
 
+	if (pci_priv->is_smmu_fault) {
+		cnss_pci_mhi_reg_dump(pci_priv);
+		pci_priv->is_smmu_fault = false;
+	}
+
 	if (!test_bit(CNSS_DEV_ERR_NOTIFY, &plat_priv->driver_state)) {
 		mod_timer(&pci_priv->dev_rddm_timer,
 			  jiffies + msecs_to_jiffies(DEV_RDDM_TIMEOUT));

+ 1 - 0
cnss2/pci.h

@@ -156,6 +156,7 @@ struct cnss_pci_data {
 	unsigned long misc_reg_dev_mask;
 	u8 iommu_geometry;
 	bool drv_supported;
+	bool is_smmu_fault;
 };
 
 static inline void cnss_set_pci_priv(struct pci_dev *pci_dev, void *data)

+ 1 - 0
cnss2/pci_qcom.c

@@ -449,6 +449,7 @@ static int cnss_pci_smmu_fault_handler(struct iommu_domain *domain,
 		return -ENODEV;
 	}
 
+	pci_priv->is_smmu_fault = true;
 	cnss_pci_update_status(pci_priv, CNSS_FW_DOWN);
 	cnss_force_fw_assert(&pci_priv->pci_dev->dev);