Message ID | 20250212083354.31919-1-qiuxu.zhuo@intel.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [1/1] EDAC/igen6: Fix the flood of invalid error reports | expand |
… > +++ b/drivers/edac/igen6_edac.c > @@ -785,13 +785,22 @@ static u64 ecclog_read_and_clear(struct igen6_imc *imc) > { … > + if (ecclog == ~0) … > + if (!(ecclog & (ECC_ERROR_LOG_CE | ECC_ERROR_LOG_UE))) … May these condition checks be combined without repeating the statement “return 0;”? Regards, Markus
> From: Markus Elfring <Markus.Elfring@web.de> > [...] > > @@ -785,13 +785,22 @@ static u64 ecclog_read_and_clear(struct > > igen6_imc *imc) { > … > > + if (ecclog == ~0) > … > > + if (!(ecclog & (ECC_ERROR_LOG_CE | ECC_ERROR_LOG_UE))) > … > > May these condition checks be combined without repeating the statement > “return 0;”? Thanks for the suggestion. Yes. However, I think that using separate "return 0" statements makes the code more readable. -Qiuxu
diff --git a/drivers/edac/igen6_edac.c b/drivers/edac/igen6_edac.c index fdf3a84fe698..595908af9e5c 100644 --- a/drivers/edac/igen6_edac.c +++ b/drivers/edac/igen6_edac.c @@ -785,13 +785,22 @@ static u64 ecclog_read_and_clear(struct igen6_imc *imc) { u64 ecclog = readq(imc->window + ECC_ERROR_LOG_OFFSET); - if (ecclog & (ECC_ERROR_LOG_CE | ECC_ERROR_LOG_UE)) { - /* Clear CE/UE bits by writing 1s */ - writeq(ecclog, imc->window + ECC_ERROR_LOG_OFFSET); - return ecclog; - } + /* + * Quirk: The ECC_ERROR_LOG register of certain SoCs may contain + * the invalid value ~0. This will result in a flood of invalid + * error reports in polling mode. Skip it. + */ + if (ecclog == ~0) + return 0; - return 0; + /* Neither a CE nor a UE. Skip it.*/ + if (!(ecclog & (ECC_ERROR_LOG_CE | ECC_ERROR_LOG_UE))) + return 0; + + /* Clear CE/UE bits by writing 1s */ + writeq(ecclog, imc->window + ECC_ERROR_LOG_OFFSET); + + return ecclog; } static void errsts_clear(struct igen6_imc *imc)