ia64/xen-unstable

changeset 10333:1a500cc4fcd5

Extended PHYSDEVOP_irq_status_query to obtain sharing status
(bound to multiple guests?).
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Jun 07 15:46:05 2006 +0100 (2006-06-07)
parents eb3d2c32a3b4
children 06569f1a4681
files xen/arch/x86/irq.c xen/arch/x86/physdev.c xen/include/asm-x86/irq.h xen/include/public/physdev.h
line diff
     1.1 --- a/xen/arch/x86/irq.c	Wed Jun 07 14:38:36 2006 +0100
     1.2 +++ b/xen/arch/x86/irq.c	Wed Jun 07 15:46:05 2006 +0100
     1.3 @@ -402,6 +402,28 @@ int pirq_acktype(int irq)
     1.4      return 0;
     1.5  }
     1.6  
     1.7 +int pirq_shared(int irq)
     1.8 +{
     1.9 +    unsigned int        vector;
    1.10 +    irq_desc_t         *desc;
    1.11 +    irq_guest_action_t *action;
    1.12 +    unsigned long       flags;
    1.13 +    int                 shared;
    1.14 +
    1.15 +    vector = irq_to_vector(irq);
    1.16 +    if ( vector == 0 )
    1.17 +        return 0;
    1.18 +
    1.19 +    desc = &irq_desc[vector];
    1.20 +
    1.21 +    spin_lock_irqsave(&desc->lock, flags);
    1.22 +    action = (irq_guest_action_t *)desc->action;
    1.23 +    shared = ((desc->status & IRQ_GUEST) && (action->nr_guests > 1));
    1.24 +    spin_unlock_irqrestore(&desc->lock, flags);
    1.25 +
    1.26 +    return shared;
    1.27 +}
    1.28 +
    1.29  int pirq_guest_bind(struct vcpu *v, int irq, int will_share)
    1.30  {
    1.31      unsigned int        vector;
     2.1 --- a/xen/arch/x86/physdev.c	Wed Jun 07 14:38:36 2006 +0100
     2.2 +++ b/xen/arch/x86/physdev.c	Wed Jun 07 15:46:05 2006 +0100
     2.3 @@ -12,15 +12,12 @@
     2.4  #include <public/xen.h>
     2.5  #include <public/physdev.h>
     2.6  
     2.7 -extern int
     2.8 +int
     2.9  ioapic_guest_read(
    2.10      unsigned long physbase, unsigned int reg, u32 *pval);
    2.11 -extern int
    2.12 +int
    2.13  ioapic_guest_write(
    2.14      unsigned long physbase, unsigned int reg, u32 pval);
    2.15 -extern int
    2.16 -pirq_acktype(
    2.17 -    int irq);
    2.18  
    2.19  long do_physdev_op(int cmd, XEN_GUEST_HANDLE(void) arg)
    2.20  {
    2.21 @@ -56,6 +53,8 @@ long do_physdev_op(int cmd, XEN_GUEST_HA
    2.22          irq_status_query.flags = 0;
    2.23          if ( pirq_acktype(irq) != 0 )
    2.24              irq_status_query.flags |= XENIRQSTAT_needs_eoi;
    2.25 +        if ( pirq_shared(irq) )
    2.26 +            irq_status_query.flags |= XENIRQSTAT_shared;
    2.27          ret = copy_to_guest(arg, &irq_status_query, 1) ? -EFAULT : 0;
    2.28          break;
    2.29      }
     3.1 --- a/xen/include/asm-x86/irq.h	Wed Jun 07 14:38:36 2006 +0100
     3.2 +++ b/xen/include/asm-x86/irq.h	Wed Jun 07 15:46:05 2006 +0100
     3.3 @@ -46,4 +46,7 @@ extern unsigned long io_apic_irqs;
     3.4  extern atomic_t irq_err_count;
     3.5  extern atomic_t irq_mis_count;
     3.6  
     3.7 +int pirq_acktype(int irq);
     3.8 +int pirq_shared(int irq);
     3.9 +
    3.10  #endif /* _ASM_HW_IRQ_H */
     4.1 --- a/xen/include/public/physdev.h	Wed Jun 07 14:38:36 2006 +0100
     4.2 +++ b/xen/include/public/physdev.h	Wed Jun 07 15:46:05 2006 +0100
     4.3 @@ -37,7 +37,11 @@ DEFINE_XEN_GUEST_HANDLE(physdev_irq_stat
     4.4  
     4.5  /* Need to call PHYSDEVOP_eoi when the IRQ has been serviced? */
     4.6  #define _XENIRQSTAT_needs_eoi   (0)
     4.7 -#define  XENIRQSTAT_needs_eoi   (1<<_XENIRQSTAT_needs_eoi)
     4.8 +#define  XENIRQSTAT_needs_eoi   (1U<<_XENIRQSTAT_needs_eoi)
     4.9 +
    4.10 +/* Need to call PHYSDEVOP_eoi when the IRQ has been serviced? */
    4.11 +#define _XENIRQSTAT_shared      (1)
    4.12 +#define  XENIRQSTAT_shared      (1U<<_XENIRQSTAT_shared)
    4.13  
    4.14  /*
    4.15   * Set the current VCPU's I/O privilege level.
    4.16 @@ -130,6 +134,7 @@ DEFINE_XEN_GUEST_HANDLE(physdev_op_t);
    4.17  #define PHYSDEVOP_APIC_WRITE             PHYSDEVOP_apic_write
    4.18  #define PHYSDEVOP_ASSIGN_VECTOR          PHYSDEVOP_alloc_irq_vector
    4.19  #define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi
    4.20 +#define PHYSDEVOP_IRQ_SHARED             XENIRQSTAT_shared
    4.21  
    4.22  #endif /* __XEN_PUBLIC_PHYSDEV_H__ */
    4.23