[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Extended PHYSDEVOP_irq_status_query to obtain sharing status



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 1a500cc4fcd5648ce52d782be30948ed9a3e28d9
# Parent  eb3d2c32a3b4de71b2eebfd0af0955dd35241c93
Extended PHYSDEVOP_irq_status_query to obtain sharing status
(bound to multiple guests?).
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/irq.c           |   22 ++++++++++++++++++++++
 xen/arch/x86/physdev.c       |    9 ++++-----
 xen/include/asm-x86/irq.h    |    3 +++
 xen/include/public/physdev.h |    7 ++++++-
 4 files changed, 35 insertions(+), 6 deletions(-)

diff -r eb3d2c32a3b4 -r 1a500cc4fcd5 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c        Wed Jun 07 14:38:36 2006 +0100
+++ b/xen/arch/x86/irq.c        Wed Jun 07 15:46:05 2006 +0100
@@ -400,6 +400,28 @@ int pirq_acktype(int irq)
 
     BUG();
     return 0;
+}
+
+int pirq_shared(int irq)
+{
+    unsigned int        vector;
+    irq_desc_t         *desc;
+    irq_guest_action_t *action;
+    unsigned long       flags;
+    int                 shared;
+
+    vector = irq_to_vector(irq);
+    if ( vector == 0 )
+        return 0;
+
+    desc = &irq_desc[vector];
+
+    spin_lock_irqsave(&desc->lock, flags);
+    action = (irq_guest_action_t *)desc->action;
+    shared = ((desc->status & IRQ_GUEST) && (action->nr_guests > 1));
+    spin_unlock_irqrestore(&desc->lock, flags);
+
+    return shared;
 }
 
 int pirq_guest_bind(struct vcpu *v, int irq, int will_share)
diff -r eb3d2c32a3b4 -r 1a500cc4fcd5 xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c    Wed Jun 07 14:38:36 2006 +0100
+++ b/xen/arch/x86/physdev.c    Wed Jun 07 15:46:05 2006 +0100
@@ -12,15 +12,12 @@
 #include <public/xen.h>
 #include <public/physdev.h>
 
-extern int
+int
 ioapic_guest_read(
     unsigned long physbase, unsigned int reg, u32 *pval);
-extern int
+int
 ioapic_guest_write(
     unsigned long physbase, unsigned int reg, u32 pval);
-extern int
-pirq_acktype(
-    int irq);
 
 long do_physdev_op(int cmd, XEN_GUEST_HANDLE(void) arg)
 {
@@ -56,6 +53,8 @@ long do_physdev_op(int cmd, XEN_GUEST_HA
         irq_status_query.flags = 0;
         if ( pirq_acktype(irq) != 0 )
             irq_status_query.flags |= XENIRQSTAT_needs_eoi;
+        if ( pirq_shared(irq) )
+            irq_status_query.flags |= XENIRQSTAT_shared;
         ret = copy_to_guest(arg, &irq_status_query, 1) ? -EFAULT : 0;
         break;
     }
diff -r eb3d2c32a3b4 -r 1a500cc4fcd5 xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h Wed Jun 07 14:38:36 2006 +0100
+++ b/xen/include/asm-x86/irq.h Wed Jun 07 15:46:05 2006 +0100
@@ -46,4 +46,7 @@ extern atomic_t irq_err_count;
 extern atomic_t irq_err_count;
 extern atomic_t irq_mis_count;
 
+int pirq_acktype(int irq);
+int pirq_shared(int irq);
+
 #endif /* _ASM_HW_IRQ_H */
diff -r eb3d2c32a3b4 -r 1a500cc4fcd5 xen/include/public/physdev.h
--- a/xen/include/public/physdev.h      Wed Jun 07 14:38:36 2006 +0100
+++ b/xen/include/public/physdev.h      Wed Jun 07 15:46:05 2006 +0100
@@ -37,7 +37,11 @@ DEFINE_XEN_GUEST_HANDLE(physdev_irq_stat
 
 /* Need to call PHYSDEVOP_eoi when the IRQ has been serviced? */
 #define _XENIRQSTAT_needs_eoi   (0)
-#define  XENIRQSTAT_needs_eoi   (1<<_XENIRQSTAT_needs_eoi)
+#define  XENIRQSTAT_needs_eoi   (1U<<_XENIRQSTAT_needs_eoi)
+
+/* Need to call PHYSDEVOP_eoi when the IRQ has been serviced? */
+#define _XENIRQSTAT_shared      (1)
+#define  XENIRQSTAT_shared      (1U<<_XENIRQSTAT_shared)
 
 /*
  * Set the current VCPU's I/O privilege level.
@@ -130,6 +134,7 @@ DEFINE_XEN_GUEST_HANDLE(physdev_op_t);
 #define PHYSDEVOP_APIC_WRITE             PHYSDEVOP_apic_write
 #define PHYSDEVOP_ASSIGN_VECTOR          PHYSDEVOP_alloc_irq_vector
 #define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi
+#define PHYSDEVOP_IRQ_SHARED             XENIRQSTAT_shared
 
 #endif /* __XEN_PUBLIC_PHYSDEV_H__ */
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.