mirror of
https://github.com/torvalds/linux.git
synced 2024-12-20 18:11:47 +00:00
c0053bd50a
Add workaround for Cortex-A15 ARM erratum 801819 which says in summary that "A livelock can occur in the L2 cache arbitration that might prevent a snoop from completing. Under certain conditions this can cause the system to deadlock. " Recommended workaround is as follows: Do both of the following: 1) Do not use the write-back no-allocate memory type. 2) Do not issue write-back cacheable stores at any time when the cache is disabled (SCTLR.C=0) and the MMU is enabled (SCTLR.M=1). Because it is implementation defined whether cacheable stores update the cache when the cache is disabled it is not expected that any portable code will execute cacheable stores when the cache is disabled. For implementations of Cortex-A15 configured without the “L2 arbitration register slice” option (typically one or two core systems), you must also do the following: 3) Disable write-streaming in each CPU by setting ACTLR[28:25] = 0b1111 So, we provide an option to disable write streaming on OMAP5 and DRA7. It is a rare condition to occur and may be enabled selectively based on platform acceptance of risk. Applies to: A15 revisions r2p0, r2p1, r2p2, r2p3 or r2p4 and REVIDR[3] is set to 0. Based on ARM errata Document revision 18.0 (22 Nov 2013) Note: the configuration for the workaround needs to be done with each CPU bringup, since CPU0 bringup is done by bootloader, it is recommended to have the workaround in the bootloader, kernel also does ensure that CPU0 has the workaround and makes the workaround active when CPU1 gets active. With CONFIG_SMP disabled, it is expected to be done by the bootloader. This does show significant degradation in synthetic tests such as mbw (https://packages.qa.debian.org/m/mbw.html) mbw -n 100 100|grep AVG (on a test platform) Without enabling the erratum: AVG Method: MEMCPY Elapsed: 0.13406 MiB: 100.00000 Copy: 745.913 MiB/s AVG Method: DUMB Elapsed: 0.06746 MiB: 100.00000 Copy: 1482.357 MiB/s AVG Method: MCBLOCK Elapsed: 0.03058 MiB: 100.00000 Copy: 3270.569 MiB/s After enabling the erratum: AVG Method: MEMCPY Elapsed: 0.13757 MiB: 100.00000 Copy: 726.913 MiB/s AVG Method: DUMB Elapsed: 0.12024 MiB: 100.00000 Copy: 831.668 MiB/s AVG Method: MCBLOCK Elapsed: 0.09243 MiB: 100.00000 Copy: 1081.942 MiB/s Most benchmarks are designed for specific performance analysis, so overall usecase must be considered before making a decision to enable/disable the erratum workaround. Pending internal investigation, the erratum is kept disabled by default. Cc: Russell King <rmk+kernel@arm.linux.org.uk> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Tony Lindgren <tony@atomide.com> Suggested-by: Richard Woodruff <r-woodruff2@ti.com> Suggested-by: Brad Griffis <bgriffis@ti.com> Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
84 lines
2.6 KiB
C
84 lines
2.6 KiB
C
/*
|
|
* omap-secure.h: OMAP Secure infrastructure header.
|
|
*
|
|
* Copyright (C) 2011 Texas Instruments, Inc.
|
|
* Santosh Shilimkar <santosh.shilimkar@ti.com>
|
|
* Copyright (C) 2012 Ivaylo Dimitrov <freemangordon@abv.bg>
|
|
* Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
#ifndef OMAP_ARCH_OMAP_SECURE_H
|
|
#define OMAP_ARCH_OMAP_SECURE_H
|
|
|
|
/* Monitor error code */
|
|
#define API_HAL_RET_VALUE_NS2S_CONVERSION_ERROR 0xFFFFFFFE
|
|
#define API_HAL_RET_VALUE_SERVICE_UNKNWON 0xFFFFFFFF
|
|
|
|
/* HAL API error codes */
|
|
#define API_HAL_RET_VALUE_OK 0x00
|
|
#define API_HAL_RET_VALUE_FAIL 0x01
|
|
|
|
/* Secure HAL API flags */
|
|
#define FLAG_START_CRITICAL 0x4
|
|
#define FLAG_IRQFIQ_MASK 0x3
|
|
#define FLAG_IRQ_ENABLE 0x2
|
|
#define FLAG_FIQ_ENABLE 0x1
|
|
#define NO_FLAG 0x0
|
|
|
|
/* Maximum Secure memory storage size */
|
|
#define OMAP_SECURE_RAM_STORAGE (88 * SZ_1K)
|
|
|
|
/* Secure low power HAL API index */
|
|
#define OMAP4_HAL_SAVESECURERAM_INDEX 0x1a
|
|
#define OMAP4_HAL_SAVEHW_INDEX 0x1b
|
|
#define OMAP4_HAL_SAVEALL_INDEX 0x1c
|
|
#define OMAP4_HAL_SAVEGIC_INDEX 0x1d
|
|
|
|
/* Secure Monitor mode APIs */
|
|
#define OMAP4_MON_SCU_PWR_INDEX 0x108
|
|
#define OMAP4_MON_L2X0_DBG_CTRL_INDEX 0x100
|
|
#define OMAP4_MON_L2X0_CTRL_INDEX 0x102
|
|
#define OMAP4_MON_L2X0_AUXCTRL_INDEX 0x109
|
|
#define OMAP4_MON_L2X0_PREFETCH_INDEX 0x113
|
|
|
|
#define OMAP5_DRA7_MON_SET_CNTFRQ_INDEX 0x109
|
|
#define OMAP5_MON_AMBA_IF_INDEX 0x108
|
|
#define OMAP5_DRA7_MON_SET_ACR_INDEX 0x107
|
|
|
|
/* Secure PPA(Primary Protected Application) APIs */
|
|
#define OMAP4_PPA_L2_POR_INDEX 0x23
|
|
#define OMAP4_PPA_CPU_ACTRL_SMP_INDEX 0x25
|
|
|
|
/* Secure RX-51 PPA (Primary Protected Application) APIs */
|
|
#define RX51_PPA_HWRNG 29
|
|
#define RX51_PPA_L2_INVAL 40
|
|
#define RX51_PPA_WRITE_ACR 42
|
|
|
|
#ifndef __ASSEMBLER__
|
|
|
|
extern u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs,
|
|
u32 arg1, u32 arg2, u32 arg3, u32 arg4);
|
|
extern u32 omap_smc2(u32 id, u32 falg, u32 pargs);
|
|
extern u32 omap_smc3(u32 id, u32 process, u32 flag, u32 pargs);
|
|
extern phys_addr_t omap_secure_ram_mempool_base(void);
|
|
extern int omap_secure_ram_reserve_memblock(void);
|
|
|
|
extern u32 rx51_secure_dispatcher(u32 idx, u32 process, u32 flag, u32 nargs,
|
|
u32 arg1, u32 arg2, u32 arg3, u32 arg4);
|
|
extern u32 rx51_secure_update_aux_cr(u32 set_bits, u32 clear_bits);
|
|
extern u32 rx51_secure_rng_call(u32 ptr, u32 count, u32 flag);
|
|
|
|
#ifdef CONFIG_SOC_HAS_REALTIME_COUNTER
|
|
void set_cntfreq(void);
|
|
#else
|
|
static inline void set_cntfreq(void)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
#endif /* __ASSEMBLER__ */
|
|
#endif /* OMAP_ARCH_OMAP_SECURE_H */
|