diff mbox series

[1/4] soc/tegra: cbb: use correct master_id mask for cbb noc in Tegra194

Message ID 20221109135717.3809-1-sumitg@nvidia.com
State Accepted
Headers show
Series [1/4] soc/tegra: cbb: use correct master_id mask for cbb noc in Tegra194 | expand

Commit Message

Sumit Gupta Nov. 9, 2022, 1:57 p.m. UTC
In Tegra194 SoC, master_id bit range is different between
cluster NOC and CBB NOC. Currently same bit range is used
which results in wrong master_id value. Due to this,
illegal accesses from the CCPLEX master do not result in a
crash as expected. Fix this by using the correct range for
the CBB NOC.
Finally, it is only necessary to extract the master_id when
the erd_mask_inband_err flag is set because when this is not
set, a crash is always triggered.

Fixes: b71344221466 ("soc/tegra: cbb: Add CBB 1.0 driver for Tegra194")
Fixes: fc2f151d2314 ("soc/tegra: cbb: Add driver for Tegra234 CBB 2.0")
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
---
 drivers/soc/tegra/cbb/tegra194-cbb.c | 14 +++++++-------
 drivers/soc/tegra/cbb/tegra234-cbb.c | 13 ++++++-------
 2 files changed, 13 insertions(+), 14 deletions(-)

Comments

Thierry Reding Nov. 11, 2022, 2:41 p.m. UTC | #1
From: Thierry Reding <treding@nvidia.com>

On Wed, 9 Nov 2022 19:27:14 +0530, Sumit Gupta wrote:
> In Tegra194 SoC, master_id bit range is different between
> cluster NOC and CBB NOC. Currently same bit range is used
> which results in wrong master_id value. Due to this,
> illegal accesses from the CCPLEX master do not result in a
> crash as expected. Fix this by using the correct range for
> the CBB NOC.
> Finally, it is only necessary to extract the master_id when
> the erd_mask_inband_err flag is set because when this is not
> set, a crash is always triggered.
> 
> [...]

Applied, thanks!

[1/4] soc/tegra: cbb: use correct master_id mask for cbb noc in Tegra194
      (no commit info)
[2/4] soc/tegra: cbb: update slave maps for Tegra234
      (no commit info)
[3/4] soc/tegra: cbb: add checks for potential out of bound errors
      (no commit info)
[4/4] soc/tegra: cbb: check firewall before enabling error reporting
      (no commit info)

Best regards,
diff mbox series

Patch

diff --git a/drivers/soc/tegra/cbb/tegra194-cbb.c b/drivers/soc/tegra/cbb/tegra194-cbb.c
index 1ae0bd9a1ac1..2e952c6f7c9e 100644
--- a/drivers/soc/tegra/cbb/tegra194-cbb.c
+++ b/drivers/soc/tegra/cbb/tegra194-cbb.c
@@ -102,8 +102,6 @@ 
 #define CLUSTER_NOC_VQC GENMASK(17, 16)
 #define CLUSTER_NOC_MSTR_ID GENMASK(21, 18)
 
-#define USRBITS_MSTR_ID GENMASK(21, 18)
-
 #define CBB_ERR_OPC GENMASK(4, 1)
 #define CBB_ERR_ERRCODE GENMASK(10, 8)
 #define CBB_ERR_LEN1 GENMASK(27, 16)
@@ -2038,15 +2036,17 @@  static irqreturn_t tegra194_cbb_err_isr(int irq, void *data)
 					    smp_processor_id(), priv->noc->name, priv->res->start,
 					    irq);
 
-			mstr_id =  FIELD_GET(USRBITS_MSTR_ID, priv->errlog5) - 1;
 			is_fatal = print_errlog(NULL, priv, status);
 
 			/*
-			 * If illegal request is from CCPLEX(0x1)
-			 * initiator then call BUG() to crash system.
+			 * If illegal request is from CCPLEX(0x1) initiator
+			 * and error is fatal then call BUG() to crash system.
 			 */
-			if ((mstr_id == 0x1) && priv->noc->erd_mask_inband_err)
-				is_inband_err = 1;
+			if (priv->noc->erd_mask_inband_err) {
+				mstr_id =  FIELD_GET(CBB_NOC_MSTR_ID, priv->errlog5);
+				if (mstr_id == 0x1)
+					is_inband_err = 1;
+			}
 		}
 	}
 
diff --git a/drivers/soc/tegra/cbb/tegra234-cbb.c b/drivers/soc/tegra/cbb/tegra234-cbb.c
index 3528f9e15d5c..654c3d164606 100644
--- a/drivers/soc/tegra/cbb/tegra234-cbb.c
+++ b/drivers/soc/tegra/cbb/tegra234-cbb.c
@@ -92,7 +92,6 @@  struct tegra234_slave_lookup {
 struct tegra234_cbb_fabric {
 	const char *name;
 	phys_addr_t off_mask_erd;
-	bool erd_mask_inband_err;
 	const char * const *master_id;
 	unsigned int notifier_offset;
 	const struct tegra_cbb_error *errors;
@@ -525,14 +524,14 @@  static irqreturn_t tegra234_cbb_isr(int irq, void *data)
 			if (err)
 				goto unlock;
 
-			mstr_id =  FIELD_GET(USRBITS_MSTR_ID, priv->mn_user_bits);
-
 			/*
-			 * If illegal request is from CCPLEX(id:0x1) master then call BUG() to
-			 * crash system.
+			 * If illegal request is from CCPLEX(id:0x1) master then call WARN()
 			 */
-			if ((mstr_id == 0x1) && priv->fabric->off_mask_erd)
-				is_inband_err = 1;
+			if (priv->fabric->off_mask_erd) {
+				mstr_id =  FIELD_GET(USRBITS_MSTR_ID, priv->mn_user_bits);
+				if (mstr_id == 0x1)
+					is_inband_err = 1;
+			}
 		}
 	}