project/bcm63xx/atf.git
6 years agosynquacer: Enable CCN driver support
Sumit Garg [Fri, 15 Jun 2018 09:20:19 +0000 (14:50 +0530)]
synquacer: Enable CCN driver support

synquacer has CCN-512 interconnect. So enable proper CCN driver
initialization.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
6 years agosynquacer: Implement topology functions
Sumit Garg [Fri, 15 Jun 2018 09:13:35 +0000 (14:43 +0530)]
synquacer: Implement topology functions

These functions describe the layout of the cores and clusters in order
to support the PSCI framework.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
6 years agosynquacer: Populate BL32 and BL33 entrypoints
Sumit Garg [Fri, 15 Jun 2018 09:08:50 +0000 (14:38 +0530)]
synquacer: Populate BL32 and BL33 entrypoints

As this platform supports direct entry to BL31 and no BL2, so
populate BL32 and BL33 entrypoints with static memory load info.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
6 years agosynquacer: Enable PL011 UART Console
Sumit Garg [Fri, 15 Jun 2018 09:04:42 +0000 (14:34 +0530)]
synquacer: Enable PL011 UART Console

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
6 years agosynquacer: Add platform core management helpers
Sumit Garg [Fri, 15 Jun 2018 08:18:11 +0000 (13:48 +0530)]
synquacer: Add platform core management helpers

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
6 years agosynquacer: Introduce basic platform support
Sumit Garg [Fri, 15 Jun 2018 08:11:59 +0000 (13:41 +0530)]
synquacer: Introduce basic platform support

synquacer supports direct entry to BL31 without BL1 and BL2 as
SCP firmware does similar work. So this patch adds BL31 stub APIs.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
6 years agoMerge pull request #1403 from glneo/for-upstream-k3
Dimitris Papastamos [Wed, 20 Jun 2018 15:37:01 +0000 (16:37 +0100)]
Merge pull request #1403 from glneo/for-upstream-k3

TI K3 platform support

6 years agoMerge pull request #1421 from Yann-lms/cpp_dtc
Dimitris Papastamos [Wed, 20 Jun 2018 15:36:00 +0000 (16:36 +0100)]
Merge pull request #1421 from Yann-lms/cpp_dtc

Build: add cpp build processing for dtb

6 years agoMerge pull request #1413 from grandpaul/paulliu-rpi3-0
Dimitris Papastamos [Wed, 20 Jun 2018 15:34:10 +0000 (16:34 +0100)]
Merge pull request #1413 from grandpaul/paulliu-rpi3-0

rpi3: BL32 optee support

6 years agoMerge pull request #1423 from chandnich/sgi-575/dyncfg
Dimitris Papastamos [Wed, 20 Jun 2018 08:50:56 +0000 (09:50 +0100)]
Merge pull request #1423 from chandnich/sgi-575/dyncfg

Sgi 575/dyncfg

6 years agoti: k3: Introduce basic generic board support
Nishanth Menon [Wed, 20 Sep 2017 06:32:13 +0000 (01:32 -0500)]
ti: k3: Introduce basic generic board support

While it would be useful to have a device tree based build, the
required components are not in place yet, so support just a simple
statically defined configuration to begin with.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
6 years agoti: k3: common: Add PSCI stubs
Benjamin Fair [Fri, 14 Oct 2016 01:13:46 +0000 (01:13 +0000)]
ti: k3: common: Add PSCI stubs

These functions are used for the PSCI implementation and are needed to
build BL31, but we cannot implement them until we add several more drivers
related to ti-sci so these are only stubs for now.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
6 years agoti: k3: common: Enable GICv3 support
Nishanth Menon [Fri, 14 Oct 2016 01:13:49 +0000 (01:13 +0000)]
ti: k3: common: Enable GICv3 support

Do proper initialization of GIC V3. This will allow CP15 access to GIC
from "normal world" (aka HLOS) via mrc/mcr calls.

K3 SoC family uses GICv3 compliant GIC500 without compatibility for
legacy GICv2.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
6 years agoti: k3: common: Program A53 arch timer frequency
Nishanth Menon [Fri, 14 Oct 2016 01:13:48 +0000 (01:13 +0000)]
ti: k3: common: Program A53 arch timer frequency

Provide K3_TIMER_FREQUENCY for the platform configuration if the GTC
clock is selected statically and override option if the platform has a
different configuration.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Benjamin Fair <b-fair@ti.com>
6 years agoti: k3: common: Add console initialization base
Nishanth Menon [Fri, 14 Oct 2016 01:13:44 +0000 (01:13 +0000)]
ti: k3: common: Add console initialization base

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
6 years agoti: k3: common: Enable MMU using xlat_tables_v2 library
Nishanth Menon [Fri, 14 Oct 2016 01:13:45 +0000 (01:13 +0000)]
ti: k3: common: Enable MMU using xlat_tables_v2 library

This library will be used to properly set up mappings from different
bootloaders at different exception levels. It ensures that memory mapped
devices such as UARTs are still accessible and memory regions have the
correct access permissions.

Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
6 years agoti: k3: common: Implement topology functions
Benjamin Fair [Fri, 14 Oct 2016 01:13:47 +0000 (01:13 +0000)]
ti: k3: common: Implement topology functions

These functions describe the layout of the cores and clusters in order to
support the PSCI framework.

Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
6 years agoti: k3: common: Populate BL32 and BL33 entrypoint
Benjamin Fair [Fri, 14 Oct 2016 01:13:52 +0000 (01:13 +0000)]
ti: k3: common: Populate BL32 and BL33 entrypoint

Because there is no BL2, BL31 must determine the entrypoint and memory
location of BL32 and BL33 on its own.

BL32_BASE and PRELOADED_BL33_BASE will be set in the corresponding board
makefile. We also allow a DTB address to be specified for cases when BL33
is a Linux image.

NOTE: It is possible to pull in this information from device tree as
well, however libfdt does not contain the required hooks to make this
happen at this point in time.

Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
6 years agoti: k3: common: Add platform core management helpers
Benjamin Fair [Tue, 18 Oct 2016 19:32:06 +0000 (14:32 -0500)]
ti: k3: common: Add platform core management helpers

The K3 family of SoCs has multiple interconnects. The key interconnect
for high performance processors is the MSMC3 interconnect. This is
an io-coherent interconnect which exports multiple ports for each
processor cluster.

Sometimes, port 0 of the MSMC may not have an ARM cluster OR is isolated
such that the instance of ATF does not manage it. Define macros
in platform_def.h to help handle this.

Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
6 years agoti: k3: Setup initial files for platform
Nishanth Menon [Fri, 14 Oct 2016 01:13:34 +0000 (01:13 +0000)]
ti: k3: Setup initial files for platform

Create the baseline Makefile, platform definitions file and platform
specific assembly macros file. This includes first set of constants
for the platform including cache sizes and linker format and a stub for
BL31 and the basic memory layout

K3 SoC family of processors do not use require a BL1 or BL2 binary,
since such functions are provided by an system controller on the SoC.
This lowers the burden of ATF to purely managing the local ARM cores
themselves.

Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
6 years agoMerge pull request #1410 from Anson-Huang/master
Dimitris Papastamos [Tue, 19 Jun 2018 14:10:23 +0000 (15:10 +0100)]
Merge pull request #1410 from Anson-Huang/master

Add NXP's i.MX8QX and i.MX8QM SoC support

6 years agoMerge pull request #1425 from jts-arm/panic
Dimitris Papastamos [Tue, 19 Jun 2018 14:09:43 +0000 (15:09 +0100)]
Merge pull request #1425 from jts-arm/panic

Panic in BL1 when TB_FW_CONFIG is invalid

6 years agoMerge pull request #1430 from dp-arm/dp/cpulib
Dimitris Papastamos [Tue, 19 Jun 2018 14:07:30 +0000 (15:07 +0100)]
Merge pull request #1430 from dp-arm/dp/cpulib

cpulib: Add ISBs or comment why they are unneeded

6 years agoMerge pull request #1418 from antonio-nino-diaz-arm/an/arm-multi-console
Dimitris Papastamos [Tue, 19 Jun 2018 13:00:07 +0000 (14:00 +0100)]
Merge pull request #1418 from antonio-nino-diaz-arm/an/arm-multi-console

 plat/arm: Migrate AArch64 port to the multi console driver

6 years agoMerge pull request #1420 from Yann-lms/mm_cursor_size_check
Dimitris Papastamos [Tue, 19 Jun 2018 12:39:55 +0000 (13:39 +0100)]
Merge pull request #1420 from Yann-lms/mm_cursor_size_check

xlat_v2: add a check on mm_cursor->size to avoid infinite loop

6 years agocpulib: Add ISBs or comment why they are unneeded
Dimitris Papastamos [Thu, 7 Jun 2018 12:20:19 +0000 (13:20 +0100)]
cpulib: Add ISBs or comment why they are unneeded

Change-Id: I18a41bb9fedda635c3c002a7f112578808410ef6
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
6 years agorpi3: update documentation for OP-TEE support
Ying-Chun Liu (PaulLiu) [Wed, 13 Jun 2018 12:53:08 +0000 (20:53 +0800)]
rpi3: update documentation for OP-TEE support

Describe how to use BL32 build variable to load OP-TEE into FIP.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
6 years agorpi3: add OPTEE support
Ying-Chun Liu (PaulLiu) [Sat, 9 Jun 2018 18:00:27 +0000 (02:00 +0800)]
rpi3: add OPTEE support

Support for loading optee images as BL32 secure payload.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
6 years agoplat/arm: Migrate AArch64 port to the multi console driver
Antonio Nino Diaz [Tue, 19 Jun 2018 08:29:36 +0000 (09:29 +0100)]
plat/arm: Migrate AArch64 port to the multi console driver

The old API is deprecated and will eventually be removed.

Arm platforms now use the multi console driver for boot and runtime
consoles. However, the crash console uses the direct console API because
it doesn't need any memory access to work. This makes it more robust
during crashes.

The AArch32 port of the Trusted Firmware doesn't support this new API
yet, so it is only enabled in AArch64 builds. Because of this, the
common code must maintain compatibility with both systems. SP_MIN
doesn't have to be updated because it's only used in AArch32 builds.
The TSP is only used in AArch64, so it only needs to support the new
API without keeping support for the old one.

Special care must be taken because of PSCI_SYSTEM_SUSPEND. In Juno, this
causes the UARTs to reset (except for the one used by the TSP). This
means that they must be unregistered when suspending and re-registered
when resuming. This wasn't a problem with the old driver because it just
restarted the UART, and there were no problems associated with
registering and unregistering consoles.

The size reserved for BL2 has been increased.

Change-Id: Icefd117dd1eb9c498921181a21318c2d2435c441
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoMerge pull request #1400 from Andre-ARM/allwinner/v1
Dimitris Papastamos [Tue, 19 Jun 2018 08:16:07 +0000 (09:16 +0100)]
Merge pull request #1400 from Andre-ARM/allwinner/v1

Allwinner platform support

6 years agoSupport for NXP's i.MX8QM SoC
Anson Huang [Mon, 11 Jun 2018 04:54:05 +0000 (12:54 +0800)]
Support for NXP's i.MX8QM SoC

NXP's i.MX8QM is an ARMv8 SoC with 2 clusters, 2 Cortex-A72
cores in one cluster and 4 Cortex-A53 in the other cluster,
and also has system controller (Cortex-M4) inside, documentation
can be found in below link:

https://www.nxp.com/products/processors-and-microcontrollers/
applications-processors/i.mx-applications-processors/i.mx-8-processors:IMX8-SERIES

This patch adds support for booting up SMP linux kernel (v4.9).

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
6 years agoSupport for NXP's i.MX8QX SoC
Anson Huang [Tue, 5 Jun 2018 08:13:45 +0000 (16:13 +0800)]
Support for NXP's i.MX8QX SoC

NXP's i.MX8QX is an ARMv8 SoC with 4 Cortex-A35 cores and
system controller (Cortex-M4) inside, documentation can
be found in below link:

https://www.nxp.com/products/processors-and-microcontrollers/
applications-processors/i.mx-applications-processors/i.mx-8-processors:IMX8-SERIES

This patch adds support for booting up SMP linux kernel (v4.9).

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
6 years agoSupport for NXP's imx SoC common function
Anson Huang [Tue, 5 Jun 2018 08:12:27 +0000 (16:12 +0800)]
Support for NXP's imx SoC common function

This patch adds support for NXP's imx SoC common
function support like topology, gic implementation.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
6 years agoSupport for NXP's imx SoC debug uart
Anson Huang [Tue, 5 Jun 2018 08:11:24 +0000 (16:11 +0800)]
Support for NXP's imx SoC debug uart

Add NXP's imx SoC debug uart driver.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
6 years agoSupport for NXP's i.MX8 SoCs IPC
Anson Huang [Tue, 5 Jun 2018 08:05:59 +0000 (16:05 +0800)]
Support for NXP's i.MX8 SoCs IPC

NXP's i.MX8 SoCs have system controller (M4 core)
which takes control of clock management, power management,
partition management, PAD management etc., other
clusters like Cortex-A35 can send out command via MU
(Message Unit) to system controller for clock/power
management etc..

This patch adds basic IPC(inter-processor communication) support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
6 years agoBuild: add cpp build processing for dtb
Yann Gautier [Mon, 18 Jun 2018 14:00:23 +0000 (16:00 +0200)]
Build: add cpp build processing for dtb

This is an add-on feature that allows processing
device tree with external includes.

"-Iinclude" is also added to INCLUDES.
It allows inclusion of dt-bindings files either in dts files or drivers,
as those files will be in include/dt-bindings/.

"-i fdts" is added to the DTC command line.
As the pre-processed files are in build directory, the DT source directory
has to be explicitely included, to manages /include/ directives.

fixes arm-software/tf-issues#595

Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Signed-off-by: Yann Gautier <yann.gautier@st.com>
6 years agoMerge pull request #1426 from antonio-nino-diaz-arm/an/spm-sync
Dimitris Papastamos [Mon, 18 Jun 2018 08:44:26 +0000 (09:44 +0100)]
Merge pull request #1426 from antonio-nino-diaz-arm/an/spm-sync

SPM: Refactor entry and exit of the SP

6 years agoMerge pull request #1422 from Yann-lms/genmask
Dimitris Papastamos [Mon, 18 Jun 2018 08:43:56 +0000 (09:43 +0100)]
Merge pull request #1422 from Yann-lms/genmask

Genmask

6 years agoSPM: Refactor entry and exit of the SP
Antonio Nino Diaz [Fri, 15 Jun 2018 15:21:01 +0000 (16:21 +0100)]
SPM: Refactor entry and exit of the SP

Only use synchronous calls to enter the Secure Partition in order to
simplify the SMC handling code.

Change-Id: Ia501a045585ee0836b9151141ad3bd11d0971be2
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoPanic in BL1 when TB_FW_CONFIG is invalid
John Tsichritzis [Fri, 15 Jun 2018 10:43:02 +0000 (11:43 +0100)]
Panic in BL1 when TB_FW_CONFIG is invalid

In Arm platforms, when using dynamic configuration, the necessary
parameters are made available as a DTB. The DTB is loaded by BL1 and,
later on, is parsed by BL1, BL2 or even both, depending on when
information from the DTB is needed.

When the DTB is going to be parsed, it must be validated first, to
ensure that it is properly structured. If an invalid DTB is detected
then:
  - BL1 prints a diagnostic but allows execution to continue,
  - BL2 prints a diagnostic and panics.

Now the behaviour of BL1 is changed so for it also to panic. Thus, the
behaviour of BL1 and BL2 is now similar.

Keep in mind that if BL1 only loads the DTB but it doesn't need to
read/write it, then it doesn't validate it. The validation is done only
when the DTB is actually going to be accessed.

Change-Id: Idcae6092e6dbeab7248dd5e041d6cbb7784fe410
Signed-off-by: John Tsichritzis <john.tsichritzis@arm.com>
6 years agoallwinner: Add security setup
Andre Przywara [Fri, 1 Jun 2018 01:01:39 +0000 (02:01 +0100)]
allwinner: Add security setup

Some peripherals are TrustZone aware, so they need to be configured to
be accessible from non-secure world, as we don't need any of them being
exclusive to the secure world.
This affects some clocks, DMA channels and the Secure Peripheral
Controller (SPC). The latter controls access to most devices, but is not
active unless booting with the secure boot fuse burnt.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
6 years agoallwinner: Add platform PSCI functions required for SMP
Samuel Holland [Sat, 12 Aug 2017 09:07:39 +0000 (04:07 -0500)]
allwinner: Add platform PSCI functions required for SMP

The reset vector entry point is preserved across CPU resets, so it only
needs to be set once at boot.

Hotplugged CPUs are not actually powered down, but are put in a wfi with
the GIC disconnected.

With this commit, Linux is able to enable, hotplug and use all four CPUs.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
6 years agoallwinner: Add functions to control CPU power/reset
Samuel Holland [Sat, 12 Aug 2017 09:07:39 +0000 (04:07 -0500)]
allwinner: Add functions to control CPU power/reset

sun50i_cpu_on will be used by the PSCI implementation to initialize
secondary cores for SMP. Unfortunately, sun50i_cpu_off is not usable by
PSCI directly, because it is not possible for a CPU to use this function
to power itself down. Power cannot be shut off until the outputs are
clamped, and MMIO does not work once the outputs are clamped.

But at least CPU0 can shutdown the other cores early in the BL31 boot
process and before shutting down the system.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
6 years agoallwinner: Add Allwinner A64 support
Samuel Holland [Sat, 12 Aug 2017 09:07:39 +0000 (04:07 -0500)]
allwinner: Add Allwinner A64 support

The Allwinner A64 SoC is quite popular on single board computers.
It comes with four Cortex-A53 cores in a singe cluster and the usual
peripherals for set-top box/tablet SoC.

The ATF platform target is called "sun50i_a64".

[Andre: adapted to amended directory layout, removed unneeded definitions ]

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
6 years agoallwinner: Introduce basic platform support
Samuel Holland [Sat, 12 Aug 2017 09:07:39 +0000 (04:07 -0500)]
allwinner: Introduce basic platform support

This platform supports Allwinner's SoCs with ARMv8 cores. So far they
all sport a single cluster of Cortex-A53 cores.

"sunxi" is the original code name used for this platform, and since it
appears in the Linux kernel and in U-Boot as well, we use it here as a
short file name prefix and for identifiers.

This port includes BL31 support only. U-Boot's SPL takes the role of the
primary loader, also doing the DRAM initialization. It then loads the
rest of the firmware, namely ATF and U-Boot (BL33), then hands execution
over to ATF.

This commit includes the basic platform code shared across all SoCs.
There is no platform.mk yet.

[Andre: moved files into proper directories, supported RESET_TO_BL31,
various clean ups and simplifications ]

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
6 years agosgi/mmap: Remove SGI specific MMAP functions
Chandni Cherukuri [Thu, 14 Jun 2018 11:17:43 +0000 (16:47 +0530)]
sgi/mmap: Remove SGI specific MMAP functions

Remove the redundant SGI functions which map memory
for BL1 and BL2.

Change-Id: I651a06d0eb6d28263a56f59701bb3815f1ba93dc
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
6 years agosgi/dyncfg: add system-id node in hw-config dtb
Chandni Cherukuri [Thu, 10 May 2018 06:33:50 +0000 (12:03 +0530)]
sgi/dyncfg: add system-id node in hw-config dtb

Append a node to hw-config dtb which will include a property to hold
the value of the SSC_VERSION register. This will be used by the BL33
stage to determine the platform-id and the config-id of the platform
it is executing on.

Change-Id: Ie7b1e5d8c1bbe0efdb7ef0714f14b7794ec6058e
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
6 years agosgi/dyncfg: add dts files to enable support for dynamic config
Chandni Cherukuri [Thu, 10 May 2018 04:46:42 +0000 (10:16 +0530)]
sgi/dyncfg: add dts files to enable support for dynamic config

Remove the existing method of populating the platform id in arg2 of
BL33 which is no longer needed with dynamic configuration feature
enabled as the BL33 will get this information directly via the config
files. Add the tb_fw_config and hw_config dts files.

Change-Id: I3c93fec2aedf9ef1f774a5f0969d2d024e47ed2c
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
6 years agoutils: Add BIT_32 and BIT_64 macros
Yann Gautier [Thu, 14 Jun 2018 11:28:31 +0000 (13:28 +0200)]
utils: Add BIT_32 and BIT_64 macros

When applying some MISRA rules, lots of issues are raised with BIT macro
on AARCH32, and cast on uint32_t would be required (Rule 10.3).
The macros BIT_32 and BIT_64 are then created for 32bit and 64bit.
Then the BIT macro defaults on BIT_64 on AARCH64,
and on BIT_32 on AARCH32.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
6 years agoAdd GENMASK macros
Yann Gautier [Thu, 14 Jun 2018 16:35:33 +0000 (18:35 +0200)]
Add GENMASK macros

Import GENMASK_32 and GENMASK_64 macros from optee-os (permissive license).
And default GENMASK is set to GENMASK_32 for AARCH32,
and to GENMASK_64 for 64bit arch.

fixes arm-software/tf-issues#596

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@st.com>
6 years agoMerge pull request #1414 from antonio-nino-diaz-arm/an/fix-rpi3-doc
Dimitris Papastamos [Thu, 14 Jun 2018 13:40:24 +0000 (14:40 +0100)]
Merge pull request #1414 from antonio-nino-diaz-arm/an/fix-rpi3-doc

rpi3: Fix kernel boot documentation

6 years agoMerge pull request #1419 from danielboulby-arm/db/docs
Dimitris Papastamos [Thu, 14 Jun 2018 13:35:17 +0000 (14:35 +0100)]
Merge pull request #1419 from danielboulby-arm/db/docs

Correct ordering of log levels in documentation

6 years agoMerge pull request #1417 from paulkocialkowski/integration
Dimitris Papastamos [Thu, 14 Jun 2018 13:34:46 +0000 (14:34 +0100)]
Merge pull request #1417 from paulkocialkowski/integration

rockchip: Move stdint header to the offending header file

6 years agoMerge pull request #1415 from antonio-nino-diaz-arm/an/spm-fixes
Dimitris Papastamos [Thu, 14 Jun 2018 13:33:13 +0000 (14:33 +0100)]
Merge pull request #1415 from antonio-nino-diaz-arm/an/spm-fixes

Minor fixes to SPM

6 years agoMerge pull request #1412 from masahir0y/uniphier
Dimitris Papastamos [Thu, 14 Jun 2018 13:32:41 +0000 (14:32 +0100)]
Merge pull request #1412 from masahir0y/uniphier

uniphier: fix CCI-500 connection for LD20

6 years agoxlat_v2: add a check on mm_cursor->size to avoid infinite loop
Yann Gautier [Thu, 14 Jun 2018 12:36:20 +0000 (14:36 +0200)]
xlat_v2: add a check on mm_cursor->size to avoid infinite loop

The issue can occur if end_va is equal to the max architecture address,
and when mm_cursor point to the last entry of mmap_region_t table: {0}.
The first line of the while will then be true, e.g. on AARCH32, we have:
mm_cursor->base_va (=0) + mm_cursor->size (=0) - 1 == end_va (=0xFFFFFFFF)
And the mm_cursor->size = 0 will be lesser than mm->size

A check on mm_cursor->size != 0 should be done as in the previous while,
to avoid such kind of infinite loop.

fixes arm-software/tf-issues#594

Signed-off-by: Yann Gautier <yann.gautier@st.com>
6 years agoCorrect ordering of log levels in documentation
Daniel Boulby [Thu, 14 Jun 2018 09:07:40 +0000 (10:07 +0100)]
Correct ordering of log levels in documentation

Changed the ordering of the log levels in the documentation to
mate the code

Change-Id: Ief1930b73d833fdf675b039c98046591c0c264c1
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
6 years agorockchip: Move stdint header to the offending header file
Paul Kocialkowski [Wed, 13 Jun 2018 18:37:25 +0000 (20:37 +0200)]
rockchip: Move stdint header to the offending header file

The stdint header was introduced to rk3399's plat_sip_calls.c in order
to fix missing stdint definitions. However, ordering headers
alphabetically caused the fix to be ineffective, as stint was then
included after the offending header file (dfs.h).

Move the stdint include to that header to properly fix the issue.

Change-Id: Ieaad37a7932786971488ab58fc5b169bfa79e197
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
6 years agorpi3: Fix kernel boot documentation
Antonio Nino Diaz [Wed, 13 Jun 2018 12:34:46 +0000 (13:34 +0100)]
rpi3: Fix kernel boot documentation

The order of the arguments of memmap was swapped. The old command was
reserving 256 MiB from the 16 MiB barrier, it should be reserving only
16 MiB at the 256 MiB barrier.

It worked because the memory used by the Trusted Firmware was reserved
anyway.

Change-Id: I3fefcfc0105ecf05ba5606517bc3236f4eb24ceb
Tested-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoMerge pull request #1402 from glneo/for-upstream-uart
Dimitris Papastamos [Wed, 13 Jun 2018 13:19:53 +0000 (14:19 +0100)]
Merge pull request #1402 from glneo/for-upstream-uart

drivers: ti: uart: Add TI specific 16550 initialization

6 years agoMerge pull request #1399 from danielboulby-arm/db/MISRA
Dimitris Papastamos [Wed, 13 Jun 2018 12:32:14 +0000 (13:32 +0100)]
Merge pull request #1399 from danielboulby-arm/db/MISRA

MISRA 5.1, 5.3 & 5.7 compliance changes

6 years agoSPM: Treat SP xlat tables the same as others
Sandrine Bailleux [Wed, 6 Jun 2018 14:35:40 +0000 (16:35 +0200)]
SPM: Treat SP xlat tables the same as others

The translation tables allocated for the Secure Partition do not need
to be treated as a special case. They can be put amongst the other
tables mapping BL31's general purpose memory. They will be mapped with
the same attributes as them, which is fine.

The explicit alignment constraint in BL31's linker script to pad the
last page of memory allocated to the Secure Partition's translation
tables is useless too, as page tables are per se pages, thus their
end address is naturally aligned on a page-boundary.

In fact, this patch does not change the existing behaviour. Since
patch 22282bb68a31 ("SPM: Move all SP-related info to SP context
struct"), the secure_partition.c file has been renamed into sp_xlat.c
but the linker script has not been properly updated. As a result, the
SP translation tables are not specifically put at the start of the
xlat_table linker section, the __SP_IMAGE_XLAT_TABLES_START__/_END__
symbols have the same value, the size of the resulting mmap_region
covering these xlat tables is 0 and so it is ignored.

Change-Id: I4cf0a4cc090298811cca53fc9cee74df0f2b1512
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
6 years agoxlat v2: Introduce xlat granule size helpers
Antonio Nino Diaz [Mon, 11 Jun 2018 12:40:32 +0000 (13:40 +0100)]
xlat v2: Introduce xlat granule size helpers

The function xlat_arch_is_granule_size_supported() can be used to check
if a specific granule size is supported. In Armv8, AArch32 only supports
4 KiB pages. AArch64 supports 4 KiB, 16 KiB or 64 KiB depending on the
implementation, which is detected at runtime.

The function xlat_arch_get_max_supported_granule_size() returns the max
granule size supported by the implementation.

Even though right now they are only used by SPM, they may be useful in
other places in the future. This patch moves the code currently in SPM
to the xlat tables lib so that it can be reused.

Change-Id: If54624a5ecf20b9b9b7f38861b56383a03bbc8a4
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoSPM: Initialize SP args as expected by cm library
Antonio Nino Diaz [Mon, 11 Jun 2018 10:01:54 +0000 (11:01 +0100)]
SPM: Initialize SP args as expected by cm library

In the context management library, cm_setup_context() takes the
information in ep_info to fill the registers x0-x7. This patch replaces
the current code that sets them manually by the correct initialization
code.

Change-Id: Id1fdf4681b154026c2e3af1f9b05b19582b7d16d
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoLOAD_IMAGE_V1: Align BL2 memory layout struct to 8 bytes
Antonio Nino Diaz [Mon, 14 May 2018 14:45:31 +0000 (15:45 +0100)]
LOAD_IMAGE_V1: Align BL2 memory layout struct to 8 bytes

In LOAD_IMAGE_V1 (i.e when LOAD_IMAGE_V2=0) the bl2_tzram_layout is,
by default, assigned to the bl1_tzram_layout->free_base which is
dynamically calculated based on the images loaded in memory. There is a
chance that the bl2_tzram_layout will be assigned a value not aligned to
8 bytes. This patch rounds up the free_base value for the required
alignment.

This doesn't happen in LOAD_IMAGE_V2 because the bl2_tzram_layout is
assigned by default to the bl1_tzram_layout->total_base, which is
aligned.

Change-Id: Idc583e7dad993d02ac6791797406118c96f83fa1
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoFix MISRA Rule 5.7 Part 3
Daniel Boulby [Tue, 15 May 2018 10:41:55 +0000 (11:41 +0100)]
Fix MISRA Rule 5.7 Part 3

Rule 5.7: A tag name shall be a unique identifier

Follow convention of shorter names for smaller scope to fix
violations of MISRA rule 5.7

Fixed For:
    make ARM_TSP_RAM_LOCATION=tdram LOG_LEVEL=50 PLAT=fvp SPD=opteed

Change-Id: I5fbb5d6ebddf169550eddb07ed880f5c8076bb76
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
6 years agoFix MISRA Rule 5.7 Part 2
Daniel Boulby [Mon, 14 May 2018 16:18:58 +0000 (17:18 +0100)]
Fix MISRA Rule 5.7 Part 2

Follow convention of shorter names for smaller scope to fix
violations of MISRA rule 5.7

To prevent violation of directive 4.5 having variable name channel
in css_pm_scmi.c not being typographically ambiguous change macro
argument CHANNEL in css_mhu_doorbell.h change argument to _channel
to fit with our convention which is a permitted exception of
directive 4.5 for this project

Rule 5.7: A tag name shall be a unique identifier

Fixed for:
    make LOG_LEVEL=50 PLAT=juno

Change-Id: I147cdb13553e83ed7df19149b282706db115d612
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
6 years agoFix MISRA Rule 5.7 Part 1
Daniel Boulby [Thu, 3 May 2018 09:59:09 +0000 (10:59 +0100)]
Fix MISRA Rule 5.7 Part 1

Rule 5.7: A tag name shall be a unique identifier

There were 2 amu_ctx struct type definitions:
    - In lib/extensions/amu/aarch64/amu.c
    - In lib/cpus/aarch64/cpuamu.c

Renamed the latter to cpuamu_ctx to avoid this name clash

To avoid violation of Rule 8.3 also change name of function
amu_ctxs to unique name (cpuamu_ctxs) since it now returns a
different type (cpuamu_ctx) than the other amu_ctxs function

Fixed for:
    make LOG_LEVEL=50 PLAT=fvp

Change-Id: Ieeb7e390ec2900fd8b775bef312eda93804a43ed
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
6 years agoFix MISRA Rule 5.3 Part 5
Daniel Boulby [Wed, 9 May 2018 11:21:46 +0000 (12:21 +0100)]
Fix MISRA Rule 5.3 Part 5

Use a _ prefix for macro arguments to prevent that argument from
hiding variables of the same name in the outer scope

Rule 5.3: An identifier declared in an inner scope shall not
          hide an identifier declared in an outer scope

Fixed For:
    make LOG_LEVEL=50 PLAT=juno

Change-Id: I575fbc96e8267f2b075e88def1f6e3185394613a
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
6 years agoFix MISRA Rule 5.3 Part 4
Daniel Boulby [Wed, 9 May 2018 10:29:07 +0000 (11:29 +0100)]
Fix MISRA Rule 5.3 Part 4

Use a _ prefix for macro arguments to prevent that argument from
hiding variables of the same name in the outer scope

Rule 5.3: An identifier declared in an inner scope shall not
          hide an identifier declared in an outer scope

Fixed For:
    make PLAT=fvp USE_COHERENT_MEM=0

Change-Id: If50c583d3b63799ee6852626b15be00c0f6b10a0
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
6 years agoFix MISRA Rule 5.3 Part 3
Daniel Boulby [Wed, 9 May 2018 09:28:12 +0000 (10:28 +0100)]
Fix MISRA Rule 5.3 Part 3

Use a _ prefix for macro arguments to prevent that argument from
hiding variables of the same name in the outer scope

Rule 5.3: An identifier declared in an inner scope shall not
          hide an identifier declared in an outer scope

Fixed For:
    make PLAT=fvp SPD=tspd

Change-Id: I2d711b9584c4cb9ba3814ecd2ca65a42b7e24179
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
6 years agoFix MISRA Rule 5.3 Part 2
Daniel Boulby [Fri, 4 May 2018 13:04:07 +0000 (14:04 +0100)]
Fix MISRA Rule 5.3 Part 2

Use a _ prefix for Macro arguments to prevent that argument from
hiding variables of the same name in the outer scope

Rule 5.3: An identifier declared in an inner scope shall not
          hide an identifier declared in an outer scope

Fixed For:
    make LOG_LEVEL=50 PLAT=fvp

Change-Id: I67b6b05cbad4aeca65ce52981b4679b340604708
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
6 years agoFix MISRA Rule 5.3 Part 1
Daniel Boulby [Fri, 4 May 2018 10:18:26 +0000 (11:18 +0100)]
Fix MISRA Rule 5.3 Part 1

Conflict with function name and variable name within that function.
Change the name of the function from image_size to get_image_size
to remove conflict and make the function fit the normal project
naming convention.

Rule 5.3:  An identifier declared in an inner scope shall not
           hide an identifier declared in an outer scope

Fixed For:
    make LOG_LEVEL=50 PLAT=fvp

Change-Id: I1a63d2730113e2741fffa79730459c584b0224d7
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
6 years agoFix MISRA Rule 5.1
Daniel Boulby [Tue, 1 May 2018 14:15:34 +0000 (15:15 +0100)]
Fix MISRA Rule 5.1

Rule 5.1: External identifiers shall be distinct

Some of the identifier names in the GICv3 driver were so long that the
first 31 characters were identical. This patch shortens these names to
make sure they are different.

Fixed for:
    LOG_LEVEL=50 PLAT=fvp

Change-Id: Iecd551e3a015d144716b87b42c83dd3ab8c34d90
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
6 years agoMerge pull request #1391 from jts-arm/misra
Dimitris Papastamos [Tue, 12 Jun 2018 12:01:35 +0000 (13:01 +0100)]
Merge pull request #1391 from jts-arm/misra

MISRA rule 21.15 fix

6 years agouniphier: fix CCI-500 connection for LD20
Satoshi Ikawa [Tue, 12 Jun 2018 01:23:29 +0000 (10:23 +0900)]
uniphier: fix CCI-500 connection for LD20

The slave ports of LD20 CCI-500 are connected as follows:

  S0: CA53
  S1: CA72

Be careful because the slave interface is not arranged in the
cluster number order (CA72: cluster 0, CA53: cluster 1).

Root-caused-by: Tetsuya Yoshizaki <yoshizaki.tetsuya@socionext.com>
Signed-off-by: Satoshi Ikawa <ikawa.satoshi@socionext.com>
6 years agodrivers: ti: uart: Add TI specific 16550 initialization
Benjamin Fair [Fri, 14 Oct 2016 01:13:33 +0000 (01:13 +0000)]
drivers: ti: uart: Add TI specific 16550 initialization

On TI platforms the UART is disabled by default and must be explicitly
enabled using the MDR1 register.

NOTE: The original definition of
http://www.ti.com/lit/ds/symlink/pc16550d.pdf has no MDR register, but
many TI SoCs implementing 16550 do have a quirky MDR register
implemented. So, this should be enabled with TI_16550_MDR_QUIRK

NOTE: In such implementation, the CSR register does not exist.

Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
6 years agoAdjust BL2_AT_EL3 memory layout
Dimitris Papastamos [Mon, 11 Jun 2018 10:07:58 +0000 (11:07 +0100)]
Adjust BL2_AT_EL3 memory layout

For the BL2_AT_EL3 configuration, move BL2 higher up to make more
space for BL31.  Adjust the BL31 limit to be up to BL2 base.  This is
because BL2 is always resident for the BL2_AT_EL3 configuration and
thus we cannot overlay it with BL31.

Change-Id: I71e89863ed48f5159e8b619f49c7c73b253397aa
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
6 years agoMISRA rule 21.15 fix
John Tsichritzis [Fri, 25 May 2018 08:12:48 +0000 (09:12 +0100)]
MISRA rule 21.15 fix

    Rule 21.15: The pointer arguments to the Standard Library functions
    memcpy, memmove and memcmp shall be pointers to qualified or unqualified
    versions of compatible types.

    Basically that means that both pointer arguments must be of the same
    type. However, even if the pointers passed as arguments to the above
    functions are of the same type, Coverity still thinks it's a violation
    if we do pointer arithmetics directly at the function call. Thus the
    pointer arithmetic operations were moved outside of the function
    argument.

    First detected on the following configuration
            make PLAT=fvp LOG_LEVEL=50

    Change-Id: I8b912ec1bfa6f2d60857cb1bd453981fd7001b94
Signed-off-by: John Tsichritzis <john.tsichritzis@arm.com>
6 years agoMerge pull request #1397 from dp-arm/dp/cortex-a76
Dimitris Papastamos [Fri, 8 Jun 2018 13:01:38 +0000 (14:01 +0100)]
Merge pull request #1397 from dp-arm/dp/cortex-a76

Add support for Cortex-A76 and Cortex-Ares

6 years agoMerge pull request #1409 from ARM-software/revert-1389-db/bugfix
Dimitris Papastamos [Fri, 8 Jun 2018 12:17:47 +0000 (13:17 +0100)]
Merge pull request #1409 from ARM-software/revert-1389-db/bugfix

Revert "Code change to fix small bugs"

6 years agoRevert "Code change to fix small bugs"
Dimitris Papastamos [Fri, 8 Jun 2018 12:17:26 +0000 (13:17 +0100)]
Revert "Code change to fix small bugs"

6 years agoMerge pull request #1405 from dp-arm/dp/cve_2017_5715
Dimitris Papastamos [Fri, 8 Jun 2018 10:47:13 +0000 (11:47 +0100)]
Merge pull request #1405 from dp-arm/dp/cve_2017_5715

Fast path SMCCC_ARCH_WORKAROUND_1 calls from AArch32

6 years agoSDEI: Ensure SDEI handler executes with CVE-2018-3639 mitigation enabled
Dimitris Papastamos [Thu, 7 Jun 2018 10:29:15 +0000 (11:29 +0100)]
SDEI: Ensure SDEI handler executes with CVE-2018-3639 mitigation enabled

When dynamic mitigation is used, the SDEI handler is required to
execute with the mitigation enabled by default, regardless of the
mitigation state for lower ELs.  This means that if the kernel or
hypervisor explicitly disables the mitigation and then later when the
event is dispatched, the dispatcher will remember the mitigation state
for the lower ELs but force the mitigation to be on during the SDEI
handler execution.  When the SDEI handler returns, it will restore the
mitigation state.

This behaviour is described in "Firmware interfaces for mitigating
cache speculation vulnerabilities System Software on Arm Systems"[0].

[0] https://developer.arm.com/cache-speculation-vulnerability-firmware-specification

Change-Id: I8dd60b736be0aa9e832b0f92d67a401fdeb417f4
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
6 years agoImplement dynamic mitigation for CVE-2018-3639 on Cortex-A76
Dimitris Papastamos [Wed, 16 May 2018 08:59:54 +0000 (09:59 +0100)]
Implement dynamic mitigation for CVE-2018-3639 on Cortex-A76

The Cortex-A76 implements SMCCC_ARCH_WORKAROUND_2 as defined in
"Firmware interfaces for mitigating cache speculation vulnerabilities
System Software on Arm Systems"[0].

Dynamic mitigation for CVE-2018-3639 is enabled/disabled by
setting/clearning bit 16 (Disable load pass store) of `CPUACTLR2_EL1`.

NOTE: The generic code that implements dynamic mitigation does not
currently implement the expected semantics when dispatching an SDEI
event to a lower EL.  This will be fixed in a separate patch.

[0] https://developer.arm.com/cache-speculation-vulnerability-firmware-specification

Change-Id: I8fb2862b9ab24d55a0e9693e48e8be4df32afb5a
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
6 years agoSet DYNAMIC_WORKAROUND_CVE_2018_3639=1 on FVP by default
Dimitris Papastamos [Thu, 31 May 2018 13:10:06 +0000 (14:10 +0100)]
Set DYNAMIC_WORKAROUND_CVE_2018_3639=1 on FVP by default

The upcoming patch that adds dynamic mitigation for Cortex-A76
requires that DYNAMIC_WORKAROUND_CVE_2018_3639=1.  On FVP, we pull in
all the CPU files into the build which means there will be a build
failure if DYNAMIC_WORKAROUND_CVE_2018_3639=0.

Change-Id: I2e781cbeafbf5d16eaabf76a1677e0c9f81269d2
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
6 years agoImplement Cortex-Ares 1043202 erratum workaround
Dimitris Papastamos [Mon, 26 Mar 2018 15:46:01 +0000 (16:46 +0100)]
Implement Cortex-Ares 1043202 erratum workaround

The workaround uses the instruction patching feature of the Ares cpu.

Change-Id: I868fce0dc0e8e41853dcce311f01ee3867aabb59
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
6 years agoAdd AMU support for Cortex-Ares
Dimitris Papastamos [Tue, 13 Feb 2018 11:28:02 +0000 (11:28 +0000)]
Add AMU support for Cortex-Ares

Change-Id: Ia170c12d3929a616ba80eb7645c301066641f5cc
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
6 years agoAdd support for Cortex-Ares and Cortex-A76 CPUs
Isla Mitchell [Thu, 3 Aug 2017 15:04:46 +0000 (16:04 +0100)]
Add support for Cortex-Ares and Cortex-A76 CPUs

Both Cortex-Ares and Cortex-A76 CPUs use the ARM DynamIQ Shared Unit
(DSU).  The power-down and power-up sequences are therefore mostly
managed in hardware, and required software operations are simple.

Change-Id: I3a9447b5bdbdbc5ed845b20f6564d086516fa161
Signed-off-by: Isla Mitchell <isla.mitchell@arm.com>
6 years agoMerge pull request #1389 from danielboulby-arm/db/bugfix
Dimitris Papastamos [Fri, 8 Jun 2018 10:45:06 +0000 (11:45 +0100)]
Merge pull request #1389 from danielboulby-arm/db/bugfix

Code change to fix small bugs

6 years agoMerge pull request #1407 from soby-mathew/sm/juno_bl1_size
Dimitris Papastamos [Fri, 8 Jun 2018 09:50:09 +0000 (10:50 +0100)]
Merge pull request #1407 from soby-mathew/sm/juno_bl1_size

Juno: Bump up the BL1-RW size

6 years agoJuno: Bump up the BL1-RW size
Soby Mathew [Thu, 7 Jun 2018 14:23:39 +0000 (15:23 +0100)]
Juno: Bump up the BL1-RW size

This patch bumps up the BL1-RW size for Juno and at the same time reduces
the BL2 size when TBB is enabled, TF_MBEDTLS_KEY_ALG=rsa+ecdsa. The BL2
size for this config is reduced as it was observed that the peak memory
usage is only reached when SPD=opteed and the dual rsa+ecdsa support is
not needed for this case.

Change-Id: Ia9009771b5cfd805e9cc75410aabb7db99fc2fbc
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
6 years agoMerge pull request #1404 from soby-mathew/sm/bl_layout_change
Dimitris Papastamos [Thu, 7 Jun 2018 13:49:25 +0000 (14:49 +0100)]
Merge pull request #1404 from soby-mathew/sm/bl_layout_change

ARM platforms: Change memory layout and update documentation

6 years agoFast path SMCCC_ARCH_WORKAROUND_1 calls from AArch32
Dimitris Papastamos [Thu, 31 May 2018 10:38:33 +0000 (11:38 +0100)]
Fast path SMCCC_ARCH_WORKAROUND_1 calls from AArch32

When SMCCC_ARCH_WORKAROUND_1 is invoked from a lower EL running in
AArch32 state, ensure that the SMC call will take a shortcut in EL3.
This minimizes the time it takes to apply the mitigation in EL3.

When lower ELs run in AArch32, it is preferred that they execute the
`BPIALL` instruction to invalidate the BTB.  However, on some cores
the `BPIALL` instruction may be a no-op and thus would benefit from
making the SMCCC_ARCH_WORKAROUND_1 call go through the fast path.

Change-Id: Ia38abd92efe2c4b4a8efa7b70f260e43c5bda8a5
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
6 years agodocs: Firmware design update for BL memory layout
Soby Mathew [Wed, 6 Jun 2018 15:03:10 +0000 (16:03 +0100)]
docs: Firmware design update for BL memory layout

This patch updates the firmware design guide for the BL memory
layout change on ARM platforms.

Change-Id: Icbfe7249484bb8b4ba3c94421172d42f27605c52
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
6 years agoARM platforms: Move BL31 below BL2 to enable BL2 overlay
Soby Mathew [Fri, 1 Jun 2018 15:53:38 +0000 (16:53 +0100)]
ARM platforms: Move BL31 below BL2 to enable BL2 overlay

The patch changes the layout of BL images in memory to enable
more efficient use of available space. Previously BL31 was loaded
with the expectation that BL2 memory would be reclaimed by BL32
loaded in SRAM. But with increasing memory requirements in the
firmware, we can no longer fit BL32 in SRAM anymore which means the
BL2 memory is not reclaimed by any runtime image. Positioning BL2
below BL1-RW and above BL31 means that the BL31 NOBITS can be
overlaid on BL2 and BL1-RW.

This patch also propogates the same memory layout to BL32 for AArch32
mode. The reset addresses for the following configurations are also
changed :
   * When RESET_TO_SP_MIN=1 for BL32 in AArch32 mode
   * When BL2_AT_EL3=1 for BL2

The restriction on BL31 to be only in DRAM when SPM is enabled
is now removed with this change. The update to the firmware design
guide for the BL memory layout is done in the following patch.

Change-Id: Icca438e257abe3e4f5a8215f945b9c3f9fbf29c9
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
6 years agoMerge pull request #1392 from dp-arm/dp/cve_2018_3639
Dimitris Papastamos [Tue, 29 May 2018 08:28:05 +0000 (09:28 +0100)]
Merge pull request #1392 from dp-arm/dp/cve_2018_3639

Implement workaround for CVE-2018-3639 on Cortex A57/A72/A73 and A75

6 years agoRemove rt_svc_descs pointer from inner scope
Daniel Boulby [Thu, 3 May 2018 16:11:04 +0000 (17:11 +0100)]
Remove rt_svc_descs pointer from inner scope

A pointer to rt_svc_desc_t was defined both in the
function and globally. The innermost definition
hid the global definition which is the one we want
to use so remove the innermost definition to prevent
this

Change-Id: Idabdbc0947178ae83224bd17a9b170df7c278d51
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
6 years agoRemove duplicate weak definition
Daniel Boulby [Tue, 1 May 2018 11:19:26 +0000 (12:19 +0100)]
Remove duplicate weak definition

The weak pragma was assigned twice to the bl2_plat_handle_post_image_load
definition both in plat/common/ and in plat/arm/common/ this was an error as
it should have only have been defined in plat/common

Change-Id: Id85e14c699cb09ed998d1677f2a172e760911918
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
6 years agoMerge pull request #1395 from antonio-nino-diaz-arm/an/spm-refactor
Dimitris Papastamos [Fri, 25 May 2018 08:47:11 +0000 (09:47 +0100)]
Merge pull request #1395 from antonio-nino-diaz-arm/an/spm-refactor

SPM: Refactor codebase