ia64/xen-unstable

changeset 14724:b3c75956303b

hvm: local_events_need_delivery() should take notice of EFLAGS.IF.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Wed Apr 04 19:17:39 2007 +0100 (2007-04-04)
parents 10f06a7a05e9
children 2bbd28891160
files xen/arch/x86/hvm/irq.c xen/include/asm-x86/event.h
line diff
     1.1 --- a/xen/arch/x86/hvm/irq.c	Wed Apr 04 18:41:42 2007 +0100
     1.2 +++ b/xen/arch/x86/hvm/irq.c	Wed Apr 04 19:17:39 2007 +0100
     1.3 @@ -337,6 +337,25 @@ int is_isa_irq_masked(struct vcpu *v, in
     1.4              domain_vioapic(v->domain)->redirtbl[gsi].fields.mask);
     1.5  }
     1.6  
     1.7 +/*
     1.8 + * TODO: 1. Should not need special treatment of event-channel events.
     1.9 + *       2. Should take notice of interrupt shadows (or clear them).
    1.10 + */
    1.11 +int hvm_local_events_need_delivery(struct vcpu *v)
    1.12 +{
    1.13 +    int pending;
    1.14 +
    1.15 +    pending = (vcpu_info(v, evtchn_upcall_pending) || cpu_has_pending_irq(v));
    1.16 +    if ( unlikely(pending) )
    1.17 +    {
    1.18 +        struct cpu_user_regs regs;
    1.19 +        hvm_store_cpu_guest_regs(v, &regs, NULL);
    1.20 +        pending = !irq_masked(regs.eflags);
    1.21 +    }
    1.22 +
    1.23 +    return pending;
    1.24 +}
    1.25 +
    1.26  #if 0 /* Keep for debugging */
    1.27  static void irq_dump(struct domain *d)
    1.28  {
     2.1 --- a/xen/include/asm-x86/event.h	Wed Apr 04 18:41:42 2007 +0100
     2.2 +++ b/xen/include/asm-x86/event.h	Wed Apr 04 19:17:39 2007 +0100
     2.3 @@ -35,12 +35,13 @@ static inline void vcpu_mark_events_pend
     2.4          vcpu_kick(v);
     2.5  }
     2.6  
     2.7 +int hvm_local_events_need_delivery(struct vcpu *v);
     2.8  static inline int local_events_need_delivery(void)
     2.9  {
    2.10      struct vcpu *v = current;
    2.11 -    return ((vcpu_info(v, evtchn_upcall_pending) &&
    2.12 -             !vcpu_info(v, evtchn_upcall_mask)) ||
    2.13 -            (is_hvm_vcpu(v) && cpu_has_pending_irq(v)));
    2.14 +    return (is_hvm_vcpu(v) ? hvm_local_events_need_delivery(v) :
    2.15 +            (vcpu_info(v, evtchn_upcall_pending) &&
    2.16 +             !vcpu_info(v, evtchn_upcall_mask)));
    2.17  }
    2.18  
    2.19  static inline int local_event_delivery_is_enabled(void)