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

From: Dmitry Osipenko
Date: Wed Jan 12 2022 - 06:02:17 EST


11.01.2022 21:45, Ashish Mhetre пишет:
> +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)
> + 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.