From: Nishanth Menon <nm@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V3 01/11] ARM: Introduce erratum workaround for 798870
Date: Tue, 3 Mar 2015 10:29:45 -0600 [thread overview]
Message-ID: <54F5E179.1070109@ti.com> (raw)
In-Reply-To: <1424897719-12666-2-git-send-email-nm@ti.com>
On 02/25/2015 02:55 PM, Nishanth Menon wrote:
> Add workaround for Cortex-A15 ARM erratum 798870 which says
> "If back-to-back speculative cache line fills (fill A and fill B) are
> issued from the L1 data cache of a CPU to the L2 cache, the second
> request (fill B) is then cancelled, and the second request would have
> detected a hazard against a recent write or eviction (write B) to the
> same cache line as fill B then the L2 logic might deadlock."
>
> Implementations for SoC families such as Exynos, OMAP5/DRA7 etc
> will be widely different.
>
> Every SoC has slightly different manner of setting up access to L2ACLR
> and similar registers since the Secure Monitor handling of Secure
> Monitor Call(smc) is diverse. Hence an weak function is introduced
> which may be overriden to implement SoC specific accessor implementation.
>
> Based on ARM errata Document revision 18.0 (22 Nov 2013)
>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
> README | 5 +++++
> arch/arm/cpu/armv7/Makefile | 2 +-
> arch/arm/cpu/armv7/cp15.c | 23 +++++++++++++++++++++++
> arch/arm/cpu/armv7/start.S | 20 ++++++++++++++++++++
> arch/arm/include/asm/armv7.h | 3 +++
> 5 files changed, 52 insertions(+), 1 deletion(-)
> create mode 100644 arch/arm/cpu/armv7/cp15.c
>
> diff --git a/README b/README
> index a28ff133ee05..11ec37ba4a00 100644
> --- a/README
> +++ b/README
> @@ -621,6 +621,11 @@ The following options need to be configured:
> exists, unlike the similar options in the Linux kernel. Do not
> set these options unless they apply!
>
> + NOTE: The following can be machine specific errata. These
> + do have ability to provide rudimentary version and machine
> + specific checks, but expect no product checks.
> + CONFIG_ARM_ERRATA_798870
> +
> - Driver Model
> Driver model is a new framework for devices in U-Boot
> introduced in early 2014. U-Boot is being progressively
> diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile
> index 409e6f5651b6..43da3e586f71 100644
> --- a/arch/arm/cpu/armv7/Makefile
> +++ b/arch/arm/cpu/armv7/Makefile
> @@ -9,7 +9,7 @@ extra-y := start.o
>
> obj-y += cache_v7.o
>
> -obj-y += cpu.o
> +obj-y += cpu.o cp15.o
> obj-y += syslib.o
>
> ifneq ($(CONFIG_AM43XX)$(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA)$(CONFIG_MX6)$(CONFIG_TI81XX)$(CONFIG_AT91FAMILY)$(CONFIG_SUNXI),)
> diff --git a/arch/arm/cpu/armv7/cp15.c b/arch/arm/cpu/armv7/cp15.c
> new file mode 100644
> index 000000000000..8ac81c9ba147
> --- /dev/null
> +++ b/arch/arm/cpu/armv7/cp15.c
> @@ -0,0 +1,23 @@
> +/*
> + * (C) Copyright 2015 Texas Insturments
> + *
> + * SPDX-License-Identifier: GPL-2.0+
> + */
> +
> +/*
> + * CP15 specific code
> + */
> +
> +#include <common.h>
> +#include <command.h>
> +#include <asm/system.h>
> +#include <asm/cache.h>
> +#include <asm/armv7.h>
> +#include <linux/compiler.h>
> +
> +void __weak v7_arch_cp15_set_l2aux_ctrl(u32 l2actlr, u32 cpu_midr,
> + u32 cpu_rev_comb, u32 cpu_variant,
> + u32 cpu_rev)
> +{
> + asm volatile ("mcr p15, 1, %0, c15, c0, 0\n\t" : : "r"(l2actlr));
> +}
> diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
> index 70048c10aee6..ec46cec9cb1c 100644
> --- a/arch/arm/cpu/armv7/start.S
> +++ b/arch/arm/cpu/armv7/start.S
> @@ -163,6 +163,26 @@ ENTRY(cpu_init_cp15)
> mcr p15, 0, r0, c15, c0, 1 @ write diagnostic register
> #endif
>
> + mrc p15, 0, r1, c0, c0, 0 @ r1 has Read Main ID Register (MIDR)
> + mov r3, r1, lsr #20 @ get variant field
> + and r3, r3, #0xf @ r3 has CPU variant
> + and r4, r1, #0xf @ r4 has CPU revision
> + mov r2, r3, lsl #4 @ shift variant field for combined value
> + orr r2, r4, r2 @ r2 has combined CPU variant + revision
I think I should move these to beyond r3 as r0-r3 could be corrupted
in c invocation OR SMC invocation...
> +
> +#ifdef CONFIG_ARM_ERRATA_798870
> + cmp r2, #0x30 @ Applies to lower than R3p0
> + bge skip_errata_798870 @ skip if not affected rev
> + cmp r2, #0x20 @ Applies to including and above R2p0
> + blt skip_errata_798870 @ skip if not affected rev
> +
> + mrc p15, 1, r0, c15, c0, 0 @ read l2 aux ctrl reg
> + orr r0, r0, #1 << 7 @ Enable hazard-detect timeout
> + b v7_arch_cp15_set_l2aux_ctrl
> + isb @ Recommended ISB after l2actlr update
> +skip_errata_798870:
> +#endif
> +
> mov pc, lr @ back to my caller
> ENDPROC(cpu_init_cp15)
>
> diff --git a/arch/arm/include/asm/armv7.h b/arch/arm/include/asm/armv7.h
> index a13da23cf172..30e0cc3cf3d5 100644
> --- a/arch/arm/include/asm/armv7.h
> +++ b/arch/arm/include/asm/armv7.h
> @@ -93,6 +93,9 @@ extern char __secure_end[];
>
> #endif /* CONFIG_ARMV7_NONSEC || CONFIG_ARMV7_VIRT */
>
> +void v7_arch_cp15_set_l2aux_ctrl(u32 l2auxctrl, u32 cpu_midr,
> + u32 cpu_rev_comb, u32 cpu_variant,
> + u32 cpu_rev);
> #endif /* ! __ASSEMBLY__ */
>
> #endif
>
--
Regards,
Nishanth Menon
next prev parent reply other threads:[~2015-03-03 16:29 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-25 20:55 [U-Boot] [PATCH V3 0/11] ARM: OMAP3-DRA7: CP15 erratum workarounds and improvements Nishanth Menon
2015-02-25 20:55 ` [U-Boot] [PATCH V3 01/11] ARM: Introduce erratum workaround for 798870 Nishanth Menon
2015-03-03 16:29 ` Nishanth Menon [this message]
2015-02-25 20:55 ` [U-Boot] [PATCH V3 02/11] ARM: Introduce erratum workaround for 454179 Nishanth Menon
2015-02-25 20:55 ` [U-Boot] [PATCH V3 03/11] ARM: Introduce erratum workaround for 430973 Nishanth Menon
2015-02-25 20:55 ` [U-Boot] [PATCH V3 04/11] ARM: Introduce erratum workaround for 621766 Nishanth Menon
2015-02-25 20:55 ` [U-Boot] [PATCH V3 05/11] ARM: OMAP: Change set_pl310_ctrl_reg to be generic Nishanth Menon
2015-03-03 17:08 ` Tom Rini
2015-03-03 17:12 ` Nishanth Menon
2015-03-03 17:54 ` Nishanth Menon
2015-03-03 17:55 ` Tom Rini
2015-02-25 20:55 ` [U-Boot] [PATCH V3 06/11] ARM: OMAP3: Rename omap3.h to omap.h to be generic as all SoCs Nishanth Menon
2015-02-25 20:55 ` [U-Boot] [PATCH V3 07/11] ARM: OMAP3: Get rid of omap3_gp_romcode_call and replace with omap_smc1 Nishanth Menon
2015-02-25 20:55 ` [U-Boot] [PATCH V3 08/11] ARM: DRA7 / OMAP5: Add workaround for ARM errata 798870 Nishanth Menon
2015-02-25 20:55 ` [U-Boot] [PATCH V3 09/11] ARM: OMAP5 / DRA7: Setup L2 Aux Control Register with recommended configuration Nishanth Menon
2015-02-25 20:55 ` [U-Boot] [PATCH V3 10/11] ARM: OMAP3: Enable workaround for ARM errata 454179, 430973, 621766 Nishanth Menon
2015-02-25 20:55 ` [U-Boot] [PATCH V3 11/11] ARM: OMAP3: rx51: " Nishanth Menon
2015-02-26 7:40 ` [U-Boot] [PATCH V3 0/11] ARM: OMAP3-DRA7: CP15 erratum workarounds and improvements Siarhei Siamashka
2015-02-26 14:50 ` Nishanth Menon
2015-02-26 16:14 ` Siarhei Siamashka
2015-03-02 21:16 ` Tom Rini
2015-03-03 6:45 ` Siarhei Siamashka
2015-03-03 16:25 ` Nishanth Menon
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=54F5E179.1070109@ti.com \
--to=nm@ti.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