]> xenbits.xensource.com Git - xen.git/commitdiff
xen: remove evtchn_upcall_mask from interface on ARM
authorIan Campbell <ian.campbell@citrix.com>
Fri, 19 Jul 2013 11:51:11 +0000 (12:51 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 20 Aug 2013 14:41:30 +0000 (15:41 +0100)
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 an 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.

ifdef the use of evtchn_upcall_mask when setting up a new vcpu info page.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
xen/common/domain.c
xen/common/keyhandler.c
xen/include/asm-arm/event.h
xen/include/asm-x86/config.h
xen/include/asm-x86/event.h
xen/include/public/arch-x86/xen.h
xen/include/public/xen.h

index 6c264a5a025087ff6e49aa0e7a06d9693caa343f..9390a22a6db264aa9cbf91ef24dad56db1a846f2 100644 (file)
@@ -921,7 +921,9 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
     if ( v->vcpu_info == &dummy_vcpu_info )
     {
         memset(new_info, 0, sizeof(*new_info));
+#ifdef XEN_HAVE_PV_UPCALL_MASK
         __vcpu_info(v, new_info, evtchn_upcall_mask) = 1;
+#endif
     }
     else
     {
index e5c15d67c5accea70430ee8136267facc80b7dbb..b9ad1b5bd7242e7af6e916ace5f199f21b79a62b 100644 (file)
@@ -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);
index ed059011025d6b0131b70244c090ebd90bce84b2..04d854fa626cdb3a1de31b420cbfe3e86530f50b 100644 (file)
@@ -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();
index 028b696dfa07e0c92a7ab03ad75a23733f7a0512..f387cd68f0e32d72ed0fe8e524461df54ba0c7d9 100644 (file)
@@ -266,6 +266,7 @@ extern unsigned char boot_edid_info[128];
 
 #define COMPAT_LEGACY_MAX_VCPUS XEN_LEGACY_MAX_VCPUS
 #define COMPAT_HAVE_PV_GUEST_ENTRY XEN_HAVE_PV_GUEST_ENTRY
+#define COMPAT_HAVE_PV_UPCALL_MASK XEN_HAVE_PV_UPCALL_MASK
 
 #endif
 
index 06057c7bea7b647662890bb63e8fa98eae655683..7edeb5bfefe135fe5b3b08217250fc3d6e8d6f62 100644 (file)
 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;
index 7ae8c9048908761aa1700201453e5422801dcd61..908ef87f359da1e8d29311a8ff65e9c29b371379 100644 (file)
@@ -72,6 +72,8 @@ typedef unsigned long xen_pfn_t;
 
 #define XEN_HAVE_PV_GUEST_ENTRY 1
 
+#define XEN_HAVE_PV_UPCALL_MASK 1
+
 /*
  * `incontents 200 segdesc Segment Descriptor Tables
  */
index 037540df45935514d668bb2cafbb5fc8d253f4cd..2a409701fb81f2e58398814b3bea27fa2ab5ffb6 100644 (file)
@@ -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;