mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
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>
This commit is contained in:
1 parent
b02dce5082
commit
45f57813f6
6 files changed
+88
-8
No files matched your search
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef _MCHECK_AMD_H
|
||||
#define _MCHECK_AMD_H
|
||||
|
||||
int mc_amd_recoverable_scan(uint64_t status);
|
||||
|
||||
#endif
|
||||
@@ -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 ) )
|
||||
|
||||