public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "André Przywara" <andre.przywara@arm.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/6] arm/arm64: Move barrier instructions into separate header
Date: Sun, 8 May 2016 01:36:37 +0100	[thread overview]
Message-ID: <572E8A15.9060606@arm.com> (raw)
In-Reply-To: <1462396534-32390-2-git-send-email-andre.przywara@arm.com>

Hi Tom,

On 04/05/16 22:15, Andre Przywara wrote:
> Commit bfb33f0bc45b ("sunxi: mctl_mem_matches: Add missing memory
> barrier") broke compilation for the Pine64, as dram_helper.c now
> includes <asm/armv7.h>, which does not compile on arm64.

I just realized that the 2016.05 release is due anytime now.
Can we at least take this single patch still?
The current HEAD is broken for Pine64 (as buildman armv8 easily proves).
It worked before the above mentioned patch - so with 2016.05-rc3.
This patch fixes it. I ran "buildman arm armv8" on HEAD + this fix and
didn't spot any regressions (I don't have a softfp toolchain, though).

Taking this one should prevent the new board support for Pine64 to be
broken on release.

Cheers,
Andre.

> Fix this by moving all barrier instructions into a separate header
> file, which can easily be shared between arm and arm64.
> Also extend the inline assembly to take the "sy" argument, which is
> optional for ARMv7, but mandatory for v8.
> 
> This fixes compilation for 64-bit sunxi boards (Pine64).
> 
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
>  arch/arm/include/asm/armv7.h       | 21 +-----------------
>  arch/arm/include/asm/barriers.h    | 44 ++++++++++++++++++++++++++++++++++++++
>  arch/arm/mach-sunxi/dram_helpers.c |  2 +-
>  3 files changed, 46 insertions(+), 21 deletions(-)
>  create mode 100644 arch/arm/include/asm/barriers.h
> 
> diff --git a/arch/arm/include/asm/armv7.h b/arch/arm/include/asm/armv7.h
> index 30e7939..423fc70 100644
> --- a/arch/arm/include/asm/armv7.h
> +++ b/arch/arm/include/asm/armv7.h
> @@ -59,26 +59,7 @@
>  #ifndef __ASSEMBLY__
>  #include <linux/types.h>
>  #include <asm/io.h>
> -
> -/*
> - * CP15 Barrier instructions
> - * Please note that we have separate barrier instructions in ARMv7
> - * However, we use the CP15 based instructtions because we use
> - * -march=armv5 in U-Boot
> - */
> -#define CP15ISB	asm volatile ("mcr     p15, 0, %0, c7, c5, 4" : : "r" (0))
> -#define CP15DSB	asm volatile ("mcr     p15, 0, %0, c7, c10, 4" : : "r" (0))
> -#define CP15DMB	asm volatile ("mcr     p15, 0, %0, c7, c10, 5" : : "r" (0))
> -
> -#ifdef __ARM_ARCH_7A__
> -#define ISB	asm volatile ("isb" : : : "memory")
> -#define DSB	asm volatile ("dsb" : : : "memory")
> -#define DMB	asm volatile ("dmb" : : : "memory")
> -#else
> -#define ISB	CP15ISB
> -#define DSB	CP15DSB
> -#define DMB	CP15DMB
> -#endif
> +#include <asm/barriers.h>
>  
>  /*
>   * Workaround for ARM errata # 798870
> diff --git a/arch/arm/include/asm/barriers.h b/arch/arm/include/asm/barriers.h
> new file mode 100644
> index 0000000..37870f9
> --- /dev/null
> +++ b/arch/arm/include/asm/barriers.h
> @@ -0,0 +1,44 @@
> +/*
> + * Copyright (C) 2016 ARM Ltd.
> + *
> + * ARM and ARM64 barrier instructions
> + * split from armv7.h to allow sharing between ARM and ARM64
> + *
> + * Original copyright in armv7.h was:
> + * (C) Copyright 2010 Texas Instruments, <www.ti.com> Aneesh V <aneesh@ti.com>
> + *
> + * Much of the original barrier code was contributed by:
> + *   Valentine Barshak <valentine.barshak@cogentembedded.com>
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +#ifndef __BARRIERS_H__
> +#define __BARRIERS_H__
> +
> +#ifndef __ASSEMBLY__
> +
> +#ifndef CONFIG_ARM64
> +/*
> + * CP15 Barrier instructions
> + * Please note that we have separate barrier instructions in ARMv7
> + * However, we use the CP15 based instructtions because we use
> + * -march=armv5 in U-Boot
> + */
> +#define CP15ISB	asm volatile ("mcr     p15, 0, %0, c7, c5, 4" : : "r" (0))
> +#define CP15DSB	asm volatile ("mcr     p15, 0, %0, c7, c10, 4" : : "r" (0))
> +#define CP15DMB	asm volatile ("mcr     p15, 0, %0, c7, c10, 5" : : "r" (0))
> +
> +#endif /* !CONFIG_ARM64 */
> +
> +#if defined(__ARM_ARCH_7A__) || defined(CONFIG_ARM64)
> +#define ISB	asm volatile ("isb sy" : : : "memory")
> +#define DSB	asm volatile ("dsb sy" : : : "memory")
> +#define DMB	asm volatile ("dmb sy" : : : "memory")
> +#else
> +#define ISB	CP15ISB
> +#define DSB	CP15DSB
> +#define DMB	CP15DMB
> +#endif
> +
> +#endif	/* __ASSEMBLY__ */
> +#endif	/* __BARRIERS_H__ */
> diff --git a/arch/arm/mach-sunxi/dram_helpers.c b/arch/arm/mach-sunxi/dram_helpers.c
> index e0c823a..20b430f 100644
> --- a/arch/arm/mach-sunxi/dram_helpers.c
> +++ b/arch/arm/mach-sunxi/dram_helpers.c
> @@ -7,7 +7,7 @@
>   */
>  
>  #include <common.h>
> -#include <asm/armv7.h>
> +#include <asm/barriers.h>
>  #include <asm/io.h>
>  #include <asm/arch/dram.h>
>  
> 

  reply	other threads:[~2016-05-08  0:36 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-04 21:15 [U-Boot] [PATCH 0/6] arm64: Pine64 fixes and updates Andre Przywara
2016-05-04 21:15 ` [U-Boot] [PATCH 1/6] arm/arm64: Move barrier instructions into separate header Andre Przywara
2016-05-08  0:36   ` André Przywara [this message]
2016-05-04 21:15 ` [U-Boot] [PATCH 2/6] Revert "sunxi: Reserve ATF memory space on A64" Andre Przywara
2016-05-15 10:12   ` [U-Boot] [U-Boot, " Hans de Goede
2016-05-04 21:15 ` [U-Boot] [PATCH 3/6] arm64: sunxi: reserve space for boot0 header Andre Przywara
2016-05-06 21:15   ` Steve Rae
2016-05-06 21:27     ` André Przywara
2016-05-06 21:35       ` Steve Rae
2016-05-15 10:13   ` [U-Boot] [U-Boot, " Hans de Goede
2016-05-04 21:15 ` [U-Boot] [PATCH 4/6] arm64: sunxi: adjust default load addresses Andre Przywara
2016-05-15 10:12   ` [U-Boot] [U-Boot, " Hans de Goede
2016-05-04 21:15 ` [U-Boot] [PATCH 5/6] arm64: Pine64: update FDT files Andre Przywara
2016-05-15 10:13   ` [U-Boot] [U-Boot,5/6] " Hans de Goede
2016-05-15 12:48     ` André Przywara
2016-05-04 21:15 ` [U-Boot] [PATCH 6/6] Pine64: rename defconfig Andre Przywara
2016-05-04 21:46   ` Peter Robinson
2016-05-04 22:14     ` André Przywara
2016-05-06 15:11       ` Tom Rini
2016-05-06 15:20         ` Andre Przywara
2016-05-06 15:31           ` Tom Rini
2016-05-15 10:30   ` [U-Boot] [U-Boot,6/6] " Hans de Goede
2016-05-15 12:49     ` André Przywara
2016-05-15 13:28       ` Hans de Goede
2016-05-15 20:19       ` Alexander Graf
2016-05-04 21:53 ` [U-Boot] [PATCH 0/6] arm64: Pine64 fixes and updates Peter Robinson
2016-05-04 22:05   ` André Przywara
2016-05-04 22:15     ` Peter Robinson
2016-05-04 22:36       ` André Przywara
2016-05-05  1:03         ` Chen-Yu Tsai
2016-05-06 15:09 ` Tom Rini
2016-05-06 17:03   ` Andre Przywara
2016-05-06 17:22     ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=572E8A15.9060606@arm.com \
    --to=andre.przywara@arm.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox