ia64/xen-unstable

changeset 19523:2eed07698921

x86 mce: Small cleanups to machine-check hypercall handling.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
G: Enter commit message. Lines beginning with 'HG:' are removed.
author Keir Fraser <keir.fraser@citrix.com>
date Wed Apr 08 14:06:04 2009 +0100 (2009-04-08)
parents 3929487cdb82
children eddb0f09fdaf
files xen/arch/x86/cpu/mcheck/mce.c
line diff
     1.1 --- a/xen/arch/x86/cpu/mcheck/mce.c	Wed Apr 08 13:48:35 2009 +0100
     1.2 +++ b/xen/arch/x86/cpu/mcheck/mce.c	Wed Apr 08 14:06:04 2009 +0100
     1.3 @@ -33,18 +33,15 @@ static void mcinfo_clear(struct mc_info 
     1.4  #define	SEG_PL(segsel)			((segsel) & 0x3)
     1.5  #define _MC_MSRINJ_F_REQ_HWCR_WREN	(1 << 16)
     1.6  
     1.7 -#if 1	/* XXFM switch to 0 for putback */
     1.8 -
     1.9 -#define	x86_mcerr(str, err) _x86_mcerr(str, err)
    1.10 -
    1.11 -static int _x86_mcerr(const char *msg, int err)
    1.12 +#if 0
    1.13 +static int x86_mcerr(const char *msg, int err)
    1.14  {
    1.15 -	printk("x86_mcerr: %s, returning %d\n",
    1.16 -	    msg != NULL ? msg : "", err);
    1.17 -	return err;
    1.18 +    gdprintk(XENLOG_WARNING, "x86_mcerr: %s, returning %d\n",
    1.19 +             msg != NULL ? msg : "", err);
    1.20 +    return err;
    1.21  }
    1.22  #else
    1.23 -#define x86_mcerr(str,err)
    1.24 +#define x86_mcerr(msg, err) (err)
    1.25  #endif
    1.26  
    1.27  cpu_banks_t mca_allbanks;
    1.28 @@ -1064,6 +1061,9 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u
    1.29  	struct xen_mc_msrinject *mc_msrinject;
    1.30  	struct xen_mc_mceinject *mc_mceinject;
    1.31  
    1.32 +	if (!IS_PRIV(v->domain) )
    1.33 +		return x86_mcerr(NULL, -EPERM);
    1.34 +
    1.35  	if ( copy_from_guest(op, u_xen_mc, 1) )
    1.36  		return x86_mcerr("do_mca: failed copyin of xen_mc_t", -EFAULT);
    1.37  
    1.38 @@ -1075,10 +1075,6 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u
    1.39  		mc_fetch.nat = &op->u.mc_fetch;
    1.40  		cmdflags = mc_fetch.nat->flags;
    1.41  
    1.42 -		/* This hypercall is for Dom0 only */
    1.43 -		if (!IS_PRIV(v->domain) )
    1.44 -			return x86_mcerr(NULL, -EPERM);
    1.45 -
    1.46  		switch (cmdflags & (XEN_MC_NONURGENT | XEN_MC_URGENT)) {
    1.47  		case XEN_MC_NONURGENT:
    1.48  			which = MC_NONURGENT;
    1.49 @@ -1134,9 +1130,6 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u
    1.50  		return x86_mcerr("do_mca notify unsupported", -EINVAL);
    1.51  
    1.52  	case XEN_MC_physcpuinfo:
    1.53 -		if ( !IS_PRIV(v->domain) )
    1.54 -			return x86_mcerr("do_mca cpuinfo", -EPERM);
    1.55 -
    1.56  		mc_physcpuinfo.nat = &op->u.mc_physcpuinfo;
    1.57  		nlcpu = num_online_cpus();
    1.58  
    1.59 @@ -1173,9 +1166,6 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u
    1.60  		break;
    1.61  
    1.62  	case XEN_MC_msrinject:
    1.63 -		if ( !IS_PRIV(v->domain) )
    1.64 -			return x86_mcerr("do_mca inject", -EPERM);
    1.65 -
    1.66  		if (nr_mce_banks == 0)
    1.67  			return x86_mcerr("do_mca inject", -ENODEV);
    1.68  
    1.69 @@ -1203,9 +1193,6 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u
    1.70  		break;
    1.71  
    1.72  	case XEN_MC_mceinject:
    1.73 -		if ( !IS_PRIV(v->domain) )
    1.74 -			return x86_mcerr("do_mca #MC", -EPERM);
    1.75 -
    1.76  		if (nr_mce_banks == 0)
    1.77  			return x86_mcerr("do_mca #MC", -ENODEV);
    1.78