ia64/xen-unstable

changeset 15596:8b4518a6f815

Implement domctl_sendtrigger_nmi for x86 hvm.

This patch implements DOMCTL_SENDTRIGGER_NMI hypercall for x86 hvm
domains. We can manually inject NMI into a domain by using
'xm trigger [domain] nmi [vcpu]'.

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
author kfraser@localhost.localdomain
date Fri Jul 13 13:49:08 2007 +0100 (2007-07-13)
parents 0aa2a954a6d1
children f479595a3c5c
files xen/arch/x86/domctl.c
line diff
     1.1 --- a/xen/arch/x86/domctl.c	Fri Jul 13 13:46:49 2007 +0100
     1.2 +++ b/xen/arch/x86/domctl.c	Fri Jul 13 13:49:08 2007 +0100
     1.3 @@ -427,6 +427,46 @@ long arch_do_domctl(
     1.4      }
     1.5      break;
     1.6  
     1.7 +    case XEN_DOMCTL_sendtrigger:
     1.8 +    {
     1.9 +        struct domain *d;
    1.10 +        struct vcpu *v;
    1.11 +
    1.12 +        ret = -ESRCH;
    1.13 +        if ( (d = rcu_lock_domain_by_id(domctl->domain)) == NULL )
    1.14 +            break;
    1.15 +
    1.16 +        ret = -EINVAL;
    1.17 +        if ( domctl->u.sendtrigger.vcpu >= MAX_VIRT_CPUS )
    1.18 +            goto sendtrigger_out;
    1.19 +
    1.20 +        ret = -ESRCH;
    1.21 +        if ( (v = d->vcpu[domctl->u.sendtrigger.vcpu]) == NULL )
    1.22 +            goto sendtrigger_out;
    1.23 +
    1.24 +        switch ( domctl->u.sendtrigger.trigger )
    1.25 +        {
    1.26 +        case XEN_DOMCTL_SENDTRIGGER_NMI:
    1.27 +        {
    1.28 +            ret = -ENOSYS;
    1.29 +            if ( !is_hvm_domain(d) )
    1.30 +                break;
    1.31 +
    1.32 +            ret = 0;
    1.33 +            if ( !test_and_set_bool(v->arch.hvm_vcpu.nmi_pending) )
    1.34 +                vcpu_kick(v);
    1.35 +        }
    1.36 +        break;
    1.37 +
    1.38 +        default:
    1.39 +            ret = -ENOSYS;
    1.40 +        }
    1.41 +
    1.42 +    sendtrigger_out:
    1.43 +        rcu_unlock_domain(d);
    1.44 +    }
    1.45 +    break;
    1.46 +
    1.47      default:
    1.48          ret = -ENOSYS;
    1.49          break;