Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80a75f12 authored by Neeraj Upadhyay's avatar Neeraj Upadhyay Committed by Mukesh Ojha
Browse files

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: default avatarNeeraj Upadhyay <neeraju@codeaurora.org>
Signed-off-by: default avatarMukesh Ojha <mojha@codeaurora.org>
parent 1565876a
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
// 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>
@@ -129,6 +130,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;
};

@@ -398,6 +400,23 @@ static void kryo_check_l3_scu_error(struct edac_device_ctl_info *edev_ctl)
	spin_unlock_irqrestore(&local_handler_lock, flags);
}

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;

#ifdef CONFIG_EDAC_KRYO_ARM64_PANIC_ON_CE
	edev_ctl->panic_on_ce = 0;
#endif
	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);
@@ -480,6 +499,9 @@ static int kryo_cpu_erp_probe(struct platform_device *pdev)
#endif
	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);