From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751388AbdHaTSO (ORCPT ); Thu, 31 Aug 2017 15:18:14 -0400 Received: from mail.skyhub.de ([5.9.137.197]:43184 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750968AbdHaTSN (ORCPT ); Thu, 31 Aug 2017 15:18:13 -0400 Date: Thu, 31 Aug 2017 21:17:54 +0200 From: Borislav Petkov To: mark gross Cc: Tony Luck , linux-edac , Steven Rostedt , Yazen Ghannam , X86 ML , LKML , Mauro Carvalho Chehab Subject: Re: [PATCH 0/7] EDAC, mce_amd: Issue decoded MCE through the tracepoint Message-ID: <20170831191754.4nnv35lpugvel3ni@pd.tnic> References: <20170825102411.8682-1-bp@alien8.de> <20170828134549.wh6toneoca47ff2w@pd.tnic> <20170830114843.deetnlz2wjbgbaj4@pd.tnic> <20170830214719.GC103314@mtgdev> <20170830220254.g7xcwosgj2hcki4n@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20170830220254.g7xcwosgj2hcki4n@pd.tnic> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 31, 2017 at 12:02:54AM +0200, Borislav Petkov wrote: > Yeah, it is a bit ad-hoc. I guess I can add an arch_has_decoder() > wrapper which each arch can define. That would be cleaner. Something like this, I guess (ontop): --- diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h index 67f951f0c840..b4855edac729 100644 --- a/arch/x86/include/asm/mce.h +++ b/arch/x86/include/asm/mce.h @@ -388,4 +388,6 @@ static inline int mce_threshold_remove_device(unsigned int cpu) { return 0; }; #endif +#define ras_arch_has_decoder ras_arch_has_decoder +bool ras_arch_has_decoder(void); #endif /* _ASM_X86_MCE_H */ diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 3ecc2b2db8f3..6414fa70fd42 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c @@ -182,6 +182,12 @@ void mce_unregister_decode_chain(struct notifier_block *nb) } EXPORT_SYMBOL_GPL(mce_unregister_decode_chain); +bool ras_arch_has_decoder(void) +{ + return mca_cfg.has_decoder; +} +EXPORT_SYMBOL_GPL(ras_arch_has_decoder); + static inline u32 ctl_reg(int bank) { return MSR_IA32_MCx_CTL(bank); diff --git a/drivers/ras/debugfs.c b/drivers/ras/debugfs.c index 62d3da9d256f..b368e8ae4738 100644 --- a/drivers/ras/debugfs.c +++ b/drivers/ras/debugfs.c @@ -1,6 +1,6 @@ #include -#include "../../arch/x86/kernel/cpu/mcheck/mce-internal.h" +#include struct dentry *ras_debugfs_dir; @@ -15,7 +15,7 @@ EXPORT_SYMBOL_GPL(ras_userspace_consumers); static int trace_show(struct seq_file *m, void *v) { seq_printf(m, "readers:%d\n", atomic_read(&trace_count)); - seq_printf(m, "has decoder:%d\n", mca_cfg.has_decoder); + seq_printf(m, "has decoder:%d\n", ras_arch_has_decoder()); return 0; } diff --git a/drivers/ras/debugfs.h b/drivers/ras/debugfs.h index db72e4513191..9c75c4c5b84d 100644 --- a/drivers/ras/debugfs.h +++ b/drivers/ras/debugfs.h @@ -5,4 +5,9 @@ extern struct dentry *ras_debugfs_dir; +#ifndef ras_arch_has_decoder +#define ras_arch_has_decoder ras_arch_has_decoder +static inline bool ras_arch_has_decoder(void) { return false; } +#endif + #endif /* __RAS_DEBUGFS_H__ */ -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.