project/bcm63xx/atf.git
5 years agommc: increase delay when initializing mmc
Joakim Bech [Tue, 18 Dec 2018 09:09:02 +0000 (10:09 +0100)]
mmc: increase delay when initializing mmc

Running TF-A 2.0 and later seems to cause a regression on HiKey 620.

    NOTICE:  BL2: v2.0(release):v2.0
    NOTICE:  BL2: Built : 17:41:23, Dec 17 2018
    NOTICE:  acpu_dvfs_set_freq: set acpu freq success!ERROR:   CMD1 failed after 100 retries
    ERROR:   BL2: Failed to load image (-5)

The reason seems to be that during emmc enumeration when BL2 sends the command
    OCR_SECTOR_MODE | OCR_VDD_MIN_2V7 | OCR_VDD_MIN_1V7

it for some reason takes some more time to get a reply. So a delay with
mdelay(1), seems to not be enough any longer and therefore we increase it to
mdelay(10) instead which makes the device boot as expected again.

Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
5 years agoMerge pull request #1712 from jeenu-arm/ssbs
Soby Mathew [Wed, 12 Dec 2018 09:43:49 +0000 (09:43 +0000)]
Merge pull request #1712 from jeenu-arm/ssbs

AArch64: Use SSBS for CVE_2018_3639 mitigation

5 years agoMerge pull request #1707 from antonio-nino-diaz-arm/an/spm
Antonio Niño Díaz [Tue, 11 Dec 2018 16:48:17 +0000 (17:48 +0100)]
Merge pull request #1707 from antonio-nino-diaz-arm/an/spm

SPM: Initial prototype based on SPCI and SPRT

5 years agoSPM: Rename files for consistency
Antonio Nino Diaz [Thu, 15 Nov 2018 08:57:18 +0000 (08:57 +0000)]
SPM: Rename files for consistency

Rename files prefixed by sp_ to spm_.

Change-Id: Ie3016a4c4ac5987fe6fdd734c6b470c60954e23d
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Remove remaining SMC interfaces
Antonio Nino Diaz [Fri, 30 Nov 2018 10:53:26 +0000 (10:53 +0000)]
SPM: Remove remaining SMC interfaces

Also, add a disclaimer to explain that the current implementation of SPM
is a prototype that is going to undergo a lot of rework.

Change-Id: I303c1e61c51d9f286cc599fea565fc9ba5a996bf
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Migrate mem attr get/set helpers to SPRT
Antonio Nino Diaz [Fri, 30 Nov 2018 10:52:09 +0000 (10:52 +0000)]
SPM: Migrate mem attr get/set helpers to SPRT

The old SMCs SP_MEMORY_ATTRIBUTES_{GET,SET}_AARCH64 have been removed in
favour of SPRT_MEMORY_PERM_ATTR_{GET,SET}_AARCH64.

Change-Id: Idb93cfa5461d0098df941037c5653f7c44b65227
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Allow preemption in non-blocking requests
Antonio Nino Diaz [Tue, 3 Jul 2018 15:54:33 +0000 (16:54 +0100)]
SPM: Allow preemption in non-blocking requests

Change-Id: I1fdc2285a3f6517a715ad6159322543fd5a37a37
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Support non-blocking calls
Antonio Nino Diaz [Thu, 8 Nov 2018 14:22:51 +0000 (14:22 +0000)]
SPM: Support non-blocking calls

Note that the arguments passed during the SMC call don't comply with the
SPCI specifications. This will be fixed in following patches, but it is
needed to implement a few more SPCI SMCs to be able to do it. The
current code allows us to start testing it.

Change-Id: Ic13dcc54c40327df03be1b0f52e8a44f468f06b4
Co-authored-by: Jean-Paul Etienne <jean-paul.etienne@arm.com>
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Implement global response buffer helpers
Antonio Nino Diaz [Thu, 18 Oct 2018 13:54:57 +0000 (14:54 +0100)]
SPM: Implement global response buffer helpers

This buffer is where all the responses from Secure Partitions are stored
until they are requested.

Change-Id: Iafeb8f0848c5ff6f3e187060cd3a47702484dc45
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Prevent simultaneous blocking calls
Antonio Nino Diaz [Tue, 3 Jul 2018 18:54:59 +0000 (19:54 +0100)]
SPM: Prevent simultaneous blocking calls

Blocking calls can only succeed if the target Secure Partition is idle.

Change-Id: Iabeaa0b8d3e653fd8581fa086758936abfc1c772
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Support blocking calls
Antonio Nino Diaz [Thu, 8 Nov 2018 14:21:19 +0000 (14:21 +0000)]
SPM: Support blocking calls

Note that the arguments passed during the SMC call don't comply with the
SPCI specifications. This will be fixed in following patches, but it is
needed to implement a few more SPCI SMCs to be able to do it. The
current code allows us to start testing it.

Change-Id: Ief0e75d072b311737fcdb0c6a60ba5b7406a9ee5
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Introduce SPRT C host library
Antonio Nino Diaz [Thu, 8 Nov 2018 09:21:48 +0000 (09:21 +0000)]
SPM: Introduce SPRT C host library

Change-Id: If57ec9cc0791f49d9ade83dff9d24ef9047963a8
Co-authored-by: Jean-Paul Etienne <jean-paul.etienne@arm.com>
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Implement SPCI open/close handle SMCs
Antonio Nino Diaz [Thu, 8 Nov 2018 14:20:07 +0000 (14:20 +0000)]
SPM: Implement SPCI open/close handle SMCs

Introduce SMCs that open and close handles according to the SPCI
specification.

Change-Id: I65f365f15612e01aa445e783e96e48ae275c39fd
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Introduce SMC handlers for SPCI and SPRT
Antonio Nino Diaz [Thu, 8 Nov 2018 14:12:40 +0000 (14:12 +0000)]
SPM: Introduce SMC handlers for SPCI and SPRT

Change-Id: I2ae9b3bb686c41b2e138132a7bed107925ac861e
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Support multiple xlat tables contexts
Antonio Nino Diaz [Tue, 30 Oct 2018 11:36:47 +0000 (11:36 +0000)]
SPM: Support multiple xlat tables contexts

Change-Id: Ib7c2529b85bb5930d44907edfc8ead13d3b1ef4d
Co-authored-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Support multiple partitions
Antonio Nino Diaz [Tue, 30 Oct 2018 11:35:30 +0000 (11:35 +0000)]
SPM: Support multiple partitions

Change-Id: I6673a5f8c2f6afa7780483e0ce8d4dad4c8dc8ea
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Remove old SMC interfaces
Antonio Nino Diaz [Tue, 30 Oct 2018 12:50:41 +0000 (12:50 +0000)]
SPM: Remove old SMC interfaces

Remove interfaces based on MM_COMMUNICATE.

Change-Id: I628c884b91d9f4758269ea2c4dedc37a66bb93cf
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Map memory regions from RD
Antonio Nino Diaz [Tue, 30 Oct 2018 11:34:23 +0000 (11:34 +0000)]
SPM: Map memory regions from RD

SPM needs to map a number of regions on behalf of the secure partition.
Previously, it used to get a list of them from platform code using the
plat_get_secure_partition_mmap() API. Now it gets them from the resource
description structure.

The SPM<->SP shared buffer is mapped dynamically at EL3. This buffer is
used to pass information between SPM and SP, so it must be mapped at EL3
as well in order to be used by SPM.

Dynamic translation tables have been enabled when the Trusted Firmware
is compiled with SPM support.

Change-Id: I64ad335e931661812a0a60558e60372e1e5e6b72
Co-authored-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Read entrypoint from resource descriptor
Antonio Nino Diaz [Tue, 26 Jun 2018 09:34:25 +0000 (10:34 +0100)]
SPM: Read entrypoint from resource descriptor

Read entrypoint of the Secure Partition from the resource description
struct.

Change-Id: Ie693c7b4d4fecafd85b6934d9d8c4232efb1dc55
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Load image and RD from SP package
Antonio Nino Diaz [Tue, 27 Nov 2018 08:36:02 +0000 (08:36 +0000)]
SPM: Load image and RD from SP package

Load SP and RD from package instead of relying on RD being already
loaded in memory and the SP being loaded as a BL32 image.

Change-Id: I18d4fbf4597656c6a7e878e1d7c01a8a324f3f8a
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: sptool: Introduce tool to package SP and RD
Antonio Nino Diaz [Tue, 27 Nov 2018 14:58:04 +0000 (14:58 +0000)]
SPM: sptool: Introduce tool to package SP and RD

This tool packages Secure Partitions and Resource Descriptor blobs into
a simple file that can be loaded by SPM.

Change-Id: If3800064f30bdc3d7fc6a15ffbb3007ef632bcaa
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoMerge pull request #1714 from chandnich/sgiclark-helios
Soby Mathew [Tue, 11 Dec 2018 10:53:36 +0000 (10:53 +0000)]
Merge pull request #1714 from chandnich/sgiclark-helios

SGI-Clark.Helios platform support patches

5 years agoSPM: Remove SP memory mappings definitions
Antonio Nino Diaz [Tue, 30 Oct 2018 11:54:20 +0000 (11:54 +0000)]
SPM: Remove SP memory mappings definitions

This information is retrieved from the resource description now.

Change-Id: Iaae23945eb2c45305cdc6442853e42f4e04fe094
Co-authored-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Deprecate boot info struct
Antonio Nino Diaz [Tue, 30 Oct 2018 11:52:45 +0000 (11:52 +0000)]
SPM: Deprecate boot info struct

This information is defined by the Secure Partition in the resource
description.

Change-Id: Ia7db90c5de8360a596106880d3f6a632a88d3ea8
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Introduce functions to load DTB files
Antonio Nino Diaz [Tue, 30 Oct 2018 11:12:42 +0000 (11:12 +0000)]
SPM: Introduce functions to load DTB files

Introduce helpers to create resource description struct, as well as code
to load the information from DTB files.

Change-Id: I0f5bb94eb8b01c6cb53fe807a9db0c05a70d7a43
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Define resource description data structures
Antonio Nino Diaz [Tue, 27 Nov 2018 09:36:22 +0000 (09:36 +0000)]
SPM: Define resource description data structures

The structures and associated definitions are in different files so that
the definitions can be used inside DTS files while the structs are
private to SPM. They follow the SPRT specification.

Change-Id: Id6a629040a086c482b9d9fa1883b8aa6bbee619f
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoSPM: Deprecate the current implementation
Antonio Nino Diaz [Tue, 30 Oct 2018 11:08:08 +0000 (11:08 +0000)]
SPM: Deprecate the current implementation

The current SPM is a prototype that only supports one secure partition
in EL0. The objective of SPM is to have multiple partitions. The current
MM interface isn't adequate for this, so it is needed to modify heavily
the code to add proper support for it.

However, there are platforms which are already using this (like SGI) and
removing the code would break it.  For this reason, the current SPM code
has been duplicated in order to temporarily preserve compatibility. All
new improvements/changes to SPM will be done in the non-deprecated copy,
that may change without notice.

The new build option SPM_DEPRECATED has been introduced to select the SPM
implementation. It defaults to 1, that selects the deprecated SPM.

Change-Id: Ic9f80b53b450e97b4d3f47e4ef4a138ee8d87443
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agofvp: Increase stack size when SPM is enabled
Antonio Nino Diaz [Thu, 18 Oct 2018 13:02:39 +0000 (14:02 +0100)]
fvp: Increase stack size when SPM is enabled

Change-Id: Iec265dc85d44f35048d1fbcfbe55960d45570027
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoAArch64: Use SSBS for CVE_2018_3639 mitigation
Jeenu Viswambharan [Thu, 15 Nov 2018 11:38:03 +0000 (11:38 +0000)]
AArch64: Use SSBS for CVE_2018_3639 mitigation

The Armv8.5 extensions introduces PSTATE.SSBS (Speculation Store Bypass
Safe) bit to mitigate against Variant 4 vulnerabilities. Although an
Armv8.5 feature, this can be implemented by CPUs implementing earlier
version of the architecture.

With this patch, when both PSTATE.SSBS is implemented and
DYNAMIC_WORKAROUND_CVE_2018_3639 is active, querying for
SMCCC_ARCH_WORKAROUND_2 via. SMCCC_ARCH_FEATURES call would return 1 to
indicate that mitigation on the PE is either permanently enabled or not
required.

When SSBS is implemented, SCTLR_EL3.DSSBS is initialized to 0 at reset
of every BL stage. This means that EL3 always executes with mitigation
applied.

For Cortex A76, if the PE implements SSBS, the existing mitigation (by
using a different vector table, and tweaking CPU ACTLR2) is not used.

Change-Id: Ib0386c5714184144d4747951751c2fc6ba4242b6
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
5 years agoMerge pull request #1704 from marex/arm/master/memsize-passing-v1
Antonio Niño Díaz [Mon, 10 Dec 2018 14:18:23 +0000 (15:18 +0100)]
Merge pull request #1704 from marex/arm/master/memsize-passing-v1

Arm/master/memsize passing v1

5 years agoMerge pull request #1700 from jwerner-chromium/JW_crashfix
Soby Mathew [Mon, 10 Dec 2018 14:00:01 +0000 (14:00 +0000)]
Merge pull request #1700 from jwerner-chromium/JW_crashfix

MULTI_CONSOLE_API fixes and cleanups

5 years agomaintainers: Add Julius Werner for coreboot and console API
Julius Werner [Wed, 28 Nov 2018 22:00:33 +0000 (14:00 -0800)]
maintainers: Add Julius Werner for coreboot and console API

I wrote most of this code and have a vested interest in keeping it
healthy, so adding myself as a maintainer.

Change-Id: I0edeebbc8336b6976dfaf393b3cfc7bc94089ac6
Signed-off-by: Julius Werner <jwerner@chromium.org>
5 years agodrivers/console: Reimplement MUTLI_CONSOLE_API framework in C
Julius Werner [Wed, 28 Nov 2018 06:10:56 +0000 (22:10 -0800)]
drivers/console: Reimplement MUTLI_CONSOLE_API framework in C

Now that we have switched to using the stack in MULTI_CONSOLE_API
framework functions and have factored all code involved in crash
reporting out into a separate file, there's really no reason to keep the
main framework code in assembly anymore. This patch rewrites it in C
which allows us to have a single implementation across aarch32/64 and
should be much easier to maintain going forward.

Change-Id: I6c85a01e89a79e8b233f3f8bee812f0dbd026221
Signed-off-by: Julius Werner <jwerner@chromium.org>
5 years agodrivers/console: Link console framework code by default
Julius Werner [Wed, 28 Nov 2018 01:50:28 +0000 (17:50 -0800)]
drivers/console: Link console framework code by default

This patch makes the build system link the console framework code by
default, like it already does with other common libraries (e.g. cache
helpers). This should not make a difference in practice since TF is
linked with --gc-sections, so the linker will garbage collect all
functions and data that are not referenced by any other code. Thus, if a
platform doesn't want to include console code for size reasons and
doesn't make any references to console functions, the code will not be
included in the final binary.

To avoid compatibility issues with older platform ports, only make this
change for the MULTI_CONSOLE_API.

Change-Id: I153a9dbe680d57aadb860d1c829759ba701130d3
Signed-off-by: Julius Werner <jwerner@chromium.org>
5 years agoconsole: Fix console_unregister() signature
Julius Werner [Tue, 4 Dec 2018 01:01:30 +0000 (17:01 -0800)]
console: Fix console_unregister() signature

console_unregister() has always returned a pointer to the console that
was removed on success, not just an integer. Fix the C prototype to
match the assembly implementation.

Change-Id: Iafc43de0767a5c87c9ae5c3aba53761dd28d51e6
Signed-off-by: Julius Werner <jwerner@chromium.org>
5 years agoplat/common/crash_console_helpers.S: Fix MULTI_CONSOLE_API support
Julius Werner [Mon, 19 Nov 2018 22:25:55 +0000 (14:25 -0800)]
plat/common/crash_console_helpers.S: Fix MULTI_CONSOLE_API support

Crash reporting via the default consoles registered by MULTI_CONSOLE_API
has been broken since commit d35cc34 (Console: Use callee-saved
registers), which was introduced to allow console drivers written in C.
It's not really possible with the current crash reporting framework to
support console drivers in C, however we should make sure that the
existing assembly drivers that do support crash reporting continue to
work through the MULTI_CONSOLE_API.

This patch fixes the problem by creating custom console_putc() and
console_flush() implementations for the crash reporting case that do not
use the stack. Platforms that want to use this feature will have to link
plat/common/aarch64/crash_console_helpers.S explicitly.

Also update the documentation to better reflect the new reality (of this
being an option rather than the expected default for most platforms).

Change-Id: Id0c761e5e2fddaf25c277bc7b8ab603946ca73cb
Signed-off-by: Julius Werner <jwerner@chromium.org>
5 years agoplat/common: Remove duplication of plat_crash_console functions/stubs
Julius Werner [Tue, 20 Nov 2018 21:02:27 +0000 (13:02 -0800)]
plat/common: Remove duplication of plat_crash_console functions/stubs

Commit e74afb652 (Deprecate weak crash console functions) deprecated the
default inclusion of weak definitions for plat_crash_console functions
in plat/common/aarch64/platform_helpers.S. The code was later copied out
to plat/common/aarch64/crash_console_helpers.S so platforms can link it
explicitly if they want to. However, since deprecation does not mean
removal, the same code is also still duplicated in platform_helpers.S.

The duplicated code contains both empty stubs for the !MULTI_CONSOLE_API
case, and a real implementation that used to work but was broken by
commit d35cc34 (Console: Use callee-saved registers) for
MULTI_CONSOLE_API. It's not great to have both of these duplicated in
two files, so this patch splits them up: in platform_helpers.S we'll
only keep the empty stubs (guarded by !ERROR_DEPRECATED), which should
not regress functionality since the MULTI_CONSOLE_API implementation was
already broken anyway. In crash_console_helpers.S, we'll only keep the
MULTI_CONSOLE_API version, which is enough both as an implementation in
itself and as a sample for how to reimplement these functions in a
platform-specific file.

Change-Id: I83d95a90ab6aac597dc2ea2f2797ac2c8ed075d4
Signed-off-by: Julius Werner <jwerner@chromium.org>
5 years agoMerge pull request #1713 from chandnich/nt-fw-config
Soby Mathew [Thu, 6 Dec 2018 15:07:44 +0000 (15:07 +0000)]
Merge pull request #1713 from chandnich/nt-fw-config

plat/arm/sgi: Use NT_FW_CONFIG instead of HW_CONFIG

5 years agoMerge pull request #1710 from soby-mathew/sm/smc_save_x0_x3
Soby Mathew [Thu, 6 Dec 2018 11:13:38 +0000 (11:13 +0000)]
Merge pull request #1710 from soby-mathew/sm/smc_save_x0_x3

BL31: Use helper function to save registers in SMC handler

5 years agoMerge pull request #1709 from joannafarley-arm/jf/copyrights-updates
Antonio Niño Díaz [Thu, 6 Dec 2018 10:29:29 +0000 (11:29 +0100)]
Merge pull request #1709 from joannafarley-arm/jf/copyrights-updates

Change copyright guidelines

5 years agoMerge pull request #1706 from Yann-lms/mmc_init_check
Antonio Niño Díaz [Thu, 6 Dec 2018 10:28:53 +0000 (11:28 +0100)]
Merge pull request #1706 from Yann-lms/mmc_init_check

MMC init check and STM32MP1 MMC driver improvements

5 years agoplat/arm/sgi: Add board support for SGI-Clark.Helios platform
Chandni Cherukuri [Thu, 16 Aug 2018 08:13:23 +0000 (13:43 +0530)]
plat/arm/sgi: Add board support for SGI-Clark.Helios platform

SGI-Clark.Helios platform is similar to SGI-Clark.Ares platform.
The difference between these two platforms is the CPU type and
the number of CPUs. Add the base support for SGI-Clark.Helios platform.

Change-Id: I2b04cb3fb953907848b4fab016e3648899ca4256
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
5 years agoplat/arm/sgi: override 'plat_psci_ops_t' for SGI-Clark.Helios platform
Chandni Cherukuri [Thu, 22 Nov 2018 04:45:25 +0000 (10:15 +0530)]
plat/arm/sgi: override 'plat_psci_ops_t' for SGI-Clark.Helios platform

For SGI-Clark.Helios platform, at present, only the CPU power ON/OFF
ops are supported. So override the PSCI ops to allow callbacks only
for CPU power ON/OFF operations.

Change-Id: Idc0a3deb78cb850310cbe849d77604fa9881579c
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
5 years agoplat/arm/sgi: add platform support for SGI-Clark.Helios platform
Chandni Cherukuri [Tue, 16 Oct 2018 08:45:31 +0000 (14:15 +0530)]
plat/arm/sgi: add platform support for SGI-Clark.Helios platform

SGI-Clark.Helios platform is based on multi-threaded CPUs and uses an
additional thread power domain level as well.

Define a power domain tree descriptor 'sgi_clark_helios_pd_tree_desc'
for SGI-Clark.Helios platform and let the function
'plat_get_power_domain_tree_desc' pick up the correct power
domain tree descriptor based on the platform.

Change-Id: Ibc6d551b570bc740053316a3608c455679d9155b
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
5 years agoplat: rcar: Generate FCNL reserved memory node
Marek Vasut [Thu, 11 Oct 2018 14:53:58 +0000 (16:53 +0200)]
plat: rcar: Generate FCNL reserved memory node

Generate a /reserved-memory node for FCNL in the DT passed to
subsequent stages, so they will know how the FCNL is configured.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
5 years agoplat: rcar: Generate platform compatible string
Marek Vasut [Thu, 11 Oct 2018 14:15:41 +0000 (16:15 +0200)]
plat: rcar: Generate platform compatible string

Generate /compatible string for the platform, so that the subsequent
stages know which platform they are running on. This could be useful
when ie. building U-Boot that contains DTs for multiple platforms and
can thus decide on which platform it is running. This would ultimately
allow single bootloader binary for all Gen3 platforms.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
5 years agoplat: rcar: Pass DTB with DRAM layout from BL2 to next stages
Marek Vasut [Tue, 2 Oct 2018 18:45:18 +0000 (20:45 +0200)]
plat: rcar: Pass DTB with DRAM layout from BL2 to next stages

Pass DTB containing DRAM layout from BL2 to BL33 via register x3, so
that the BL33 can simply consume it and get accurate DRAM layout info.
BL33 is in most usecases U-Boot.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
5 years agoplat: rcar: Use array in the DRAM size reporting
Marek Vasut [Tue, 2 Oct 2018 18:43:09 +0000 (20:43 +0200)]
plat: rcar: Use array in the DRAM size reporting

Use array of start-size tuples for the DRAM banks and call single
function which iterates over this array to report the DRAM info.
This is in preparation for expanding this to generate FDT for the
next stage.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
5 years agoplat: rcar: Print DRAM configuration after init
Marek Vasut [Tue, 2 Oct 2018 13:12:15 +0000 (15:12 +0200)]
plat: rcar: Print DRAM configuration after init

Print the DRAM configuration only after the DRAM was initialized. This
will be useful when deduplicating code populating FDT passed to U-Boot,
since it will contain the same macros as bl2_advertise_dram_size().

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
5 years agoplat: rcar: Fill in memory information for M3W, M3N
Marek Vasut [Tue, 2 Oct 2018 13:09:04 +0000 (15:09 +0200)]
plat: rcar: Fill in memory information for M3W, M3N

Make the DRAM configuration debug print consistent for all supported SoCs.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
5 years agoplat: rcar: Drop H3 v3.0 check on DRAM debug print
Marek Vasut [Tue, 2 Oct 2018 12:53:27 +0000 (14:53 +0200)]
plat: rcar: Drop H3 v3.0 check on DRAM debug print

There is nothing preventing H3 older than v3.0 from printing the
DRAM configuration, just like v3.0 and newer. Drop the check and
let all H3 revisions print DRAM configuration in BL2.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
5 years agoplat: rcar: Add E3 1GBx4 debug print
Marek Vasut [Tue, 2 Oct 2018 11:51:19 +0000 (13:51 +0200)]
plat: rcar: Add E3 1GBx4 debug print

RCAR_DRAM_DDR3L_MEMCONF = 2 means E3 with 1GBx4 memory configuration.
Add debug print for this configuration for completeness sake.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
5 years agoplat: rcar: Move DRAM layout print to separate function
Marek Vasut [Tue, 2 Oct 2018 11:33:32 +0000 (13:33 +0200)]
plat: rcar: Move DRAM layout print to separate function

Just move the DRAM layout information into separate function,
no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
5 years agoplat/arm/sgi: Use NT_FW_CONFIG instead of HW_CONFIG
Chandni Cherukuri [Wed, 28 Nov 2018 05:56:19 +0000 (11:26 +0530)]
plat/arm/sgi: Use NT_FW_CONFIG instead of HW_CONFIG

With the two new APIs 'plat_arm_sgi_get_platform_id' and
'plat_arm_sgi_get_config_id' that are available now, BL31 need not
depend on hw_config device tree to identify the platform. In addition
to this, the existing hardware description in hw_config can be limited
to use by BL33 and not by the operating system.

So the hardware description from hw_config dts can be moved into
nt_fw_config dts and the use of hw_config dts can be removed.

Change-Id: I873b7e1e72823d3ec5d253a848e85ae724f09e49
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
5 years agoMerge pull request #1711 from antonio-nino-diaz-arm/an/fix-imx
Antonio Niño Díaz [Wed, 5 Dec 2018 11:24:01 +0000 (12:24 +0100)]
Merge pull request #1711 from antonio-nino-diaz-arm/an/fix-imx

tzc380: Fix some asserts

5 years agotzc380: Fix some asserts
Antonio Nino Diaz [Wed, 5 Dec 2018 11:01:17 +0000 (11:01 +0000)]
tzc380: Fix some asserts

This driver can be compiled in release builds, but GCC generates warnings
for some comparisons and that prevents the firmware from being built in
debug builds.

Change-Id: Ic52e1b4a11896ecf086864fbe2b5bfc143ec9b1b
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
5 years agoBL31: Use helper function to save registers in SMC handler
Soby Mathew [Fri, 16 Nov 2018 15:43:34 +0000 (15:43 +0000)]
BL31: Use helper function to save registers in SMC handler

Use the helper function `save_gp_registers` to save the register
state to cpu_context on entry to EL3 in SMC handler. This has the
effect of saving x0 - x3 as well into the cpu_context which was
not done previously but it unifies the register save sequence
in BL31.

Change-Id: I5753c942263a5f9178deda3dba896e3220f3dd83
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
5 years agoMerge pull request #1653 from JackyBai/master
Antonio Niño Díaz [Wed, 5 Dec 2018 10:22:55 +0000 (11:22 +0100)]
Merge pull request #1653 from JackyBai/master

Add NXP i.MX8MQ basic support

5 years agoChange copyright guidelines
Joanna Farley [Tue, 13 Nov 2018 10:52:12 +0000 (10:52 +0000)]
Change copyright guidelines

Copyright guidance has been changed for migration of the
ARM run project to trustedfirmware.org where the project
governance is different.

Change-Id: I059177453fb357843eced93c2a55b3705a379683
Signed-off-by: Joanna Farley <joanna.farley@arm.com>
5 years agoplat: imx: Add i.MX8MQ basic support
Bai Ping [Sat, 27 Oct 2018 16:12:34 +0000 (00:12 +0800)]
plat: imx: Add i.MX8MQ basic support

i.MX8MQ is new SOC of NXP's i.MX8M family based on
A53. It can provide industry-leading audio, voice
and video processing for applications that scale
from consumer home audio to industrial building
automation and mobile computers

this patchset add the basic supoort to boot up
the 4 X A53. more feature will be added later.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
5 years agoMerge pull request #1703 from oscardagrach/hikey960-dmac-fix
Antonio Niño Díaz [Tue, 4 Dec 2018 16:19:50 +0000 (17:19 +0100)]
Merge pull request #1703 from oscardagrach/hikey960-dmac-fix

hikey960: initialize EDMAC and channels

5 years agoMerge pull request #1705 from chandnich/platform-id
Antonio Nino Diaz [Tue, 4 Dec 2018 14:04:52 +0000 (14:04 +0000)]
Merge pull request #1705 from chandnich/platform-id

plat/arm/sgi: Use platform specific functions to get platform ids

5 years agoMerge pull request #1702 from MISL-EBU-System-SW/patches-18.12
Antonio Niño Díaz [Tue, 4 Dec 2018 14:01:48 +0000 (15:01 +0100)]
Merge pull request #1702 from MISL-EBU-System-SW/patches-18.12

Update code with latest changes from Marvell LSP 18.12

5 years agoplat/marvell: update platform LSP version to 18.12.0
Konstantin Porotchkin [Thu, 29 Nov 2018 13:04:10 +0000 (15:04 +0200)]
plat/marvell: update platform LSP version to 18.12.0

Sync the platform code version with current Marvell LSP.

Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
5 years agoa8k: pm: extend MSS_TRIGGER_TIMEOUT
Igal Liberman [Mon, 3 Sep 2018 07:40:21 +0000 (10:40 +0300)]
a8k: pm: extend MSS_TRIGGER_TIMEOUT

Very rarely, during cpuidle operations the following error
is seen: "PM MSG Trigger Timeout".
This is caused by slow handling of message interrutps
in the PM FW running on CM3 (under heavy PM operation load).

This is not a real issue, so we extend the timeout to
avoid the error prints.

Change-Id: I92fd6f2ff1ddf208b216c123880ded28a00b6e0e
Signed-off-by: Igal Liberman <igall@marvell.com>
Reviewed-on: http://vgitil04.il.marvell.com:8080/59670
Reviewed-by: Kostya Porotchkin <kostap@marvell.com>
Tested-by: iSoC Platform CI <ykjenk@marvell.com>
5 years agoplat/marvell: comphy: Add support for SFI on Lane 4
Konstantin Porotchkin [Sun, 21 Oct 2018 13:48:33 +0000 (16:48 +0300)]
plat/marvell: comphy: Add support for SFI on Lane 4

Add static configuration for SFI+ 10Gbps interface on SERDES
Lane 4.
This is just a copy of Lane 2 static values, not optimized.
Board-to-board iperf test shows up to 6Gbps transfer speed.

Change-Id: I024d2ac132f7fa6c342a64367f3dca2123a27e97
Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
Reviewed-by: Igal Liberman <igall@marvell.com>
5 years agodoc: marvell: Update build manual with new memory layouts
Konstantin Porotchkin [Sun, 25 Nov 2018 14:18:06 +0000 (16:18 +0200)]
doc: marvell: Update build manual with new memory layouts

Add description for memory layouts used by EspressoBin v7 (DDR4)

Change-Id: I199d8b52580b26e560f14b503a6e99d32de4f284
Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
Reviewed-on: http://vgitil04.il.marvell.com:8080/61279
Reviewed-by: Stefan Chulski <stefanc@marvell.com>
Tested-by: iSoC Platform CI <ykjenk@marvell.com>
5 years agofix: a3900: pm: fix number of CPU power switches.
Christine Gharzuzi [Wed, 25 Jul 2018 13:06:10 +0000 (16:06 +0300)]
fix: a3900: pm: fix number of CPU power switches.

- Number of open power switches for CPUs should be three
  and now two.

- This patch updates the value of open power switches from
  0xfd (two power-switches) to 0xfc (three power-switches).

Change-Id: I2783ab7f04bbbb6da78eeedcabe4636f9a774512
Signed-off-by: Christine Gharzuzi <chrisg@marvell.com>
Reviewed-by: Kostya Porotchkin <kostap@marvell.com>
5 years agosvc: Update the EEPROM AVS values processing
Konstantin Porotchkin [Tue, 6 Nov 2018 10:25:38 +0000 (12:25 +0200)]
svc: Update the EEPROM AVS values processing

Add support for SVC test builds for tuning AVS values.
Update the SVC procedure and add EEPROM access.
Add support for AP807 AVS values (10 bits wide).

Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
5 years agoble: ap807: Switch to PLL mode and update CPU frequency
Christine Gharzuzi [Mon, 25 Jun 2018 10:39:37 +0000 (13:39 +0300)]
ble: ap807: Switch to PLL mode and update CPU frequency

- Update CPU frequency on AP807 to 2GHz for SAR 0x0.
- Increase AVS to 0.88V for 2GHz clock

Change-Id: Ic945b682ab2f8543e34294bfc56c3eae2c5e0c8e
Signed-off-by: Christine Gharzuzi <chrisg@marvell.com>
Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
5 years agomvebu: cp110: avoid pcie power on/off sequence when called from Linux
Igal Liberman [Thu, 15 Nov 2018 14:13:11 +0000 (16:13 +0200)]
mvebu: cp110: avoid pcie power on/off sequence when called from Linux

In Armada 8K DB boards, PCIe initialization can be executed only once
because PCIe reset performed during chip power on and it cannot be
executed via GPIO later.
This means that power on can be executed only once, when it's called
from the bootloader.
Power on:
Read bit 21 of the mode, it marks if the caller is
the bootloader or the Linux Kernel.
Power off:
Check if the comphy was already configured to PCIe, if yes,
check if the caller is bootloader, if both conditions are true
(PCIe mode and called by Linux) - skip the power-off.

In addition, fix incorrect documentation describing mode fields -
PCIe width is 3 bits, not 2.

NOTE: with this patch, please use LK4.14.76 (LK4.4.120 may not work
with it).

Change-Id: I4b929011f97a0a1869a51ba378687e78b3eca4ff
Signed-off-by: Igal Liberman <igall@marvell.com>
Reviewed-by: Grzegorz Jaszczyk <jaz@semihalf.com>
Reviewed-by: Kostya Porotchkin <kostap@marvell.com>
5 years agoplat: marvell: a3700: do not power off cpu due to errata ref #13
Grzegorz Jaszczyk [Wed, 14 Nov 2018 17:47:35 +0000 (18:47 +0100)]
plat: marvell: a3700: do not power off cpu due to errata ref #13

Do not power off the CPU1 since there is no way to wake it up
(wake-up is causing CPU0 reset as well duo to HW bug). Quote from errata
Ref #13 [In power saving mode, both cores must be powered off]:
"When Core 0 is on and Core 1 is in power-off state, a Core 1
wake-up resets Core 0 as well and puts Core 0 back to ROM".

To overcome described HW bug instead of powering the CPU off, let it
reach WFI instruction, which is invoked by generic psci_do_cpu_off
function after platform handler finishes. This will put the core in low
power state and give a chance to wake it up.

Before this change, after running secondary kernel via kexec, only one
core was up, now both cores are up.

Change-Id: I87f144867550728055d9b8a2edb84a14539acab7
Signed-off-by: Grzegorz Jaszczyk <jaz@semihalf.com>
Reviewed-by: Kostya Porotchkin <kostap@marvell.com>
5 years agomvebu: cp110: fix phy selector configuration for XFI1
Grzegorz Jaszczyk [Fri, 19 Oct 2018 13:30:02 +0000 (15:30 +0200)]
mvebu: cp110: fix phy selector configuration for XFI1

Extended phy selector configuration about XFI1 mode.

Change-Id: I1309770bbb5fdbfb0127b6f12ee78974d1d6b19f
Signed-off-by: Grzegorz Jaszczyk <jaz@semihalf.com>
Reviewed-by: Kostya Porotchkin <kostap@marvell.com>
5 years agodrivers: add tzc380 support
Peng Fan [Wed, 5 Jul 2017 08:34:37 +0000 (16:34 +0800)]
drivers: add tzc380 support

Add tzc380 support.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Bai Ping <ping.bai@nxp.com>
5 years agodrivers: st: mmc: improve error cases in send_cmd function
Yann Gautier [Fri, 30 Nov 2018 14:22:11 +0000 (15:22 +0100)]
drivers: st: mmc: improve error cases in send_cmd function

Signed-off-by: Yann Gautier <yann.gautier@st.com>
5 years agostm32mp: check stm32_sdmmc2_mmc_init return
Yann Gautier [Thu, 29 Nov 2018 14:44:04 +0000 (15:44 +0100)]
stm32mp: check stm32_sdmmc2_mmc_init return

Signed-off-by: Yann Gautier <yann.gautier@st.com>
5 years agodrivers: mmc: check mmc_reset_to_idle return
Yann Gautier [Thu, 29 Nov 2018 14:43:37 +0000 (15:43 +0100)]
drivers: mmc: check mmc_reset_to_idle return

Signed-off-by: Yann Gautier <yann.gautier@st.com>
5 years agoMerge pull request #1699 from chandnich/sgi-mt-support
Soby Mathew [Mon, 3 Dec 2018 13:29:33 +0000 (13:29 +0000)]
Merge pull request #1699 from chandnich/sgi-mt-support

Add support to implement multi-threaded platforms for SGI

5 years agoplat/arm/sgi: Use platform specific functions to get platform ids
Chandni Cherukuri [Wed, 28 Nov 2018 06:01:51 +0000 (11:31 +0530)]
plat/arm/sgi: Use platform specific functions to get platform ids

Add two new functions 'plat_arm_sgi_get_platform_id' and
'plat_arm_sgi_get_config_id' which will be implemented by all the
SGI platforms. These functions can be used to determine the part
number and configuration id of the SGI platforms.

In BL2, these functions are used to populate the 'system-id' node.
In BL31, these functions are used to populate the 'sgi_plat_info_t'
structure with the part number and configuration id of the platform.

Change-Id: I3bacda933527724a3b4074ad4ed5b53a81ea4689
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
5 years agoMerge pull request #1701 from chandnich/psci-ops
Soby Mathew [Fri, 30 Nov 2018 16:25:27 +0000 (16:25 +0000)]
Merge pull request #1701 from chandnich/psci-ops

remove weak implemention of 'plat_arm_psci_override_pm_ops'

5 years agohikey960: initialize EDMAC and channels
Ryan Grachek [Thu, 29 Nov 2018 18:45:55 +0000 (12:45 -0600)]
hikey960: initialize EDMAC and channels

This is needed to utilize the DMA controller on the hikey960

Signed-off-by: Ryan Grachek <ryan@edited.us>
5 years agoMerge pull request #1688 from JoelHutton/jh/variant_1_mitigations
Antonio Niño Díaz [Thu, 29 Nov 2018 15:05:50 +0000 (16:05 +0100)]
Merge pull request #1688 from JoelHutton/jh/variant_1_mitigations

Initial Spectre V1 mitigations (CVE-2017-5753).

5 years agoMerge pull request #1698 from hzhuang1/rm_emmc_delay
Antonio Niño Díaz [Thu, 29 Nov 2018 15:05:17 +0000 (16:05 +0100)]
Merge pull request #1698 from hzhuang1/rm_emmc_delay

Rm emmc delay

5 years agoMerge pull request #1679 from pangupta/master
Antonio Niño Díaz [Thu, 29 Nov 2018 15:05:05 +0000 (16:05 +0100)]
Merge pull request #1679 from pangupta/master

ccn: Introduce API to set and read value of node register

5 years agoplat/arm: remove weak implemention of 'plat_arm_psci_override_pm_ops' function
Chandni Cherukuri [Wed, 14 Nov 2018 08:13:59 +0000 (13:43 +0530)]
plat/arm: remove weak implemention of 'plat_arm_psci_override_pm_ops' function

In order to allow Arm platforms to override the default list of PSCI
callbacks, remove the existing weak implementation of
'plat_arm_psci_override_pm_ops' function and let all the Arm platforms
implement their own 'plat_arm_psci_override_pm_ops' function.

For platforms that support SCMI protocol, the function
'css_scmi_override_pm_ops' can be additionally used as well to
override the default PSCI callbacks.

Change-Id: If7c27468bd51a00ea9c2a3716b5894163f5a9f3c
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
5 years agoMerge pull request #1693 from jeenu-arm/ehf-doc
Antonio Niño Díaz [Wed, 28 Nov 2018 10:55:53 +0000 (11:55 +0100)]
Merge pull request #1693 from jeenu-arm/ehf-doc

EHF and RAS documentation

6 years agoMerge pull request #1696 from satheesbalya-arm/sb1/sb1_2406_romlib_juno
Antonio Niño Díaz [Tue, 27 Nov 2018 08:06:15 +0000 (09:06 +0100)]
Merge pull request #1696 from satheesbalya-arm/sb1/sb1_2406_romlib_juno

romlib: Add juno support for romlib

6 years agoMerge pull request #1695 from satheesbalya-arm/sb1/sb1_2641_romlib_phase2
Antonio Niño Díaz [Tue, 27 Nov 2018 08:05:50 +0000 (09:05 +0100)]
Merge pull request #1695 from satheesbalya-arm/sb1/sb1_2641_romlib_phase2

romlib: Allow patching of romlib functions

6 years agoplat/arm/sgi: allow value of PLAT_MAX_PWR_LVL to be platform specific
Chandni Cherukuri [Tue, 16 Oct 2018 08:41:34 +0000 (14:11 +0530)]
plat/arm/sgi: allow value of PLAT_MAX_PWR_LVL to be platform specific

For platforms with multi-threaded CPUs, the number of power domains
supported would be more than the value currently defined by
PLAT_MAX_PWR_LVL. So move the PLAT_MAX_PWR_LVL macro to platform
specific code and let the platform define the number of power domain
levels.

Change-Id: I21c0682e62b397860b2999031a0c9c5ce0d28eed
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
6 years agoplat/arm/sgi: override weak implementation of plat_arm_get_cpu_pe_count
Chandni Cherukuri [Thu, 16 Aug 2018 08:15:17 +0000 (13:45 +0530)]
plat/arm/sgi: override weak implementation of plat_arm_get_cpu_pe_count

To support platforms which are based on multi-threaded CPUs, override
the weak implementation of plat_arm_get_cpu_pe_count function to return
the number of threads supported by the CPU used in the platform.

Change-Id: Ia680773f1277b17e2d3d2414d87943dcece33e89
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
6 years agoplat/arm/common: add an additional platform power level
Chandni Cherukuri [Tue, 16 Oct 2018 09:12:19 +0000 (14:42 +0530)]
plat/arm/common: add an additional platform power level

For platforms using multi-threaded CPUs, there can be upto four
platform power domain levels. At present, there are three platform
power domain levels that are defined for the CSS platforms. Define a
fourth level 'ARM_PWR_LVL3' as well to provide support for an
additional platform power domain level.

Change-Id: I40cc17a10f4690a560776f504364fd7277a7e72a
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
6 years agoplat/css: allow platforms to define the system power domain level
Chandni Cherukuri [Tue, 16 Oct 2018 09:49:54 +0000 (15:19 +0530)]
plat/css: allow platforms to define the system power domain level

The CSS_SYSTEM_PWR_DMN_LVL macro that defines the system power domain
level is fixed at ARM_PWR_LVL2 for all CSS platforms. However, the
system power domain level can be different for CSS platforms that
use multi-threaded CPUs.

So, in preparation towards adding support for platforms that use
multi-threaded CPUs, refactor the definition of CSS_SYSTEM_PWR_DMN_LVL
such that CSS_SYSTEM_PWR_DMN_LVL is uniquely defined for each of the
CSS platform.

Change-Id: Ia837b13f6865e71da01780993c048b45b7f36d85
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
6 years agodocs: Add RAS framework documentation
Jeenu Viswambharan [Fri, 12 Oct 2018 07:48:36 +0000 (08:48 +0100)]
docs: Add RAS framework documentation

Change-Id: Ibf2b21b12ebc0af5815fc6643532a3be9100bf02
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
6 years agoInitial Spectre V1 mitigations (CVE-2017-5753).
Joel Hutton [Tue, 9 Oct 2018 13:08:42 +0000 (14:08 +0100)]
Initial Spectre V1 mitigations (CVE-2017-5753).

Initial Spectre Variant 1 mitigations (CVE-2017-5753).
A potential speculative data leak was found in PSCI code, this depends
on a non-robust implementation of the `plat_get_core_pos_by_mpidr()`
function. This is considered very low-risk. This patch adds a macro to
mitigate this. Note not all code paths could be analyzed with current
tools.

Add a macro which makes a variable 'speculation safe', using the
 __builtin_speculation_safe_value function of GCC and llvm. This will be
available in GCC 9, and is planned for llvm, but is not currently in
mainline GCC or llvm. In order to implement this mitigation the compiler
must support this builtin. Support is indicated by the
__HAVE_SPECULATION_SAFE_VALUE flag.

The -mtrack-speculation option maintains a 'tracker' register, which
determines if the processor is in false speculation at any point. This
adds instructions and increases code size, but avoids the performance
impact of a hard barrier.

Without the -mtrack-speculation option, __builtin_speculation_safe_value
expands to a

    ISB
    DSB SY

sequence after a conditional branch, before the
speculation safe variable is used. With -mtrack-speculation a

    CSEL tracker, tracker, XZR, [cond];
    AND safeval,tracker;
    CSDB

sequence is added instead, clearing the vulnerable variable by
AND'ing it with the tracker register, which is zero during speculative
execution. [cond] are the status flags which will only be true during
speculative execution. For more information on
__builtin_speculation_safe_value and the -mtrack-speculation option see
https://developer.arm.com/support/arm-security-updates/speculative-processor-vulnerability/compiler-support-for-mitigations

The -mtracking option was not added, as the performance impact of the
mitigation is low, and there is only one occurence.

Change-Id: Ic9e66d1f4a5155e42e3e4055594974c230bfba3c
Signed-off-by: Joel Hutton <Joel.Hutton@Arm.com>
6 years agodocs: Add Exception Handling Framework documentation
Jeenu Viswambharan [Wed, 18 Oct 2017 13:30:53 +0000 (14:30 +0100)]
docs: Add Exception Handling Framework documentation

Change-Id: I77d38758d18ba6dda1652b1b1e644fbfb14386cc
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
6 years agoSDEI: Unconditionally resume Secure if it was interrupted
Jeenu Viswambharan [Thu, 11 Oct 2018 08:50:26 +0000 (09:50 +0100)]
SDEI: Unconditionally resume Secure if it was interrupted

Secure world execution nearly always expect a controlled exit to
Non-secure world. SDEI interrupts, although targets EL3, occur on behalf
of Non-secure world, and may have higher priority than Secure world
interrupts. Therefore they might preempt Secure execution, and yield
execution to Non-secure SDEI handler. Upon completion of SDEI event
handling (regardless of whether it's COPLETE or COMPLETE_AND_RESUME), we
must resume Secure execution if it was preempted.

Change-Id: I6edd991032588588427ba2fe6c3d7668f7080e3d
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
6 years agoMerge pull request #1697 from antonio-nino-diaz-arm/an/arch
Antonio Niño Díaz [Mon, 26 Nov 2018 10:51:57 +0000 (11:51 +0100)]
Merge pull request #1697 from antonio-nino-diaz-arm/an/arch

Synchronise arch.h and arch_helpers.h with TF-A-Tests

6 years agoSynchronise arch.h and arch_helpers.h with TF-A-Tests
Antonio Nino Diaz [Thu, 22 Nov 2018 15:53:17 +0000 (15:53 +0000)]
Synchronise arch.h and arch_helpers.h with TF-A-Tests

The headers forked at some point in the past and have diverged a lot. In
order to make it easier to share code between TF-A-Tests and TF-A, this
patch synchronises most of the definitions in the mentioned headers.

This is not a complete sync, it has to be followed by more cleanup.

This patch also removes the read helpers for the AArch32 instructions
ats1cpr and ats1hr (they are write-only).

Change-Id: Id13ecd7aeb83bd2318cd47156d71a42f1c9f6ba2
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agohikey: remove delay after eMMC initialized
Haojian Zhuang [Wed, 21 Nov 2018 01:23:20 +0000 (09:23 +0800)]
hikey: remove delay after eMMC initialized

commit 386b14bf64124ebf0368eab33ef07603e0c3138a
Author: Haojian Zhuang <haojian.zhuang@linaro.org>
Date:   Wed Nov 21 09:19:49 2018 +0800

    mmc: poll eMMC status after EXT_CSD command

    EXT_CSD command needs to access data from eMMC device. Add the
    operation of polling eMMC device status. Make sure the command is
    finished.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
A hacked delay time can't fit each eMMC device. Since the above commit
enables the polling operation, remove the hacked delay time now.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
6 years agommc: poll eMMC status after EXT_CSD command
Haojian Zhuang [Wed, 21 Nov 2018 01:19:49 +0000 (09:19 +0800)]
mmc: poll eMMC status after EXT_CSD command

EXT_CSD command needs to access data from eMMC device. Add the
operation of polling eMMC device status. Make sure the command is
finished.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>