drivers: edac: Add panic notifier for kryo EDAC device

Add panic notifier, which captures any cache errors
which were not handled, due to interrupts not getting
handled.

Change-Id: I9315a32dcbf6fdfa509c4ab934b75d076fedfa39
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
This commit is contained in:
Neeraj Upadhyay
2020-03-02 12:17:44 +05:30
parent 7a55aabe29
commit 70a6545571

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/kernel.h>
@@ -11,6 +11,7 @@
#include <linux/cpu.h>
#include <linux/cpu_pm.h>
#include <linux/interrupt.h>
#include <linux/notifier.h>
#include <linux/of_irq.h>
#include <asm/cputype.h>
@@ -136,6 +137,7 @@ struct erp_drvdata {
struct edac_device_ctl_info *edev_ctl;
struct erp_drvdata __percpu **erp_cpu_drvdata;
struct notifier_block nb_pm;
struct notifier_block nb_panic;
int ppi;
};
@@ -403,6 +405,21 @@ void kryo_poll_cache_errors(struct edac_device_ctl_info *edev_ctl)
edev_ctl, 0);
}
static int kryo_cpu_panic_notify(struct notifier_block *this,
unsigned long event, void *ptr)
{
struct edac_device_ctl_info *edev_ctl =
panic_handler_drvdata->edev_ctl;
edev_ctl->panic_on_ce = 0;
edev_ctl->panic_on_ue = 0;
kryo_check_l3_scu_error(edev_ctl);
kryo_check_l1_l2_ecc(edev_ctl);
return NOTIFY_OK;
}
static irqreturn_t kryo_l1_l2_handler(int irq, void *drvdata)
{
kryo_check_l1_l2_ecc(panic_handler_drvdata->edev_ctl);
@@ -488,6 +505,9 @@ static int kryo_cpu_erp_probe(struct platform_device *pdev)
drv->edev_ctl->panic_on_ce = ARM64_ERP_PANIC_ON_CE;
drv->edev_ctl->panic_on_ue = ARM64_ERP_PANIC_ON_UE;
drv->nb_pm.notifier_call = kryo_pmu_cpu_pm_notify;
drv->nb_panic.notifier_call = kryo_cpu_panic_notify;
atomic_notifier_chain_register(&panic_notifier_list,
&drv->nb_panic);
platform_set_drvdata(pdev, drv);
rc = edac_device_add_device(drv->edev_ctl);