Skip to contentSkip to conversation

memory: tegra: Update mc interrupts

PATCH In review Ashish Mhetre 4 participants 25 messages Jan 11, 2022 – Jan 21, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover memory: tegra: Update mc interrupts

Update MC code to add interrupt handling and error logging support. All basic interrupts and corresponding error logging supported by T186 and T194 is added.

Ashish Mhetre (4):
memory: tegra: Add support for mc interrupts
memory: tegra: Add interrupt mask
memory: tegra: add mc-err support for T186
memory: tegra: add mc-err support for T194

 drivers/memory/tegra/mc.c       |  14 ++++-
 drivers/memory/tegra/mc.h       |  26 ++++++++-
 drivers/memory/tegra/tegra114.c |   1 +
 drivers/memory/tegra/tegra124.c |   2 +
 drivers/memory/tegra/tegra186.c | 118 ++++++++++++++++++++++++++++++++++++++
 drivers/memory/tegra/tegra194.c | 124 ++++++++++++++++++++++++++++++++++++++++
 drivers/memory/tegra/tegra20.c  |   6 +-
 drivers/memory/tegra/tegra210.c |   1 +
 drivers/memory/tegra/tegra30.c  |   1 +
 include/soc/tegra/mc.h          |   7 ++-
 10 files changed, 294 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/4 memory: tegra: Add support for mc interrupts

Implement new structure for function related to mc interrupts. Move handle_irq into this structure.
Add support for clearing interrupts.

---
 drivers/memory/tegra/mc.c       | 14 +++++++++++---
 drivers/memory/tegra/mc.h       |  1 +
 drivers/memory/tegra/tegra114.c |  1 +
 drivers/memory/tegra/tegra124.c |  2 ++
 drivers/memory/tegra/tegra186.c | 14 ++++++++++++++
 drivers/memory/tegra/tegra194.c | 12 ++++++++++++
 drivers/memory/tegra/tegra20.c  |  6 +++++-
 drivers/memory/tegra/tegra210.c |  1 +
 drivers/memory/tegra/tegra30.c  |  1 +
 include/soc/tegra/mc.h          |  7 ++++++-
 10 files changed, 54 insertions(+), 5 deletions(-)
drivers/memory/tegra/mc.c +11 -3
index 3c5aae7..3b3f052 100644
@@ -604,9 +604,12 @@ static irqreturn_t tegra30_mc_handle_irq(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
+const struct tegra_mc_interrupt_ops tegra30_mc_interrupt_ops = {
+	.handle_irq = tegra30_mc_handle_irq,
+};
+
 const struct tegra_mc_ops tegra30_mc_ops = {
 	.probe = tegra30_mc_probe,
-	.handle_irq = tegra30_mc_handle_irq,
 };
 #endif
 
@@ -765,16 +768,21 @@ static int tegra_mc_probe(struct platform_device *pdev)
 			return err;
 	}
 
-	if (mc->soc->ops && mc->soc->ops->handle_irq) {
+	if (mc->soc->interrupt_ops && mc->soc->interrupt_ops->handle_irq) {
 		mc->irq = platform_get_irq(pdev, 0);
 		if (mc->irq < 0)
 			return mc->irq;
 
 		WARN(!mc->soc->client_id_mask, "missing client ID mask for this SoC\n");
 
+		/* clear any mc-errs that occurred before. */
+		if (mc->soc->interrupt_ops->clear_interrupt)
+			mc->soc->interrupt_ops->clear_interrupt(mc);
+
 		mc_writel(mc, mc->soc->intmask, MC_INTMASK);
 
-		err = devm_request_irq(&pdev->dev, mc->irq, mc->soc->ops->handle_irq, 0,
+		err = devm_request_irq(&pdev->dev, mc->irq,
+				       mc->soc->interrupt_ops->handle_irq, 0,
 				       dev_name(&pdev->dev), mc);
 		if (err < 0) {
 			dev_err(&pdev->dev, "failed to request IRQ#%u: %d\n", mc->irq,
drivers/memory/tegra/mc.h +1 -0
index 1e49298..f1fd457 100644
@@ -144,6 +144,7 @@ extern const struct tegra_mc_soc tegra194_mc_soc;
     defined(CONFIG_ARCH_TEGRA_210_SOC)
 int tegra30_mc_probe(struct tegra_mc *mc);
 extern const struct tegra_mc_ops tegra30_mc_ops;
+extern const struct tegra_mc_interrupt_ops tegra30_mc_interrupt_ops;
 #endif
 
 #if defined(CONFIG_ARCH_TEGRA_186_SOC) || \
drivers/memory/tegra/tegra114.c +1 -0
index 4135057..f7b8dd9 100644
@@ -1114,4 +1114,5 @@ const struct tegra_mc_soc tegra114_mc_soc = {
 	.resets = tegra114_mc_resets,
 	.num_resets = ARRAY_SIZE(tegra114_mc_resets),
 	.ops = &tegra30_mc_ops,
+	.interrupt_ops = &tegra30_mc_interrupt_ops,
 };
drivers/memory/tegra/tegra124.c +2 -0
index d780a84..8b704c1 100644
@@ -1275,6 +1275,7 @@ const struct tegra_mc_soc tegra124_mc_soc = {
 	.num_resets = ARRAY_SIZE(tegra124_mc_resets),
 	.icc_ops = &tegra124_mc_icc_ops,
 	.ops = &tegra30_mc_ops,
+	.interrupt_ops = &tegra30_mc_interrupt_ops,
 };
 #endif /* CONFIG_ARCH_TEGRA_124_SOC */
 
@@ -1307,5 +1308,6 @@ const struct tegra_mc_soc tegra132_mc_soc = {
 	.num_resets = ARRAY_SIZE(tegra124_mc_resets),
 	.icc_ops = &tegra124_mc_icc_ops,
 	.ops = &tegra30_mc_ops,
+	.interrupt_ops = &tegra30_mc_interrupt_ops,
 };
 #endif /* CONFIG_ARCH_TEGRA_132_SOC */
drivers/memory/tegra/tegra186.c +14 -0
index e65eac5..b548b6a 100644
@@ -12,6 +12,8 @@
 
 #include <soc/tegra/mc.h>
 
+#include "mc.h"
+
 #if defined(CONFIG_ARCH_TEGRA_186_SOC)
 #include <dt-bindings/memory/tegra186-mc.h>
 #endif
@@ -20,6 +22,8 @@
 #define MC_SID_STREAMID_SECURITY_WRITE_ACCESS_DISABLED BIT(16)
 #define MC_SID_STREAMID_SECURITY_OVERRIDE BIT(8)
 
+#define MC_INTSTATUS_CLEAR			0x00033340
+
 static void tegra186_mc_program_sid(struct tegra_mc *mc)
 {
 	unsigned int i;
@@ -137,6 +141,15 @@ static int tegra186_mc_probe_device(struct tegra_mc *mc, struct device *dev)
 	return 0;
 }
 
+static void tegra186_mc_clear_interrupt(struct tegra_mc *mc)
+{
+	mc_writel(mc, MC_INTSTATUS_CLEAR, MC_INTSTATUS);
+}
+
+const struct tegra_mc_interrupt_ops tegra186_mc_interrupt_ops = {
+	.clear_interrupt = tegra186_mc_clear_interrupt,
+};
+
 const struct tegra_mc_ops tegra186_mc_ops = {
 	.probe = tegra186_mc_probe,
 	.remove = tegra186_mc_remove,
@@ -874,5 +887,6 @@ const struct tegra_mc_soc tegra186_mc_soc = {
 	.clients = tegra186_mc_clients,
 	.num_address_bits = 40,
 	.ops = &tegra186_mc_ops,
+	.interrupt_ops = &tegra186_mc_interrupt_ops,
 };
 #endif
drivers/memory/tegra/tegra194.c +12 -0
index cab998b..19f135f 100644
@@ -9,6 +9,17 @@
 
 #include "mc.h"
 
+#define MC_INTSTATUS_CLEAR			0x00133340
+
+static void tegra194_mc_clear_interrupt(struct tegra_mc *mc)
+{
+	mc_writel(mc, MC_INTSTATUS_CLEAR, MC_INTSTATUS);
+}
+
+const struct tegra_mc_interrupt_ops tegra194_mc_interrupt_ops = {
+	.clear_interrupt = tegra194_mc_clear_interrupt,
+};
+
 static const struct tegra_mc_client tegra194_mc_clients[] = {
 	{
 		.id = TEGRA194_MEMORY_CLIENT_PTCR,
@@ -1348,4 +1359,5 @@ const struct tegra_mc_soc tegra194_mc_soc = {
 	.clients = tegra194_mc_clients,
 	.num_address_bits = 40,
 	.ops = &tegra186_mc_ops,
+	.interrupt_ops = &tegra194_mc_interrupt_ops,
 };
drivers/memory/tegra/tegra20.c +5 -1
index fcd7738..3bcb2ca 100644
@@ -786,11 +786,15 @@ static irqreturn_t tegra20_mc_handle_irq(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
+static const struct tegra_mc_interrupt_ops tegra20_mc_interrupt_ops = {
+	.handle_irq = tegra20_mc_handle_irq,
+};
+
 static const struct tegra_mc_ops tegra20_mc_ops = {
 	.probe = tegra20_mc_probe,
 	.suspend = tegra20_mc_suspend,
 	.resume = tegra20_mc_resume,
-	.handle_irq = tegra20_mc_handle_irq,
+	.interrupt_ops = tegra20_mc_interrupt_ops,
 };
 
 const struct tegra_mc_soc tegra20_mc_soc = {
drivers/memory/tegra/tegra210.c +1 -0
index 8ab6498..d7ed163 100644
@@ -1287,4 +1287,5 @@ const struct tegra_mc_soc tegra210_mc_soc = {
 	.resets = tegra210_mc_resets,
 	.num_resets = ARRAY_SIZE(tegra210_mc_resets),
 	.ops = &tegra30_mc_ops,
+	.interrupt_ops = &tegra30_mc_interrupt_ops,
 };
drivers/memory/tegra/tegra30.c +1 -0
index 8431635..bb5ff68 100644
@@ -1400,4 +1400,5 @@ const struct tegra_mc_soc tegra30_mc_soc = {
 	.num_resets = ARRAY_SIZE(tegra30_mc_resets),
 	.icc_ops = &tegra30_mc_icc_ops,
 	.ops = &tegra30_mc_ops,
+	.interrupt_ops = &tegra30_mc_interrupt_ops,
 };
include/soc/tegra/mc.h +6 -1
index 1066b11..debc47b 100644
@@ -170,6 +170,11 @@ struct tegra_mc_icc_ops {
 						void *data);
 };
 
+struct tegra_mc_interrupt_ops {
+	void (*clear_interrupt)(struct tegra_mc *mc);
+	irqreturn_t (*handle_irq)(int irq, void *data);
+};
+
 struct tegra_mc_ops {
 	/*
 	 * @probe: Callback to set up SoC-specific bits of the memory controller. This is called
@@ -179,7 +184,6 @@ struct tegra_mc_ops {
 	void (*remove)(struct tegra_mc *mc);
 	int (*suspend)(struct tegra_mc *mc);
 	int (*resume)(struct tegra_mc *mc);
-	irqreturn_t (*handle_irq)(int irq, void *data);
 	int (*probe_device)(struct tegra_mc *mc, struct device *dev);
 };
 
@@ -205,6 +209,7 @@ struct tegra_mc_soc {
 
 	const struct tegra_mc_icc_ops *icc_ops;
 	const struct tegra_mc_ops *ops;
+	const struct tegra_mc_interrupt_ops *interrupt_ops;
 };
 
 struct tegra_mc {
Signature · 1 line
2.7.4
#2 lore raw

Re: [Patch V1 1/4] memory: tegra: Add support for mc interrupts

Quoted 1 line · Ashish Mhetre

Implement new structure for function related to mc interrupts.

s/mc/MC/

Quoted 2 lines

Move handle_irq into this structure.
Add support for clearing interrupts.

The subject says you are adding support for MC interrupts, so before they were not supported at all?

Here you also mention clearing of interrupts - another new feature. One commit for refactoring (adding new structure) which does not change functionality, second commit for adding new feature.

Different question - why do you need new structure for just two function pointers? Why these different IRQ handling functions cannot be in tegra_mc_ops? To me, it's unnecessary code complexity (plus performance impact, but it's not that important). If this is really, really needed, please describe the rationale in the commit message.

Quoted 15 lines
---
 drivers/memory/tegra/mc.c       | 14 +++++++++++---
 drivers/memory/tegra/mc.h       |  1 +
 drivers/memory/tegra/tegra114.c |  1 +
 drivers/memory/tegra/tegra124.c |  2 ++
 drivers/memory/tegra/tegra186.c | 14 ++++++++++++++
 drivers/memory/tegra/tegra194.c | 12 ++++++++++++
 drivers/memory/tegra/tegra20.c  |  6 +++++-
 drivers/memory/tegra/tegra210.c |  1 +
 drivers/memory/tegra/tegra30.c  |  1 +
 include/soc/tegra/mc.h          |  7 ++++++-
 10 files changed, 54 insertions(+), 5 deletions(-)

Best regards,
Krzysztof

#3 lore raw

Re: [Patch V1 1/4] memory: tegra: Add support for mc interrupts

Quoted 8 lines · Krzysztof Kozlowski

External email: Use caution opening links or attachments

Quoted 1 line · Ashish Mhetre

Implement new structure for function related to mc interrupts.

s/mc/MC/

Okay, I'll update these.

Quoted 6 lines
Quoted 2 lines

Move handle_irq into this structure.
Add support for clearing interrupts.

The subject says you are adding support for MC interrupts, so before they were not supported at all?

Interrupt handling and error logging is not supported from Tegra186 onward. So the patches are for adding supported interrupts and logging them from Tegra186 onward. But you are right, subject/commit message is misleading. I'll update it in next version.

Quoted 9 lines

Here you also mention clearing of interrupts - another new feature. One commit for refactoring (adding new structure) which does not change functionality, second commit for adding new feature.

Quoted 1 line

Different question - why do you need new structure for just two function

pointers? Why these different IRQ handling functions cannot be in tegra_mc_ops? To me, it's unnecessary code complexity (plus performance impact, but it's not that important). If this is really, really needed, please describe the rationale in the commit message.

clearing_interrupts() won't be needed. As pointed by Dmitry, we should be logging early boot MC interrupts as well instead of clearing them. Also, I'll keep handling irq inside tegra_mc_ops instead of adding new structure.

Quoted 19 lines
Quoted 15 lines
---
  drivers/memory/tegra/mc.c       | 14 +++++++++++---
  drivers/memory/tegra/mc.h       |  1 +
  drivers/memory/tegra/tegra114.c |  1 +
  drivers/memory/tegra/tegra124.c |  2 ++
  drivers/memory/tegra/tegra186.c | 14 ++++++++++++++
  drivers/memory/tegra/tegra194.c | 12 ++++++++++++
  drivers/memory/tegra/tegra20.c  |  6 +++++-
  drivers/memory/tegra/tegra210.c |  1 +
  drivers/memory/tegra/tegra30.c  |  1 +
  include/soc/tegra/mc.h          |  7 ++++++-
  10 files changed, 54 insertions(+), 5 deletions(-)

Best regards,
Krzysztof

#4 lore raw

Re: [Patch V1 1/4] memory: tegra: Add support for mc interrupts

In reply to Ashish Mhetre

11.01.2022 21:45, Ashish Mhetre пишет:

Quoted 4 lines
drivers/memory/tegra/mc.c +0 -0
@@ -765,16 +768,21 @@ static int tegra_mc_probe(struct platform_device *pdev)
 			return err;
 	}

drivers/memory/tegra/mc.c static int tegra_mc_probe(struct platform_device *pdev) · line 778

Quoted 10 lines
drivers/memory/tegra/mc.c +2 -1
 
-	if (mc->soc->ops && mc->soc->ops->handle_irq) {
+	if (mc->soc->interrupt_ops && mc->soc->interrupt_ops->handle_irq) {
 		mc->irq = platform_get_irq(pdev, 0);
 		if (mc->irq < 0)
 			return mc->irq;
 
 		WARN(!mc->soc->client_id_mask, "missing client ID mask for this SoC\n");
 
+		/* clear any mc-errs that occurred before. */

s/mc-errs/Memory Controller errors/

drivers/memory/tegra/mc.c static int tegra_mc_probe(struct platform_device *pdev) · line 780

Quoted 2 lines
drivers/memory/tegra/mc.c +2 -0
+		if (mc->soc->interrupt_ops->clear_interrupt)
+			mc->soc->interrupt_ops->clear_interrupt(mc);

There is no explanation of this change neither in the code, nor in the commit message. Please always provide detailed descriptions for a non-trivial changes.

Interrupts aren't cleared intentionally by the driver, otherwise you'll never know about early-boot memory faults which happened before the probe. Hence this change is incorrect.

#5 lore raw

Re: [Patch V1 1/4] memory: tegra: Add support for mc interrupts

Quoted 15 lines · Dmitry Osipenko

External email: Use caution opening links or attachments

11.01.2022 21:45, Ashish Mhetre пишет:

Quoted 11 lines
drivers/memory/tegra/mc.c +1 -1
@@ -765,16 +768,21 @@ static int tegra_mc_probe(struct platform_device *pdev)
                       return err;
       }
 
-     if (mc->soc->ops && mc->soc->ops->handle_irq) {
+     if (mc->soc->interrupt_ops && mc->soc->interrupt_ops->handle_irq) {
               mc->irq = platform_get_irq(pdev, 0);
               if (mc->irq < 0)
                       return mc->irq;
 
Quoted 6 lines

drivers/memory/tegra/mc.c static int tegra_mc_probe(struct platform_device *pdev) · line 778

Quoted 3 lines
drivers/memory/tegra/mc.c +1 -0
               WARN(!mc->soc->client_id_mask, "missing client ID mask for this SoC\n");
 
+             /* clear any mc-errs that occurred before. */

s/mc-errs/Memory Controller errors/

Sure, I'll update these in next version.

Quoted 10 lines

drivers/memory/tegra/mc.c static int tegra_mc_probe(struct platform_device *pdev) · line 780

Quoted 2 lines
drivers/memory/tegra/mc.c +2 -0
+             if (mc->soc->interrupt_ops->clear_interrupt)
+                     mc->soc->interrupt_ops->clear_interrupt(mc);

There is no explanation of this change neither in the code, nor in the commit message. Please always provide detailed descriptions for a non-trivial changes.

Interrupts aren't cleared intentionally by the driver, otherwise you'll never know about early-boot memory faults which happened before the probe. Hence this change is incorrect.

That's true, we should be logging early-boot memory faults as well. Ideally there shouldn't be any early-boot faults as all clients will be up after MC, right? But I agree that we should be checking and logging if any interrupt is present.

#6 lore raw

Re: [Patch V1 1/4] memory: tegra: Add support for mc interrupts

19.01.2022 11:47, Ashish Mhetre пишет:

Quoted 35 lines · Dmitry Osipenko
Quoted 17 lines

External email: Use caution opening links or attachments

11.01.2022 21:45, Ashish Mhetre пишет:

Quoted 13 lines
drivers/memory/tegra/mc.c +1 -1
@@ -765,16 +768,21 @@ static int tegra_mc_probe(struct
 platform_device *pdev)
                        return err;
        }
 
-     if (mc->soc->ops && mc->soc->ops->handle_irq) {
+     if (mc->soc->interrupt_ops &&
 mc->soc->interrupt_ops->handle_irq) {
                mc->irq = platform_get_irq(pdev, 0);
                if (mc->irq < 0)
                        return mc->irq;
 
Quoted 7 lines
Quoted 4 lines

               WARN(!mc->soc->client_id_mask, "missing client ID mask for this SoC\n");

+             /* clear any mc-errs that occurred before. */

s/mc-errs/Memory Controller errors/

Sure, I'll update these in next version.

Quoted 7 lines
Quoted 2 lines

+             if (mc->soc->interrupt_ops->clear_interrupt) +                     mc->soc->interrupt_ops->clear_interrupt(mc);

There is no explanation of this change neither in the code, nor in the commit message. Please always provide detailed descriptions for a non-trivial changes.

Quoted 7 lines
Quoted 3 lines

Interrupts aren't cleared intentionally by the driver, otherwise you'll never know about early-boot memory faults which happened before the probe. Hence this change is incorrect.

That's true, we should be logging early-boot memory faults as well. Ideally there shouldn't be any early-boot faults as all clients will be up after MC, right? But I agree that we should be checking and logging if any interrupt is present.

Normally there won't be any errors during early boot, otherwise they need to be fixed.

#7 lore raw

Re: [Patch V1 1/4] memory: tegra: Add support for mc interrupts

In reply to Ashish Mhetre
Thank you for the patch! Yet something to improve:

Hi Ashish,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tegra/for-next]
[also build test ERROR on v5.16 next-20220112]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Ashish-Mhetre/memory-tegra-Update-mc-interrupts/20220112-024847
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux.git for-next
config: arm-defconfig (https://download.01.org/0day-ci/archive/20220113/202201130230.8UdZpJ3c-lkp(a)intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/71553a1a735ae07293d43df685262f85e6453170
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Ashish-Mhetre/memory-tegra-Update-mc-interrupts/20220112-024847 git checkout 71553a1a735ae07293d43df685262f85e6453170
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

>> drivers/memory/tegra/tegra20.c:797:10: error: 'const struct tegra_mc_ops' has no member named 'interrupt_ops'
     797 |         .interrupt_ops = tegra20_mc_interrupt_ops,
         |          ^~~~~~~~~~~~~
>> drivers/memory/tegra/tegra20.c:797:26: error: incompatible types when initializing type 'int (*)(struct tegra_mc *, struct device *)' using type 'struct tegra_mc_interrupt_ops'

797 | .interrupt_ops = tegra20_mc_interrupt_ops,
| ^~~~~~~~~~~~~~~~~~~~~~~~

vim +797 drivers/memory/tegra/tegra20.c

792
793 static const struct tegra_mc_ops tegra20_mc_ops = {
794 .probe = tegra20_mc_probe,
795 .suspend = tegra20_mc_suspend,
796 .resume = tegra20_mc_resume,

 > 797		.interrupt_ops = tegra20_mc_interrupt_ops,

798 };
799

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#8 lore raw

Re: [Patch V1 1/4] memory: tegra: Add support for mc interrupts

In reply to Ashish Mhetre
Thank you for the patch! Yet something to improve:

Hi Ashish,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tegra/for-next]
[also build test ERROR on v5.16 next-20220120]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Ashish-Mhetre/memory-tegra-Update-mc-interrupts/20220112-024847
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux.git for-next
config: arm-allyesconfig (https://download.01.org/0day-ci/archive/20220121/202201210912.gUHr0zcb-lkp(a)intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/71553a1a735ae07293d43df685262f85e6453170
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Ashish-Mhetre/memory-tegra-Update-mc-interrupts/20220112-024847 git checkout 71553a1a735ae07293d43df685262f85e6453170
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

drivers/memory/tegra/tegra20.c:797:10: error: 'const struct tegra_mc_ops' has no member named 'interrupt_ops'
797 | .interrupt_ops = tegra20_mc_interrupt_ops,
| ^~~~~~~~~~~~~

>> drivers/memory/tegra/tegra20.c:797:26: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]

797 | .interrupt_ops = tegra20_mc_interrupt_ops,
| ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/memory/tegra/tegra20.c:797:26: note: (near initialization for 'tegra20_mc_ops')
drivers/memory/tegra/tegra20.c:797:26: error: incompatible types when initializing type 'int (*)(struct tegra_mc *)' using type 'struct tegra_mc_interrupt_ops'
cc1: some warnings being treated as errors

vim +797 drivers/memory/tegra/tegra20.c

792
793 static const struct tegra_mc_ops tegra20_mc_ops = {
794 .probe = tegra20_mc_probe,
795 .suspend = tegra20_mc_suspend,
796 .resume = tegra20_mc_resume,

 > 797		.interrupt_ops = tegra20_mc_interrupt_ops,

798 };
799

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#9 lore raw

PATCH 2/4 memory: tegra: Add interrupt mask

In reply to Ashish Mhetre

Add interrupt masks for all supported interrupts on tegra MCs. Update interrupt mask value for T186 and T194 as per supported interrupts.

---
 drivers/memory/tegra/mc.h       | 4 ++++
 drivers/memory/tegra/tegra186.c | 4 ++++
 drivers/memory/tegra/tegra194.c | 4 ++++
 3 files changed, 12 insertions(+)
drivers/memory/tegra/mc.h +4 -0
index f1fd457..2d4f495 100644
@@ -44,6 +44,10 @@
 #define MC_TIMING_CONTROL_DBG				0xf8
 #define MC_TIMING_CONTROL				0xfc
 
+#define MC_INT_DECERR_ROUTE_SANITY			BIT(20)
+#define MC_INT_WCAM_ERR					BIT(19)
+#define MC_INT_SCRUB_ECC_WR_ACK				BIT(18)
+#define MC_INT_DECERR_GENERALIZED_CARVEOUT		BIT(17)
 #define MC_INT_DECERR_MTS				BIT(16)
 #define MC_INT_SECERR_SEC				BIT(13)
 #define MC_INT_DECERR_VPR				BIT(12)
drivers/memory/tegra/tegra186.c +4 -0
index b548b6a..6766cc4 100644
@@ -886,6 +886,10 @@ const struct tegra_mc_soc tegra186_mc_soc = {
 	.num_clients = ARRAY_SIZE(tegra186_mc_clients),
 	.clients = tegra186_mc_clients,
 	.num_address_bits = 40,
+	.intmask = MC_INT_WCAM_ERR | MC_INT_SCRUB_ECC_WR_ACK |
+		   MC_INT_DECERR_GENERALIZED_CARVEOUT | MC_INT_DECERR_MTS |
+		   MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
+		   MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
 	.ops = &tegra186_mc_ops,
 	.interrupt_ops = &tegra186_mc_interrupt_ops,
 };
drivers/memory/tegra/tegra194.c +4 -0
index 19f135f..76ba3da 100644
@@ -1358,6 +1358,10 @@ const struct tegra_mc_soc tegra194_mc_soc = {
 	.num_clients = ARRAY_SIZE(tegra194_mc_clients),
 	.clients = tegra194_mc_clients,
 	.num_address_bits = 40,
+	.intmask = MC_INT_DECERR_ROUTE_SANITY | MC_INT_WCAM_ERR |
+		   MC_INT_DECERR_GENERALIZED_CARVEOUT | MC_INT_DECERR_MTS |
+		   MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
+		   MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
 	.ops = &tegra186_mc_ops,
 	.interrupt_ops = &tegra194_mc_interrupt_ops,
 };
Signature · 1 line
2.7.4
#10 lore raw

Re: [Patch V1 2/4] memory: tegra: Add interrupt mask

Quoted 2 lines · Ashish Mhetre

Add interrupt masks for all supported interrupts on tegra MCs. Update interrupt mask value for T186 and T194 as per supported interrupts.

The commit subject is too generic. The commit description need to also describe why you are doing it and what you want achieve.

Best regards,
Krzysztof

#11 lore raw

Re: [Patch V1 2/4] memory: tegra: Add interrupt mask

Quoted 7 lines · Krzysztof Kozlowski

External email: Use caution opening links or attachments

Quoted 2 lines · Ashish Mhetre

Add interrupt masks for all supported interrupts on tegra MCs. Update interrupt mask value for T186 and T194 as per supported interrupts.

Quoted 7 lines

The commit subject is too generic. The commit description need to also describe why you are doing it and what you want achieve.

Best regards,
Krzysztof

Sure, I'll update the commit message.

#12 lore raw

PATCH 3/4 memory: tegra: add mc-err support for T186

In reply to Ashish Mhetre

Add all mc-errors supported by T186.
Implement mc interrupt handling routine for T186.

---
 drivers/memory/tegra/mc.h       |  17 +++++++
 drivers/memory/tegra/tegra186.c | 100 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 117 insertions(+)
drivers/memory/tegra/mc.h +17 -0
index 2d4f495..7817492 100644
@@ -44,6 +44,15 @@
 #define MC_TIMING_CONTROL_DBG				0xf8
 #define MC_TIMING_CONTROL				0xfc
 
+#define MC_ERR_VPR_STATUS				0x654
+#define MC_ERR_VPR_ADR					0x658
+#define MC_ERR_SEC_STATUS				0x67c
+#define MC_ERR_SEC_ADR					0x680
+#define MC_ERR_MTS_STATUS				0x9b0
+#define MC_ERR_MTS_ADR					0x9b4
+#define MC_ERR_GENERALIZED_CARVEOUT_STATUS		0xc00
+#define MC_ERR_GENERALIZED_CARVEOUT_ADR			0xc04
+
 #define MC_INT_DECERR_ROUTE_SANITY			BIT(20)
 #define MC_INT_WCAM_ERR					BIT(19)
 #define MC_INT_SCRUB_ECC_WR_ACK				BIT(18)
@@ -159,6 +168,14 @@ extern const struct tegra_mc_ops tegra186_mc_ops;
 extern const char * const tegra_mc_status_names[32];
 extern const char * const tegra_mc_error_names[8];
 
+struct tegra_mc_error {
+	u32 int_bit;
+	const char *msg;
+	u32 status_reg;
+	u32 addr_reg;
+	u32 addr_reg_hi;
+};
+
 /*
  * These IDs are for internal use of Tegra ICC drivers. The ID numbers are
  * chosen such that they don't conflict with the device-tree ICC node IDs.
drivers/memory/tegra/tegra186.c +100 -0

114 lines not on this page · raw message

Signature · 1 line
2.7.4
#13 lore raw

Re: [Patch V1 3/4] memory: tegra: add mc-err support for T186

Cc in the future also Dmitry, because he was involved in these drivers quite a lot.

Quoted 2 lines · Ashish Mhetre

Add all mc-errors supported by T186.
Implement mc interrupt handling routine for T186.

Here and in other patches - please use Tegra186 (and similar) to be consistent with existing upstream naming.

Quoted 28 lines
---
 drivers/memory/tegra/mc.h       |  17 +++++++
 drivers/memory/tegra/tegra186.c | 100 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 117 insertions(+)
drivers/memory/tegra/mc.h +9 -0
index 2d4f495..7817492 100644
@@ -44,6 +44,15 @@
 #define MC_TIMING_CONTROL_DBG				0xf8
 #define MC_TIMING_CONTROL				0xfc
 
+#define MC_ERR_VPR_STATUS				0x654
+#define MC_ERR_VPR_ADR					0x658
+#define MC_ERR_SEC_STATUS				0x67c
+#define MC_ERR_SEC_ADR					0x680
+#define MC_ERR_MTS_STATUS				0x9b0
+#define MC_ERR_MTS_ADR					0x9b4
+#define MC_ERR_GENERALIZED_CARVEOUT_STATUS		0xc00
+#define MC_ERR_GENERALIZED_CARVEOUT_ADR			0xc04
+
 #define MC_INT_DECERR_ROUTE_SANITY			BIT(20)
 #define MC_INT_WCAM_ERR					BIT(19)
 #define MC_INT_SCRUB_ECC_WR_ACK				BIT(18)

drivers/memory/tegra/mc.h extern const struct tegra_mc_ops tegra186_mc_ops; · line 172

Quoted 5 lines
drivers/memory/tegra/mc.h +2 -0
@@ -159,6 +168,14 @@ extern const struct tegra_mc_ops tegra186_mc_ops;
 extern const char * const tegra_mc_status_names[32];
 extern const char * const tegra_mc_error_names[8];
 
+struct tegra_mc_error {
+	u32 int_bit;

Where is it used (read)?

drivers/memory/tegra/mc.h extern const struct tegra_mc_ops tegra186_mc_ops; · line 175

Quoted 3 lines
drivers/memory/tegra/mc.h +3 -0
+	const char *msg;
+	u32 status_reg;
+	u32 addr_reg;

Please describe all these fields with kerneldoc.

drivers/memory/tegra/mc.h extern const struct tegra_mc_ops tegra186_mc_ops; · line 176

Quoted 1 line
drivers/memory/tegra/mc.h +1 -0
+	u32 addr_reg_hi;

Looks unused.

Quoted 53 lines
drivers/memory/tegra/mc.h +2 -0
+};
+
 /*
  * These IDs are for internal use of Tegra ICC drivers. The ID numbers are
  * chosen such that they don't conflict with the device-tree ICC node IDs.
drivers/memory/tegra/tegra186.c +40 -0
index 6766cc4..4f3ae71 100644
@@ -146,8 +146,107 @@ static void tegra186_mc_clear_interrupt(struct tegra_mc *mc)
 	mc_writel(mc, MC_INTSTATUS_CLEAR, MC_INTSTATUS);
 }
 
+static const struct tegra_mc_error int_mc_errors[] = {
+	{
+		.int_bit = MC_INT_DECERR_EMEM,
+		.msg = "EMEM address decode error",
+		.status_reg = MC_ERR_STATUS,
+		.addr_reg = MC_ERR_ADR,
+	},
+	{
+		.int_bit = MC_INT_SECURITY_VIOLATION,
+		.msg = "non secure access to secure region",
+		.status_reg = MC_ERR_STATUS,
+		.addr_reg = MC_ERR_ADR,
+	},
+	{
+		.int_bit = MC_INT_DECERR_VPR,
+		.msg = "MC request violates VPR requirements",
+		.status_reg = MC_ERR_VPR_STATUS,
+		.addr_reg = MC_ERR_VPR_ADR,
+	},
+	{
+		.int_bit = MC_INT_SECERR_SEC,
+		.msg = "MC request violated SEC carveout requirements",
+		.status_reg = MC_ERR_SEC_STATUS,
+		.addr_reg = MC_ERR_SEC_ADR,
+	},
+	{
+		.int_bit = MC_INT_DECERR_MTS,
+		.msg = "MTS carveout access violation",
+		.status_reg = MC_ERR_MTS_STATUS,
+		.addr_reg = MC_ERR_MTS_ADR,
+	},
+	{
+		.int_bit = MC_INT_DECERR_GENERALIZED_CARVEOUT,
+		.msg = "GSC access violation",
+		.status_reg = MC_ERR_GENERALIZED_CARVEOUT_STATUS,
+		.addr_reg = MC_ERR_GENERALIZED_CARVEOUT_ADR,
+	},
+};
+
+static irqreturn_t tegra186_mc_handle_irq(int irq, void *data)

drivers/memory/tegra/tegra186.c static void tegra186_mc_clear_interrupt(struct tegra_mc *mc) · line 198

Quoted 10 lines
drivers/memory/tegra/tegra186.c +10 -0
+{
+	struct tegra_mc *mc = data;
+	unsigned long status;
+	unsigned int bit;
+
+	status = mc_readl(mc, MC_INTSTATUS) & mc->soc->intmask;
+	if (!status)
+		return IRQ_NONE;
+
+	for_each_set_bit(bit, &status, 32) {

Don't you need bitops.h for this?

drivers/memory/tegra/tegra186.c static void tegra186_mc_clear_interrupt(struct tegra_mc *mc) · line 199

Quoted 1 line
drivers/memory/tegra/tegra186.c +1 -0
+		const char *error = int_mc_errors[bit].msg ?: "unknown";

int_mc_errors has size of 6, but it's index (the bit variable) can be 20 or even 32. Are you sure indices are used properly or maybe int_mc_errors missed initializer per-index?

drivers/memory/tegra/tegra186.c static void tegra186_mc_clear_interrupt(struct tegra_mc *mc) · line 205

Quoted 6 lines
drivers/memory/tegra/tegra186.c +6 -0
+		const char *client = "unknown";
+		const char *direction, *secure;
+		phys_addr_t addr = 0;
+		unsigned int i;
+		u8 id;
+		u32 value;

Keep order in reversed xmas tree plus name it in a meaningful way. You read here several registers, so which one is value? Probably you meant status?

Quoted 28 lines
drivers/memory/tegra/tegra186.c +28 -0
+
+		value = mc_readl(mc, int_mc_errors[bit].status_reg);
+
+#ifdef CONFIG_PHYS_ADDR_T_64BIT
+		if (mc->soc->num_address_bits > 32) {
+			addr = ((value >> MC_ERR_STATUS_ADR_HI_SHIFT) &
+				MC_ERR_STATUS_ADR_HI_MASK);
+			addr <<= 32;
+		}
+#endif
+		addr |= mc_readl(mc, int_mc_errors[bit].addr_reg);
+
+		if (value & MC_ERR_STATUS_RW)
+			direction = "write";
+		else
+			direction = "read";
+
+		if (value & MC_ERR_STATUS_SECURITY)
+			secure = "secure ";
+		else
+			secure = "";
+
+		id = value & mc->soc->client_id_mask;
+
+		for (i = 0; i < mc->soc->num_clients; i++) {
+			if (mc->soc->clients[i].id == id) {
+				client = mc->soc->clients[i].name;
+				break;

drivers/memory/tegra/tegra186.c static void tegra186_mc_clear_interrupt(struct tegra_mc *mc) · line 244

Quoted 10 lines
drivers/memory/tegra/tegra186.c +10 -0
+			}
+		}
+
+		dev_err_ratelimited(mc->dev, "%s: %s%s @%pa: %s\n",
+				    client, secure, direction, &addr, error);
+	}
+
+	/* clear interrupts */
+	mc_writel(mc, status, MC_INTSTATUS);> +
+	return IRQ_HANDLED;

I don't think you are actually handling these errors as stated in commit message. You only log them. Please adjust the commit subject and message to mention the actual purpose/action of error handling.

Quoted 10 lines
drivers/memory/tegra/tegra186.c +3 -0
+}
+
 const struct tegra_mc_interrupt_ops tegra186_mc_interrupt_ops = {
 	.clear_interrupt = tegra186_mc_clear_interrupt,
+	.handle_irq = tegra186_mc_handle_irq,
 };
 
 const struct tegra_mc_ops tegra186_mc_ops = {

drivers/memory/tegra/tegra186.c const struct tegra_mc_soc tegra186_mc_soc = { · line 991

Quoted 7 lines
drivers/memory/tegra/tegra186.c +1 -0
@@ -886,6 +985,7 @@ const struct tegra_mc_soc tegra186_mc_soc = {
 	.num_clients = ARRAY_SIZE(tegra186_mc_clients),
 	.clients = tegra186_mc_clients,
 	.num_address_bits = 40,
+	.client_id_mask = 0xff,
 	.intmask = MC_INT_WCAM_ERR | MC_INT_SCRUB_ECC_WR_ACK |
 		   MC_INT_DECERR_GENERALIZED_CARVEOUT | MC_INT_DECERR_MTS |
 		   MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |

Best regards,
Krzysztof

#14 lore raw

Re: [Patch V1 3/4] memory: tegra: add mc-err support for T186

Quoted 6 lines · Krzysztof Kozlowski

External email: Use caution opening links or attachments

Cc in the future also Dmitry, because he was involved in these drivers quite a lot.

I'll make sure of that in future patches.

Quoted 7 lines · Ashish Mhetre
Quoted 2 lines

Add all mc-errors supported by T186.
Implement mc interrupt handling routine for T186.

Here and in other patches - please use Tegra186 (and similar) to be consistent with existing upstream naming.

Okay, I'll update the naming.

Quoted 31 lines
Quoted 31 lines
---
  drivers/memory/tegra/mc.h       |  17 +++++++
  drivers/memory/tegra/tegra186.c | 100 ++++++++++++++++++++++++++++++++++++++++
  2 files changed, 117 insertions(+)
drivers/memory/tegra/mc.h +9 -0
index 2d4f495..7817492 100644
@@ -44,6 +44,15 @@
  #define MC_TIMING_CONTROL_DBG                                0xf8
  #define MC_TIMING_CONTROL                            0xfc
 
+#define MC_ERR_VPR_STATUS                            0x654
+#define MC_ERR_VPR_ADR                                       0x658
+#define MC_ERR_SEC_STATUS                            0x67c
+#define MC_ERR_SEC_ADR                                       0x680
+#define MC_ERR_MTS_STATUS                            0x9b0
+#define MC_ERR_MTS_ADR                                       0x9b4
+#define MC_ERR_GENERALIZED_CARVEOUT_STATUS           0xc00
+#define MC_ERR_GENERALIZED_CARVEOUT_ADR                      0xc04
+
  #define MC_INT_DECERR_ROUTE_SANITY                   BIT(20)
  #define MC_INT_WCAM_ERR                                      BIT(19)
  #define MC_INT_SCRUB_ECC_WR_ACK                              BIT(18)
@@ -159,6 +168,14 @@ extern const struct tegra_mc_ops tegra186_mc_ops;
  extern const char * const tegra_mc_status_names[32];
  extern const char * const tegra_mc_error_names[8];
 
Quoted 5 lines

drivers/memory/tegra/mc.h extern const struct tegra_mc_ops tegra186_mc_ops; · line 172

Quoted 2 lines
drivers/memory/tegra/mc.h +2 -0
+struct tegra_mc_error {
+     u32 int_bit;

Where is it used (read)?

Oops, int_bit should be getting used in handle_irq for checking type of interrupt. I'll update it in next version.

Quoted 10 lines

drivers/memory/tegra/mc.h extern const struct tegra_mc_ops tegra186_mc_ops; · line 175

Quoted 3 lines
drivers/memory/tegra/mc.h +3 -0
+     const char *msg;
+     u32 status_reg;
+     u32 addr_reg;

Please describe all these fields with kerneldoc.

drivers/memory/tegra/mc.h extern const struct tegra_mc_ops tegra186_mc_ops; · line 176

Quoted 1 line
drivers/memory/tegra/mc.h +1 -0
+     u32 addr_reg_hi;

Looks unused.

It's getting used in patch 4. I'll update it in next version.

Quoted 57 lines
Quoted 57 lines
drivers/memory/tegra/mc.h +2 -0
+};
+
  /*
   * These IDs are for internal use of Tegra ICC drivers. The ID numbers are
   * chosen such that they don't conflict with the device-tree ICC node IDs.
drivers/memory/tegra/tegra186.c +44 -0
index 6766cc4..4f3ae71 100644
@@ -146,8 +146,107 @@ static void tegra186_mc_clear_interrupt(struct tegra_mc *mc)
       mc_writel(mc, MC_INTSTATUS_CLEAR, MC_INTSTATUS);
  }
 
+static const struct tegra_mc_error int_mc_errors[] = {
+     {
+             .int_bit = MC_INT_DECERR_EMEM,
+             .msg = "EMEM address decode error",
+             .status_reg = MC_ERR_STATUS,
+             .addr_reg = MC_ERR_ADR,
+     },
+     {
+             .int_bit = MC_INT_SECURITY_VIOLATION,
+             .msg = "non secure access to secure region",
+             .status_reg = MC_ERR_STATUS,
+             .addr_reg = MC_ERR_ADR,
+     },
+     {
+             .int_bit = MC_INT_DECERR_VPR,
+             .msg = "MC request violates VPR requirements",
+             .status_reg = MC_ERR_VPR_STATUS,
+             .addr_reg = MC_ERR_VPR_ADR,
+     },
+     {
+             .int_bit = MC_INT_SECERR_SEC,
+             .msg = "MC request violated SEC carveout requirements",
+             .status_reg = MC_ERR_SEC_STATUS,
+             .addr_reg = MC_ERR_SEC_ADR,
+     },
+     {
+             .int_bit = MC_INT_DECERR_MTS,
+             .msg = "MTS carveout access violation",
+             .status_reg = MC_ERR_MTS_STATUS,
+             .addr_reg = MC_ERR_MTS_ADR,
+     },
+     {
+             .int_bit = MC_INT_DECERR_GENERALIZED_CARVEOUT,
+             .msg = "GSC access violation",
+             .status_reg = MC_ERR_GENERALIZED_CARVEOUT_STATUS,
+             .addr_reg = MC_ERR_GENERALIZED_CARVEOUT_ADR,
+     },
+};
+
+static irqreturn_t tegra186_mc_handle_irq(int irq, void *data)
+{
+     struct tegra_mc *mc = data;
+     unsigned long status;
+     unsigned int bit;
Quoted 9 lines

drivers/memory/tegra/tegra186.c static void tegra186_mc_clear_interrupt(struct tegra_mc *mc) · line 198

Quoted 6 lines
drivers/memory/tegra/tegra186.c +6 -0
+
+     status = mc_readl(mc, MC_INTSTATUS) & mc->soc->intmask;
+     if (!status)
+             return IRQ_NONE;
+
+     for_each_set_bit(bit, &status, 32) {

Don't you need bitops.h for this?

It didn't throw any errors when I built it. bitops.h is mostly getting included from one of the existing includes.
Probably of_device.h -> of.h -> bitops.h

Quoted 6 lines

drivers/memory/tegra/tegra186.c static void tegra186_mc_clear_interrupt(struct tegra_mc *mc) · line 199

Quoted 1 line
drivers/memory/tegra/tegra186.c +1 -0
+             const char *error = int_mc_errors[bit].msg ?: "unknown";

int_mc_errors has size of 6, but it's index (the bit variable) can be 20 or even 32. Are you sure indices are used properly or maybe int_mc_errors missed initializer per-index?

That's true, I have not implemented it correctly. I should have looped over int_mc_errors[] and should have checked .int_bit with bit and used index of that element.

Quoted 11 lines

drivers/memory/tegra/tegra186.c static void tegra186_mc_clear_interrupt(struct tegra_mc *mc) · line 205

Quoted 6 lines
drivers/memory/tegra/tegra186.c +6 -0
+             const char *client = "unknown";
+             const char *direction, *secure;
+             phys_addr_t addr = 0;
+             unsigned int i;
+             u8 id;
+             u32 value;

Keep order in reversed xmas tree plus name it in a meaningful way. You read here several registers, so which one is value? Probably you meant status?

Yes, I meant status. But tegra30_mc_handle_irq() is implemented in similar way. So I went with same names. I'll update the names and order.

Quoted 34 lines
Quoted 34 lines
drivers/memory/tegra/tegra186.c +34 -0
+
+             value = mc_readl(mc, int_mc_errors[bit].status_reg);
+
+#ifdef CONFIG_PHYS_ADDR_T_64BIT
+             if (mc->soc->num_address_bits > 32) {
+                     addr = ((value >> MC_ERR_STATUS_ADR_HI_SHIFT) &
+                             MC_ERR_STATUS_ADR_HI_MASK);
+                     addr <<= 32;
+             }
+#endif
+             addr |= mc_readl(mc, int_mc_errors[bit].addr_reg);
+
+             if (value & MC_ERR_STATUS_RW)
+                     direction = "write";
+             else
+                     direction = "read";
+
+             if (value & MC_ERR_STATUS_SECURITY)
+                     secure = "secure ";
+             else
+                     secure = "";
+
+             id = value & mc->soc->client_id_mask;
+
+             for (i = 0; i < mc->soc->num_clients; i++) {
+                     if (mc->soc->clients[i].id == id) {
+                             client = mc->soc->clients[i].name;
+                             break;
+                     }
+             }
+
+             dev_err_ratelimited(mc->dev, "%s: %s%s @%pa: %s\n",
+                                 client, secure, direction, &addr, error);
+     }
Quoted 9 lines

drivers/memory/tegra/tegra186.c static void tegra186_mc_clear_interrupt(struct tegra_mc *mc) · line 244

Quoted 4 lines
drivers/memory/tegra/tegra186.c +4 -0
+
+     /* clear interrupts */
+     mc_writel(mc, status, MC_INTSTATUS);> +
+     return IRQ_HANDLED;

I don't think you are actually handling these errors as stated in commit message. You only log them. Please adjust the commit subject and message to mention the actual purpose/action of error handling.

Yes, I'll update the commit message.

Quoted 22 lines
Quoted 10 lines
drivers/memory/tegra/tegra186.c +3 -0
+}
+
  const struct tegra_mc_interrupt_ops tegra186_mc_interrupt_ops = {
       .clear_interrupt = tegra186_mc_clear_interrupt,
+     .handle_irq = tegra186_mc_handle_irq,
  };
 
  const struct tegra_mc_ops tegra186_mc_ops = {

drivers/memory/tegra/tegra186.c const struct tegra_mc_soc tegra186_mc_soc = { · line 991

Quoted 7 lines
drivers/memory/tegra/tegra186.c +1 -0
@@ -886,6 +985,7 @@ const struct tegra_mc_soc tegra186_mc_soc = {
       .num_clients = ARRAY_SIZE(tegra186_mc_clients),
       .clients = tegra186_mc_clients,
       .num_address_bits = 40,
+     .client_id_mask = 0xff,
       .intmask = MC_INT_WCAM_ERR | MC_INT_SCRUB_ECC_WR_ACK |
                  MC_INT_DECERR_GENERALIZED_CARVEOUT | MC_INT_DECERR_MTS |
                  MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |

Best regards,
Krzysztof

#15 lore raw

Re: [Patch V1 3/4] memory: tegra: add mc-err support for T186

In reply to Ashish Mhetre

11.01.2022 21:45, Ashish Mhetre пишет:

Quoted 14 lines

Add all mc-errors supported by T186.
Implement mc interrupt handling routine for T186.

---
 drivers/memory/tegra/mc.h       |  17 +++++++
 drivers/memory/tegra/tegra186.c | 100 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 117 insertions(+)
drivers/memory/tegra/mc.h +0 -0
index 2d4f495..7817492 100644

drivers/memory/tegra/mc.h line 46

Quoted 3 lines
drivers/memory/tegra/mc.h +0 -0
@@ -44,6 +44,15 @@
 #define MC_TIMING_CONTROL_DBG				0xf8
 #define MC_TIMING_CONTROL				0xfc
 

this empty line is unnecessary

Quoted 44 lines
drivers/memory/tegra/mc.h +17 -0
+#define MC_ERR_VPR_STATUS				0x654
+#define MC_ERR_VPR_ADR					0x658
+#define MC_ERR_SEC_STATUS				0x67c
+#define MC_ERR_SEC_ADR					0x680
+#define MC_ERR_MTS_STATUS				0x9b0
+#define MC_ERR_MTS_ADR					0x9b4
+#define MC_ERR_GENERALIZED_CARVEOUT_STATUS		0xc00
+#define MC_ERR_GENERALIZED_CARVEOUT_ADR			0xc04
+
 #define MC_INT_DECERR_ROUTE_SANITY			BIT(20)
 #define MC_INT_WCAM_ERR					BIT(19)
 #define MC_INT_SCRUB_ECC_WR_ACK				BIT(18)
@@ -159,6 +168,14 @@ extern const struct tegra_mc_ops tegra186_mc_ops;
 extern const char * const tegra_mc_status_names[32];
 extern const char * const tegra_mc_error_names[8];
 
+struct tegra_mc_error {
+	u32 int_bit;
+	const char *msg;
+	u32 status_reg;
+	u32 addr_reg;
+	u32 addr_reg_hi;
+};
+
 /*
  * These IDs are for internal use of Tegra ICC drivers. The ID numbers are
  * chosen such that they don't conflict with the device-tree ICC node IDs.
drivers/memory/tegra/tegra186.c +9 -0
index 6766cc4..4f3ae71 100644
@@ -146,8 +146,107 @@ static void tegra186_mc_clear_interrupt(struct tegra_mc *mc)
 	mc_writel(mc, MC_INTSTATUS_CLEAR, MC_INTSTATUS);
 }
 
+static const struct tegra_mc_error int_mc_errors[] = {
+	{
+		.int_bit = MC_INT_DECERR_EMEM,
+		.msg = "EMEM address decode error",
+		.status_reg = MC_ERR_STATUS,
+		.addr_reg = MC_ERR_ADR,
+	},
+	{
+		.int_bit = MC_INT_SECURITY_VIOLATION,

drivers/memory/tegra/tegra186.c static void tegra186_mc_clear_interrupt(struct tegra_mc *mc) · line 167

Quoted 10 lines
drivers/memory/tegra/tegra186.c +10 -0
+		.msg = "non secure access to secure region",
+		.status_reg = MC_ERR_STATUS,
+		.addr_reg = MC_ERR_ADR,
+	},
+	{
+		.int_bit = MC_INT_DECERR_VPR,
+		.msg = "MC request violates VPR requirements",
+		.status_reg = MC_ERR_VPR_STATUS,
+		.addr_reg = MC_ERR_VPR_ADR,
+	},

I see that these VPR registers present on all SoCs starting with T124. It doesn't look like you need the separate IRQ handlers at all, instead please extend the common T30 handler. For example, you may add a switch-case statements to handle those T124+ specific bits differently.

static irqreturn_t tegra30_mc_handle_irq(int irq, void *data) {
...

	switch (bit) {
	case MC_INT_DECERR_VPR:
		status_reg = MC_ERR_VPR_STATUS;
		addr_reg   = MC_ERR_VPR_ADR;
		break;
	...
	default:
		status_reg = MC_ERR_STATUS;
		addr_reg   = MC_ERR_ADR;
	}

	value = mc_readl(mc, status_reg);
	...
	
	value = mc_readl(mc, addr_reg);
#16 lore raw

Re: [Patch V1 3/4] memory: tegra: add mc-err support for T186

Quoted 13 lines · Dmitry Osipenko

External email: Use caution opening links or attachments

11.01.2022 21:45, Ashish Mhetre пишет:

Quoted 9 lines

Add all mc-errors supported by T186.
Implement mc interrupt handling routine for T186.

---
  drivers/memory/tegra/mc.h       |  17 +++++++
  drivers/memory/tegra/tegra186.c | 100 ++++++++++++++++++++++++++++++++++++++++
  2 files changed, 117 insertions(+)
Quoted 11 lines

drivers/memory/tegra/mc.h line 46

Quoted 8 lines
drivers/memory/tegra/mc.h +0 -0
index 2d4f495..7817492 100644
@@ -44,6 +44,15 @@
  #define MC_TIMING_CONTROL_DBG                                0xf8
  #define MC_TIMING_CONTROL                            0xfc
 

this empty line is unnecessary

I'll fix this in next version.

Quoted 63 lines
Quoted 44 lines
drivers/memory/tegra/mc.h +17 -0
+#define MC_ERR_VPR_STATUS                            0x654
+#define MC_ERR_VPR_ADR                                       0x658
+#define MC_ERR_SEC_STATUS                            0x67c
+#define MC_ERR_SEC_ADR                                       0x680
+#define MC_ERR_MTS_STATUS                            0x9b0
+#define MC_ERR_MTS_ADR                                       0x9b4
+#define MC_ERR_GENERALIZED_CARVEOUT_STATUS           0xc00
+#define MC_ERR_GENERALIZED_CARVEOUT_ADR                      0xc04
+
  #define MC_INT_DECERR_ROUTE_SANITY                   BIT(20)
  #define MC_INT_WCAM_ERR                                      BIT(19)
  #define MC_INT_SCRUB_ECC_WR_ACK                              BIT(18)
@@ -159,6 +168,14 @@ extern const struct tegra_mc_ops tegra186_mc_ops;
  extern const char * const tegra_mc_status_names[32];
  extern const char * const tegra_mc_error_names[8];
 
+struct tegra_mc_error {
+     u32 int_bit;
+     const char *msg;
+     u32 status_reg;
+     u32 addr_reg;
+     u32 addr_reg_hi;
+};
+
  /*
   * These IDs are for internal use of Tegra ICC drivers. The ID numbers are
   * chosen such that they don't conflict with the device-tree ICC node IDs.
drivers/memory/tegra/tegra186.c +9 -0
index 6766cc4..4f3ae71 100644
@@ -146,8 +146,107 @@ static void tegra186_mc_clear_interrupt(struct tegra_mc *mc)
       mc_writel(mc, MC_INTSTATUS_CLEAR, MC_INTSTATUS);
  }
 
+static const struct tegra_mc_error int_mc_errors[] = {
+     {
+             .int_bit = MC_INT_DECERR_EMEM,
+             .msg = "EMEM address decode error",
+             .status_reg = MC_ERR_STATUS,
+             .addr_reg = MC_ERR_ADR,
+     },
+     {
+             .int_bit = MC_INT_SECURITY_VIOLATION,

drivers/memory/tegra/tegra186.c static void tegra186_mc_clear_interrupt(struct tegra_mc *mc) · line 167

Quoted 10 lines
drivers/memory/tegra/tegra186.c +10 -0
+             .msg = "non secure access to secure region",
+             .status_reg = MC_ERR_STATUS,
+             .addr_reg = MC_ERR_ADR,
+     },
+     {
+             .int_bit = MC_INT_DECERR_VPR,
+             .msg = "MC request violates VPR requirements",
+             .status_reg = MC_ERR_VPR_STATUS,
+             .addr_reg = MC_ERR_VPR_ADR,
+     },

I see that these VPR registers present on all SoCs starting with T124. It doesn't look like you need the separate IRQ handlers at all, instead please extend the common T30 handler. For example, you may add a switch-case statements to handle those T124+ specific bits differently.

static irqreturn_t tegra30_mc_handle_irq(int irq, void *data) {
...

Quoted 15 lines
         switch (bit) {
         case MC_INT_DECERR_VPR:
                 status_reg = MC_ERR_VPR_STATUS;
                 addr_reg   = MC_ERR_VPR_ADR;
                 break;
         ...
         default:
                 status_reg = MC_ERR_STATUS;
                 addr_reg   = MC_ERR_ADR;
         }

         value = mc_readl(mc, status_reg);
         ...

         value = mc_readl(mc, addr_reg);

Okay. I'll use same handler as Tegra30 with additional Tegra186 onward bits.
Also, shall I change name of tegra30_mc_handle_irq() to tegra_mc_handle_irq() as we are using it across all Tegra SOCs ?

#17 lore raw

Re: [Patch V1 3/4] memory: tegra: add mc-err support for T186

19.01.2022 11:53, Ashish Mhetre пишет:

Quoted 108 lines · Dmitry Osipenko
Quoted 14 lines

External email: Use caution opening links or attachments

11.01.2022 21:45, Ashish Mhetre пишет:

Quoted 10 lines

Add all mc-errors supported by T186.
Implement mc interrupt handling routine for T186.

---
  drivers/memory/tegra/mc.h       |  17 +++++++
  drivers/memory/tegra/tegra186.c | 100
++++++++++++++++++++++++++++++++++++++++

  2 files changed, 117 insertions(+)
Quoted 11 lines

drivers/memory/tegra/mc.h line 46

Quoted 8 lines
drivers/memory/tegra/mc.h +0 -0
index 2d4f495..7817492 100644
@@ -44,6 +44,15 @@
   #define MC_TIMING_CONTROL_DBG                                0xf8
   #define MC_TIMING_CONTROL                            0xfc
 

this empty line is unnecessary

I'll fix this in next version.

Quoted 78 lines
Quoted 48 lines
drivers/memory/tegra/mc.h +17 -0
+#define MC_ERR_VPR_STATUS                            0x654
+#define MC_ERR_VPR_ADR                                       0x658
+#define MC_ERR_SEC_STATUS                            0x67c
+#define MC_ERR_SEC_ADR                                       0x680
+#define MC_ERR_MTS_STATUS                            0x9b0
+#define MC_ERR_MTS_ADR                                       0x9b4
+#define MC_ERR_GENERALIZED_CARVEOUT_STATUS           0xc00
+#define MC_ERR_GENERALIZED_CARVEOUT_ADR                      0xc04
+
   #define MC_INT_DECERR_ROUTE_SANITY                   BIT(20)
   #define MC_INT_WCAM_ERR                                      BIT(19)
   #define MC_INT_SCRUB_ECC_WR_ACK                              BIT(18)
@@ -159,6 +168,14 @@ extern const struct tegra_mc_ops tegra186_mc_ops;
   extern const char * const tegra_mc_status_names[32];
   extern const char * const tegra_mc_error_names[8];
 
+struct tegra_mc_error {
+     u32 int_bit;
+     const char *msg;
+     u32 status_reg;
+     u32 addr_reg;
+     u32 addr_reg_hi;
+};
+
   /*
    * These IDs are for internal use of Tegra ICC drivers. The ID

numbers are
   * chosen such that they don't conflict with the device-tree ICC node IDs.

drivers/memory/tegra/tegra186.c +9 -0
index 6766cc4..4f3ae71 100644
@@ -146,8 +146,107 @@ static void tegra186_mc_clear_interrupt(struct
 tegra_mc *mc)
        mc_writel(mc, MC_INTSTATUS_CLEAR, MC_INTSTATUS);
   }
 
+static const struct tegra_mc_error int_mc_errors[] = {
+     {
+             .int_bit = MC_INT_DECERR_EMEM,
+             .msg = "EMEM address decode error",
+             .status_reg = MC_ERR_STATUS,
+             .addr_reg = MC_ERR_ADR,
+     },
+     {
+             .int_bit = MC_INT_SECURITY_VIOLATION,

drivers/memory/tegra/tegra186.c static void tegra186_mc_clear_interrupt(struct · line 168

Quoted 10 lines
drivers/memory/tegra/tegra186.c +10 -0
+             .msg = "non secure access to secure region",
+             .status_reg = MC_ERR_STATUS,
+             .addr_reg = MC_ERR_ADR,
+     },
+     {
+             .int_bit = MC_INT_DECERR_VPR,
+             .msg = "MC request violates VPR requirements",
+             .status_reg = MC_ERR_VPR_STATUS,
+             .addr_reg = MC_ERR_VPR_ADR,
+     },

I see that these VPR registers present on all SoCs starting with T124. It doesn't look like you need the separate IRQ handlers at all, instead please extend the common T30 handler. For example, you may add a switch-case statements to handle those T124+ specific bits differently.

static irqreturn_t tegra30_mc_handle_irq(int irq, void *data) {
...
         switch (bit) {
         case MC_INT_DECERR_VPR:
                 status_reg = MC_ERR_VPR_STATUS; addr_reg   = MC_ERR_VPR_ADR; break;
         ...
         default:
                 status_reg = MC_ERR_STATUS; addr_reg   = MC_ERR_ADR;
         }

Quoted 8 lines
Quoted 4 lines

         value = mc_readl(mc, status_reg);
         ...

         value = mc_readl(mc, addr_reg);

Okay. I'll use same handler as Tegra30 with additional Tegra186 onward bits.
Also, shall I change name of tegra30_mc_handle_irq() to tegra_mc_handle_irq() as we are using it across all Tegra SOCs ?

T20 won't use it, no need to change the name.

#18 lore raw

Re: [Patch V1 3/4] memory: tegra: add mc-err support for T186

In reply to Ashish Mhetre

11.01.2022 21:45, Ashish Mhetre пишет:

Quoted 41 lines
drivers/memory/tegra/tegra186.c +41 -0
+static const struct tegra_mc_error int_mc_errors[] = {
+	{
+		.int_bit = MC_INT_DECERR_EMEM,
+		.msg = "EMEM address decode error",
+		.status_reg = MC_ERR_STATUS,
+		.addr_reg = MC_ERR_ADR,
+	},
+	{
+		.int_bit = MC_INT_SECURITY_VIOLATION,
+		.msg = "non secure access to secure region",
+		.status_reg = MC_ERR_STATUS,
+		.addr_reg = MC_ERR_ADR,
+	},
+	{
+		.int_bit = MC_INT_DECERR_VPR,
+		.msg = "MC request violates VPR requirements",
+		.status_reg = MC_ERR_VPR_STATUS,
+		.addr_reg = MC_ERR_VPR_ADR,
+	},
+	{
+		.int_bit = MC_INT_SECERR_SEC,
+		.msg = "MC request violated SEC carveout requirements",
+		.status_reg = MC_ERR_SEC_STATUS,
+		.addr_reg = MC_ERR_SEC_ADR,
+	},
+	{
+		.int_bit = MC_INT_DECERR_MTS,
+		.msg = "MTS carveout access violation",
+		.status_reg = MC_ERR_MTS_STATUS,
+		.addr_reg = MC_ERR_MTS_ADR,
+	},
+	{
+		.int_bit = MC_INT_DECERR_GENERALIZED_CARVEOUT,
+		.msg = "GSC access violation",
+		.status_reg = MC_ERR_GENERALIZED_CARVEOUT_STATUS,
+		.addr_reg = MC_ERR_GENERALIZED_CARVEOUT_ADR,
+	},
+};
+
+static irqreturn_t tegra186_mc_handle_irq(int irq, void *data)
+{

drivers/memory/tegra/tegra186.c static void tegra186_mc_clear_interrupt(struct tegra_mc *mc) · line 199

Quoted 10 lines
drivers/memory/tegra/tegra186.c +10 -0
+	struct tegra_mc *mc = data;
+	unsigned long status;
+	unsigned int bit;
+
+	status = mc_readl(mc, MC_INTSTATUS) & mc->soc->intmask;
+	if (!status)
+		return IRQ_NONE;
+
+	for_each_set_bit(bit, &status, 32) {
+		const char *error = int_mc_errors[bit].msg ?: "unknown";

int_mc_errors[bit] isn't what you need and .int_bit is unused, which suggests that all this code doesn't work and was untested. Please don't send untested patches.

#19 lore raw

Re: [Patch V1 3/4] memory: tegra: add mc-err support for T186

Quoted 51 lines · Dmitry Osipenko

External email: Use caution opening links or attachments

11.01.2022 21:45, Ashish Mhetre пишет:

Quoted 47 lines
drivers/memory/tegra/tegra186.c +47 -0
+static const struct tegra_mc_error int_mc_errors[] = {
+     {
+             .int_bit = MC_INT_DECERR_EMEM,
+             .msg = "EMEM address decode error",
+             .status_reg = MC_ERR_STATUS,
+             .addr_reg = MC_ERR_ADR,
+     },
+     {
+             .int_bit = MC_INT_SECURITY_VIOLATION,
+             .msg = "non secure access to secure region",
+             .status_reg = MC_ERR_STATUS,
+             .addr_reg = MC_ERR_ADR,
+     },
+     {
+             .int_bit = MC_INT_DECERR_VPR,
+             .msg = "MC request violates VPR requirements",
+             .status_reg = MC_ERR_VPR_STATUS,
+             .addr_reg = MC_ERR_VPR_ADR,
+     },
+     {
+             .int_bit = MC_INT_SECERR_SEC,
+             .msg = "MC request violated SEC carveout requirements",
+             .status_reg = MC_ERR_SEC_STATUS,
+             .addr_reg = MC_ERR_SEC_ADR,
+     },
+     {
+             .int_bit = MC_INT_DECERR_MTS,
+             .msg = "MTS carveout access violation",
+             .status_reg = MC_ERR_MTS_STATUS,
+             .addr_reg = MC_ERR_MTS_ADR,
+     },
+     {
+             .int_bit = MC_INT_DECERR_GENERALIZED_CARVEOUT,
+             .msg = "GSC access violation",
+             .status_reg = MC_ERR_GENERALIZED_CARVEOUT_STATUS,
+             .addr_reg = MC_ERR_GENERALIZED_CARVEOUT_ADR,
+     },
+};
+
+static irqreturn_t tegra186_mc_handle_irq(int irq, void *data)
+{
+     struct tegra_mc *mc = data;
+     unsigned long status;
+     unsigned int bit;
+
+     status = mc_readl(mc, MC_INTSTATUS) & mc->soc->intmask;
+     if (!status)
Quoted 8 lines

drivers/memory/tegra/tegra186.c static void tegra186_mc_clear_interrupt(struct tegra_mc *mc) · line 199

Quoted 4 lines
drivers/memory/tegra/tegra186.c +4 -0
+             return IRQ_NONE;
+
+     for_each_set_bit(bit, &status, 32) {
+             const char *error = int_mc_errors[bit].msg ?: "unknown";

int_mc_errors[bit] isn't what you need and .int_bit is unused, which suggests that all this code doesn't work and was untested. Please don't send untested patches.

Yes, my bad. I will update this in next patch.
Actually I made sure that the patches build without errors and also made sure that they does not break anything. As for reproducing each of these memory controller errors, I agree that I haven't done that.

#20 lore raw

Re: [Patch V1 3/4] memory: tegra: add mc-err support for T186

In reply to Ashish Mhetre

11.01.2022 21:45, Ashish Mhetre пишет:

Quoted 3 lines

#define MC_INT_DECERR_ROUTE_SANITY BIT(20)
#define MC_INT_WCAM_ERR BIT(19)
#define MC_INT_SCRUB_ECC_WR_ACK BIT(18)

I don't see where these errors are handled in the code. Is documentation that explains these bits publicly available?

#21 lore raw

Re: [Patch V1 3/4] memory: tegra: add mc-err support for T186

12.01.2022 14:22, Dmitry Osipenko пишет:

Quoted 8 lines

11.01.2022 21:45, Ashish Mhetre пишет:

Quoted 3 lines

#define MC_INT_DECERR_ROUTE_SANITY BIT(20)
#define MC_INT_WCAM_ERR BIT(19)
#define MC_INT_SCRUB_ECC_WR_ACK BIT(18)

I don't see where these errors are handled in the code. Is documentation that explains these bits publicly available?

MC_INT_SCRUB_ECC_WR_ACK shouldn't be a error.

#22 lore raw

Re: [Patch V1 3/4] memory: tegra: add mc-err support for T186

Quoted 12 lines · Dmitry Osipenko

External email: Use caution opening links or attachments

12.01.2022 14:22, Dmitry Osipenko пишет:

Quoted 8 lines

11.01.2022 21:45, Ashish Mhetre пишет:

Quoted 3 lines
  #define MC_INT_DECERR_ROUTE_SANITY                  BIT(20)
  #define MC_INT_WCAM_ERR                                     BIT(19)
  #define MC_INT_SCRUB_ECC_WR_ACK                             BIT(18)

I don't see where these errors are handled in the code. Is documentation that explains these bits publicly available?

MC_INT_DECERR_ROUTE_SANITY is supposed to be part a of Tegra194 interrupts. I have missed adding it and will update in next version. MC_INT_WCAM_ERR is a MC channel error and is not applicable in upstream. I'll remove it.
These bits are defined in same documentation where other errors are defined.

Quoted 2 lines

MC_INT_SCRUB_ECC_WR_ACK shouldn't be a error.

Okay, I 'll remove it.

#23 lore raw

Re: [Patch V1 3/4] memory: tegra: add mc-err support for T186

19.01.2022 12:09, Ashish Mhetre пишет:

Quoted 15 lines · Dmitry Osipenko
Quoted 12 lines

External email: Use caution opening links or attachments

12.01.2022 14:22, Dmitry Osipenko пишет:

Quoted 8 lines

11.01.2022 21:45, Ashish Mhetre пишет:

Quoted 3 lines

  #define MC_INT_DECERR_ROUTE_SANITY                  BIT(20) #define MC_INT_WCAM_ERR                                     BIT(19) #define MC_INT_SCRUB_ECC_WR_ACK                             BIT(18)

I don't see where these errors are handled in the code. Is documentation that explains these bits publicly available?

Quoted 6 lines

MC_INT_DECERR_ROUTE_SANITY is supposed to be part a of Tegra194 interrupts. I have missed adding it and will update in next version. MC_INT_WCAM_ERR is a MC channel error and is not applicable in upstream. I'll remove it.
These bits are defined in same documentation where other errors are defined.

Is this documentation publicly available? I only have access to the public TRM that can be downloaded from the NVIDIA website and there are no register sets there for newer SoCs, AFAICS. If TRM was updated and now contains registers, then I'll try to get the latest version.

#24 lore raw

PATCH 4/4 memory: tegra: add mc-err support for T194

In reply to Ashish Mhetre

Add all basic mc-errors supported by T194.
Implement mc interrupt handling routine for T194.

---
 drivers/memory/tegra/mc.h       |   2 +
 drivers/memory/tegra/tegra194.c | 108 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 110 insertions(+)
drivers/memory/tegra/mc.h +2 -0
index 7817492..1d881e7 100644
@@ -43,6 +43,7 @@
 #define MC_EMEM_ARB_OVERRIDE				0xe8
 #define MC_TIMING_CONTROL_DBG				0xf8
 #define MC_TIMING_CONTROL				0xfc
+#define MC_ERR_ADR_HI					0x11fc
 
 #define MC_ERR_VPR_STATUS				0x654
 #define MC_ERR_VPR_ADR					0x658
@@ -50,6 +51,7 @@
 #define MC_ERR_SEC_ADR					0x680
 #define MC_ERR_MTS_STATUS				0x9b0
 #define MC_ERR_MTS_ADR					0x9b4
+#define MC_ERR_GENERALIZED_CARVEOUT_STATUS_1		0xbfc
 #define MC_ERR_GENERALIZED_CARVEOUT_STATUS		0xc00
 #define MC_ERR_GENERALIZED_CARVEOUT_ADR			0xc04
 
drivers/memory/tegra/tegra194.c +108 -0

128 lines not on this page · raw message

Signature · 1 line
2.7.4