From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xen.org
Cc: keir@xen.org, ian.jackson@eu.citrix.com,
Ian Campbell <ian.campbell@citrix.com>,
jbeulich@suse.com
Subject: [PATCH 5/5] xen: remove evtchn_upcall_mask from interface on ARM
Date: Thu, 18 Jul 2013 14:15:40 +0100 [thread overview]
Message-ID: <1374153340-29398-5-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1374153311.26728.86.camel@kazak.uk.xensource.com>
On ARM event-channel upcalls are masked using the hardware's interrupt mask
bit and not by a software bit.
Leaving this field present in the interface has caused some confusion already
and is liable to mean it gets inadvertently used in the future. So arrange for
this field to be turned into a padding field on ARM by introducing a
XEN_HAVE_PV_UPCALL_MASK define.
This bit is also unused for x86 PV-on-HVM guests, but we can't realistically
distinguish those from x86 PV guests in the headers.
Add a per-arch vcpu_event_delivery_is_enabled function to replace the single
open coded use of evtchn_upcall_mask in common code (in a debug keyhandler).
The existing local_event_delivery_is_enabled, which operates only on current,
was unimplemented on ARM and unused on x86, so remove it.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: keir@xen.org
Cc: jbeulich@suse.com
---
This patch build on top of Stefano's "xen/arm: trap guest WFI" patch.
---
xen/common/keyhandler.c | 2 +-
xen/include/asm-arm/event.h | 13 +++++++------
xen/include/asm-x86/event.h | 10 +++++-----
xen/include/public/arch-x86/xen.h | 3 +++
xen/include/public/xen.h | 4 ++++
5 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c
index 5072133..5725f90 100644
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -293,7 +293,7 @@ static void dump_domains(unsigned char key)
v->vcpu_id, v->processor,
v->is_running ? 'T':'F', v->poll_evtchn,
vcpu_info(v, evtchn_upcall_pending),
- vcpu_info(v, evtchn_upcall_mask));
+ !vcpu_event_delivery_is_enabled(v));
cpuset_print(tmpstr, sizeof(tmpstr), v->vcpu_dirty_cpumask);
printk("dirty_cpus=%s ", tmpstr);
cpuset_print(tmpstr, sizeof(tmpstr), v->cpu_affinity);
diff --git a/xen/include/asm-arm/event.h b/xen/include/asm-arm/event.h
index ed05901..04d854f 100644
--- a/xen/include/asm-arm/event.h
+++ b/xen/include/asm-arm/event.h
@@ -7,6 +7,12 @@
void vcpu_kick(struct vcpu *v);
void vcpu_mark_events_pending(struct vcpu *v);
+static inline int vcpu_event_delivery_is_enabled(struct vcpu *v)
+{
+ struct cpu_user_regs *regs = &v->arch.cpu_info->guest_cpu_user_regs;
+ return !(regs->cpsr & PSR_IRQ_MASK);
+}
+
static inline int local_events_need_delivery_nomask(void)
{
struct pending_irq *p = irq_to_pending(current, VGIC_IRQ_EVTCHN_CALLBACK);
@@ -31,16 +37,11 @@ static inline int local_events_need_delivery_nomask(void)
static inline int local_events_need_delivery(void)
{
- struct cpu_user_regs *regs = guest_cpu_user_regs();
-
- /* guest IRQs are masked */
- if ( (regs->cpsr & PSR_IRQ_MASK) )
+ if ( !vcpu_event_delivery_is_enabled(current) )
return 0;
return local_events_need_delivery_nomask();
}
-int local_event_delivery_is_enabled(void);
-
static inline void local_event_delivery_enable(void)
{
struct cpu_user_regs *regs = guest_cpu_user_regs();
diff --git a/xen/include/asm-x86/event.h b/xen/include/asm-x86/event.h
index 06057c7..7edeb5b 100644
--- a/xen/include/asm-x86/event.h
+++ b/xen/include/asm-x86/event.h
@@ -14,6 +14,11 @@
void vcpu_kick(struct vcpu *v);
void vcpu_mark_events_pending(struct vcpu *v);
+static inline int vcpu_event_delivery_is_enabled(struct vcpu *v)
+{
+ return !vcpu_info(v, evtchn_upcall_mask);
+}
+
int hvm_local_events_need_delivery(struct vcpu *v);
static inline int local_events_need_delivery(void)
{
@@ -23,11 +28,6 @@ static inline int local_events_need_delivery(void)
!vcpu_info(v, evtchn_upcall_mask)));
}
-static inline int local_event_delivery_is_enabled(void)
-{
- return !vcpu_info(current, evtchn_upcall_mask);
-}
-
static inline void local_event_delivery_disable(void)
{
vcpu_info(current, evtchn_upcall_mask) = 1;
diff --git a/xen/include/public/arch-x86/xen.h b/xen/include/public/arch-x86/xen.h
index c528e91..5c4b08e 100644
--- a/xen/include/public/arch-x86/xen.h
+++ b/xen/include/public/arch-x86/xen.h
@@ -73,6 +73,9 @@ typedef unsigned long xen_pfn_t;
#define XEN_HAVE_PV_GUEST_ENTRY 1
#define COMPAT_HAVE_PV_GUEST_ENTRY 1
+#define XEN_HAVE_PV_UPCALL_MASK 1
+#define COMPAT_HAVE_PV_UPCALL_MASK 1
+
/*
* `incontents 200 segdesc Segment Descriptor Tables
*/
diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h
index 037540d..2a40970 100644
--- a/xen/include/public/xen.h
+++ b/xen/include/public/xen.h
@@ -612,7 +612,11 @@ struct vcpu_info {
* to block: this avoids wakeup-waiting races.
*/
uint8_t evtchn_upcall_pending;
+#ifdef XEN_HAVE_PV_UPCALL_MASK
uint8_t evtchn_upcall_mask;
+#else /* XEN_HAVE_PV_UPCALL_MASK */
+ uint8_t pad0;
+#endif /* XEN_HAVE_PV_UPCALL_MASK */
xen_ulong_t evtchn_pending_sel;
struct arch_vcpu_info arch;
struct vcpu_time_info time;
--
1.7.2.5
next prev parent reply other threads:[~2013-07-18 13:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-18 13:15 [PATCH v5 0/5] xen: public interface and foreign struct check changes for arm Ian Campbell
2013-07-18 13:15 ` [PATCH 1/5] xen/compat: support XEN_HAVE_FOO ifdefs in public interface Ian Campbell
2013-07-18 13:15 ` [PATCH 2/5] xen: only expose start_info on architectures which have a PV boot path Ian Campbell
2013-07-18 13:38 ` Jan Beulich
2013-07-18 13:57 ` Ian Campbell
2013-07-18 14:04 ` Jan Beulich
2013-07-18 14:08 ` Ian Campbell
2013-07-18 14:12 ` Jan Beulich
2013-07-18 14:31 ` Ian Campbell
2013-07-18 13:15 ` [PATCH 3/5] xen: arm: include public/xen.h in foreign interface checking Ian Campbell
2013-07-18 13:15 ` [PATCH 4/5] tools: foreign: add checks for compatible architectures Ian Campbell
2013-07-18 13:15 ` Ian Campbell [this message]
2013-07-18 13:40 ` [PATCH 5/5] xen: remove evtchn_upcall_mask from interface on ARM Jan Beulich
2013-07-18 14:36 ` Ian Campbell
2013-07-18 13:42 ` [PATCH v5 0/5] xen: public interface and foreign struct check changes for arm Jan Beulich
2013-07-18 13:48 ` Ian Campbell
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=1374153340-29398-5-git-send-email-ian.campbell@citrix.com \
--to=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=xen-devel@lists.xen.org \
/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).