From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com,
JBeulich@suse.com,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH v9 07/10] xen: remove workaround to inject evtchn_irq on irq enable
Date: Thu, 24 Jul 2014 18:33:09 +0100 [thread overview]
Message-ID: <1406223192-26267-7-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1407241825570.2293@kaball.uk.xensource.com>
evtchn_upcall_pending is already set by common code at vcpu creation,
therefore on ARM we also need to call vgic_vcpu_inject_irq for it.
Currently we do that from vgic_enable_irqs as a workaround.
Do this properly by introducing an appropriate arch specific hook:
arch_evtchn_inject. arch_evtchn_inject is called by map_vcpu_info to
inject the evtchn irq into the guest. On ARM is implemented by calling
vgic_vcpu_inject_irq, on x86 is unneeded.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
CC: JBeulich@suse.com
---
Changes in v9:
- use an arch hook.
Changes in v2:
- coding style fix;
- add comment;
- return an error if arch_set_info_guest is called without VGCF_online.
---
xen/arch/arm/vgic.c | 23 +++++++++--------------
xen/common/domain.c | 1 +
xen/include/asm-arm/event.h | 2 ++
xen/include/asm-x86/event.h | 2 ++
4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 299ae7e..474eebd 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -263,20 +263,10 @@ void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n)
v_target = d->arch.vgic.handler->get_target_vcpu(v, irq);
p = irq_to_pending(v_target, irq);
set_bit(GIC_IRQ_GUEST_ENABLED, &p->status);
- /* We need to force the first injection of evtchn_irq because
- * evtchn_upcall_pending is already set by common code on vcpu
- * creation. */
- if ( irq == v_target->domain->arch.evtchn_irq &&
- vcpu_info(current, evtchn_upcall_pending) &&
- list_empty(&p->inflight) )
- vgic_vcpu_inject_irq(v_target, irq);
- else {
- unsigned long flags;
- spin_lock_irqsave(&v_target->arch.vgic.lock, flags);
- if ( !list_empty(&p->inflight) && !test_bit(GIC_IRQ_GUEST_VISIBLE, &p->status) )
- gic_raise_guest_irq(v_target, irq, p->priority);
- spin_unlock_irqrestore(&v_target->arch.vgic.lock, flags);
- }
+ spin_lock_irqsave(&v_target->arch.vgic.lock, flags);
+ if ( !list_empty(&p->inflight) && !test_bit(GIC_IRQ_GUEST_VISIBLE, &p->status) )
+ gic_raise_guest_irq(v_target, irq, p->priority);
+ spin_unlock_irqrestore(&v_target->arch.vgic.lock, flags);
if ( p->desc != NULL )
{
irq_set_affinity(p->desc, cpumask_of(v_target->processor));
@@ -432,6 +422,11 @@ void vgic_vcpu_inject_spi(struct domain *d, unsigned int irq)
vgic_vcpu_inject_irq(v, irq);
}
+void arch_evtchn_inject(struct vcpu *v)
+{
+ vgic_vcpu_inject_irq(v, v->domain->arch.evtchn_irq);
+}
+
/*
* Local variables:
* mode: C
diff --git a/xen/common/domain.c b/xen/common/domain.c
index cd64aea..05d0049 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1058,6 +1058,7 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
vcpu_info(v, evtchn_upcall_pending) = 1;
for ( i = 0; i < BITS_PER_EVTCHN_WORD(d); i++ )
set_bit(i, &vcpu_info(v, evtchn_pending_sel));
+ arch_evtchn_inject(v);
return 0;
}
diff --git a/xen/include/asm-arm/event.h b/xen/include/asm-arm/event.h
index 5330dfe..8c77427 100644
--- a/xen/include/asm-arm/event.h
+++ b/xen/include/asm-arm/event.h
@@ -56,6 +56,8 @@ static inline int arch_virq_is_global(int virq)
return 1;
}
+void arch_evtchn_inject(struct vcpu *v);
+
#endif
/*
* Local variables:
diff --git a/xen/include/asm-x86/event.h b/xen/include/asm-x86/event.h
index a82062e..3c1a9d1 100644
--- a/xen/include/asm-x86/event.h
+++ b/xen/include/asm-x86/event.h
@@ -44,4 +44,6 @@ static inline int arch_virq_is_global(uint32_t virq)
return 1;
}
+static inline void arch_evtchn_inject(struct vcpu *v) { }
+
#endif
--
1.7.10.4
next prev parent reply other threads:[~2014-07-24 17:33 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-24 17:31 [PATCH v9 00/10] gic and vgic fixes and improvements Stefano Stabellini
2014-07-24 17:33 ` [PATCH v9 01/10] xen/arm: observe itargets setting in vgic_enable_irqs and vgic_disable_irqs Stefano Stabellini
2014-07-24 17:33 ` [PATCH v9 02/10] xen/arm: move setting GIC_IRQ_GUEST_QUEUED earlier Stefano Stabellini
2014-07-28 15:16 ` Julien Grall
2014-07-28 16:18 ` Stefano Stabellini
2014-07-24 17:33 ` [PATCH v9 03/10] xen/arm: inflight irqs during migration Stefano Stabellini
2014-07-24 17:33 ` [PATCH v9 04/10] xen/arm: support irq delivery to vcpu > 0 Stefano Stabellini
2014-07-28 16:16 ` Julien Grall
2014-07-24 17:33 ` [PATCH v9 05/10] xen/arm: physical irq follow virtual irq Stefano Stabellini
2014-07-28 15:47 ` Julien Grall
2014-07-28 16:20 ` Stefano Stabellini
2014-07-28 16:42 ` Julien Grall
2014-08-01 17:22 ` Stefano Stabellini
2014-08-01 17:54 ` Julien Grall
2014-08-01 17:58 ` Stefano Stabellini
2014-08-01 18:00 ` Julien Grall
2014-07-24 17:33 ` [PATCH v9 06/10] xen: introduce sched_move_irqs Stefano Stabellini
2014-07-24 17:33 ` Stefano Stabellini [this message]
2014-07-25 8:12 ` [PATCH v9 07/10] xen: remove workaround to inject evtchn_irq on irq enable Jan Beulich
2014-08-01 17:00 ` Stefano Stabellini
2014-08-04 7:15 ` Jan Beulich
2014-08-04 10:02 ` Stefano Stabellini
2014-08-04 10:18 ` Jan Beulich
2014-08-04 20:29 ` Stefano Stabellini
2014-08-05 6:25 ` Jan Beulich
2014-08-05 11:26 ` Stefano Stabellini
2014-07-24 17:33 ` [PATCH v9 08/10] xen/arm: take the rank lock before accessing ipriority Stefano Stabellini
2014-07-28 16:22 ` Julien Grall
2014-07-24 17:33 ` [PATCH v9 09/10] xen: introduce bit access macros for the IRQ line status flags Stefano Stabellini
2014-07-25 12:21 ` Julien Grall
2014-07-24 17:33 ` [PATCH v9 10/10] xen/arm: make accesses to desc->status flags atomic Stefano Stabellini
2014-07-25 12:40 ` Julien Grall
2014-07-28 16:31 ` Stefano Stabellini
2014-07-28 17:14 ` Julien Grall
2014-07-29 10:25 ` Stefano Stabellini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1406223192-26267-7-git-send-email-stefano.stabellini@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=JBeulich@suse.com \
--cc=julien.grall@citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).