Commit Graph

2312 Commits

Author SHA1 Message Date
davidcunado-arm f07d3985b8 Merge pull request #885 from antonio-nino-diaz-arm/an/console-flush
Implement console_flush()
2017-04-12 22:23:44 +01:00
Varun Wadekar c05a2197f3 Tegra: memctrl_v1: enable 'xlat_table_v2' library
This patch enables the 'xlat_table_v2' library for the Tegra Memory
Controller driver. This library allows us to dynamically map/unmap
memory regions, with MMU enabled.

The Memory Controller driver maps/unmaps non-overlapping Video Memory
region, to clean it of any secure contents, before it resizes the
region.

Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-10 16:21:57 -07:00
Varun Wadekar ae8ac2d233 Tegra: allow platforms to override plat_core_pos_by_mpidr()
This patch makes the default implementation of plat_core_pos_by_mpidr()
as weakly linked, so that platforms can override it with their own.

Tegra186, for one, does not have CPU IDs 2 and 3, so it has its own
implementation of plat_core_pos_by_mpidr().

Change-Id: I7a5319869c01ede3775386cb95af1431792f74b3
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-07 09:32:35 -07:00
Pritesh Raithatha 06803cfd02 Tegra: memctrl_v2: platform handler for MC settings
This patch empowers the platforms to provide the settings (e.g. stream ID,
security setting, transaction overrides) required by the Memory Controller
driver. This allows the platforms to program the Memory Controller as per
their needs and makes the driver scalable.

Original-change-by: Pritesh Raithatha <praithatha@nvidia.com>

Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-07 09:32:28 -07:00
Harvey Hsieh c4dae9fc69 Tegra: memctrl_v2: remove non-secure access to TZSRAM memory
This patch removes the memory controller configuration setting, which
allowed non-secure access to the TZSRAM memory.

Change-Id: Ic13645ba6a7694f192565962df40ca4fb8130f23
Signed-off-by: Harvey Hsieh <hhsieh@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-07 09:32:28 -07:00
Rich Wiley 5dc574b4cd Tegra186: mce: support for TEGRA_ARI_MISC_CCPLEX_EDBGREQ
This ARI call enables the EDBGREQ feature in the CCPLEX,
which will cause the CPUs to enter debug state instead of
vectoring to sw (ie MCA handler) upon receiving an async
abort signal.

Change-Id: Ifcb0e11446b6ac55179e3350d8f02b60ba32c94d
Signed-off-by: Rich Wiley <rwiley@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-07 09:32:28 -07:00
Varun Wadekar 6d6bbc88d1 Tegra186: update t18x_ari.h to v3.1
This patch updates the ARI header file to v3.1.

Change-Id: I3e58cf50d27fb6e72062bb9d9782b75296b32025
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-07 09:32:28 -07:00
Steven Kao 83f3f536e5 Tegra186: PSCI: support for 64-bit TZDRAM base
This patch fixes the variable width to store the TZDRAM base
address used to resume from System Suspend.

Change-Id: Ib67eda64b09f26fb2f427f0d624f057081473132
Signed-off-by: Steven Kao <skao@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-07 09:23:24 -07:00
Varun Wadekar 16c7cd01b2 Tegra: memctrl_v2: config to enable SMMU device
This patch adds a config to the memory controller driver to enable SMMU
device init during boot. Tegra186 platforms keeps it enabled by default,
but future platforms might not support it.

Change-Id: Iebe1c60a25fc1cfb4c97a507e121d6685a49cb83
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-07 09:23:09 -07:00
Varun Wadekar 691bc22de9 Tegra186: read activity monitor's clock counter values
This patch adds a new SMC function ID to read the refclk and coreclk
clock counter values from the Activity Monitor. The non-secure world
requires this information to calculate the CPU's frequency.

Formula: "freq = (delta_coreclk / delta_refclk) * refclk_freq"

The following CPU registers have to be set by the non-secure driver
before issuing the SMC:

X1 = MPIDR of the target core
X2 = MIDR of the target core

Change-Id: I296d835def1f5788c17640c0c456b8f8f0e90824
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-07 09:15:51 -07:00
Varun Wadekar e698a822f0 Tegra: memctrl_v2: make AFI device settings configurable
This patch adds a new config to enable MC settings for the AFIW
and AFIR devices. Platforms must enable this config on their own.

Change-Id: I53b450117e4764ea76d9347ee2928f9be178b107
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-07 09:15:33 -07:00
Varun Wadekar cb38550c94 Tegra186: move smmu driver to tegra/common
This patch moves the smmu driver introduced by the Tegra186 port
to tegra/common so that future chips can (re)use it.

Change-Id: Ia44c7f2a62fb2d8869db3a44742a8c6b13c49036
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-07 09:15:17 -07:00
Varun Wadekar 06060028e1 Tegra186: split MCE driver into public/private interfaces
This patch splits the MCE driver into public and private interfaces
to allow usage of common functionality across multiple SoCs.

Change-Id: Ib58080e730d72f11ff79507d8e0acffb2ad5c606
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-07 09:15:14 -07:00
davidcunado-arm 45cd814bf7 Merge pull request #892 from rockchip-linux/fixes-a-typo
rockchip/rk3399: the printf changed to tf_printf for console output
2017-04-07 15:54:14 +01:00
davidcunado-arm 264521bf40 Merge pull request #891 from vwadekar/tegra186-platform-support-v4
Tegra186 platform support v4
2017-04-07 13:43:37 +01:00
Caesar Wang 01178e82d6 rockchip/rk3399: changed printf/tf_printf for console output
The printf() isn't used by the firmware itself, just by the tools under
the ./tools/ folder. Then tf_printf will unconditionally print.
Remove the unused print_dram_status_info() function.

Change-Id: Ie699ccb54a5be9a2cbbd7b8d4193b57075a2f57a
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
2017-04-07 09:16:59 +08:00
Soren Brinkmann cd689a4b38 zynqmp: Enable workaround for errata 855873
Zynqmp implements a version of the Cortex A53 affected by errata 855873.
Enable the workaround for the errata and silence the warning: "WARNING:
BL31: cortex_a53: errata workaround for 855873 was missing!".

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
2017-04-06 11:44:27 -07:00
davidcunado-arm 3b68c09c44 Merge pull request #888 from douglas-raillard-arm/dr/fix_ULL_issue
Fix ARM_BL31_IN_DRAM build
2017-04-06 15:23:52 +01:00
Antonio Nino Diaz 38aecbb43e Replace tf_printf occurrences with ERROR
The amount of console output is controlled by the LOG_LEVEL build
option. Using tf_printf without any #ifdef depending on the LOG_LEVEL
doesn't give the user that flexibility.

This patch replaces all occurrences of tf_printf that prints error, but
aren't dependent on LOG_LEVEL, with the ERROR macro.

Change-Id: Ib5147f14fc1579398a11f19ddd0e840ff6692831
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2017-04-06 14:46:38 +01:00
davidcunado-arm 38fc7ed466 Merge pull request #889 from paulkocialkowski/integration
rockchip: Remove unused rockchip_pd_pwr_down_wfi function
2017-04-06 10:55:17 +01:00
davidcunado-arm ed7562521b Merge pull request #886 from dp-arm/dp/stack-protector
Add support for GCC stack protection
2017-04-06 10:20:47 +01:00
davidcunado-arm 90e0ffd367 Merge pull request #882 from douglas-raillard-arm/dr/review_juno_errata
Enable all A53 and A57 errata workarounds for Juno
2017-04-05 22:39:22 +01:00
Varun Wadekar 2dd7d41a2b Tegra186: move TSA macros to tegra_def.h
This patch moves the TSA block's macros from memctrl_v2.h to
tegra_def.h in the Tegra186 tree.

Change-Id: I8b45dd3905c5d1f33ffb36d8b2de72aeb06674aa
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-05 14:09:51 -07:00
Varun Wadekar 0258840e42 Tegra: drivers: memctrl: move chip specific defines to tegra_def.h
This patch moves the chip specific memory controller driver defines to
the appropriate tegra_def.h files, for future compatibility.

Change-Id: I3179fb771d8b32e913ca29bd94af95f4b2fc1961
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-05 14:09:51 -07:00
Varun Wadekar dec349c87d Tegra186: move platform specific MCE defines to tegra_def.h
This patch moves the MCE's configurable parameters to tegra_def.h for
the Tegra186 SoC, to allow forward compatiblity.

Change-Id: If8660c1c09908a4064dbb67d5ca4fb78389cab13
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-05 14:09:51 -07:00
Mustafa Yigit Bilgen d81938ab3a Tegra: memctrl_v2: no SID override for AON
Remove stream ID overrides for AON. AON drives its own stream ID when
accesing IOVA memory. However, it needs to use a physical stream ID when
accesing GSC memory. Overriding stream ids prevents AON from accessing
GSC memory, so remove them to allow AON to access GSCs.

Change-Id: Ia2b11014d9780c4546b5e781621ae4cd413735cc
Signed-off-by: Mustafa Yigit Bilgen <mbilgen@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-05 14:09:51 -07:00
Vivek Aseeja 396a9b8fee Tegra186: memctrl_v2: remove APE overrides for chip verification
This patch reverts the APE overrides added for chip verification.

Change-Id: Ib85560934d63f6e41e95ef6898a341f24761a517
Signed-off-by: Vivek Aseeja <vaseeja@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-05 14:09:51 -07:00
Krishna Sitaraman 5ea1fe569d Tegra186: use MSB of wake_time
This patch updates wake time of the cpu to use the MSBs and zero
out the LSB's. Only 24 out of 32 bits are currently passed
through the PSCI interface. Previously all the LSB's were used.

Change-Id: Ie2d9d1bf6e3003dd47526a124f64e6ad555d2371
Signed-off-by: Krishna Sitaraman <ksitaraman@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-05 14:09:51 -07:00
Krishna Sitaraman a259293ebe Tegra186: Update API for reset vector ARI
The TEGRA_ARI_COPY_MISCREG_AA64_RST ARI should be called with
request_lo/hi set to zero. MTS automatically takes the reset
vector from MISCREG_AA64_RST register and does not need it to
be passed as parameters.  This patch updates the API and the
caller function accordingly.

Change-Id: Ie3e3402d93951102239d988ca9f0cdf94f290d2f
Signed-off-by: Krishna Sitaraman <ksitaraman@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-05 14:09:51 -07:00
Mustafa Yigit Bilgen 322b00fcfb Tegra186: clean CPU wake times from L2 cache
When entering C7, ATF disables caches and flushes the L1 cache. However,
wake_time[cpu] can still remain in the L2 cache, causing later reads to it
to fetch from DRAM. This will read stale values.

Fix this by aligning wake_time[cpu] to cache lines, and explicitly cleaning it
before disabling caches.

Change-Id: Id73d095b479677595a6b3dd0abb240a1fef5f311
Signed-off-by: Mustafa Yigit Bilgen <mbilgen@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-05 14:09:51 -07:00
Krishna Sitaraman ac26b96b40 Tegra186: update t18x_ari.h to v3.0
This patch updates the ARI header to version 3.0

Change-Id: I7cfe0c61c80a6b78625232135dd63393602d32fe
Signed-off-by: Krishna Sitaraman <ksitaraman@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-05 14:09:51 -07:00
davidcunado-arm 12517ca783 Merge pull request #881 from davidcunado-arm/dc/update_userguide
Upgrade mbed TLS version
2017-04-05 22:02:55 +01:00
davidcunado-arm 5dff210dff Merge pull request #877 from soby-mathew/sm/build_opt_checks
Include all makefiles before build option checks
2017-04-05 22:02:19 +01:00
Varun Wadekar 25621454d5 Tegra186: trampoline: update "System Suspend" exit criteria
The TZRAM memory loses its state during "System Suspend". This patch
check if TZRAM base address contains valid data, to decide if the system
is exiting from "System Suspend". To enable TZDRAM encryption, the Memory
Controller's TZDRAM base/size registers would be populated by the BPMP
when the system "wakes up".

Change-Id: I5fc8ba1ae3bce12f0ece493f6f9f5f4d92a46344
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-05 13:56:41 -07:00
Krishna Sitaraman 53451898a1 Tegra186: Add smc handler for coresight clock gating
This change adds function to invoke for MISC_CCPLEX ARI calls and
the corresponding smc handler. This can be used to enable/disable
Coresight clock gating.

Change-Id: I4bc17aa478a46c29bfe17fd74f839a383ee2b644
Signed-off-by: Krishna Sitaraman <ksitaraman@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-05 13:56:36 -07:00
Harvey Hsieh 719f3ec242 Tegra: memctrl_v2: save TZDRAM settings to secure scratch registers
Save TZDRAM settings for SC7 resume firmware to restore.

SECURITY_BOM:     MC_SECURITY_CFG0_0 = SECURE_RSV55_SCRATCH_0
SECURITY_BOM_HI:  MC_SECURITY_CFG3_0 = SECURE_RSV55_SCRATCH_1
SECURITY_SIZE_MB: MC_SECURITY_CFG1_0 = SECURE_RSV54_SCRATCH_1

Change-Id: I78e891d9ebf576ff2a17ff87cf3aff4030ee11b8
Signed-off-by: Harvey Hsieh <hhsieh@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-05 13:56:29 -07:00
Krishna Sitaraman 6ef90b9638 Tegra186: mce: fix return value for enum features ari
This patch fixes the incorrect return value that was being passed
back for the ENUM_FEATURES ARI call.

Change-Id: I3842c6ce27ea24698608830cf4c12cfa7ff64421
Signed-off-by: Krishna Sitaraman <ksitaraman@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-05 13:56:10 -07:00
Krishna Sitaraman 10007118a2 Tegra186: mce: clear reserved fields for ARI calls
This patch clears the unused or reserved ARI input registers
before issuing the actual ARI command.

Change-Id: I454b86566bfe088049a5c63527c1323d7b25248a
Signed-off-by: Krishna Sitaraman <ksitaraman@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-04-05 13:56:06 -07:00
davidcunado-arm 331f8a063f Merge pull request #876 from soby-mathew/sm/refactor_header
Re-factor header files for easier PSCI library integration
2017-04-05 21:07:05 +01:00
davidcunado-arm 82720675b9 Merge pull request #884 from vwadekar/tegra186-platform-support-v3
Tegra186 platform support v3
2017-04-05 20:25:18 +01:00
Masahiro Yamada 4d045d0ebb Build: add generic way to include SCP_BL2 into FIP image
If SCP_BL2 is passed in from the command line, it is recognized by
make_helpers/tbbr/tbbr_tools.mk, and the cert_create tool generates
the corresponding key and content certificates.

On the other hand, the top-level Makefile does not care SCP_BL2, so
the --scp-fw option is not passed to the fiptool.  As far as I see
plat/arm/css/common/css_common.mk, it looks like a platform's job to
add $(eval $(call FIP_ADD_IMG,SCP_BL2,--scp-fw)).

We can make the top-level Makefile kind enough to take care of it.
This is useful when we want to have optional SCP_BL2 firmware.

Adjust css_common.mk so that Juno still requires SCP_BL2 by default.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-04-05 23:33:32 +09:00
Paul Kocialkowski b6dcbf588a rockchip: Remove unused rockchip_pd_pwr_down_wfi function
The rockchip_pd_pwr_down_wfi function is currently unused, which may
trigger compiler warnings or errors. Remove it.

Change-Id: I7e1b0ae092e8855528ac2065ecefc8bd45305f31
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
2017-04-05 00:55:57 +02:00
Douglas Raillard f9608bc8f8 Fix ARM_BL31_IN_DRAM build
Some header files using the ULL() macro were not directly including
utils.h where the macro definition resides. As a consequence, a linker
script with values using this macro did not see the macro definition
and kept the "ULL(<value>)" call in the preprocessed file, which lead to
link error.

Files using ULL() macro now include utils.h directly.

Change-Id: I433a7f36bd21a156c20e69bc2a2bb406140ebdf9
Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
2017-04-03 18:59:22 +01:00
davidcunado-arm ffe102ca6d Merge pull request #874 from dp-arm/dp/mbed-macros
mbedtls: Namespace TF specific macros
2017-03-31 17:47:21 +01:00
dp-arm e6d2aea159 Juno: Initialize stack protector canary from the trusted entropy source
Change-Id: I7f3e4bfd46613c6311ba4015d56705414fd6feab
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
2017-03-31 13:58:51 +01:00
dp-arm df9a39eaa9 Juno: Introduce juno_getentropy(void *buf, size_t len)
This function fills the buffer (first argument) with the specified
number of bytes (second argument) from the trusted entropy source.

This function will be used to initialize the stack protector canary.

Change-Id: Iff15aaf4778c13fa883ecb5528fcf9b8479d4489
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
2017-03-31 13:58:51 +01:00
dp-arm 233d83d06c Introduce MIN()/MAX() macros in utils.h
Change-Id: If88270bc9edb32634a793b1e1be6c4829f39b9c5
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
2017-03-31 13:58:51 +01:00
Douglas Raillard 51faada71a Add support for GCC stack protection
Introduce new build option ENABLE_STACK_PROTECTOR. It enables
compilation of all BL images with one of the GCC -fstack-protector-*
options.

A new platform function plat_get_stack_protector_canary() is introduced.
It returns a value that is used to initialize the canary for stack
corruption detection. Returning a random value will prevent an attacker
from predicting the value and greatly increase the effectiveness of the
protection.

A message is printed at the ERROR level when a stack corruption is
detected.

To be effective, the global data must be stored at an address
lower than the base of the stacks. Failure to do so would allow an
attacker to overwrite the canary as part of an attack which would void
the protection.

FVP implementation of plat_get_stack_protector_canary is weak as
there is no real source of entropy on the FVP. It therefore relies on a
timer's value, which could be predictable.

Change-Id: Icaaee96392733b721fa7c86a81d03660d3c1bc06
Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
2017-03-31 13:58:48 +01:00
Antonio Nino Diaz 1e09ff9344 Remove dead loops in assert() in C and ASM
The desired behaviour is to call `plat_panic_handler()`, and to use
`no_ret` to do so from ASM.

Change-Id: I88b2feefa6e6c8f9bf057fd51ee0d2e9fb551e4f
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2017-03-31 09:54:22 +01:00
Antonio Nino Diaz 0b32628edd Flush console where necessary
Call console_flush() before execution either terminates or leaves an
exception level.

Fixes: ARM-software/tf-issues#123

Change-Id: I64eeb92effb039f76937ce89f877b68e355588e3
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2017-03-31 09:54:22 +01:00