[Xen-devel,PATCH-4.5,v3,01/12] xen/arm: no need to set HCR_VI when using the vgic to inject irqs

Message ID 1393439997-26936-1-git-send-email-stefano.stabellini@eu.citrix.com
State New
Headers show

Commit Message

Stefano Stabellini Feb. 26, 2014, 6:39 p.m.
It can actually cause spurious interrupt injections into the guest.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 xen/arch/arm/gic.c |   20 --------------------
 1 file changed, 20 deletions(-)

Comments

Julien Grall Feb. 26, 2014, 7:50 p.m. | #1
On 26/02/14 18:39, Stefano Stabellini wrote:
> It can actually cause spurious interrupt injections into the guest.
>

I would explain what is the current behaviour with HCR_VI, e.g. the
guest is entering in interrupt mode...

By only reading the documentation and your commit message, this patch 
seems wrong (I know it's not the case ;)).

Patch

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 1484e1f..f860194 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -725,22 +725,6 @@  void gic_clear_pending_irqs(struct vcpu *v)
     spin_unlock_irqrestore(&gic.lock, flags);
 }
 
-static void gic_inject_irq_start(void)
-{
-    register_t hcr = READ_SYSREG(HCR_EL2);
-    WRITE_SYSREG(hcr | HCR_VI, HCR_EL2);
-    isb();
-}
-
-static void gic_inject_irq_stop(void)
-{
-    register_t hcr = READ_SYSREG(HCR_EL2);
-    if (hcr & HCR_VI) {
-        WRITE_SYSREG(hcr & ~HCR_VI, HCR_EL2);
-        isb();
-    }
-}
-
 int gic_events_need_delivery(void)
 {
     return (!list_empty(&current->arch.vgic.lr_pending) ||
@@ -753,10 +737,6 @@  void gic_inject(void)
         vgic_vcpu_inject_irq(current, current->domain->arch.evtchn_irq, 1);
 
     gic_restore_pending_irqs(current);
-    if (!gic_events_need_delivery())
-        gic_inject_irq_stop();
-    else
-        gic_inject_irq_start();
 }
 
 int gic_route_irq_to_guest(struct domain *d, const struct dt_irq *irq,