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

From: Ashish Mhetre
Date: Wed Jan 19 2022 - 03:59:05 EST




On 1/12/2022 4:32 PM, Dmitry Osipenko wrote:
External email: Use caution opening links or attachments


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.
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.