diff mbox

arm: do not use dmb for armv5

Message ID 1409244856-10157-1-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Aug. 28, 2014, 4:54 p.m. UTC
Original bug:
https://bugs.linaro.org/show_bug.cgi?id=355
Armv5 fails on compilation dmb instuction.
Use the same thing like linux kernel does.

CC: Yao Zhao <yao.zhao@windriver.com>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 Hi Yao,

 Can you please test this patch?

 Thank you,
 Maxim.


 platform/linux-generic/include/api/odp_sync.h | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Maxim Uvarov Aug. 28, 2014, 7:44 p.m. UTC | #1
On 08/28/2014 11:29 PM, Yao Zhao wrote:
> Hi Maxim,
>
> You missed the ";" for arm 2 cases.
> Other than that, it does build for yocto's qemuarm now.
>
> yao

Ah, thanks! Will send v2. Will add you to Tested-by:

Maxim.
>
> ------------------------------------------------------------------------
>
> *From:* Maxim Uvarov <maxim.uvarov@linaro.org>
> *Sent:* Thursday, August 28, 2014 12:54PM
> *To:* lng-odp@lists.linaro.org
> *Cc:* Maxim Uvarov <maxim.uvarov@linaro.org>, Zhao, Yao
> *Subject:* [PATCH] arm: do not use dmb for armv5
>
> Original bug:
> https://bugs.linaro.org/show_bug.cgi?id=355
> Armv5 fails on compilation dmb instuction.
> Use the same thing like linux kernel does.
>
> CC: Yao Zhao<yao.zhao@windriver.com>
> Signed-off-by: Maxim Uvarov<maxim.uvarov@linaro.org>
> ---
>   Hi Yao,
>
>   Can you please test this patch?
>
>   Thank you,
>   Maxim.
>
>
>   platform/linux-generic/include/api/odp_sync.h | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/platform/linux-generic/include/api/odp_sync.h b/platform/linux-generic/include/api/odp_sync.h
> index 9cf4d46..89bd307 100644
> --- a/platform/linux-generic/include/api/odp_sync.h
> +++ b/platform/linux-generic/include/api/odp_sync.h
> @@ -31,9 +31,16 @@ static inline void odp_sync_stores(void)
>   
>   	__asm__  __volatile__ ("sfence\n" : : : "memory");
>   
> -#elif defined __arm__ || defined __aarch64__
> +#elif defined(__arm__)
> +#if __ARM_ARCH == 6
> +	__asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" \
> +			: : "r" (0) : "memory")
> +#elif __ARM_ARCH >= 7 || defined __aarch64__
>   
>   	__asm__ __volatile__ ("dmb st" : : : "memory");
> +#else
> +	__asm__ __volatile__ ("" : : : "memory")
> +#endif
>   
>   #elif defined __OCTEON__
>   
>
>
diff mbox

Patch

diff --git a/platform/linux-generic/include/api/odp_sync.h b/platform/linux-generic/include/api/odp_sync.h
index 9cf4d46..89bd307 100644
--- a/platform/linux-generic/include/api/odp_sync.h
+++ b/platform/linux-generic/include/api/odp_sync.h
@@ -31,9 +31,16 @@  static inline void odp_sync_stores(void)
 
 	__asm__  __volatile__ ("sfence\n" : : : "memory");
 
-#elif defined __arm__ || defined __aarch64__
+#elif defined(__arm__)
+#if __ARM_ARCH == 6
+	__asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" \
+			: : "r" (0) : "memory")
+#elif __ARM_ARCH >= 7 || defined __aarch64__
 
 	__asm__ __volatile__ ("dmb st" : : : "memory");
+#else
+	__asm__ __volatile__ ("" : : : "memory")
+#endif
 
 #elif defined __OCTEON__