All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sumit Gupta <sumitg@nvidia.com>
To: <treding@nvidia.com>, <jonathanh@nvidia.com>, <robh@kernel.org>,
	<krzk+dt@kernel.org>, <conor+dt@kernel.org>,
	<linux-tegra@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<devicetree@vger.kernel.org>
Cc: <--to=tbergstrom@nvidia.com>, <bbasu@nvidia.com>, <sumitg@nvidia.com>
Subject: [Patch 5/8] soc: tegra: cbb: support hw lookup to get timed out target address
Date: Fri, 30 May 2025 19:03:33 +0530	[thread overview]
Message-ID: <20250530133336.1419971-6-sumitg@nvidia.com> (raw)
In-Reply-To: <20250530133336.1419971-1-sumitg@nvidia.com>

Add support for hardware based lookup to get address of timed out
target node. This features is added in upcoming SoCs and avoids
need of creating per fabric target_map tables in driver.

Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
---
 drivers/soc/tegra/cbb/tegra234-cbb.c | 41 ++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 5 deletions(-)

diff --git a/drivers/soc/tegra/cbb/tegra234-cbb.c b/drivers/soc/tegra/cbb/tegra234-cbb.c
index 10f57f17fee8..aab0cd85dea5 100644
--- a/drivers/soc/tegra/cbb/tegra234-cbb.c
+++ b/drivers/soc/tegra/cbb/tegra234-cbb.c
@@ -30,13 +30,17 @@
 #define FABRIC_EN_CFG_ADDR_LOW_0		0x80
 #define FABRIC_EN_CFG_ADDR_HI_0			0x84
 
+#define FABRIC_EN_CFG_TARGET_NODE_ADDR_INDEX_0_0 0x100
+#define FABRIC_EN_CFG_TARGET_NODE_ADDR_LOW_0    0x140
+#define FABRIC_EN_CFG_TARGET_NODE_ADDR_HI_0     0x144
+
 #define FABRIC_MN_INITIATOR_ERR_EN_0		0x200
 #define FABRIC_MN_INITIATOR_ERR_FORCE_0		0x204
-#define FABRIC_MN_INITIATOR_ERR_STATUS_0		0x208
-#define FABRIC_MN_INITIATOR_ERR_OVERFLOW_STATUS_0	0x20c
+#define FABRIC_MN_INITIATOR_ERR_STATUS_0	0x208
+#define FABRIC_MN_INITIATOR_ERR_OVERFLOW_STATUS_0 0x20c
 
 #define FABRIC_MN_INITIATOR_LOG_ERR_STATUS_0	0x300
-#define FABRIC_MN_INITIATOR_LOG_ADDR_LOW_0		0x304
+#define FABRIC_MN_INITIATOR_LOG_ADDR_LOW_0	0x304
 #define FABRIC_MN_INITIATOR_LOG_ADDR_HIGH_0	0x308
 #define FABRIC_MN_INITIATOR_LOG_ATTRIBUTES0_0	0x30c
 #define FABRIC_MN_INITIATOR_LOG_ATTRIBUTES1_0	0x310
@@ -320,6 +324,23 @@ static void tegra234_sw_lookup_target_timeout(struct seq_file *file, struct tegr
 	}
 }
 
+static void tegra234_hw_lookup_target_timeout(struct seq_file *file, struct tegra234_cbb *cbb,
+					      u8 target_id, u8 fab_id)
+{
+	unsigned int notifier = cbb->fabric->notifier_offset;
+	u32 hi, lo;
+	u64 addr;
+
+	writel(target_id, cbb->regs + notifier + FABRIC_EN_CFG_TARGET_NODE_ADDR_INDEX_0_0);
+
+	hi = readl(cbb->regs + notifier + FABRIC_EN_CFG_TARGET_NODE_ADDR_HI_0);
+	lo = readl(cbb->regs + notifier + FABRIC_EN_CFG_TARGET_NODE_ADDR_LOW_0);
+
+	addr = (u64)hi << 32 | lo;
+
+	tegra_cbb_print_err(file, "\t  Target Node Addr : %#llx\n", addr);
+}
+
 static void tegra234_cbb_print_error(struct seq_file *file, struct tegra234_cbb *cbb, u32 status,
 				     u32 overflow)
 {
@@ -445,8 +466,18 @@ static void print_errlog_err(struct seq_file *file, struct tegra234_cbb *cbb)
 	if (!cbb->fabric->fab_list[fab_id].is_lookup)
 		return;
 
-	if (!strcmp(cbb->fabric->errors[cbb->type].code, "TIMEOUT_ERR"))
-		tegra234_sw_lookup_target_timeout(file, cbb, target_id, fab_id);
+	/*
+	 * If is_lookup field is set in fabric_lookup table of soc data, it
+	 * means that address lookup of target is supported for Timeout errors.
+	 * If is_lookup is set and the target_map is not populated making
+	 * max_targets as zero, then it means HW lookup is to be performed.
+	 */
+	if (!strcmp(cbb->fabric->errors[cbb->type].code, "TIMEOUT_ERR")) {
+		if (cbb->fabric->fab_list[fab_id].max_targets)
+			tegra234_sw_lookup_target_timeout(file, cbb, target_id, fab_id);
+		else
+			tegra234_hw_lookup_target_timeout(file, cbb, target_id, fab_id);
+	}
 
 	return;
 }
-- 
2.25.1


  parent reply	other threads:[~2025-05-30 13:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-30 13:33 [Patch 0/8] Support for Tegra264 and GB10 in CBB driver Sumit Gupta
2025-05-30 13:33 ` [Patch 1/8] soc: tegra: cbb: clear err force register with err status Sumit Gupta
2025-05-30 13:33 ` [Patch 2/8] soc: tegra: cbb: change master-slave to initiator-target Sumit Gupta
2025-05-30 13:33 ` [Patch 3/8] soc: tegra: cbb: make error interrupt enable and status per SoC Sumit Gupta
2025-05-30 13:33 ` [Patch 4/8] soc: tegra: cbb: improve handling for per SoC fabric data Sumit Gupta
2025-05-30 13:33 ` Sumit Gupta [this message]
2025-05-30 13:33 ` [Patch 6/8] dt-bindings: arm: tegra: Add NVIDIA Tegra264 CBB 2.0 binding Sumit Gupta
2025-06-03  7:09   ` Krzysztof Kozlowski
2025-05-30 13:33 ` [Patch 7/8] soc: tegra: cbb: add support for cbb fabrics in Tegra264 Sumit Gupta
2025-05-30 13:33 ` [Patch 8/8] soc: tegra: cbb: add support for cbb fabrics in GB10 Sumit Gupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250530133336.1419971-6-sumitg@nvidia.com \
    --to=sumitg@nvidia.com \
    --cc=--to=tbergstrom@nvidia.com \
    --cc=bbasu@nvidia.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=treding@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.