Commit Graph

2123 Commits

Author SHA1 Message Date
Masahiro Yamada bb41eb7a9d cert: move platform_oid.h to include/tools_share for all platforms
Platforms aligned with TBBR are supposed to use their own OIDs, but
defining the same macros with different OIDs does not provide any
value (at least technically).

For easier use of TBBR, this commit allows platforms to reuse the OIDs
obtained by ARM Ltd.  This will be useful for non-ARM vendors that
do not need their own extension fields in their certificate files.

The OIDs of ARM Ltd. have been moved to include/tools_share/tbbr_oid.h

Platforms can include <tbbr_oid.h> instead of <platform_oid.h> by
defining USE_TBBR_DEFS as 1.  USE_TBBR_DEFS is 0 by default to keep the
backward compatibility.

For clarification, I inserted a blank line between headers from the
include/ directory (#include <...>) and ones from a local directory
(#include "..." ).

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-05-24 00:08:35 +09:00
Masahiro Yamada 2a6c1a8f9a fip: move headers shared between TF and fiptool to include/tools_share
Some header files need to be shared between TF and host programs.
For fiptool, two headers are copied to the tools/fiptool directory,
but it looks clumsy.

This commit introduces a new directory, include/tools_share, which
collects headers that should be shared between TF and host programs.

This will clarify the interface exposed to host tools.  We should
add new headers to this directory only when we really need to do so.

For clarification, I inserted a blank line between headers from the
include/ directory (#include <...>) and ones from a local directory
(#include "..." ).

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-05-23 23:58:47 +09:00
Masahiro Yamada be4cd40e8b Build: fix assert_boolean implementation
The current assert_boolean does not work with variables assigned with
'=' flavor instead of ':='.

For example,

 FOO = $(BAR)
 BAR := 1

Here, $(value FOO) is evaluated to $(BAR), not 1.  This is not what
we expect.  While I am here, I simplified the implementation.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-05-23 23:57:49 +09:00
davidcunado-arm 727a68b8ef Merge pull request #936 from antonio-nino-diaz-arm/an/assert-mem
Simplify assert() to reduce memory usage
2017-05-19 10:54:23 +01:00
danh-arm 4fd4af26cb Merge pull request #942 from soby-mathew/sm/fix_juno_build_err
Juno: Fix AArch32 sp_min build
2017-05-16 18:05:07 +01:00
Soby Mathew bbf4c22da3 Juno: Fix AArch32 sp_min build
The commit abd2aba99e introduced a
regression to the AArch32 sp_min Juno build. This patch fixes that.

Change-Id: I4b141717684d6aee60c761ea17f23170aa6708c3
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2017-05-16 11:22:36 +01:00
danh-arm 093e53f6e7 Merge pull request #937 from rockchip-linux/rk3328_assert
rockchip: rk3328: Add assert check in pmu.c
2017-05-16 11:00:07 +01:00
danh-arm f0019fcca7 Merge pull request #935 from davidcunado-arm/dc/mbed_api
mbedtls: Namespace update for TF specific macros
2017-05-16 10:57:16 +01:00
danh-arm 6cea94510f Merge pull request #934 from sandrine-bailleux-arm/sb/break-headers-circular-dep
Break circular dependency in FVP and Nvidia header files
2017-05-16 10:56:51 +01:00
Antonio Nino Diaz 0da2fe7e29 Simplify assert() to reduce memory usage
The behaviour of assert() now depends on the value of the new optional
platform define `PLAT_LOG_LEVEL_ASSERT`. This defaults to `LOG_LEVEL` if
not defined by the platform.

- If `PLAT_LOG_LEVEL_ASSERT` >= `LOG_LEVEL_VERBOSE`, it prints the file
  name, line and asserted expression.
- If `PLAT_LOG_LEVEL_ASSERT` >= `LOG_LEVEL_INFO`, it prints the file
  name and line.
- If not, it doesn't print anything.

Note the old behaviour was to print the function name whereas now it
prints the file name. This reduces memory usage because the file name is
shared between all assert calls in a given file. Also, the default
behaviour in debug builds is to no longer print the asserted expression,
greatly reducing the string usage.

For FVP debug builds this change saves approximately:

              No TBBR    TBBR
        BL1    1.6 KB   2.2 KB
        BL2    1.7 KB   2.1 KB
        BL31   2.6 KB   3.3 KB

Change-Id: I2947569d593df0b25611dc3c7a6096f42155c115
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2017-05-16 09:58:08 +01:00
tony.xie 6bf14e1d6e rockchip: rk3328: Add assert check in pmu.c
Add assert() check for cpuson_flags[] and cpuson_entry_point[].

Change-Id: I971fe54c2baa3b4514a3979042341220f5e20901
Signed-off-by: tony.xie <tony.xie@rock-chips.com>
2017-05-15 10:36:14 +08:00
davidcunado-arm 823cc7a9d2 Merge pull request #930 from antonio-nino-diaz-arm/an/fixes-xlat-v2
Minor fixes to the xlat tables lib v2
2017-05-12 22:48:34 +01:00
David Cunado 6a0b0d7f86 Migrate ARM platforms to use TF_MBEDTLS_KEY_ALG
A previous patch superseded the MBEDTLS_KEY_ALG. This patch updates
the ARM platforms to use the new TF_MBEDTLS_KEY_ALG define.

Change-Id: Ie0e1bc272e127e879ac58e7cfcbe268751d7688e
Signed-off-by: David Cunado <david.cunado@arm.com>
2017-05-12 14:44:57 +01:00
David Cunado 0aff7ad2bc mbedtls: Complete namespace for TF specific macros
This patch renames MBEDTLS_KEY_ALG to TF_MBEDTLS_KEY_ALG. This
completes the migration of TF specific macros so that they do not
have the MBEDTLS_ suffix (see arm-trusted-firmware#874).

Change-Id: Iad7632477e220b0af987c4db3cf52229fb127d00
Signed-off-by: David Cunado <david.cunado@arm.com>
2017-05-12 14:44:36 +01:00
David Cunado b188351025 mbedtls: Namespace for TF specific macros
An earlier patch (arm-trusted-firmware#874) migrated MBEDTLS_ suffixed
macros to have a TBBR_ suffix to avoid any potential clash with future
mbedtls macros.

But on reflection the TBBR_ suffix could be confusing as the macros
are used to drive TF-specific configuration of mbedtls. As such
this patch migrates these macros from TBBR_suffix to TF_MBEDTLS_
suffix which more accurately conveys their use.

Change-Id: Ic87642b653ceeaa03d62f724976abd5e12e867d4
Signed-off-by: David Cunado <david.cunado@arm.com>
2017-05-12 14:44:35 +01:00
Sandrine Bailleux 24c287be89 Tegra: Break circular dependency in platform header files
For SoCs T132 and T210, the header file 'platform_def.h' used to include
'tegra_def.h' and vice versa. This patch breaks this circular dependency
by making 'tegra_def.h' independent.

Change-Id: I45a00a84e6ab8b93d5e9242a9ff65f03e9102a96
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2017-05-12 09:34:56 +01:00
Sandrine Bailleux 144c3f5e4b FVP: Break circular dependency in platform header files
We used to have the following circular dependency in the FVP platform
header files:

 +-> arm_def.h ---> platform_def.h ---> fvp_def.h --+
 |__________________________________________________|

This patch breaks it by not including 'arm_def.h' from 'fvp_def.h'.

Change-Id: I280d906559e3343dd38764029e77c0ea768b4fec
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2017-05-12 09:34:56 +01:00
davidcunado-arm b4b541cb29 Merge pull request #933 from davidcunado-arm/dc/add_spdx
Add missing SPDX header
2017-05-11 18:26:02 +01:00
David Cunado fa715215e7 Add missing SPDX header
A new file added as part of arm-trusted-firmware#927 was missing the
SPDX license identifier - this patch adds the missing identifier.

Change-Id: Id1355f2bdca930b7e65bb54eff7e6c764ebb0d96
Signed-off-by: David Cunado <david.cunado@arm.com>
2017-05-11 17:31:29 +01:00
davidcunado-arm f67c66311e Merge pull request #928 from davidcunado-arm/dc/update_userguide
Update AEM and Cortex Models versions
2017-05-11 16:05:07 +01:00
davidcunado-arm d6104f5ab4 Merge pull request #927 from jeenu-arm/state-switch
Execution state switch
2017-05-11 16:04:52 +01:00
davidcunado-arm 78b7134927 Merge pull request #932 from dp-arm/dp/spdx-rockchip
Use SPDX license identifiers for remaining files
2017-05-11 10:20:31 +01:00
dp-arm c3e70be1c1 Use SPDX license identifiers for remaining files
Change-Id: I7f54f45db65f32481cc05e1bd2c9c683b756e19a
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
2017-05-10 15:16:34 +01:00
davidcunado-arm a78b73f804 Merge pull request #918 from rockchip-linux/rk3328
rockchip: rk3328: support rk3328
2017-05-10 12:48:38 +01:00
davidcunado-arm cdf972cc7f Merge pull request #931 from antonio-nino-diaz-arm/an/revert-rockchip
Revert "rockchip: Remove unused rockchip_pd_pwr_down_wfi function"
2017-05-10 12:11:22 +01:00
Antonio Nino Diaz 9bb0b3c667 Revert "rockchip: Remove unused rockchip_pd_pwr_down_wfi function"
This reverts commit b6dcbf588a.

This function wasn't used when it was removed, but it is needed to
compile the new changes proposed for Rockchip platforms.

Change-Id: Ia5bfe1f8398e08431f96923e2f059a83e5cb78d4
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2017-05-10 11:00:59 +01:00
tony.xie be2a3127a3 rockchip: rk3328: Add a missing paragraph for copyright notice.
Change-Id: I78c7e304d3070f66e2ca3bf838c76ee6a2ae3430
Signed-off-by: tony.xie <tony.xie@rock-chips.com>
2017-05-10 10:26:08 +08:00
Antonio Nino Diaz e769db3eb8 Minor fixes to the xlat tables lib v2
- Fix some comments.
- Remove duplicated definition.
- Make xlat_arch_get_max_supported_pa() private in aarch64.

Change-Id: I629237209cfb2ce7b0c4bd539d63dd81d45b2edd
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2017-05-09 11:05:05 +01:00
davidcunado-arm 172138b9e0 Merge pull request #926 from EvanLloyd/win_make_4
Minor makefile fixes
2017-05-08 23:32:52 +01:00
davidcunado-arm 07f40001d1 Merge pull request #922 from davidcunado-arm/dc/smc_yielding_spds
Migrate secure payload dispatchers to new SMC terminology
2017-05-08 23:23:36 +01:00
David Cunado b9ecb21676 Update AEM and Cortex Models versions
AEMv8-A Model release v8.4 has been made available and Trusted Firmware
has been tested against these versions as part of its CI system. This
patch updates the user guide documentation to reflect the version of AEM
and Cortex Models that Trusted Firmware has been tested against.

Additionally, ARM FVPs FVP_Base_Cortex-A57x1-A53x1 and
FVP_Base_Cortex-A57x2-A53x4 are removed from the list of tested FVPs
as they are currently not being tested with the latest version of ARM
Trusted Firmware.

Also, documentation and links to Linaro pages have been updated to
reflect the changes in the ARM community document hosting.

Change-Id: Idae97303ce0929c82b137017de84ce94678f6f2b
Signed-off-by: David Cunado <david.cunado@arm.com>
2017-05-05 11:31:13 +01:00
davidcunado-arm 5e62327786 Merge pull request #924 from antonio-nino-diaz-arm/an/fix-xn-bit
Fix execute-never permissions in xlat tables libs
2017-05-05 09:50:34 +01:00
David Cunado bbbbcdaecf Migrate secure payload dispatchers to new SMC terminology
Since Issue B (November 2016) of the SMC Calling Convention document
standard SMC calls are renamed to yielding SMC calls to help avoid
confusion with the standard service SMC range, which remains unchanged.

http://infocenter.arm.com/help/topic/com.arm.doc.den0028b/ARM_DEN0028B_SMC_Calling_Convention.pd

A previous patch introduced a new define for yielding SMC call type.
This patch updates the secure payload dispatchers (except the TSPD) to
use this new define and also migrates the code to use the new
terminology.

Change-Id: I3d2437c04e3b21fdbd32019f55c066c87679a5bf
Signed-off-by: David Cunado <david.cunado@arm.com>
2017-05-04 21:23:06 +01:00
davidcunado-arm f132b4a05b Merge pull request #925 from dp-arm/dp/spdx
Use SPDX license identifiers
2017-05-04 16:35:19 +01:00
Jeenu Viswambharan b10d44995e Introduce ARM SiP service to switch execution state
In AArch64, privileged exception levels control the execution state
(a.k.a. register width) of the immediate lower Exception Level; i.e.
whether the lower exception level executes in AArch64 or AArch32 state.
For an exception level to have its execution state changed at run time,
it must request the change by raising a synchronous exception to the
higher exception level.

This patch implements and adds such a provision to the ARM SiP service,
by which an immediate lower exception level can request to switch its
execution state. The execution state is switched if the request is:

  - raised from non-secure world;

  - raised on the primary CPU, before any secondaries are brought online
    with CPU_ON PSCI call;

  - raised from an exception level immediately below EL3: EL2, if
    implemented; otherwise NS EL1.

If successful, the SMC doesn't return to the caller, but to the entry
point supplied with the call. Otherwise, the caller will observe the SMC
returning with STATE_SW_E_DENIED code. If ARM Trusted Firmware is built
for AArch32, the feature is not supported, and the call will always
fail.

For the ARM SiP service:

  - Add SMC function IDs for both AArch32 and AArch64;
  - Increment the SiP service minor version to 2;
  - Adjust the number of supported SiP service calls.

Add documentation for ARM SiP service.

Fixes ARM-software/tf-issues#436

Change-Id: I4347f2d6232e69fbfbe333b340fcd0caed0a4cea
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2017-05-04 11:00:34 +01:00
dp-arm 82cb2c1ad9 Use SPDX license identifiers
To make software license auditing simpler, use SPDX[0] license
identifiers instead of duplicating the license text in every file.

NOTE: Files that have been imported by FreeBSD have not been modified.

[0]: https://spdx.org/

Change-Id: I80a00e1f641b8cc075ca5a95b10607ed9ed8761a
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
2017-05-03 09:39:28 +01:00
Evan Lloyd 052ab529c4 Build: Correct Unix specific echo commands
Some recent changes have added direct use of the echo command without
parameters.  This fails on a Windows shell, because echo without
parameters reports the mode ("ECHO is on").
This is corrected using the ECHO_BLANK_LINE macro already provided
for that purpose.

Change-Id: I5fd7192861b4496f6f46b4f096e80a752cd135d6
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
2017-05-02 19:12:11 +01:00
Evan Lloyd 6ba7d274e2 Build: Fix parallel build
2 problems were found, but are in one change to avoid submitting a patch
that might fail to build. The problems were:
1.  The macro MAKE_PREREQ_DIR has a minor bug, in that it is capable of
    generating recursive dependencies.
2.  The inclusion of BUILD_DIR in TEMP_OBJ_DIRS left no explicit
    dependency, BUILD_DIR might not exist when subdirectories are
    created by a thread on another CPU.

This fix corrects these with the following changes:
1.  MAKE_PREREQ_DIR does nothing for a direct self dependency.
2.  BUILD_DIR is built using MAKE_PREREQ_DIR.
3.  BUILD_DIR is an explicit prerequisite of all OBJ_DIRS.

Change-Id: I938cddea4a006df225c02a47b9cf759212f27fb7

Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
2017-05-02 18:27:05 +01:00
davidcunado-arm 4b427bd487 Merge pull request #919 from davidcunado-arm/dc/smc_yielding_generic
Update terminology: standard SMC to yielding SMC
2017-05-02 16:32:20 +01:00
Jeenu Viswambharan f4c8aa9054 Add macro to check whether the CPU implements an EL
Replace all instances of checks with the new macro.

Change-Id: I0eec39b9376475a1a9707a3115de9d36f88f8a2a
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2017-05-02 16:11:12 +01:00
Antonio Nino Diaz a56402521f Fix execute-never permissions in xlat tables libs
Translation regimes that only support one virtual address space (such as
the ones for EL2 and EL3) can flag memory regions as execute-never by
setting to 1 the XN bit in the Upper Attributes field in the translation
tables descriptors. Translation regimes that support two different
virtual address spaces (such as the one shared by EL1 and EL0) use bits
PXN and UXN instead.

The Trusted Firmware runs at EL3 and EL1, it has to handle translation
tables of both translation regimes, but the previous code handled both
regimes the same way, as if both had only 1 VA range.

When trying to set a descriptor as execute-never it would set the XN
bit correctly in EL3, but it would set the XN bit in EL1 as well. XN is
at the same bit position as UXN, which means that EL0 was being
prevented from executing code at this region, not EL1 as the code
intended. Therefore, the PXN bit was unset to 0 all the time. The result
is that, in AArch64 mode, read-only data sections of BL2 weren't
protected from being executed.

This patch adds support of translation regimes with two virtual address
spaces to both versions of the translation tables library, fixing the
execute-never permissions for translation tables in EL1.

The library currently does not support initializing translation tables
for EL0 software, therefore it does not set/unset the UXN bit. If EL1
software needs to initialize translation tables for EL0 software, it
should use a different library instead.

Change-Id: If27588f9820ff42988851d90dc92801c8ecbe0c9
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2017-05-02 15:34:01 +01:00
davidcunado-arm 062dd37828 Merge pull request #923 from nmenon/fix_xlat_1
xlat lib: Don't set mmap_attr_t enum to be -1
2017-05-02 15:32:23 +01:00
Nishanth Menon 7055e6fa32 xlat lib: Don't set mmap_attr_t enum to be -1
-1 is not a defined mmap_attr_t type. Instead of using invalid enum
types, we can either choose to define a INVALID type OR handle the
condition specifically.

Since the usage of mmap_region_attr is limited, it is easier to just
handle the error condition specifically and return 0 or -1 depending
on success or fail.

Fixes: ARM-Software/tf-issues#473
Fixes: 28fa2e9ee8 ("xlat lib: Use mmap_attr_t type consistently")

Signed-off-by: Nishanth Menon <nm@ti.com>
2017-05-02 07:05:42 -05:00
davidcunado-arm 7fa3214e18 Merge pull request #896 from sbranden/tf_issue_461
Move defines in utils.h to utils_def.h to fix shared header compile i…
2017-05-02 11:13:20 +01:00
davidcunado-arm 798b084dee Merge pull request #913 from vwadekar/tegra-fixes-from-downstream
Tegra fixes from downstream
2017-05-02 10:37:30 +01:00
Varun Wadekar 7c1d434206 Tegra210: implement 'get_target_pwr_state' handler
This patch implements the handler to calculate the cluster and
system power states for the Tegra210 SoC. The power states
returned by this handler are used by the PSCI library to decide
cache maintenance operations - cluster v cpu.

Change-Id: I93e4139d4cd8a086b51f328e9a76e91428ebcdab
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-05-01 15:36:44 -07:00
Varun Wadekar 14a1c0edf0 Tegra: fix the NS DRAM address calculation logic
This patch fixes the logic used to calculate the end of NS memory
aperture. The functions allows zero sized NS apertures as that is
a valid requirement for some use cases. e.g. VPR resize.

Change-Id: Ie966e0ea2f9c6888d21c38e734003704094b3720
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-05-01 15:33:44 -07:00
Varun Wadekar 9d42d23a2c Tegra: memctrl_v2: zero out NS Video memory carveout region
The video memory carveout has to be re-sized depending on the Video
content. This requires the NS world to send us new base/size values.
Before setting up the new region, we must zero out the previous memory
region, so that the video frames are not leaked to the outside world.

This patch adds the logic to zero out the previous memory carveout
region.

Change-Id: I471167ef7747154440df5c1a5e015fbeb69d9043
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-05-01 15:33:31 -07:00
Varun Wadekar e9cb01d96e Tegra186: calculate proper power state for cluster/system power down
Earlier, we were setting "System Suspend" as the power state for all system
states. This caused incorrect system state during a cluster power down.

This patch fixes this anomaly and sets the correct power state during a
cluster/system power down.

Change-Id: Ibd002930e0ae103e381e0a19670c3c4d057e7cb7
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-05-01 15:29:13 -07:00
Steven Kao ab3a33fe5c Tegra186: mce: max retries for ARI requests
This patch adds max retries for all ARI requests and asserts
if the ARI request is still busy.

Change-Id: I454ad9b557bb59e513e4c0c6f071275c87d0e07a
Signed-off-by: Steven Kao <skao@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-05-01 15:28:56 -07:00