public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] soc/tegra: cbb: Bug fixes for CBB 2.0 driver
@ 2026-01-21 10:12 Sumit Gupta
  2026-01-21 10:12 ` [PATCH 1/3] soc/tegra: cbb: set ERD on resume for err interrupt Sumit Gupta
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sumit Gupta @ 2026-01-21 10:12 UTC (permalink / raw)
  To: treding, jonathanh, linux-tegra, linux-kernel; +Cc: bbasu, sumitg

Bug fixes for Tegra CBB 2.0 driver addressing resume handling,
fabric lookup table sizing, and cross-fabric timeout lookup.

Sumit Gupta (3):
  soc/tegra: cbb: set ERD on resume for err interrupt
  soc/tegra: cbb: fix incorrect ARRAY_SIZE in fabric lookup tables
  soc/tegra: cbb: fix cross-fabric target timeout lookup

 drivers/soc/tegra/cbb/tegra234-cbb.c | 35 +++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 3 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] soc/tegra: cbb: set ERD on resume for err interrupt
  2026-01-21 10:12 [PATCH 0/3] soc/tegra: cbb: Bug fixes for CBB 2.0 driver Sumit Gupta
@ 2026-01-21 10:12 ` Sumit Gupta
  2026-01-21 10:12 ` [PATCH 2/3] soc/tegra: cbb: fix incorrect ARRAY_SIZE in fabric lookup tables Sumit Gupta
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Sumit Gupta @ 2026-01-21 10:12 UTC (permalink / raw)
  To: treding, jonathanh, linux-tegra, linux-kernel; +Cc: bbasu, sumitg

Set the Error Response Disable (ERD) bit to mask SError responses
and use interrupt-based error reporting. When the ERD bit is set,
inband error responses to the initiator via SError are suppressed,
and fabric errors are reported via an interrupt instead.

The register is set during boot but the info is lost during system
suspend and needs to be set again on resume.

Fixes: fc2f151d2314 ("soc/tegra: cbb: Add driver for Tegra234 CBB 2.0")
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
---
 drivers/soc/tegra/cbb/tegra234-cbb.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/soc/tegra/cbb/tegra234-cbb.c b/drivers/soc/tegra/cbb/tegra234-cbb.c
index a9adbcecd47c..518733a06658 100644
--- a/drivers/soc/tegra/cbb/tegra234-cbb.c
+++ b/drivers/soc/tegra/cbb/tegra234-cbb.c
@@ -1586,6 +1586,10 @@ static int __maybe_unused tegra234_cbb_resume_noirq(struct device *dev)
 {
 	struct tegra234_cbb *cbb = dev_get_drvdata(dev);
 
+	/* set ERD bit to mask SError and generate interrupt to report error */
+	if (cbb->fabric->off_mask_erd)
+		tegra234_cbb_mask_serror(cbb);
+
 	tegra234_cbb_error_enable(&cbb->base);
 
 	dev_dbg(dev, "%s resumed\n", cbb->fabric->fab_list[cbb->fabric->fab_id].name);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] soc/tegra: cbb: fix incorrect ARRAY_SIZE in fabric lookup tables
  2026-01-21 10:12 [PATCH 0/3] soc/tegra: cbb: Bug fixes for CBB 2.0 driver Sumit Gupta
  2026-01-21 10:12 ` [PATCH 1/3] soc/tegra: cbb: set ERD on resume for err interrupt Sumit Gupta
@ 2026-01-21 10:12 ` Sumit Gupta
  2026-01-21 10:12 ` [PATCH 3/3] soc/tegra: cbb: fix cross-fabric target timeout lookup Sumit Gupta
  2026-03-27 14:31 ` [PATCH 0/3] soc/tegra: cbb: Bug fixes for CBB 2.0 driver Thierry Reding
  3 siblings, 0 replies; 5+ messages in thread
From: Sumit Gupta @ 2026-01-21 10:12 UTC (permalink / raw)
  To: treding, jonathanh, linux-tegra, linux-kernel; +Cc: bbasu, sumitg

Fix incorrect ARRAY_SIZE usage in fabric lookup tables which could
cause out-of-bounds access during target timeout lookup.

Fixes: 25de5c8fe0801 ("soc/tegra: cbb: Improve handling for per SoC fabric data")
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
---
 drivers/soc/tegra/cbb/tegra234-cbb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/tegra/cbb/tegra234-cbb.c b/drivers/soc/tegra/cbb/tegra234-cbb.c
index 518733a06658..626e0e820329 100644
--- a/drivers/soc/tegra/cbb/tegra234-cbb.c
+++ b/drivers/soc/tegra/cbb/tegra234-cbb.c
@@ -881,7 +881,7 @@ static const struct tegra234_fabric_lookup tegra234_cbb_fab_list[] = {
 				 ARRAY_SIZE(tegra234_common_target_map) },
 	[T234_AON_FABRIC_ID] = { "aon-fabric", true,
 				 tegra234_aon_target_map,
-				 ARRAY_SIZE(tegra234_bpmp_target_map) },
+				 ARRAY_SIZE(tegra234_aon_target_map) },
 	[T234_PSC_FABRIC_ID] = { "psc-fabric" },
 	[T234_BPMP_FABRIC_ID] = { "bpmp-fabric", true,
 				 tegra234_bpmp_target_map,
@@ -1160,7 +1160,7 @@ static const struct tegra234_fabric_lookup tegra241_cbb_fab_list[] = {
 	[T234_CBB_FABRIC_ID]  = { "cbb-fabric", true,
 				  tegra241_cbb_target_map, ARRAY_SIZE(tegra241_cbb_target_map) },
 	[T234_BPMP_FABRIC_ID] = { "bpmp-fabric", true,
-				  tegra241_bpmp_target_map, ARRAY_SIZE(tegra241_cbb_target_map) },
+				  tegra241_bpmp_target_map, ARRAY_SIZE(tegra241_bpmp_target_map) },
 };
 static const struct tegra234_cbb_fabric tegra241_cbb_fabric = {
 	.fab_id = T234_CBB_FABRIC_ID,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] soc/tegra: cbb: fix cross-fabric target timeout lookup
  2026-01-21 10:12 [PATCH 0/3] soc/tegra: cbb: Bug fixes for CBB 2.0 driver Sumit Gupta
  2026-01-21 10:12 ` [PATCH 1/3] soc/tegra: cbb: set ERD on resume for err interrupt Sumit Gupta
  2026-01-21 10:12 ` [PATCH 2/3] soc/tegra: cbb: fix incorrect ARRAY_SIZE in fabric lookup tables Sumit Gupta
@ 2026-01-21 10:12 ` Sumit Gupta
  2026-03-27 14:31 ` [PATCH 0/3] soc/tegra: cbb: Bug fixes for CBB 2.0 driver Thierry Reding
  3 siblings, 0 replies; 5+ messages in thread
From: Sumit Gupta @ 2026-01-21 10:12 UTC (permalink / raw)
  To: treding, jonathanh, linux-tegra, linux-kernel; +Cc: bbasu, sumitg

When a fabric receives an error interrupt, the error may have
occurred on a different fabric. The target timeout lookup was using
the wrong base address (cbb->regs) with offsets from a different
fabric's target map, causing a kernel page fault.

  Unable to handle kernel paging request at virtual address ffff80000954cc00
  pc : tegra234_cbb_get_tmo_slv+0xc/0x28
  Call trace:
   tegra234_cbb_get_tmo_slv+0xc/0x28
   print_err_notifier+0x6c0/0x7d0
   tegra234_cbb_isr+0xe4/0x1b4

Add tegra234_cbb_get_fabric() to look up the correct fabric device
using fab_id, and use its base address for accessing target timeout
registers.

Fixes: 25de5c8fe0801 ("soc/tegra: cbb: Improve handling for per SoC fabric data")
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
---
 drivers/soc/tegra/cbb/tegra234-cbb.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/tegra/cbb/tegra234-cbb.c b/drivers/soc/tegra/cbb/tegra234-cbb.c
index 626e0e820329..7e387fc54c6b 100644
--- a/drivers/soc/tegra/cbb/tegra234-cbb.c
+++ b/drivers/soc/tegra/cbb/tegra234-cbb.c
@@ -313,12 +313,37 @@ static void tegra234_cbb_lookup_apbslv(struct seq_file *file, const char *target
 	}
 }
 
+static struct tegra234_cbb *tegra234_cbb_get_fabric(u8 fab_id)
+{
+	struct tegra_cbb *entry;
+
+	list_for_each_entry(entry, &cbb_list, node) {
+		struct tegra234_cbb *priv = to_tegra234_cbb(entry);
+
+		if (priv->fabric->fab_id == fab_id)
+			return priv;
+	}
+
+	return NULL;
+}
+
 static void tegra234_sw_lookup_target_timeout(struct seq_file *file, struct tegra234_cbb *cbb,
 					      u8 target_id, u8 fab_id)
 {
 	const struct tegra234_target_lookup *map = cbb->fabric->fab_list[fab_id].target_map;
+	struct tegra234_cbb *target_cbb = NULL;
 	void __iomem *addr;
 
+	if (fab_id == cbb->fabric->fab_id)
+		target_cbb = cbb;
+	else
+		target_cbb = tegra234_cbb_get_fabric(fab_id);
+
+	if (!target_cbb) {
+		dev_err(cbb->base.dev, "could not find fabric for fab_id:%d\n", fab_id);
+		return;
+	}
+
 	if (target_id >= cbb->fabric->fab_list[fab_id].max_targets) {
 		tegra_cbb_print_err(file, "\t  Invalid target_id:%d\n", target_id);
 		return;
@@ -341,7 +366,7 @@ static void tegra234_sw_lookup_target_timeout(struct seq_file *file, struct tegr
 	 *	e) Goto step-a till all bits are set.
 	 */
 
-	addr = cbb->regs + map[target_id].offset;
+	addr = target_cbb->regs + map[target_id].offset;
 
 	if (strstr(map[target_id].name, "AXI2APB")) {
 		addr += APB_BLOCK_TMO_STATUS_0;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] soc/tegra: cbb: Bug fixes for CBB 2.0 driver
  2026-01-21 10:12 [PATCH 0/3] soc/tegra: cbb: Bug fixes for CBB 2.0 driver Sumit Gupta
                   ` (2 preceding siblings ...)
  2026-01-21 10:12 ` [PATCH 3/3] soc/tegra: cbb: fix cross-fabric target timeout lookup Sumit Gupta
@ 2026-03-27 14:31 ` Thierry Reding
  3 siblings, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2026-03-27 14:31 UTC (permalink / raw)
  To: Sumit Gupta; +Cc: treding, jonathanh, linux-tegra, linux-kernel, bbasu

[-- Attachment #1: Type: text/plain, Size: 566 bytes --]

On Wed, Jan 21, 2026 at 03:42:02PM +0530, Sumit Gupta wrote:
> Bug fixes for Tegra CBB 2.0 driver addressing resume handling,
> fabric lookup table sizing, and cross-fabric timeout lookup.
> 
> Sumit Gupta (3):
>   soc/tegra: cbb: set ERD on resume for err interrupt
>   soc/tegra: cbb: fix incorrect ARRAY_SIZE in fabric lookup tables
>   soc/tegra: cbb: fix cross-fabric target timeout lookup
> 
>  drivers/soc/tegra/cbb/tegra234-cbb.c | 35 +++++++++++++++++++++++++---
>  1 file changed, 32 insertions(+), 3 deletions(-)

Applied, thanks.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-03-27 14:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-21 10:12 [PATCH 0/3] soc/tegra: cbb: Bug fixes for CBB 2.0 driver Sumit Gupta
2026-01-21 10:12 ` [PATCH 1/3] soc/tegra: cbb: set ERD on resume for err interrupt Sumit Gupta
2026-01-21 10:12 ` [PATCH 2/3] soc/tegra: cbb: fix incorrect ARRAY_SIZE in fabric lookup tables Sumit Gupta
2026-01-21 10:12 ` [PATCH 3/3] soc/tegra: cbb: fix cross-fabric target timeout lookup Sumit Gupta
2026-03-27 14:31 ` [PATCH 0/3] soc/tegra: cbb: Bug fixes for CBB 2.0 driver Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox