[SRU][Jammy:linux-intel-iotg][PATCH v2 1/1] UBUNTU: SAUCE: EDAC/igen6: Add registration APIs for In-Band ECC error notification
Jian Hui Lee
jianhui.lee at canonical.com
Tue May 10 12:22:43 UTC 2022
From: Qiuxu Zhuo <qiuxu.zhuo at intel.com>
BugLink: https://launchpad.net/bugs/1929901
The igen6_edac driver is the root to capture the In-Band ECC error
event. There are some external modules which want to be notified about
the In-Band ECC errors for specific error handling. So add the
registration APIs for those external modules for the In-Band ECC errors.
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo at intel.com>
Signed-off-by: Hsuan-Yu Lin <shane.lin at canonical.com>
Signed-off-by: Wen-chien Jesse Sung <jesse.sung at canonical.com>
(cherry picked from commit a2d2ab315873d4c4f1db8b57f0281bad633b202f linux-intel-5.13)
Signed-off-by: Jian Hui Lee <jianhui.lee at canonical.com>
---
drivers/edac/igen6_edac.c | 23 +++++++++++++++++++++++
drivers/edac/igen6_edac.h | 22 ++++++++++++++++++++++
2 files changed, 45 insertions(+)
create mode 100644 drivers/edac/igen6_edac.h
diff --git a/drivers/edac/igen6_edac.c b/drivers/edac/igen6_edac.c
index a07bbfd075d0..0cdb8f6745c7 100644
--- a/drivers/edac/igen6_edac.c
+++ b/drivers/edac/igen6_edac.c
@@ -26,6 +26,7 @@
#include "edac_mc.h"
#include "edac_module.h"
+#include "igen6_edac.h"
#define IGEN6_REVISION "v2.5"
@@ -428,6 +429,20 @@ static const struct pci_device_id igen6_pci_tbl[] = {
};
MODULE_DEVICE_TABLE(pci, igen6_pci_tbl);
+static BLOCKING_NOTIFIER_HEAD(ibecc_err_handler_chain);
+
+int ibecc_err_register_notifer(struct notifier_block *nb)
+{
+ return blocking_notifier_chain_register(&ibecc_err_handler_chain, nb);
+}
+EXPORT_SYMBOL_GPL(ibecc_err_register_notifer);
+
+int ibecc_err_unregister_notifer(struct notifier_block *nb)
+{
+ return blocking_notifier_chain_unregister(&ibecc_err_handler_chain, nb);
+}
+EXPORT_SYMBOL_GPL(ibecc_err_unregister_notifer);
+
static enum dev_type get_width(int dimm_l, u32 mad_dimm)
{
u32 w = dimm_l ? MAD_DIMM_CH_DLW(mad_dimm) :
@@ -545,6 +560,7 @@ static void igen6_output_error(struct decoded_addr *res,
enum hw_event_mc_err_type type = ecclog & ECC_ERROR_LOG_UE ?
HW_EVENT_ERR_UNCORRECTED :
HW_EVENT_ERR_CORRECTED;
+ struct ibecc_err_info e;
edac_mc_handle_error(type, mci, 1,
res->sys_addr >> PAGE_SHIFT,
@@ -552,6 +568,13 @@ static void igen6_output_error(struct decoded_addr *res,
ECC_ERROR_LOG_SYND(ecclog),
res->channel_idx, res->sub_channel_idx,
-1, "", "");
+
+ /* Notify other handlers for further IBECC error handling */
+ memset(&e, 0, sizeof(e));
+ e.type = type;
+ e.sys_addr = res->sys_addr;
+ e.ecc_log = ecclog;
+ blocking_notifier_call_chain(&ibecc_err_handler_chain, 0, &e);
}
static struct gen_pool *ecclog_gen_pool_create(void)
diff --git a/drivers/edac/igen6_edac.h b/drivers/edac/igen6_edac.h
new file mode 100644
index 000000000000..ca447593bdf8
--- /dev/null
+++ b/drivers/edac/igen6_edac.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Registration for IBECC error notification
+ * Copyright (C) 2020 Intel Corporation
+ */
+
+#ifndef _IGEN6_EDAC_H
+#define _IGEN6_EDAC_H
+
+#include <linux/edac.h>
+#include <linux/notifier.h>
+
+struct ibecc_err_info {
+ enum hw_event_mc_err_type type;
+ u64 sys_addr;
+ u64 ecc_log;
+};
+
+int ibecc_err_register_notifer(struct notifier_block *nb);
+int ibecc_err_unregister_notifer(struct notifier_block *nb);
+
+#endif /* _IGEN6_EDAC_H */
--
2.34.1
More information about the kernel-team
mailing list