All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/arm: introduce platform_need_explicit_eoi
@ 2014-06-20 13:35 Stefano Stabellini
  2014-06-20 14:11 ` Julien Grall
  2014-07-02 14:49 ` Julien Grall
  0 siblings, 2 replies; 19+ messages in thread
From: Stefano Stabellini @ 2014-06-20 13:35 UTC (permalink / raw)
  To: xen-devel; +Cc: apatel, Ian.Campbell, psawargaonkar, stefano.stabellini

GICH_LR_HW doesn't work as expected on X-Gene: request maintenance
interrupts and perform EOIs in the hypervisor as a workaround.
Trigger this behaviour with a per platform option.

No need to find the pcpu that needs to write to GICC_DIR, because after
"physical irq follow virtual irq" we always inject the virtual irq on
the vcpu that is running on the pcpu that received the interrupt.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
CC: psawargaonkar@apm.com
CC: apatel@apm.com
---
 xen/arch/arm/gic.c                   |   13 ++++++++++++-
 xen/arch/arm/platforms/xgene-storm.c |    2 +-
 xen/include/asm-arm/platform.h       |    5 +++++
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 58233cc..8695078 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -577,7 +577,9 @@ static inline void gic_set_lr(int lr, struct pending_irq *p,
 
     lr_val = state | (GIC_PRI_TO_GUEST(p->priority) << GICH_LR_PRIORITY_SHIFT) |
         ((p->irq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT);
-    if ( p->desc != NULL )
+    if ( platform_has_quirk(PLATFORM_QUIRK_NEED_EOI) )
+        lr_val |= GICH_LR_MAINTENANCE_IRQ;
+    else if ( p->desc != NULL )
         lr_val |= GICH_LR_HW | (p->desc->irq << GICH_LR_PHYSICAL_SHIFT);
 
     GICH[GICH_LR + lr] = lr_val;
@@ -656,6 +658,11 @@ void gic_raise_guest_irq(struct vcpu *v, unsigned int virtual_irq,
     gic_add_to_lr_pending(v, irq_to_pending(v, virtual_irq));
 }
 
+static void gic_irq_eoi(int irq)
+{
+    GICC[GICC_DIR] = irq;
+}
+
 static void gic_update_one_lr(struct vcpu *v, int i)
 {
     struct pending_irq *p;
@@ -692,7 +699,11 @@ static void gic_update_one_lr(struct vcpu *v, int i)
         clear_bit(i, &this_cpu(lr_mask));
 
         if ( p->desc != NULL )
+        {
             p->desc->status &= ~IRQ_INPROGRESS;
+            if ( platform_has_quirk(PLATFORM_QUIRK_NEED_EOI) )
+                gic_irq_eoi(p->irq);
+        }
         clear_bit(GIC_IRQ_GUEST_VISIBLE, &p->status);
         clear_bit(GIC_IRQ_GUEST_ACTIVE, &p->status);
         p->lr = GIC_INVALID_LR;
diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
index c9dd63c..5396c46 100644
--- a/xen/arch/arm/platforms/xgene-storm.c
+++ b/xen/arch/arm/platforms/xgene-storm.c
@@ -37,7 +37,7 @@ static bool reset_vals_valid = false;
 
 static uint32_t xgene_storm_quirks(void)
 {
-    return PLATFORM_QUIRK_GIC_64K_STRIDE;
+    return PLATFORM_QUIRK_GIC_64K_STRIDE|PLATFORM_QUIRK_NEED_EOI;
 }
 
 static int map_one_mmio(struct domain *d, const char *what,
diff --git a/xen/include/asm-arm/platform.h b/xen/include/asm-arm/platform.h
index bcd2097..572f5b1 100644
--- a/xen/include/asm-arm/platform.h
+++ b/xen/include/asm-arm/platform.h
@@ -55,6 +55,11 @@ struct platform_desc {
  */
 #define PLATFORM_QUIRK_GIC_64K_STRIDE (1 << 0)
 
+/*
+ * Quirk for platforms where GICH_LR_HW does not work as expected.
+ */
+#define PLATFORM_QUIRK_NEED_EOI       (1 << 1)
+
 void __init platform_init(void);
 int __init platform_init_time(void);
 int __init platform_specific_mapping(struct domain *d);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2014-07-02 15:34 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-20 13:35 [PATCH] xen/arm: introduce platform_need_explicit_eoi Stefano Stabellini
2014-06-20 14:11 ` Julien Grall
2014-06-20 14:27   ` Stefano Stabellini
2014-06-20 14:47     ` Julien Grall
2014-06-20 16:48       ` Stefano Stabellini
2014-06-20 16:59         ` Julien Grall
2014-06-20 17:40           ` Stefano Stabellini
2014-06-20 18:33             ` Julien Grall
2014-06-21 14:43               ` Stefano Stabellini
2014-06-21 14:59                 ` Julien Grall
2014-06-21 15:26                   ` Stefano Stabellini
2014-06-21 15:59                     ` Julien Grall
2014-06-23 10:43                       ` Stefano Stabellini
2014-06-27 15:51                         ` Ian Campbell
2014-06-30 10:01                           ` Julien Grall
2014-07-02 15:31                             ` Stefano Stabellini
2014-07-02 15:34                           ` Stefano Stabellini
2014-07-02 14:49 ` Julien Grall
2014-07-02 15:31   ` Stefano Stabellini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.