ia64/xen-unstable

changeset 8569:6ccee759e34f

Reassert nmi pending when a nmi handler is registered
if we lost a previous nmi.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Jan 11 19:24:43 2006 +0100 (2006-01-11)
parents 57c50578414d
children c96ea9ebcd29
files xen/common/kernel.c
line diff
     1.1 --- a/xen/common/kernel.c	Wed Jan 11 19:18:21 2006 +0100
     1.2 +++ b/xen/common/kernel.c	Wed Jan 11 19:24:43 2006 +0100
     1.3 @@ -151,19 +151,32 @@ long do_xen_version(int cmd, void *arg)
     1.4  
     1.5  long do_nmi_op(unsigned int cmd, void *arg)
     1.6  {
     1.7 +    struct vcpu *v = current;
     1.8 +    struct domain *d = current->domain;
     1.9      long rc = 0;
    1.10  
    1.11      switch ( cmd )
    1.12      {
    1.13      case XENNMI_register_callback:
    1.14 -        if ( (current->domain->domain_id != 0) || (current->vcpu_id != 0) )
    1.15 -            rc = -EINVAL;
    1.16 +        if ( (d->domain_id != 0) || (v->vcpu_id != 0) )
    1.17 +        { 
    1.18 +           rc = -EINVAL;
    1.19 +        }
    1.20          else
    1.21 -            current->nmi_addr = (unsigned long)arg;
    1.22 -        printk("***** NMI handler at 0x%lx\n", current->nmi_addr);
    1.23 +        {
    1.24 +            v->nmi_addr = (unsigned long)arg;
    1.25 +#ifdef CONFIG_X86
    1.26 +            /*
    1.27 +             * If no handler was registered we can 'lose the NMI edge'.
    1.28 +             * Re-assert it now.
    1.29 +             */
    1.30 +            if ( d->shared_info->arch.nmi_reason != 0 )
    1.31 +                set_bit(_VCPUF_nmi_pending, &v->vcpu_flags);
    1.32 +#endif
    1.33 +        }
    1.34          break;
    1.35      case XENNMI_unregister_callback:
    1.36 -        current->nmi_addr = 0;
    1.37 +        v->nmi_addr = 0;
    1.38          break;
    1.39      default:
    1.40          rc = -ENOSYS;