x86/MCE/AMD, EDAC/mce_amd: Support non-uniform MCA bank type enumeration
authorYazen Ghannam <yazen.ghannam@amd.com>
Thu, 16 Dec 2021 16:29:05 +0000 (16:29 +0000)
committerBorislav Petkov <bp@suse.de>
Wed, 22 Dec 2021 16:22:09 +0000 (17:22 +0100)
commit91f75eb481cfaee5c4ed8fb5214bf2fbfa04bd7b
treebcd9ec4fff33c95955373d121183d434ae5c8887
parent5176a93ab27aef1b9f4496fc68e6c303a011d7cc
x86/MCE/AMD, EDAC/mce_amd: Support non-uniform MCA bank type enumeration

AMD systems currently lay out MCA bank types such that the type of bank
number "i" is either the same across all CPUs or is Reserved/Read-as-Zero.

For example:

  Bank # | CPUx | CPUy
    0      LS     LS
    1      RAZ    UMC
    2      CS     CS
    3      SMU    RAZ

Future AMD systems will lay out MCA bank types such that the type of
bank number "i" may be different across CPUs.

For example:

  Bank # | CPUx | CPUy
    0      LS     LS
    1      RAZ    UMC
    2      CS     NBIO
    3      SMU    RAZ

Change the structures that cache MCA bank types to be per-CPU and update
smca_get_bank_type() to handle this change.

Move some SMCA-specific structures to amd.c from mce.h, since they no
longer need to be global.

Break out the "count" for bank types from struct smca_hwid, since this
should provide a per-CPU count rather than a system-wide count.

Apply the "const" qualifier to the struct smca_hwid_mcatypes array. The
values in this array should not change at runtime.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20211216162905.4132657-3-yazen.ghannam@amd.com
arch/x86/include/asm/mce.h
arch/x86/kernel/cpu/mce/amd.c
drivers/edac/mce_amd.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c