linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] x86/mce: Define function to extract ErrorAddr from MCA_ADDR
@ 2021-06-25  1:33 Smita Koralahalli
  2021-06-25  1:33 ` [PATCH 2/2] x86/mce: Add support for Extended Physical Address MCA changes Smita Koralahalli
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Smita Koralahalli @ 2021-06-25  1:33 UTC (permalink / raw)
  To: x86, linux-kernel, linux-edac
  Cc: Tony Luck, H . Peter Anvin, Yazen Ghannam, Muralidhara M K,
	Akshay Gupta, Youquan Song, Zhen Lei, Smita Koralahalli

Move MCA_ADDR[ErrorAddr] extraction into a separate helper function. This
will be further refactored in the next patch.

Signed-off-by: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
---
v2:
	- No change.
---
 arch/x86/include/asm/mce.h     |  2 ++
 arch/x86/kernel/cpu/mce/amd.c  | 14 +++++++++-----
 arch/x86/kernel/cpu/mce/core.c |  7 ++-----
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index 0607ec4f5091..0a1c7224a582 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -357,6 +357,7 @@ extern int mce_threshold_remove_device(unsigned int cpu);
 
 void mce_amd_feature_init(struct cpuinfo_x86 *c);
 int umc_normaddr_to_sysaddr(u64 norm_addr, u16 nid, u8 umc, u64 *sys_addr);
+void smca_extract_err_addr(struct mce *m);
 
 #else
 
@@ -366,6 +367,7 @@ static inline bool amd_mce_is_memory_error(struct mce *m)		{ return false; };
 static inline void mce_amd_feature_init(struct cpuinfo_x86 *c)		{ }
 static inline int
 umc_normaddr_to_sysaddr(u64 norm_addr, u16 nid, u8 umc, u64 *sys_addr)	{ return -EINVAL; };
+static inline void smca_extract_err_addr(struct mce *m)			{ }
 #endif
 
 static inline void mce_hygon_feature_init(struct cpuinfo_x86 *c)	{ return mce_amd_feature_init(c); }
diff --git a/arch/x86/kernel/cpu/mce/amd.c b/arch/x86/kernel/cpu/mce/amd.c
index 08831acc1d03..f71435e53cdb 100644
--- a/arch/x86/kernel/cpu/mce/amd.c
+++ b/arch/x86/kernel/cpu/mce/amd.c
@@ -899,6 +899,13 @@ bool amd_mce_is_memory_error(struct mce *m)
 	return m->bank == 4 && xec == 0x8;
 }
 
+void smca_extract_err_addr(struct mce *m)
+{
+	u8 lsb = (m->addr >> 56) & 0x3f;
+
+	m->addr &= GENMASK_ULL(55, lsb);
+}
+
 static void __log_error(unsigned int bank, u64 status, u64 addr, u64 misc)
 {
 	struct mce m;
@@ -917,11 +924,8 @@ static void __log_error(unsigned int bank, u64 status, u64 addr, u64 misc)
 		 * 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);
-		}
+		if (mce_flags.smca)
+			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 bf7fe87a7e88..2c09c1eec50a 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -703,11 +703,8 @@ static void mce_read_aux(struct mce *m, int i)
 		 * 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);
-		}
+		if (mce_flags.smca)
+			smca_extract_err_addr(m);
 	}
 
 	if (mce_flags.smca) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH 0/2] x86/mce: Support extended MCA_ADDR address on SMCA systems
@ 2021-06-08 22:10 Smita Koralahalli
  2021-06-08 22:10 ` [PATCH 1/2] x86/mce: Define function to extract ErrorAddr from MCA_ADDR Smita Koralahalli
  0 siblings, 1 reply; 7+ messages in thread
From: Smita Koralahalli @ 2021-06-08 22:10 UTC (permalink / raw)
  To: x86, linux-kernel, linux-edac
  Cc: Borislav Petkov, Tony Luck, Yazen Ghannam, Muralidhara M K,
	Akshay Gupta, Youquan Song, Zhen Lei, Thomas Gleixner,
	Ingo Molnar, H . Peter Anvin, Smita Koralahalli

This series of patches adds support for extended physical address on newer
AMD processors such as AMD 'Milan'.

The first patch defines a separate helper function to extract
MCA_ADDR[ErrorAddr].

The second patch adds support for extended ErrorAddr bits in MCA_ADDR.

Smita Koralahalli (2):
  x86/mce: Define function to extract ErrorAddr from MCA_ADDR
  x86/mce: Add support for Extended Physical Address MCA changes

 arch/x86/include/asm/mce.h     |  4 ++++
 arch/x86/kernel/cpu/mce/amd.c  | 41 ++++++++++++++++++++++++++--------
 arch/x86/kernel/cpu/mce/core.c | 13 ++++-------
 3 files changed, 40 insertions(+), 18 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-10-08 16:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25  1:33 [PATCH 1/2] x86/mce: Define function to extract ErrorAddr from MCA_ADDR Smita Koralahalli
2021-06-25  1:33 ` [PATCH 2/2] x86/mce: Add support for Extended Physical Address MCA changes Smita Koralahalli
2021-07-13 16:21   ` Yazen Ghannam
2021-07-13 16:10 ` [PATCH 1/2] x86/mce: Define function to extract ErrorAddr from MCA_ADDR Yazen Ghannam
2021-09-13 19:19 ` Smita Koralahalli Channabasappa
2021-10-08 16:45   ` Borislav Petkov
  -- strict thread matches above, loose matches on Subject: below --
2021-06-08 22:10 [PATCH 0/2] x86/mce: Support extended MCA_ADDR address on SMCA systems Smita Koralahalli
2021-06-08 22:10 ` [PATCH 1/2] x86/mce: Define function to extract ErrorAddr from MCA_ADDR Smita Koralahalli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).