• Yazen Ghannam's avatar
    x86/MCE: Determine MCA banks' init state properly · 068b053d
    Yazen Ghannam authored
    The OS is expected to write all bits to MCA_CTL for each bank,
    thus enabling error reporting in all banks. However, some banks
    may be unused in which case the registers for such banks are
    Read-as-Zero/Writes-Ignored. Also, the OS may avoid setting some control
    bits because of quirks, etc.
    
    A bank can be considered uninitialized if the MCA_CTL register returns
    zero. This is because either the OS did not write anything or because
    the hardware is enforcing RAZ/WI for the bank.
    
    Set a bank's init value based on if the control bits are set or not in
    hardware. Return an error code in the sysfs interface for uninitialized
    banks.
    
    Do a final bank init check in a separate function which is not part of
    any user-controlled code flows. This is so a user may enable/disable a
    bank during runtime without having to restart their system.
    
     [ bp: Massage a bit. Discover bank init state at boot. ]
    Signed-off-by: default avatarYazen Ghannam <yazen.ghannam@amd.com>
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: "linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Tony Luck <tony.luck@intel.com>
    Cc: "x86@kernel.org" <x86@kernel.org>
    Link: https://lkml.kernel.org/r/20190607201752.221446-6-Yazen.Ghannam@amd.com
    068b053d
core.c 58.7 KB