From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Stabellini Subject: [PATCH v9 01/12] xen/arm: no need to set HCR_VI when using the vgic to inject irqs Date: Tue, 10 Jun 2014 15:07:09 +0100 Message-ID: <1402409240-28114-1-git-send-email-stefano.stabellini@eu.citrix.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xensource.com Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org HCR_VI forces the guest to resume execution in IRQ mode and can actually cause spurious interrupt injections. The GIC is capable of injecting interrupts into the guest and causing it to switch to IRQ mode automatically, without any need for the hypervisor to set HCR_VI manually. See ARM ARM B1.8.11 and chapter 5.4 of the Generic Interrupt Controller Architecture Specification. Signed-off-by: Stefano Stabellini Acked-by: Julien Grall Acked-by: Ian Campbell --- Changes in v4: - improve commit message. --- xen/arch/arm/gic.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 577d85b..a449ef3 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -643,22 +643,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(¤t->arch.vgic.lr_pending) || @@ -671,10 +655,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(); } static void do_sgi(struct cpu_user_regs *regs, int othercpu, enum gic_sgi sgi) -- 1.7.10.4