Skip to content

Commit da1536b

Browse files
qzhuo2ranjan-dutta
authored andcommitted
EDAC/igen6: Add registration APIs for In-Band ECC error notification
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@intel.com>
1 parent 39b1cbd commit da1536b

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

drivers/edac/igen6_edac.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include "edac_mc.h"
2828
#include "edac_module.h"
29+
#include "igen6_edac.h"
2930

3031
#define IGEN6_REVISION "v2.5.1"
3132

@@ -428,6 +429,20 @@ static const struct pci_device_id igen6_pci_tbl[] = {
428429
};
429430
MODULE_DEVICE_TABLE(pci, igen6_pci_tbl);
430431

432+
static BLOCKING_NOTIFIER_HEAD(ibecc_err_handler_chain);
433+
434+
int ibecc_err_register_notifer(struct notifier_block *nb)
435+
{
436+
return blocking_notifier_chain_register(&ibecc_err_handler_chain, nb);
437+
}
438+
EXPORT_SYMBOL_GPL(ibecc_err_register_notifer);
439+
440+
int ibecc_err_unregister_notifer(struct notifier_block *nb)
441+
{
442+
return blocking_notifier_chain_unregister(&ibecc_err_handler_chain, nb);
443+
}
444+
EXPORT_SYMBOL_GPL(ibecc_err_unregister_notifer);
445+
431446
static enum dev_type get_width(int dimm_l, u32 mad_dimm)
432447
{
433448
u32 w = dimm_l ? MAD_DIMM_CH_DLW(mad_dimm) :
@@ -545,13 +560,21 @@ static void igen6_output_error(struct decoded_addr *res,
545560
enum hw_event_mc_err_type type = ecclog & ECC_ERROR_LOG_UE ?
546561
HW_EVENT_ERR_UNCORRECTED :
547562
HW_EVENT_ERR_CORRECTED;
563+
struct ibecc_err_info e;
548564

549565
edac_mc_handle_error(type, mci, 1,
550566
res->sys_addr >> PAGE_SHIFT,
551567
res->sys_addr & ~PAGE_MASK,
552568
ECC_ERROR_LOG_SYND(ecclog),
553569
res->channel_idx, res->sub_channel_idx,
554570
-1, "", "");
571+
572+
/* Notify other handlers for further IBECC error handling */
573+
memset(&e, 0, sizeof(e));
574+
e.type = type;
575+
e.sys_addr = res->sys_addr;
576+
e.ecc_log = ecclog;
577+
blocking_notifier_call_chain(&ibecc_err_handler_chain, 0, &e);
555578
}
556579

557580
static struct gen_pool *ecclog_gen_pool_create(void)

drivers/edac/igen6_edac.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/*
3+
* Registration for IBECC error notification
4+
* Copyright (C) 2020 Intel Corporation
5+
*/
6+
7+
#ifndef _IGEN6_EDAC_H
8+
#define _IGEN6_EDAC_H
9+
10+
#include <linux/edac.h>
11+
#include <linux/notifier.h>
12+
13+
struct ibecc_err_info {
14+
enum hw_event_mc_err_type type;
15+
u64 sys_addr;
16+
u64 ecc_log;
17+
};
18+
19+
int ibecc_err_register_notifer(struct notifier_block *nb);
20+
int ibecc_err_unregister_notifer(struct notifier_block *nb);
21+
22+
#endif /* _IGEN6_EDAC_H */

0 commit comments

Comments
 (0)