diff mbox

[v3,15/19] xen/arm: Introduce a helper to check local abort is enabled

Message ID 1490965679-619-16-git-send-email-Wei.Chen@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Chen March 31, 2017, 1:07 p.m. UTC
In previous patch, we have umasked the Abort/SError bit for Xen
in most of its running time. So in some use-cases, we have to
check whether the abort is enabled in current context. For example,
while we want to synchronize SErrors, we have to confirm the abort
is enabled. Otherwise synchronize SErrors is pointless.

Signed-off-by: Wei Chen <Wei.Chen@arm.com>
---
 xen/include/asm-arm/arm32/system.h | 7 +++++++
 xen/include/asm-arm/arm64/system.h | 7 +++++++
 2 files changed, 14 insertions(+)

Comments

Julien Grall March 31, 2017, 2:25 p.m. UTC | #1
Hi Wei,

On 31/03/17 14:07, Wei Chen wrote:
> In previous patch, we have umasked the Abort/SError bit for Xen
> in most of its running time. So in some use-cases, we have to
> check whether the abort is enabled in current context. For example,
> while we want to synchronize SErrors, we have to confirm the abort
> is enabled. Otherwise synchronize SErrors is pointless.
>
> Signed-off-by: Wei Chen <Wei.Chen@arm.com>

Reviewed-by: Julien Grall <julien.grall@arm.com>

Cheers,
Stefano Stabellini March 31, 2017, 6:43 p.m. UTC | #2
On Fri, 31 Mar 2017, Wei Chen wrote:
> In previous patch, we have umasked the Abort/SError bit for Xen
> in most of its running time. So in some use-cases, we have to
> check whether the abort is enabled in current context. For example,
> while we want to synchronize SErrors, we have to confirm the abort
> is enabled. Otherwise synchronize SErrors is pointless.
> 
> Signed-off-by: Wei Chen <Wei.Chen@arm.com>
> ---
>  xen/include/asm-arm/arm32/system.h | 7 +++++++
>  xen/include/asm-arm/arm64/system.h | 7 +++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/xen/include/asm-arm/arm32/system.h b/xen/include/asm-arm/arm32/system.h
> index c617b40..6c5b9f5 100644
> --- a/xen/include/asm-arm/arm32/system.h
> +++ b/xen/include/asm-arm/arm32/system.h
> @@ -35,6 +35,13 @@ static inline int local_irq_is_enabled(void)
>      return !(flags & PSR_IRQ_MASK);
>  }
>  
> +static inline int local_abort_is_enabled(void)
> +{
> +    unsigned long flags;
> +    local_save_flags(flags);
> +    return !(flags & PSR_ABT_MASK);
> +}
> +
>  #define local_fiq_enable()  __asm__("cpsie f   @ __stf\n" : : : "memory", "cc")
>  #define local_fiq_disable() __asm__("cpsid f   @ __clf\n" : : : "memory", "cc")
>  
> diff --git a/xen/include/asm-arm/arm64/system.h b/xen/include/asm-arm/arm64/system.h
> index 2e2ee21..309485f 100644
> --- a/xen/include/asm-arm/arm64/system.h
> +++ b/xen/include/asm-arm/arm64/system.h
> @@ -58,6 +58,13 @@ static inline int local_fiq_is_enabled(void)
>      return !(flags & PSR_FIQ_MASK);
>  }
>  
> +static inline int local_abort_is_enabled(void)
> +{
> +    unsigned long flags;
> +    local_save_flags(flags);
> +    return !(flags & PSR_ABT_MASK);
> +}

Given that the two functions are identical, please add just one to
xen/include/asm-arm/system.h, if possible.
diff mbox

Patch

diff --git a/xen/include/asm-arm/arm32/system.h b/xen/include/asm-arm/arm32/system.h
index c617b40..6c5b9f5 100644
--- a/xen/include/asm-arm/arm32/system.h
+++ b/xen/include/asm-arm/arm32/system.h
@@ -35,6 +35,13 @@  static inline int local_irq_is_enabled(void)
     return !(flags & PSR_IRQ_MASK);
 }
 
+static inline int local_abort_is_enabled(void)
+{
+    unsigned long flags;
+    local_save_flags(flags);
+    return !(flags & PSR_ABT_MASK);
+}
+
 #define local_fiq_enable()  __asm__("cpsie f   @ __stf\n" : : : "memory", "cc")
 #define local_fiq_disable() __asm__("cpsid f   @ __clf\n" : : : "memory", "cc")
 
diff --git a/xen/include/asm-arm/arm64/system.h b/xen/include/asm-arm/arm64/system.h
index 2e2ee21..309485f 100644
--- a/xen/include/asm-arm/arm64/system.h
+++ b/xen/include/asm-arm/arm64/system.h
@@ -58,6 +58,13 @@  static inline int local_fiq_is_enabled(void)
     return !(flags & PSR_FIQ_MASK);
 }
 
+static inline int local_abort_is_enabled(void)
+{
+    unsigned long flags;
+    local_save_flags(flags);
+    return !(flags & PSR_ABT_MASK);
+}
+
 #endif
 /*
  * Local variables: