• Y
    x86/mce/AMD: Add system physical address translation for AMD Fam17h · f5382de9
    Yazen Ghannam 提交于
    The Unified Memory Controllers (UMCs) on Fam17h log a normalized address
    in their MCA_ADDR registers. We need to convert that normalized address
    to a system physical address in order to support a few facilities:
    
    1) To offline poisoned pages in DRAM proactively in the deferred error
       handler.
    
    2) To print sysaddr and page info for DRAM ECC errors in EDAC.
    
    [ Boris: fixes/cleanups ontop:
    
      * hi_addr_offset = 0 - no need for that branch. Stick it all under the
        HiAddrOffsetEn case. It confines hi_addr_offset's declaration too.
    
      * Move variables to the innermost scope they're used at so that we save
        on stack and not blow it up immediately on function entry.
    
      * Do not modify *sys_addr prematurely - we want to not exit early and
        have modified *sys_addr some, which callers get to see. We either
        convert to a sys_addr or we don't do anything. And we signal that with
        the retval of the function.
    
      * Rename label out -> out_err - because it is the error path.
    
      * No need to pr_err of the conversion failed case: imagine a
        sparsely-populated machine with UMCs which don't have DIMMs. Callers
        should look at the retval instead and issue a printk only when really
        necessary. No need for useless info in dmesg.
    
      * s/temp_reg/tmp/ and other variable names shortening => shorter code.
    
      * Use BIT() everywhere.
    
      * Make error messages more informative.
    
      *  Small build fix for the !CONFIG_X86_MCE_AMD case.
    
      * ... and more minor cleanups.
    ]
    Signed-off-by: NYazen Ghannam <Yazen.Ghannam@amd.com>
    Signed-off-by: NBorislav Petkov <bp@suse.de>
    Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
    Cc: Aravind Gopalakrishnan <aravindksg.lkml@gmail.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Tony Luck <tony.luck@intel.com>
    Cc: linux-edac <linux-edac@vger.kernel.org>
    Link: http://lkml.kernel.org/r/20161122111133.mjzpvzhf7o7yl2oa@pd.tnic
    [ Typo fixes. ]
    Signed-off-by: NIngo Molnar <mingo@kernel.org>
    f5382de9
mce_amd.c 33.2 KB