mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
xen: arm64: interrupt/abort mask/unmask
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Tim Deegan <tim@xen.org>
This commit is contained in:
1 parent
8b93c06fd2
commit
8c75419129
3 files changed
+98
-44
No files matched your search
@@ -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:
|
||||
|
||||
@@ -173,6 +173,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:
|
||||
|
||||
@@ -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
|
||||
|
||||