[PATCH 2/5] x86/mcheck/AMD: Do not perform shared bank check for future processors

From: Aravind Gopalakrishnan
Date: Thu Jan 14 2016 - 17:30:54 EST


Fam17h and above should not require a check to see if a bank
is shared or not. For shared banks, there will always be only
one core that has visibility over the MSRs and only that
particular core will be allowed to write to the MSRs

Fixing the code to return early if we detect Fam17h or above.
No change in functionality for earlier processors

Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@xxxxxxx>
---
arch/x86/kernel/cpu/mcheck/mce_amd.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index e99b150..da570a8 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -84,6 +84,14 @@ struct thresh_restart {

static inline bool is_shared_bank(int bank)
{
+ /*
+ * For Fam17h and above, we shouldn't require this check.
+ * Only the core that can see valid values on the MSRs has
+ * control over the respective MCA bank
+ */
+ if (mce_flags.smca)
+ return 0;
+
/* Bank 4 is for northbridge reporting and is thus shared */
return (bank == 4);
}
--
2.7.0