x86/mce: Add support for PHYSADDRV and PHYSADDRVALIDSUPPORTED bits
Subsystems (3)
PATCH v3 1/1 x86/mce: Add support for PHYSADDRV and PHYSADDRVALIDSUPPORTED bits
Starting with Zen6, AMD's Scalable MCA systems will incorporate two new bits in MCA_STATUS and MCA_CONFIG MSRs. These bits will indicate if a valid System Physical Address (SPA) is present in MCA_ADDR.
PhysAddrValidSupported bit (MCA_CONFIG[11]) serves as the architectural indicator and states if PhysAddrV bit (MCA_STATUS[54]) is Reserved or if it indicates validity of SPA in MCA_ADDR.
PhysAddrV bit (MCA_STATUS[54]) advertises if MCA_ADDR contains valid SPA or if it is implementation specific.
Use and prefer MCA_STATUS[PhysAddrV] when checking for a usable address.
---
Changes in v2:
1. Modified commit message per feedback received.
2. Refactored and simplified per feedback received.
CHanges in v3:
1. Avoid reading MCA_CONFIG register everytime amd_mce_usable_address() is called. Instead, just cache the value if PhysAddrValidSupported bit is set.
Links:
v1: https://lore.kernel.org/all/[email protected]/
v2: https://lore.kernel.org/all/[email protected]/
--- arch/x86/include/asm/mce.h | 2 ++ arch/x86/kernel/cpu/mce/amd.c | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
arch/x86/include/asm/mce.h +2 -0
@@ -48,6 +48,7 @@/* AMD-specific bits */ #define MCI_STATUS_TCC BIT_ULL(55)/* Task context corrupt */ +#define MCI_STATUS_PADDRV BIT_ULL(54)/* Valid System Physical Address */ #define MCI_STATUS_SYNDV BIT_ULL(53)/* synd reg. valid */ #define MCI_STATUS_DEFERRED BIT_ULL(44)/* uncorrected error, deferred exception */ #define MCI_STATUS_POISON BIT_ULL(43)/* access poisonous data */
@@ -62,6 +63,7 @@*/ #define MCI_CONFIG_MCAX 0x1#define MCI_CONFIG_FRUTEXT BIT_ULL(9) +#define MCI_CONFIG_PADDRV BIT_ULL(11)#define MCI_IPID_MCATYPE 0xFFFF0000#define MCI_IPID_HWID 0xFFF
arch/x86/kernel/cpu/mce/amd.c +13 -3
@@ -87,6 +87,8 @@ struct smca_bank {const struct smca_hwid *hwid;u32 id;/* Value of MCA_IPID[InstanceId]. */ u8 sysfs_id;/* Value used for sysfs name. */ + u64 paddrv :1, /* Physical Address Valid bit in MCA_CONFIG */ + __reserved :63; }; static DEFINE_PER_CPU_READ_MOSTLY(struct smca_bank[MAX_NR_BANKS], smca_banks);
@@ -327,6 +329,9 @@ static void smca_configure(unsigned int bank, unsigned int cpu)this_cpu_ptr (mce_banks_array)[bank].lsb_in_status = !!(low &BIT (8 )); +if (low &MCI_CONFIG_PADDRV ) +this_cpu_ptr (smca_banks)[bank].paddrv =1 ; +wrmsr (smca_config, low, high); }
@@ -790,9 +795,9 @@ bool amd_mce_is_memory_error(struct mce *m) }/* -* AMD systems do not have an explicit indicator that the value in MCA_ADDR is -* a system physical address. Therefore, individual cases need to be detected. -* Future cases and checks will be added as needed. +* Some AMD systems have an explicit indicator that the value in MCA_ADDR is a +* system physical address. Individual cases though, need to be detected for +* other systems. Future cases will be added as needed. * * 1) General case * a) Assume address is not usable.
@@ -806,6 +811,8 @@ bool amd_mce_is_memory_error(struct mce *m)* a) Reported in legacy bank 4 with extended error code (XEC) 8. * b) MCA_STATUS[43] is *not* defined as poison in legacy bank 4. Therefore, * this bit should not be checked. +* 4) MCI_STATUS_PADDRVAL is set +* a) Will provide a valid system physical address. * * NOTE: SMCA UMC memory errors fall into case #1. */
@@ -819,6 +826,9 @@ bool amd_mce_usable_address(struct mce *m)return false; } +if (this_cpu_ptr (smca_banks)[m->bank].paddrv) +return m->status &MCI_STATUS_PADDRV ; +/* Check poison bit for all other bank types. */ if (m->status &MCI_STATUS_POISON )return true;
base-commit: c2ef745151b21d4dcc4b29a1eabf1096f5ba544b
Signature · 1 line
2.43.0
[tip: ras/core] x86/mce: Add support for physical address valid bit
The following commit has been merged into the ras/core branch of tip:
The following commit has been merged into the ras/core branch of tip:
Commit-ID: ab19d15bd5ee9e3a3a7f8e0ac9eb8f6eb9c0af2e Gitweb: https://git.kernel.org/tip/ab19d15bd5ee9e3a3a7f8e0ac9eb8f6eb9c0af2e Author: Avadhut Naik <[email protected]> AuthorDate: Tue, 18 Nov 2025 19:15:03 Committer: Borislav Petkov (AMD) <[email protected]> CommitterDate: Tue, 18 Nov 2025 20:24:13 +01:00
x86/mce: Add support for physical address valid bit
Starting with Zen6, AMD's Scalable MCA systems will incorporate two new bits in MCA_STATUS and MCA_CONFIG MSRs. These bits will indicate if a valid System Physical Address (SPA) is present in MCA_ADDR.
PhysAddrValidSupported bit (MCA_CONFIG[11]) serves as the architectural indicator and states if PhysAddrV bit (MCA_STATUS[54]) is Reserved or if it indicates validity of SPA in MCA_ADDR.
PhysAddrV bit (MCA_STATUS[54]) advertises if MCA_ADDR contains valid SPA or if it is implementation specific.
Use and prefer MCA_STATUS[PhysAddrV] when checking for a usable address.
--- arch/x86/include/asm/mce.h | 2 ++ arch/x86/kernel/cpu/mce/amd.c | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
arch/x86/include/asm/mce.h +2 -0
@@ -48,6 +48,7 @@/* AMD-specific bits */ #define MCI_STATUS_TCC BIT_ULL(55)/* Task context corrupt */ +#define MCI_STATUS_PADDRV BIT_ULL(54)/* Valid System Physical Address */ #define MCI_STATUS_SYNDV BIT_ULL(53)/* synd reg. valid */ #define MCI_STATUS_DEFERRED BIT_ULL(44)/* uncorrected error, deferred exception */ #define MCI_STATUS_POISON BIT_ULL(43)/* access poisonous data */
@@ -62,6 +63,7 @@*/ #define MCI_CONFIG_MCAX 0x1#define MCI_CONFIG_FRUTEXT BIT_ULL(9) +#define MCI_CONFIG_PADDRV BIT_ULL(11)#define MCI_IPID_MCATYPE 0xFFFF0000#define MCI_IPID_HWID 0xFFF
arch/x86/kernel/cpu/mce/amd.c +13 -3
@@ -87,6 +87,8 @@ struct smca_bank {const struct smca_hwid *hwid;u32 id;/* Value of MCA_IPID[InstanceId]. */ u8 sysfs_id;/* Value used for sysfs name. */ + u64 paddrv :1, /* Physical Address Valid bit in MCA_CONFIG */ + __reserved :63; }; static DEFINE_PER_CPU_READ_MOSTLY(struct smca_bank[MAX_NR_BANKS], smca_banks);
@@ -327,6 +329,9 @@ static void smca_configure(unsigned int bank, unsigned int cpu)this_cpu_ptr (mce_banks_array)[bank].lsb_in_status = !!(low &BIT (8 )); +if (low &MCI_CONFIG_PADDRV ) +this_cpu_ptr (smca_banks)[bank].paddrv =1 ; +wrmsr (smca_config, low, high); }
@@ -790,9 +795,9 @@ bool amd_mce_is_memory_error(struct mce *m) }/* -* AMD systems do not have an explicit indicator that the value in MCA_ADDR is -* a system physical address. Therefore, individual cases need to be detected. -* Future cases and checks will be added as needed. +* Some AMD systems have an explicit indicator that the value in MCA_ADDR is a +* system physical address. Individual cases though, need to be detected for +* other systems. Future cases will be added as needed. * * 1) General case * a) Assume address is not usable.
@@ -806,6 +811,8 @@ bool amd_mce_is_memory_error(struct mce *m)* a) Reported in legacy bank 4 with extended error code (XEC) 8. * b) MCA_STATUS[43] is *not* defined as poison in legacy bank 4. Therefore, * this bit should not be checked. +* 4) MCI_STATUS_PADDRVAL is set +* a) Will provide a valid system physical address. * * NOTE: SMCA UMC memory errors fall into case #1. */
@@ -819,6 +826,9 @@ bool amd_mce_usable_address(struct mce *m)return false; } +if (this_cpu_ptr (smca_banks)[m->bank].paddrv) +return m->status &MCI_STATUS_PADDRV ; +/* Check poison bit for all other bank types. */ if (m->status &MCI_STATUS_POISON )return true;
[tip: ras/core] x86/mce: Add support for physical address valid bit
In reply to Avadhut NaikThe following commit has been merged into the ras/core branch of tip:
The following commit has been merged into the ras/core branch of tip:
Commit-ID: 821f5fe4dbcb82357f0dfcfca3dd98f2b4097e53 Gitweb: https://git.kernel.org/tip/821f5fe4dbcb82357f0dfcfca3dd98f2b4097e53 Author: Avadhut Naik <[email protected]> AuthorDate: Tue, 18 Nov 2025 19:15:03 Committer: Borislav Petkov (AMD) <[email protected]> CommitterDate: Fri, 21 Nov 2025 10:32:28 +01:00
x86/mce: Add support for physical address valid bit
Starting with Zen6, AMD's Scalable MCA systems will incorporate two new bits in MCA_STATUS and MCA_CONFIG MSRs. These bits will indicate if a valid System Physical Address (SPA) is present in MCA_ADDR.
PhysAddrValidSupported bit (MCA_CONFIG[11]) serves as the architectural indicator and states if PhysAddrV bit (MCA_STATUS[54]) is Reserved or if it indicates validity of SPA in MCA_ADDR.
PhysAddrV bit (MCA_STATUS[54]) advertises if MCA_ADDR contains valid SPA or if it is implementation specific.
Use and prefer MCA_STATUS[PhysAddrV] when checking for a usable address.
--- arch/x86/include/asm/mce.h | 2 ++ arch/x86/kernel/cpu/mce/amd.c | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
arch/x86/include/asm/mce.h +2 -0
@@ -48,6 +48,7 @@/* AMD-specific bits */ #define MCI_STATUS_TCC BIT_ULL(55)/* Task context corrupt */ +#define MCI_STATUS_PADDRV BIT_ULL(54)/* Valid System Physical Address */ #define MCI_STATUS_SYNDV BIT_ULL(53)/* synd reg. valid */ #define MCI_STATUS_DEFERRED BIT_ULL(44)/* uncorrected error, deferred exception */ #define MCI_STATUS_POISON BIT_ULL(43)/* access poisonous data */
@@ -62,6 +63,7 @@*/ #define MCI_CONFIG_MCAX 0x1#define MCI_CONFIG_FRUTEXT BIT_ULL(9) +#define MCI_CONFIG_PADDRV BIT_ULL(11)#define MCI_IPID_MCATYPE 0xFFFF0000#define MCI_IPID_HWID 0xFFF
arch/x86/kernel/cpu/mce/amd.c +13 -3
@@ -87,6 +87,8 @@ struct smca_bank {const struct smca_hwid *hwid;u32 id;/* Value of MCA_IPID[InstanceId]. */ u8 sysfs_id;/* Value used for sysfs name. */ + u64 paddrv :1, /* Physical Address Valid bit in MCA_CONFIG */ + __reserved :63; }; static DEFINE_PER_CPU_READ_MOSTLY(struct smca_bank[MAX_NR_BANKS], smca_banks);
@@ -327,6 +329,9 @@ static void smca_configure(unsigned int bank, unsigned int cpu)this_cpu_ptr (mce_banks_array)[bank].lsb_in_status = !!(low &BIT (8 )); +if (low &MCI_CONFIG_PADDRV ) +this_cpu_ptr (smca_banks)[bank].paddrv =1 ; +wrmsr (smca_config, low, high); }
@@ -790,9 +795,9 @@ bool amd_mce_is_memory_error(struct mce *m) }/* -* AMD systems do not have an explicit indicator that the value in MCA_ADDR is -* a system physical address. Therefore, individual cases need to be detected. -* Future cases and checks will be added as needed. +* Some AMD systems have an explicit indicator that the value in MCA_ADDR is a +* system physical address. Individual cases though, need to be detected for +* other systems. Future cases will be added as needed. * * 1) General case * a) Assume address is not usable.
@@ -806,6 +811,8 @@ bool amd_mce_is_memory_error(struct mce *m)* a) Reported in legacy bank 4 with extended error code (XEC) 8. * b) MCA_STATUS[43] is *not* defined as poison in legacy bank 4. Therefore, * this bit should not be checked. +* 4) MCI_STATUS_PADDRVAL is set +* a) Will provide a valid system physical address. * * NOTE: SMCA UMC memory errors fall into case #1. */
@@ -819,6 +826,9 @@ bool amd_mce_usable_address(struct mce *m)return false; } +if (this_cpu_ptr (smca_banks)[m->bank].paddrv) +return m->status &MCI_STATUS_PADDRV ; +/* Check poison bit for all other bank types. */ if (m->status &MCI_STATUS_POISON )return true;