diff options
author | Christoph Egger <Christoph.Egger@amd.com> | 2012-10-05 14:32:02 +0200 |
---|---|---|
committer | Christoph Egger <Christoph.Egger@amd.com> | 2012-10-05 14:32:02 +0200 |
commit | 45f57813f646967f93ddadf28a1eb7b2464d35a7 (patch) | |
tree | 76f2ba65b20258ee55c17f6f0a7d6621a0dd5cc3 /xen | |
parent | b02dce5082373bd39225c00b0ef1fde32760cf38 (diff) | |
download | xen-45f57813f646967f93ddadf28a1eb7b2464d35a7.tar.gz xen-45f57813f646967f93ddadf28a1eb7b2464d35a7.tar.bz2 xen-45f57813f646967f93ddadf28a1eb7b2464d35a7.zip |
x86/MCE: implement recoverscan for AMD
Implement recoverable_scan() for AMD.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
Diffstat (limited to 'xen')
-rw-r--r-- | xen/arch/x86/cpu/mcheck/Makefile | 1 | ||||
-rw-r--r-- | xen/arch/x86/cpu/mcheck/amd_f10.c | 8 | ||||
-rw-r--r-- | xen/arch/x86/cpu/mcheck/mce.h | 2 | ||||
-rw-r--r-- | xen/arch/x86/cpu/mcheck/mce_amd.c | 77 | ||||
-rw-r--r-- | xen/arch/x86/cpu/mcheck/mce_amd.h | 6 | ||||
-rw-r--r-- | xen/arch/x86/cpu/mcheck/mce_intel.c | 2 |
6 files changed, 88 insertions, 8 deletions
diff --git a/xen/arch/x86/cpu/mcheck/Makefile b/xen/arch/x86/cpu/mcheck/Makefile index 2ffa5da306..7138b2358f 100644 --- a/xen/arch/x86/cpu/mcheck/Makefile +++ b/xen/arch/x86/cpu/mcheck/Makefile @@ -2,6 +2,7 @@ obj-y += amd_nonfatal.o obj-y += k7.o obj-y += amd_k8.o obj-y += amd_f10.o +obj-y += mce_amd.o obj-y += barrier.o obj-y += mctelem.o obj-y += mce.o diff --git a/xen/arch/x86/cpu/mcheck/amd_f10.c b/xen/arch/x86/cpu/mcheck/amd_f10.c index 3c807f585d..e112f89346 100644 --- a/xen/arch/x86/cpu/mcheck/amd_f10.c +++ b/xen/arch/x86/cpu/mcheck/amd_f10.c @@ -37,18 +37,13 @@ #include <xen/init.h> #include <xen/types.h> -#include <xen/kernel.h> -#include <xen/config.h> -#include <xen/smp.h> -#include <asm/processor.h> -#include <asm/system.h> #include <asm/msr.h> #include "mce.h" #include "mce_quirks.h" #include "x86_mca.h" - +#include "mce_amd.h" static struct mcinfo_extended * amd_f10_handler(struct mc_info *mi, uint16_t bank, uint64_t status) @@ -101,6 +96,7 @@ enum mcheck_type amd_f10_mcheck_init(struct cpuinfo_x86 *c) mcequirk_amd_apply(quirkflag); x86_mce_callback_register(amd_f10_handler); + mce_recoverable_register(mc_amd_recoverable_scan); return mcheck_amd_famXX; } diff --git a/xen/arch/x86/cpu/mcheck/mce.h b/xen/arch/x86/cpu/mcheck/mce.h index 64e1c40123..11dae80b4c 100644 --- a/xen/arch/x86/cpu/mcheck/mce.h +++ b/xen/arch/x86/cpu/mcheck/mce.h @@ -73,7 +73,7 @@ extern void mcheck_cmn_handler(struct cpu_user_regs *, long, struct mca_banks *, struct mca_banks *); /* Register a handler for judging whether mce is recoverable. */ -typedef int (*mce_recoverable_t)(u64 status); +typedef int (*mce_recoverable_t)(uint64_t status); extern void mce_recoverable_register(mce_recoverable_t); /* Read an MSR, checking for an interposed value first */ diff --git a/xen/arch/x86/cpu/mcheck/mce_amd.c b/xen/arch/x86/cpu/mcheck/mce_amd.c new file mode 100644 index 0000000000..3c64d24f08 --- /dev/null +++ b/xen/arch/x86/cpu/mcheck/mce_amd.c @@ -0,0 +1,77 @@ +/* + * common MCA implementation for AMD CPUs. + * Copyright (c) 2012 Advanced Micro Devices, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <xen/init.h> +#include <xen/types.h> + +#include <asm/msr.h> + +#include "mce.h" +#include "x86_mca.h" +#include "mce_amd.h" + +/* Error Code Types */ +enum mc_ec_type { + MC_EC_TLB_TYPE = 0x0010, + MC_EC_MEM_TYPE = 0x0100, + MC_EC_BUS_TYPE = 0x0800, +}; + +enum mc_ec_type +mc_ec2type(uint16_t errorcode) +{ + if ( errorcode & MC_EC_BUS_TYPE ) + return MC_EC_BUS_TYPE; + if ( errorcode & MC_EC_MEM_TYPE ) + return MC_EC_MEM_TYPE; + if ( errorcode & MC_EC_TLB_TYPE ) + return MC_EC_TLB_TYPE; + /* Unreached */ + BUG(); + return 0; +} + +int +mc_amd_recoverable_scan(uint64_t status) +{ + int ret = 0; + enum mc_ec_type ectype; + uint16_t errorcode; + + if ( !(status & MCi_STATUS_UC) ) + return 1; + + errorcode = status & (MCi_STATUS_MCA | MCi_STATUS_MSEC); + ectype = mc_ec2type(errorcode); + + switch ( ectype ) + { + case MC_EC_BUS_TYPE: /* value in addr MSR is physical */ + /* should run cpu offline action */ + break; + case MC_EC_MEM_TYPE: /* value in addr MSR is physical */ + ret = 1; /* run memory page offline action */ + break; + case MC_EC_TLB_TYPE: /* value in addr MSR is virtual */ + /* should run tlb flush action and retry */ + break; + } + + return ret; +} diff --git a/xen/arch/x86/cpu/mcheck/mce_amd.h b/xen/arch/x86/cpu/mcheck/mce_amd.h new file mode 100644 index 0000000000..10e363134d --- /dev/null +++ b/xen/arch/x86/cpu/mcheck/mce_amd.h @@ -0,0 +1,6 @@ +#ifndef _MCHECK_AMD_H +#define _MCHECK_AMD_H + +int mc_amd_recoverable_scan(uint64_t status); + +#endif diff --git a/xen/arch/x86/cpu/mcheck/mce_intel.c b/xen/arch/x86/cpu/mcheck/mce_intel.c index a717dfd660..babab904be 100644 --- a/xen/arch/x86/cpu/mcheck/mce_intel.c +++ b/xen/arch/x86/cpu/mcheck/mce_intel.c @@ -560,7 +560,7 @@ static int intel_need_clearbank_scan(enum mca_source who, u64 status) * 4) SRAO ser_support = 1, PCC = 0, S = 1, AR = 0, EN = 1 [UC = 1] * 5) UCNA ser_support = 1, OVER = 0, EN = 1, PCC = 0, S = 0, AR = 0, [UC = 1] */ -static int intel_recoverable_scan(u64 status) +static int intel_recoverable_scan(uint64_t status) { if ( !(status & MCi_STATUS_UC ) ) |