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

[Xen-devel] [PATCH v4 5/6] arm: remove VGIC_SOFTIRQ



Instead of using a softirq to check whether we need to set the VI bit in
the HCR (IRQ injection in the guest), always check the lr_mask on
leave_hypervisor_tail.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 xen/arch/arm/gic.c            |   13 ++++++++++---
 xen/arch/arm/gic.h            |    4 ++--
 xen/arch/arm/traps.c          |    4 +++-
 xen/arch/arm/vgic.c           |   15 ---------------
 xen/include/asm-arm/softirq.h |    3 +--
 5 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index c05e598..cdb4e4a 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -433,7 +433,7 @@ out:
     return;
 }
 
-void gic_inject_irq_start(void)
+static void gic_inject_irq_start(void)
 {
     uint32_t hcr;
     hcr = READ_CP32(HCR);
@@ -441,7 +441,7 @@ void gic_inject_irq_start(void)
     isb();
 }
 
-void gic_inject_irq_stop(void)
+static void gic_inject_irq_stop(void)
 {
     uint32_t hcr;
     hcr = READ_CP32(HCR);
@@ -451,6 +451,14 @@ void gic_inject_irq_stop(void)
     }
 }
 
+void gic_inject(void)
+{
+    if (!gic.lr_mask)
+        gic_inject_irq_stop();
+    else
+        gic_inject_irq_start();
+}
+
 int gic_route_irq_to_guest(struct domain *d, unsigned int irq,
                            const char * devname)
 {
@@ -540,7 +548,6 @@ static void maintenance_interrupt(int irq, void *dev_id, 
struct cpu_user_regs *r
             GICC[GICC_DIR] = virq;
         }
         list_del_init(&p->inflight);
-        cpu_raise_softirq(current->processor, VGIC_SOFTIRQ);
         spin_unlock(&current->arch.vgic.lock);
 
         i++;
diff --git a/xen/arch/arm/gic.h b/xen/arch/arm/gic.h
index 6b2be4f..2c5922e 100644
--- a/xen/arch/arm/gic.h
+++ b/xen/arch/arm/gic.h
@@ -128,11 +128,11 @@ extern struct pending_irq *irq_to_pending(struct vcpu *v, 
unsigned int irq);
 
 extern void gic_route_irqs(void);
 
+extern void gic_inject(void);
+
 extern void __cpuinit init_maintenance_interrupt(void);
 extern void gic_set_guest_irq(unsigned int irq,
         unsigned int state, unsigned int priority);
-extern void gic_inject_irq_start(void);
-extern void gic_inject_irq_stop(void);
 extern int gic_route_irq_to_guest(struct domain *d, unsigned int irq,
                                   const char * devname);
 
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 6304bbd..abc26a3 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -608,8 +608,10 @@ asmlinkage void leave_hypervisor_tail(void)
     while (1)
     {
         local_irq_disable();
-        if (!softirq_pending(smp_processor_id()))
+        if (!softirq_pending(smp_processor_id())) {
+            gic_inject();
             return;
+        }
         local_irq_enable();
         do_softirq();
     }
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 4d2a0e0..629a0da 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -577,23 +577,8 @@ void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int 
irq, int virtual)
     list_add_tail(&n->inflight, &v->arch.vgic.inflight_irqs);
     spin_unlock(&v->arch.vgic.lock);
     /* we have a new higher priority irq, inject it into the guest */
-    cpu_raise_softirq(v->processor, VGIC_SOFTIRQ);
 }
 
-static void vgic_softirq(void)
-{
-    if (list_empty(&current->arch.vgic.inflight_irqs))
-        return;
-
-    gic_inject_irq_start();
-}
-
-static int __init init_vgic_softirq(void)
-{
-    open_softirq(VGIC_SOFTIRQ, vgic_softirq);
-    return 0;
-}
-__initcall(init_vgic_softirq);
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/asm-arm/softirq.h b/xen/include/asm-arm/softirq.h
index 536af38..27818ae 100644
--- a/xen/include/asm-arm/softirq.h
+++ b/xen/include/asm-arm/softirq.h
@@ -1,8 +1,7 @@
 #ifndef __ASM_SOFTIRQ_H__
 #define __ASM_SOFTIRQ_H__
 
-#define VGIC_SOFTIRQ        (NR_COMMON_SOFTIRQS + 0)
-#define NR_ARCH_SOFTIRQS       1
+#define NR_ARCH_SOFTIRQS       0
 
 #endif /* __ASM_SOFTIRQ_H__ */
 /*
-- 
1.7.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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