[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] xen: arm64: interrupt/abort mask/unmask
commit 8c75419129ce1c40a3775ec1abc802b08bb29071 Author: Ian Campbell <ian.campbell@xxxxxxxxxx> AuthorDate: Fri Feb 22 08:57:55 2013 +0000 Commit: Ian Campbell <ian.campbell@xxxxxxxxxx> CommitDate: Fri Feb 22 12:14:52 2013 +0000 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 276e363..f28879d 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 8692a5d..daa221e 100644 --- a/xen/include/asm-arm/arm64/system.h +++ b/xen/include/asm-arm/arm64/system.h @@ -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: diff --git a/xen/include/asm-arm/system.h b/xen/include/asm-arm/system.h index f2a87d4..290d38d 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 -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |