ia64/xen-unstable

changeset 8505:9efe7eb108e1

The dom0_ops implementation wasn't matching the interface definition,
leading to ill messages when X starts up (and potentially to other
problems). The attached patch fixes that. However, it also points out
that there is a potential disagreement between the dom0_ops interface
and the internal MTRR interface - the former expects an unsigned
register number from the domain, the latter wants a signed one and does
a lookup when it's negative. I would think that the lookup code should
just be ripped out of xen/arch/x86/mtrr/main.c.

Signed-off-by: Jan Beulich <JBeulich@novell.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Jan 04 18:51:38 2006 +0100 (2006-01-04)
parents ecc20905cde3
children 07306e35a5fc
files xen/arch/x86/dom0_ops.c
line diff
     1.1 --- a/xen/arch/x86/dom0_ops.c	Wed Jan 04 18:47:11 2006 +0100
     1.2 +++ b/xen/arch/x86/dom0_ops.c	Wed Jan 04 18:51:38 2006 +0100
     1.3 @@ -103,12 +103,27 @@ long arch_do_dom0_op(dom0_op_t *op, dom0
     1.4              op->u.add_memtype.nr_pfns,
     1.5              op->u.add_memtype.type,
     1.6              1);
     1.7 +        if (ret > 0)
     1.8 +        {
     1.9 +            (void)__put_user(0, &u_dom0_op->u.add_memtype.handle);
    1.10 +            (void)__put_user(ret, &u_dom0_op->u.add_memtype.reg);
    1.11 +            ret = 0;
    1.12 +        }
    1.13      }
    1.14      break;
    1.15  
    1.16      case DOM0_DEL_MEMTYPE:
    1.17      {
    1.18 -        ret = mtrr_del_page(op->u.del_memtype.reg, 0, 0);
    1.19 +        if (op->u.del_memtype.handle == 0
    1.20 +            /* mtrr/main.c otherwise does a lookup */
    1.21 +            && (int)op->u.del_memtype.reg >= 0)
    1.22 +        {
    1.23 +            ret = mtrr_del_page(op->u.del_memtype.reg, 0, 0);
    1.24 +            if (ret > 0)
    1.25 +                ret = 0;
    1.26 +        }
    1.27 +        else
    1.28 +            ret = -EINVAL;
    1.29      }
    1.30      break;
    1.31  
    1.32 @@ -179,7 +194,7 @@ long arch_do_dom0_op(dom0_op_t *op, dom0
    1.33          memcpy(pi->hw_cap, boot_cpu_data.x86_capability, NCAPINTS*4);
    1.34          ret = 0;
    1.35          if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
    1.36 -	    ret = -EFAULT;
    1.37 +            ret = -EFAULT;
    1.38      }
    1.39      break;
    1.40