Re: [Patch V3] memory: tegra: Add MC error logging on tegra186 onward

From: Dmitry Osipenko
Date: Fri Jan 21 2022 - 07:31:13 EST


...
> @@ -529,12 +536,44 @@ static irqreturn_t tegra30_mc_handle_irq(int irq, void *data)
> u8 id, type;
> u32 value;
>
> - value = mc_readl(mc, MC_ERR_STATUS);
> + switch (bit) {

Again, I see that the code wasn't tested :/ Shouldn't be too difficult
to create memory-read errors to check that at least basics work
properly. Please always test your changes next time.

So it must be "switch(BIT(bit))" here, please write it like this:

u32 intmask = BIT(bit);
...
switch(intmask) {

> + case MC_INT_DECERR_VPR:
> + status_reg = MC_ERR_VPR_STATUS;
> + addr_reg = MC_ERR_VPR_ADR;
> + break;

Please add newline after every "break;" of every case. This will make
code easier to read a tad.

> + case MC_INT_SECERR_SEC:
> + status_reg = MC_ERR_SEC_STATUS;
> + addr_reg = MC_ERR_SEC_ADR;
> + break;
> + case MC_INT_DECERR_MTS:
> + status_reg = MC_ERR_MTS_STATUS;
> + addr_reg = MC_ERR_MTS_ADR;
> + break;
> + case MC_INT_DECERR_GENERALIZED_CARVEOUT:
> + status_reg = MC_ERR_GENERALIZED_CARVEOUT_STATUS;
> + addr_reg = MC_ERR_GENERALIZED_CARVEOUT_ADR;
> + break;
> + case MC_INT_DECERR_ROUTE_SANITY:
> + status_reg = MC_ERR_ROUTE_SANITY_STATUS;
> + addr_reg = MC_ERR_ROUTE_SANITY_ADR;
> + break;
> + default:
> + status_reg = MC_ERR_STATUS;
> + addr_reg = MC_ERR_ADR;

Add newline here too.

> + if (mc->soc->has_addr_hi_reg)
> + addr_hi_reg = MC_ERR_ADR_HI;
> + break;
> + }
...
Note that you could use "git format-patch -v4 ..." instead of manually
changing the [PATCH] prefix.