[<prev] [next>] [day] [month] [year] [list]
Message-ID: <167231242579.4906.1017232750066168905.tip-bot2@tip-bot2>
Date: Thu, 29 Dec 2022 11:13:45 -0000
From: "tip-bot2 for Smita Koralahalli" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Smita Koralahalli <Smita.KoralahalliChannabasappa@....com>,
Borislav Petkov <bp@...e.de>,
"Borislav Petkov (AMD)" <bp@...en8.de>,
Yazen Ghannam <yazen.ghannam@....com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: ras/core] x86/mce: Define a function to extract ErrorAddr from MCA_ADDR
The following commit has been merged into the ras/core branch of tip:
Commit-ID: 2117654e806c08c343e3d0567bbedf33eab040c8
Gitweb: https://git.kernel.org/tip/2117654e806c08c343e3d0567bbedf33eab040c8
Author: Smita Koralahalli <Smita.KoralahalliChannabasappa@....com>
AuthorDate: Tue, 06 Dec 2022 11:36:06 -06:00
Committer: Borislav Petkov (AMD) <bp@...en8.de>
CommitterDate: Wed, 28 Dec 2022 22:11:48 +01:00
x86/mce: Define a function to extract ErrorAddr from MCA_ADDR
Move MCA_ADDR[ErrorAddr] extraction into a separate helper function. This
will be further refactored to support extended ErrorAddr bits in MCA_ADDR
in newer AMD CPUs.
[ bp: Massage. ]
Signed-off-by: Smita Koralahalli <Smita.KoralahalliChannabasappa@....com>
Signed-off-by: Borislav Petkov <bp@...e.de>
Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
Reviewed-by: Yazen Ghannam <yazen.ghannam@....com>
Link: https://lore.kernel.org/all/20220225193342.215780-3-Smita.KoralahalliChannabasappa@amd.com/
---
arch/x86/kernel/cpu/mce/amd.c | 10 +---------
arch/x86/kernel/cpu/mce/core.c | 10 +---------
arch/x86/kernel/cpu/mce/internal.h | 15 +++++++++++++++
3 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/arch/x86/kernel/cpu/mce/amd.c b/arch/x86/kernel/cpu/mce/amd.c
index 10fb5b5..c6b1fd5 100644
--- a/arch/x86/kernel/cpu/mce/amd.c
+++ b/arch/x86/kernel/cpu/mce/amd.c
@@ -736,15 +736,7 @@ static void __log_error(unsigned int bank, u64 status, u64 addr, u64 misc)
if (m.status & MCI_STATUS_ADDRV) {
m.addr = addr;
- /*
- * Extract [55:<lsb>] where lsb is the least significant
- * *valid* bit of the address bits.
- */
- if (mce_flags.smca) {
- u8 lsb = (m.addr >> 56) & 0x3f;
-
- m.addr &= GENMASK_ULL(55, lsb);
- }
+ smca_extract_err_addr(&m);
}
if (mce_flags.smca) {
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 2c8ec5c..d0ade77 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -633,15 +633,7 @@ static noinstr void mce_read_aux(struct mce *m, int i)
m->addr <<= shift;
}
- /*
- * Extract [55:<lsb>] where lsb is the least significant
- * *valid* bit of the address bits.
- */
- if (mce_flags.smca) {
- u8 lsb = (m->addr >> 56) & 0x3f;
-
- m->addr &= GENMASK_ULL(55, lsb);
- }
+ smca_extract_err_addr(m);
}
if (mce_flags.smca) {
diff --git a/arch/x86/kernel/cpu/mce/internal.h b/arch/x86/kernel/cpu/mce/internal.h
index 7e03f5b..6dcb94f 100644
--- a/arch/x86/kernel/cpu/mce/internal.h
+++ b/arch/x86/kernel/cpu/mce/internal.h
@@ -189,8 +189,23 @@ extern bool filter_mce(struct mce *m);
#ifdef CONFIG_X86_MCE_AMD
extern bool amd_filter_mce(struct mce *m);
+
+/* Extract [55:<lsb>] where lsb is the LS-*valid* bit of the address bits. */
+static __always_inline void smca_extract_err_addr(struct mce *m)
+{
+ u8 lsb;
+
+ if (!mce_flags.smca)
+ return;
+
+ lsb = (m->addr >> 56) & 0x3f;
+
+ m->addr &= GENMASK_ULL(55, lsb);
+}
+
#else
static inline bool amd_filter_mce(struct mce *m) { return false; }
+static inline void smca_extract_err_addr(struct mce *m) { }
#endif
#ifdef CONFIG_X86_ANCIENT_MCE
Powered by blists - more mailing lists