[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH V2 16/46] xen: arm64: interrupt/abort mask/unmask



Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Tim Deegan <tim@xxxxxxx>
---
 xen/include/asm-arm/arm32/system.h |   44 +++++++++++++++++++++++++++++
 xen/include/asm-arm/arm64/system.h |   54 ++++++++++++++++++++++++++++++++++++
 xen/include/asm-arm/system.h       |   44 -----------------------------
 3 files changed, 98 insertions(+), 44 deletions(-)

diff --git a/xen/include/asm-arm/arm32/system.h 
b/xen/include/asm-arm/arm32/system.h
index 9dbe8e3..ac8fcb0 100644
--- a/xen/include/asm-arm/arm32/system.h
+++ b/xen/include/asm-arm/arm32/system.h
@@ -133,6 +133,50 @@ static always_inline unsigned long __cmpxchg(
     ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),            \
                                    (unsigned long)(n),sizeof(*(ptr))))
 
+#define local_irq_disable() asm volatile ( "cpsid i @ local_irq_disable\n" : : 
: "cc" )
+#define local_irq_enable()  asm volatile ( "cpsie i @ local_irq_enable\n" : : 
: "cc" )
+
+#define local_save_flags(x)                                      \
+({                                                               \
+    BUILD_BUG_ON(sizeof(x) != sizeof(long));                     \
+    asm volatile ( "mrs %0, cpsr     @ local_save_flags\n"       \
+                  : "=r" (x) :: "memory", "cc" );                \
+})
+#define local_irq_save(x)                                        \
+({                                                               \
+    local_save_flags(x);                                         \
+    local_irq_disable();                                         \
+})
+#define local_irq_restore(x)                                     \
+({                                                               \
+    BUILD_BUG_ON(sizeof(x) != sizeof(long));                     \
+    asm volatile (                                               \
+            "msr     cpsr_c, %0      @ local_irq_restore\n"      \
+            :                                                    \
+            : "r" (flags)                                        \
+            : "memory", "cc");                                   \
+})
+
+static inline int local_irq_is_enabled(void)
+{
+    unsigned long flags;
+    local_save_flags(flags);
+    return !(flags & PSR_IRQ_MASK);
+}
+
+#define local_fiq_enable()  __asm__("cpsie f   @ __stf\n" : : : "memory", "cc")
+#define local_fiq_disable() __asm__("cpsid f   @ __clf\n" : : : "memory", "cc")
+
+#define local_abort_enable() __asm__("cpsie a  @ __sta\n" : : : "memory", "cc")
+#define local_abort_disable() __asm__("cpsid a @ __sta\n" : : : "memory", "cc")
+
+static inline int local_fiq_is_enabled(void)
+{
+    unsigned long flags;
+    local_save_flags(flags);
+    return !(flags & PSR_FIQ_MASK);
+}
+
 #endif
 /*
  * Local variables:
diff --git a/xen/include/asm-arm/arm64/system.h 
b/xen/include/asm-arm/arm64/system.h
index 6fd26f8..cc7b959 100644
--- a/xen/include/asm-arm/arm64/system.h
+++ b/xen/include/asm-arm/arm64/system.h
@@ -172,6 +172,60 @@ static inline unsigned long __cmpxchg_mb(volatile void 
*ptr, unsigned long old,
                                        (unsigned long)(n),              \
                                        sizeof(*(ptr))))
 
+/* Uses uimm4 as a bitmask to select the clearing of one or more of
+ * the DAIF exception mask bits:
+ * bit 3 selects the D mask,
+ * bit 2 the A mask,
+ * bit 1 the I mask and
+ * bit 0 the F mask.
+*/
+
+#define local_fiq_disable()   asm volatile ( "msr daifset, #1\n" ::: "memory" )
+#define local_fiq_enable()    asm volatile ( "msr daifclr, #1\n" ::: "memory" )
+#define local_irq_disable()   asm volatile ( "msr daifset, #2\n" ::: "memory" )
+#define local_irq_enable()    asm volatile ( "msr daifclr, #2\n" ::: "memory" )
+#define local_abort_disable() asm volatile ( "msr daifset, #4\n" ::: "memory" )
+#define local_abort_enable()  asm volatile ( "msr daifclr, #4\n" ::: "memory" )
+
+#define local_save_flags(x)                                      \
+({                                                               \
+    BUILD_BUG_ON(sizeof(x) != sizeof(long));                     \
+    asm volatile(                                                \
+        "mrs    %0, daif    // local_save_flags\n"               \
+                : "=r" (x)                                       \
+                :                                                \
+                : "memory");                                     \
+})
+
+#define local_irq_save(x)                                        \
+({                                                               \
+    local_save_flags(x);                                         \
+    local_irq_disable();                                         \
+})
+#define local_irq_restore(x)                                     \
+({                                                               \
+    BUILD_BUG_ON(sizeof(x) != sizeof(long));                     \
+    asm volatile (                                               \
+        "msr    daif, %0                // local_irq_restore"    \
+        :                                                        \
+        : "r" (flags)                                            \
+        : "memory");                                             \
+})
+
+static inline int local_irq_is_enabled(void)
+{
+    unsigned long flags;
+    local_save_flags(flags);
+    return !(flags & PSR_IRQ_MASK);
+}
+
+static inline int local_fiq_is_enabled(void)
+{
+    unsigned long flags;
+    local_save_flags(flags);
+    return !(flags & PSR_FIQ_MASK);
+}
+
 #endif
 /*
  * Local variables:
diff --git a/xen/include/asm-arm/system.h b/xen/include/asm-arm/system.h
index e4cb99c..a26936b 100644
--- a/xen/include/asm-arm/system.h
+++ b/xen/include/asm-arm/system.h
@@ -29,50 +29,6 @@
 # error "unknown ARM variant"
 #endif
 
-#define local_irq_disable() asm volatile ( "cpsid i @ local_irq_disable\n" : : 
: "cc" )
-#define local_irq_enable()  asm volatile ( "cpsie i @ local_irq_enable\n" : : 
: "cc" )
-
-#define local_save_flags(x)                                      \
-({                                                               \
-    BUILD_BUG_ON(sizeof(x) != sizeof(long));                     \
-    asm volatile ( "mrs %0, cpsr     @ local_save_flags\n"       \
-                  : "=r" (x) :: "memory", "cc" );                \
-})
-#define local_irq_save(x)                                        \
-({                                                               \
-    local_save_flags(x);                                         \
-    local_irq_disable();                                         \
-})
-#define local_irq_restore(x)                                     \
-({                                                               \
-    BUILD_BUG_ON(sizeof(x) != sizeof(long));                     \
-    asm volatile (                                               \
-            "msr     cpsr_c, %0      @ local_irq_restore\n"      \
-            :                                                    \
-            : "r" (flags)                                        \
-            : "memory", "cc");                                   \
-})
-
-static inline int local_irq_is_enabled(void)
-{
-    unsigned long flags;
-    local_save_flags(flags);
-    return !(flags & PSR_IRQ_MASK);
-}
-
-#define local_fiq_enable()  __asm__("cpsie f   @ __stf\n" : : : "memory", "cc")
-#define local_fiq_disable() __asm__("cpsid f   @ __clf\n" : : : "memory", "cc")
-
-#define local_abort_enable() __asm__("cpsie a  @ __sta\n" : : : "memory", "cc")
-#define local_abort_disable() __asm__("cpsid a @ __sta\n" : : : "memory", "cc")
-
-static inline int local_fiq_is_enabled(void)
-{
-    unsigned long flags;
-    local_save_flags(flags);
-    return !!(flags & PSR_FIQ_MASK);
-}
-
 extern struct vcpu *__context_switch(struct vcpu *prev, struct vcpu *next);
 
 #endif
-- 
1.7.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.