project/bcm63xx/atf.git
6 years agoRename symbols and files relating to CVE-2017-5715
Dimitris Papastamos [Fri, 6 Apr 2018 14:29:34 +0000 (15:29 +0100)]
Rename symbols and files relating to CVE-2017-5715

This patch renames symbols and files relating to CVE-2017-5715 to make
it easier to introduce new symbols and files for new CVE mitigations.

Change-Id: I24c23822862ca73648c772885f1690bed043dbc7
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
6 years agoMerge pull request #1386 from soby-mathew/sm/dyn_bl31
Dimitris Papastamos [Wed, 23 May 2018 11:45:13 +0000 (12:45 +0100)]
Merge pull request #1386 from soby-mathew/sm/dyn_bl31

Extend dynamic configuration

6 years agoMerge pull request #1393 from geesun/correct_comment
Dimitris Papastamos [Tue, 22 May 2018 09:34:52 +0000 (10:34 +0100)]
Merge pull request #1393 from geesun/correct_comment

Correct some typo errors in comment

6 years agoMerge pull request #1390 from soby-mathew/sm/fvp_rm_dtb
Dimitris Papastamos [Tue, 22 May 2018 09:31:25 +0000 (10:31 +0100)]
Merge pull request #1390 from soby-mathew/sm/fvp_rm_dtb

Remove the DTBs and update userguide for FVP

6 years agoCorrect some typo errors in comment
Qixiang Xu [Mon, 5 Mar 2018 01:31:11 +0000 (09:31 +0800)]
Correct some typo errors in comment

File: include/common/aarch64/el3_common_macros.S

Change-Id: I619401e961a3f627ad8864781b5f90bc747c3ddb
Signed-off-by: Qixiang Xu <qixiang.xu@arm.com>
6 years agoMerge pull request #1359 from danielboulby-arm/db/match_flags_type
Dimitris Papastamos [Mon, 21 May 2018 15:31:04 +0000 (16:31 +0100)]
Merge pull request #1359 from danielboulby-arm/db/match_flags_type

Ensure read and write of flags defined in the console struct are 32 bit

6 years agoFVP: Add dummy configs for BL31, BL32 and BL33
Soby Mathew [Wed, 4 Apr 2018 08:40:32 +0000 (09:40 +0100)]
FVP: Add dummy configs for BL31, BL32 and BL33

This patch adds soc_fw_config, tos_fw_config and nt_fw_config to the FVP.
The config files are placeholders and do not have any useful bindings
defined. The tos_fw_config is packaged in FIP and loaded by BL2 only
if SPD=tspd. The load address of these configs are specified in tb_fw_config
via new bindings defined for these configs. Currently, in FVP, the
soc_fw_config and tos_fw_config is loaded in the page between BL2_BASE
and ARM_SHARED_RAM. This memory was typically used for BL32 when
ARM_TSP_RAM_LOCATION=tsram but since we cannot fit BL32 in that
space anymore, it should be safe to use this memory for these configs.
There is also a runtime check in arm_bl2_dyn_cfg_init() which ensures
that this overlap doesn't happen.

The previous arm_dyn_get_hwconfig_info() is modified to accept configs
other than hw_config and hence renamed to arm_dyn_get_config_load_info().
The patch also corrects the definition of ARM_TB_FW_CONFIG_LIMIT to be
BL2_BASE.

Change-Id: I03a137d9fa1f92c862c254be808b8330cfd17a5a
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
6 years agoDocs: Update user guide for Dynamic Config on FVP
Soby Mathew [Wed, 9 May 2018 12:59:29 +0000 (13:59 +0100)]
Docs: Update user guide for Dynamic Config on FVP

From TF-A v1.5, FVP supports loading the kernel FDT through
firmware as part of dynamic configuration feature. This means
that the FDT no longer needs to be loaded via Model parameters.
This patch updates the user guide to reflect the same.

Change-Id: I79833beeaae44a1564f6512c3a473625e5959f65
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
6 years agoDynamic_config: remove the FVP dtb files
Soby Mathew [Fri, 16 Feb 2018 14:57:24 +0000 (14:57 +0000)]
Dynamic_config: remove the FVP dtb files

Since FVP enables dynamic configuration by default, the DT blobs are
compiled from source and included in FIP during build. Hence this
patch removes the dtb files from the `fdts` folder.

Change-Id: Ic155ecd257384a33eb2aa38c9b4430e47b09cd31
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
6 years agoDynamic cfg: Enable support on CoT for other configs
Soby Mathew [Thu, 29 Mar 2018 13:29:55 +0000 (14:29 +0100)]
Dynamic cfg: Enable support on CoT for other configs

This patch implements support for adding dynamic configurations for
BL31 (soc_fw_config), BL32 (tos_fw_config) and BL33 (nt_fw_config). The
necessary cert tool support and changes to default chain of trust are made
for these configs.

Change-Id: I25f266277b5b5501a196d2f2f79639d838794518
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
6 years agoFVP: Enable capability to disable auth via dynamic config
Soby Mathew [Mon, 26 Mar 2018 14:16:46 +0000 (15:16 +0100)]
FVP: Enable capability to disable auth via dynamic config

This patch adds capability to FVP to disable authentication dynamically
via the `disable_auth` property in TB_FW_CONFIG. Both BL1 and BL2 parses
the TB_FW_CONFIG for the `disable_auth` property and invokes the
`load_dyn_disable_auth()` API to disable authentication if the
property is set to 1. The DYN_DISABLE_AUTH is enabled by default for
FVP as it is a development platform. Note that the TB_FW_CONFIG has to
be authenticated by BL1 irrespective of these settings.

The arm_bl2_dyn_cfg_init() is now earlier in bl2_plat_preload_setup()
rather than in bl2_platform_setup() as we need to get the value of
`disable_auth` property prior to authentication of any image by BL2.

Change-Id: I734acd59572849793e5020ec44c6ac51f654a4d1
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
6 years agoAllow disabling authentication dynamically
Soby Mathew [Mon, 26 Mar 2018 11:43:37 +0000 (12:43 +0100)]
Allow disabling authentication dynamically

This patch allows platforms to dynamically disable authentication of
images during cold boot. This capability is controlled via the
DYN_DISABLE_AUTH build flag and is only meant for development
purposes.

Change-Id: Ia3df8f898824319bb76d5cc855b5ad6c3d227260
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
6 years agoMerge pull request #1369 from sivadur/xilinxdiff
danh-arm [Thu, 17 May 2018 17:20:59 +0000 (18:20 +0100)]
Merge pull request #1369 from sivadur/xilinxdiff

Xilinx platform mangement related changes

6 years agoEnsure read and write of flags are 32 bit
Daniel Boulby [Wed, 16 May 2018 15:04:35 +0000 (16:04 +0100)]
Ensure read and write of flags are 32 bit

In 'console_set_scope' and when registering a console, field 'flags' of
'console_t' is assigned a 32-bit value. However, when it is actually
used, the functions perform 64-bit reads to access its value. This patch
changes all 64-bit reads to 32-bit reads.

Change-Id: I181349371409e60065335f078857946fa3c32dc1
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
6 years agoMerge pull request #1340 from Andre-ARM/sec-irqs-fixes
Dimitris Papastamos [Thu, 17 May 2018 13:35:34 +0000 (14:35 +0100)]
Merge pull request #1340 from Andre-ARM/sec-irqs-fixes

Fix support for systems without secure interrupts

6 years agoMerge pull request #1384 from rockchip-linux/for_m0_patch
Dimitris Papastamos [Thu, 17 May 2018 12:46:57 +0000 (13:46 +0100)]
Merge pull request #1384 from rockchip-linux/for_m0_patch

for rk3399 suspend/resume

6 years agozynqmp: Add wdt timeout restart functionality
Siva Durga Prasad Paladugu [Mon, 30 Apr 2018 14:42:12 +0000 (20:12 +0530)]
zynqmp: Add wdt timeout restart functionality

This patch adds support to restart system incase of wdt
timeout.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
6 years agozynqmp: Fix EG/EV detection logic
Siva Durga Prasad Paladugu [Mon, 5 Mar 2018 13:17:15 +0000 (18:47 +0530)]
zynqmp: Fix EG/EV detection logic

The vcu disable bit in efuse ipdisable register is valid
only if PL powered up so, consider PL powerup status for
determing EG/EV part. If PL is not powered up, display
EG/EV as a part of string. The PL powerup status will
be filled by pmufw based on PL PROGB status in the
9th bit of version field.This patch also used IPI
to get this info from pmufw instead of directly accessing
the registers. Accessing this info from pmufw using
IPI fixes the issue of PMUFW access denied error for
reading IPDISABLE register.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
6 years agozynqmp: Add new API for processing secure images
Siva Durga Prasad Paladugu [Mon, 30 Apr 2018 14:36:58 +0000 (20:06 +0530)]
zynqmp: Add new API for processing secure images

This patch adds new API for processing secure images. This API
is used for authentication and decryption of secure images using
xilsecure in pmufw.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
6 years agoxilinx: zynqmp: pm_service: Fix APU only restart
Tejas Patel [Fri, 9 Feb 2018 10:42:59 +0000 (02:42 -0800)]
xilinx: zynqmp: pm_service: Fix APU only restart

Existing code blocks each IPI send request in ipi_mb_notify()
function till pmu clears respective bit in ipi observation
register.

After sending PM_SYSTEM_SHUTDOWN request to PMU, PMU will
restart APU. While PMU is restarting APU, ATF is running out
of OCM, which can cause read/write hang from/to OCM.
There is no need to wait for notification from PMU in case
of SystemShutdown request in ATF, as APU is going to restart.

This patch fixes APU only restart issue.

Signed-off-by: Tejas Patel <tejasp@xilinx.com>
Acked-by: Wendy Liang <wendy.liang@xilinx.com>
6 years agoplat: xilinx: zynqmp: Make fpga load blocking until completed
Siva Durga Prasad Paladugu [Wed, 7 Feb 2018 07:43:01 +0000 (13:13 +0530)]
plat: xilinx: zynqmp: Make fpga load blocking until completed

This patch makes bitstream load blocking call and waits until
bitstream is loaded successfully or return with error.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Tested-by: Avesh Khan <aveshk@xilinx.com>
6 years agoplat: xilinx: zynqmp: Remove GET_CALLBACK_DATA function
Siva Durga Prasad Paladugu [Mon, 30 Apr 2018 14:23:56 +0000 (19:53 +0530)]
plat: xilinx: zynqmp: Remove GET_CALLBACK_DATA function

GET_CALLBACK_DATA function is not required now. IPI mailbox
can be used instead of GET_CALLBACK_DATA function.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
6 years agozynqmp: pm_service: Make PMU IPI-1 channel unsecure
Rajan Vaja [Tue, 30 Jan 2018 11:59:23 +0000 (03:59 -0800)]
zynqmp: pm_service: Make PMU IPI-1 channel unsecure

PMU IPI-1 is used for callbacks from PMU to master. Unsecure
master can also receive callbacks from PMU, so make PMU IPI-1
as non-secure.

All requests from master(s) to PMU would still go on PMU IPI-1
secure channel.

Signed-off-by: Rajan Vaja <rajanv@xilinx.com>
6 years agozynqmp: pm: Remove unnecessary header includes
Rajan Vaja [Fri, 15 Dec 2017 06:58:07 +0000 (22:58 -0800)]
zynqmp: pm: Remove unnecessary header includes

Remove includes of gic_common.h and string.h which
are not required.

Signed-off-by: Rajan Vaja <rajanv@xilinx.com>
Acked-by: Jolly Shah <jollys@xilinx.com>
6 years agoxilinx: zynqmp: Remove PMU Firmware checks
Siva Durga Prasad Paladugu [Mon, 30 Apr 2018 14:13:03 +0000 (19:43 +0530)]
xilinx: zynqmp: Remove PMU Firmware checks

Xilinx now requires the PMU FW when using ATF, so it doesn't make sense
to maintain checks for the PMU FW in ATF. This also means that cases
where ATF came up before the PMU FW (such as on QEMU) ATF will now hang
waiting for the PMU FW instead of aborting.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
6 years agozynqmp: pm: Reverse logic for detecting that the PMU firmware is loaded
Siva Durga Prasad Paladugu [Mon, 30 Apr 2018 14:09:49 +0000 (19:39 +0530)]
zynqmp: pm: Reverse logic for detecting that the PMU firmware is loaded

Use positive logic (pm_up instead of pm_down) to check whether PMU
services are available. This change also puts the variable into the
BSS section rather than the Data section as the variable is now
initialized to 0 rather than 1.

Signed-off-by: Will Wong <WILLW@xilinx.com>
Signed-off-by: Stefan Krsmanovic <stefan.krsmanovic@aggios.com>
Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
6 years agoplat: zynqmp: Don't panic() if we can't find the FSBL struct
Alistair Francis [Fri, 1 Dec 2017 00:21:21 +0000 (16:21 -0800)]
plat: zynqmp: Don't panic() if we can't find the FSBL struct

If we can't find the FSBL handoff struct don't panic and just use the
defaults instead.

We still print a warning to the user to let them know what we couldn't
find it.

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
6 years agoplat: zynqmp: Let fsbl_atf_handover() return an error status
Siva Durga Prasad Paladugu [Thu, 17 May 2018 09:47:46 +0000 (15:17 +0530)]
plat: zynqmp: Let fsbl_atf_handover() return an error status

Instead of calling panic() in fsbl_atf_handover() return the error
status so that bl31_early_platform_setup() can act accordingly.

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
6 years agoInclude "bl_common.h" in Xilinx zynqmp_private.h
Wendy Liang [Fri, 10 Nov 2017 23:55:16 +0000 (15:55 -0800)]
Include "bl_common.h" in Xilinx zynqmp_private.h

Type "entry_point_info_t" is used in zynqmp_private.h. It is defined
in "bl_common.h". The header file which defines the type should be
included.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
6 years agozynqmp: pm: Added APIs for xilsecure linux support
Siva Durga Prasad Paladugu [Tue, 1 May 2018 05:42:55 +0000 (11:12 +0530)]
zynqmp: pm: Added APIs for xilsecure linux support

Added SHA to calculate SHA3 hash,RSA to encrypt data with
public key and decrypt with private key and AES to do symmetric
encryption with User key or device key.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
6 years agoplat: zynqmp: Add support for CG/EG/EV device detection
Siva Durga Prasad Paladugu [Tue, 1 May 2018 05:40:25 +0000 (11:10 +0530)]
plat: zynqmp: Add support for CG/EG/EV device detection

Read ipdisable reg which needs to be used for cg/eg/ev device detection.
ATF runs in EL3 that's why this read can be done directly.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
6 years agoaarch64: zynqmp: Add new Ids for RFSoC
Siva Durga Prasad Paladugu [Tue, 6 Jun 2017 07:24:52 +0000 (12:54 +0530)]
aarch64: zynqmp: Add new Ids for RFSoC

Add new id codes for RFSoC's.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agozynqmp: Fix CSU ID SVD mask fo getting chip ID
Siva Durga Prasad Paladugu [Tue, 1 Aug 2017 04:53:19 +0000 (10:23 +0530)]
zynqmp: Fix CSU ID SVD mask fo getting chip ID

This patch corrects the SVD mask for getting chip ID
using 0xe is wrong and 0x7 is correct.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
6 years agozynqmp: pm: Allow to set shutdown scope via pm_system_shutdown API
Siva Durga Prasad Paladugu [Mon, 30 Apr 2018 10:26:10 +0000 (15:56 +0530)]
zynqmp: pm: Allow to set shutdown scope via pm_system_shutdown API

psci system_reset and system_off calls now retrieve shutdown scope on
the fly. The default scope is system, but it can be changed by calling
pm_system_shutdown(2, scope)

Until full support for different restart scopes becomes available with
PSCI 1.1 this change allows users to set the reboot scope to match
their application needs.

Possible scope values:
0 - APU subsystem: does not affect RPU, PMU or PL
1 - PS only: shutdown/restart entire PS without affecting PL
2 - System: shutdown/restart applies to entire system

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Davorin Mista <davorin.mista@aggios.com>
6 years agozynqmp: pm: Implement PM_INIT_FINALIZE PM API call
Filip Drazic [Wed, 15 Mar 2017 10:50:47 +0000 (11:50 +0100)]
zynqmp: pm: Implement PM_INIT_FINALIZE PM API call

The PM_INIT_FINALIZE PM API is required to inform the PFW that APU is
done with requesting nodes and that not-requested nodes can be powered
down. If PM is not enabled, this call will never be made and PFW will
never power down any of the nodes which APU can use.

Signed-off-by: Filip Drazic <filip.drazic@aggios.com>
6 years agozynqmp: pm: Rename PM_INIT to PM_INIT_FINALIZE
Filip Drazic [Thu, 16 Mar 2017 15:56:53 +0000 (16:56 +0100)]
zynqmp: pm: Rename PM_INIT to PM_INIT_FINALIZE

Signed-off-by: Filip Drazic <filip.drazic@aggios.com>
6 years agozynqmp: pm: Implemented new pm API to load secure images
Siva Durga Prasad Paladugu [Mon, 30 Apr 2018 10:19:27 +0000 (15:49 +0530)]
zynqmp: pm: Implemented new pm API to load secure images

This patch adds pm_secure_rsaaes() API to provide access to
the xilsecure library for loading secure images

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
6 years agoxilinx: zynqmp: Read bootmode register using PM API
Siva Durga Prasad Paladugu [Mon, 20 Feb 2017 12:25:50 +0000 (17:55 +0530)]
xilinx: zynqmp: Read bootmode register using PM API

Read boot mode register using pm_mmio_read if pmu is
present otherwise access it directly using mmio_read_32().

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
6 years agozynqmp: pm: Decode start address related SMC arguments for pm_req_wakeup
Filip Drazic [Tue, 7 Feb 2017 11:03:57 +0000 (12:03 +0100)]
zynqmp: pm: Decode start address related SMC arguments for pm_req_wakeup

The pm_req_wakeup PM API accepts start address (64-bit unsiged integer)
and a flag stating if address should be used. To save an argument
of the SMC call, flag is encoded in the LSB of the address, since
addresses are word aligned.
Decode start address and use-address flag in the PM SMC handler and
pass them to pm_req_wakeup.

Signed-off-by: Filip Drazic <filip.drazic@aggios.com>
Acked-by: Will Wong <willw@xilinx.com>
6 years agozynqmp: pm: Move pm_client_wakeup call from pm_req_wakeup
Filip Drazic [Tue, 7 Feb 2017 11:03:56 +0000 (12:03 +0100)]
zynqmp: pm: Move pm_client_wakeup call from pm_req_wakeup

Call to pm_client_wakeup from pm_req_wakeup prevented the PM API
call to be used to wake up non-APU processor (e.g. from higher ELs),
since it clears power down request for specified APU processor.
Move this function out of pm_client_wakeup to allow passing wake up
requests to the PMU for other processor in the system.

Signed-off-by: Filip Drazic <filip.drazic@aggios.com>
Acked-by: Will Wong <willw@xilinx.com>
6 years agozynqmp: pm: Remove unused NODE_AFI, add NODE_EXTERN
Mirela Simonovic [Mon, 30 Jan 2017 16:44:00 +0000 (17:44 +0100)]
zynqmp: pm: Remove unused NODE_AFI, add NODE_EXTERN

NODE_EXTERN is the slave node which represents an external wake
source.

Signed-off-by: Mirela Simonovic <mirela.simonovic@aggios.com>
Acked-by: Will Wong <willw@xilinx.com>
6 years agozynqmp: pm: Add support for setting suspend-to-RAM mode
Siva Durga Prasad Paladugu [Fri, 27 Apr 2018 10:56:47 +0000 (16:26 +0530)]
zynqmp: pm: Add support for setting suspend-to-RAM mode

Beside standard suspend-to-RAM state, Zynq MPSoC supports
suspend-to-RAM state with additional power savings, called
power-off suspend-to-RAM. If this mode is set, only NODE_EXTERN
must be set as wake source. Standard suspend-to-RAM procedure
is unchanged.

This patch adds support for setting suspend mode from higher
ELs and ensuring that all conditions for power-off suspend mode
are set.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Filip Drazic <filip.drazic@aggios.com>
6 years agozynqmp: pm: Implement pm_get_node_status API function
Anes Hadziahmetagic [Fri, 27 Jan 2017 17:42:44 +0000 (18:42 +0100)]
zynqmp: pm: Implement pm_get_node_status API function

pm_get_node_status API function returns 3 values:
-status: Current power state of the node
-requirements: Current requirements for the node
-usage: Current usage of the node
The last two values only apply to slave nodes.

Signed-off-by: Anes Hadziahmetagic <anes.hadziahmetagic@aggios.com>
Signed-off-by: Filip Drazic <filip.drazic@aggios.com>
Acked-by: Will Wong <willw@xilinx.com>
6 years agoMerge pull request #1387 from vishwanathahg/sgi575/core_pos_calc
Dimitris Papastamos [Wed, 16 May 2018 14:23:18 +0000 (15:23 +0100)]
Merge pull request #1387 from vishwanathahg/sgi575/core_pos_calc

Sgi575/core pos calc

6 years agoMerge pull request #1383 from sandrine-bailleux-arm/topics/sb/sp-access-fpregs
Dimitris Papastamos [Wed, 16 May 2018 13:27:06 +0000 (14:27 +0100)]
Merge pull request #1383 from sandrine-bailleux-arm/topics/sb/sp-access-fpregs

SPM: Do not trap S-EL0 access to SVE/SIMD/FP regs

6 years agoMerge pull request #1382 from sandrine-bailleux-arm/topics/sb/fix-doc
Dimitris Papastamos [Wed, 16 May 2018 13:26:52 +0000 (14:26 +0100)]
Merge pull request #1382 from sandrine-bailleux-arm/topics/sb/fix-doc

Fix doc for bl31_plat_get_next_image_ep_info()

6 years agoMerge pull request #1381 from antonio-nino-diaz-arm/an/kernel-boot
Dimitris Papastamos [Wed, 16 May 2018 13:26:28 +0000 (14:26 +0100)]
Merge pull request #1381 from antonio-nino-diaz-arm/an/kernel-boot

plat/arm: Introduce ARM_LINUX_KERNEL_AS_BL33 build option

6 years agoMerge pull request #1378 from vwadekar/denver-cve-2017-5715
Dimitris Papastamos [Wed, 16 May 2018 09:59:25 +0000 (10:59 +0100)]
Merge pull request #1378 from vwadekar/denver-cve-2017-5715

CVE-2017-5715 mitigation for Denver CPUs

6 years agocss/sgi: rework the core position calculation function
Vishwanatha HG [Tue, 8 May 2018 11:45:37 +0000 (17:15 +0530)]
css/sgi: rework the core position calculation function

The MT bit in MPIDR is always set for SGI platforms and so the
core position calculation code is updated to take into account
the thread affinity value as well.

Change-Id: I7b2a52707f607dc3859c6bbcd2b145b7987cb4ed
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
Signed-off-by: Vishwanatha HG <vishwanatha.hg@arm.com>
6 years agocss/sgi: remove redundant copy of gic driver data
Vishwanatha HG [Tue, 8 May 2018 10:47:31 +0000 (16:17 +0530)]
css/sgi: remove redundant copy of gic driver data

Instead of instantiating a local copy of GICv3 driver data for SGI
platforms, reuse the existing instance of GICv3 driver data available
in the arm common platform code.

Change-Id: If6f38e15d1f0e20cea96fff98091da300015d295
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
Signed-off-by: Vishwanatha HG <vishwanatha.hg@arm.com>
6 years agoWorkaround for CVE-2017-5715 on NVIDIA Denver CPUs
Varun Wadekar [Thu, 11 Jan 2018 01:03:22 +0000 (17:03 -0800)]
Workaround for CVE-2017-5715 on NVIDIA Denver CPUs

Flush the indirect branch predictor and RSB on entry to EL3 by issuing
a newly added instruction for Denver CPUs. Support for this operation
can be determined by comparing bits 19:16 of ID_AFR0_EL1 with 0b0001.

To achieve this without performing any branch instruction, a per-cpu
vbar is installed which executes the workaround and then branches off
to the corresponding vector entry in the main vector table. A side
effect of this change is that the main vbar is configured before any
reset handling. This is to allow the per-cpu reset function to override
the vbar setting.

Change-Id: Ief493cd85935bab3cfee0397e856db5101bc8011
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
6 years agoMerge pull request #1376 from vwadekar/cm-init-actlr-el1
Dimitris Papastamos [Tue, 15 May 2018 17:40:46 +0000 (18:40 +0100)]
Merge pull request #1376 from vwadekar/cm-init-actlr-el1

lib: el3_runtime: initialise actlr_el1 to hardware defaults

6 years agoMerge pull request #1380 from CJKay/mmap-fix
Dimitris Papastamos [Tue, 15 May 2018 17:40:19 +0000 (18:40 +0100)]
Merge pull request #1380 from CJKay/mmap-fix

Fix incorrect number of reserved memory map entries for Arm platforms

6 years agoMerge pull request #1379 from CJKay/nsram-fix
Dimitris Papastamos [Tue, 15 May 2018 17:40:03 +0000 (18:40 +0100)]
Merge pull request #1379 from CJKay/nsram-fix

Fix incorrect NSRAM memory map region for SGI-575

6 years agoFix build error with correct format string
Jeenu Viswambharan [Tue, 15 May 2018 15:18:40 +0000 (16:18 +0100)]
Fix build error with correct format string

Change-Id: I11c12b113c4975efd3ac7ac2e8b93e6771a7e7ff
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
6 years agoMerge pull request #1373 from jeenu-arm/ras-support
Dimitris Papastamos [Tue, 15 May 2018 14:34:20 +0000 (15:34 +0100)]
Merge pull request #1373 from jeenu-arm/ras-support

RAS support

6 years agoMerge pull request #1385 from antonio-nino-diaz-arm/an/revert-console
Dimitris Papastamos [Tue, 15 May 2018 12:34:11 +0000 (13:34 +0100)]
Merge pull request #1385 from antonio-nino-diaz-arm/an/revert-console

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

6 years agoRevert "plat/arm: Migrate AArch64 port to the multi console driver"
Antonio Nino Diaz [Tue, 15 May 2018 12:12:50 +0000 (13:12 +0100)]
Revert "plat/arm: Migrate AArch64 port to the multi console driver"

This reverts commit 2f18aa1fa35305f8feec25867473d30975b242fe.

It is causing some tests to fail. Until the cause is found and fixed, it
is needed to remove this commit from master.

Change-Id: Ic5ff7a841903a15613e00379e87cbbd8a0e85152
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agorockchip/rk3399: Add watchdog support in pmusram
Derek Basehore [Mon, 23 Apr 2018 21:49:22 +0000 (14:49 -0700)]
rockchip/rk3399: Add watchdog support in pmusram

To catch early hangs in resume, this sets up the watchdog before
anything else in the pmusram code (ignoring setting up the stack...).
This uses hard coded settings for the watchdog until the proper
watchdog restore later on in the firmware/kernel.

This also restores the old watchdog register values before the PLLs
are restored to make sure we don't temporarily switch over to a 1/3s
timeout on the watchdog when the pclk_wdt goes from 4MHz to 100MHz.

Change-Id: I8f7652089a88783271b17482117b4609330abe80
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
6 years agorockchip/rk3399: Split M0 binary into two
Lin Huang [Fri, 20 Apr 2018 07:55:21 +0000 (15:55 +0800)]
rockchip/rk3399: Split M0 binary into two

All the m0 code run in SRAM before, but we need to watch PMU_POWER_ST
when SOC enter into FSM, and SRAM will shutdown during this time, so
this code need run in PMUSRAM. But PMUSRAM only 8K space, we can not
put all the m0 binary into PMUSRAM, Split the M0 binary into two, dram
part still run in SRAM, and suspend part run in PMUSRAM.

Change-Id: Ie08bdf3e2b8838f12b9297fe60ab0aad219684b1
Signed-off-by: Lin Huang <hl@rock-chips.com>
6 years agorockchip/rk3399: improve pmu powermode configure when suspend
Lin Huang [Fri, 20 Apr 2018 07:40:15 +0000 (15:40 +0800)]
rockchip/rk3399: improve pmu powermode configure when suspend

we need to enable PMU_WKUP_RST_EN for pmu powermode configure, since
enable wakeup reset will hold the soc status, so the SOC will not affect
by some power or other single glitch when resume, and keep the soc in the
right status. And it not need to enable DDRIO_RET_HW_DE_REQ, the ddr resume
will do it manual.

Change-Id: Ib4af897ffb3cb63dc2aa9a6002e5d9ef86ee4a49
Signed-off-by: Lin Huang <hl@rock-chips.com>
6 years agoSPM: Do not trap S-EL0 access to SVE/SIMD/FP regs
Sandrine Bailleux [Wed, 9 May 2018 12:45:34 +0000 (14:45 +0200)]
SPM: Do not trap S-EL0 access to SVE/SIMD/FP regs

This allows secure partitions to access these registers. This is
needed in some cases. For example, it has been reported that in order
to implement secure storage services, a secure partition needs to
encrypt/decrypt some authentication variables, which requires FP/SIMD
support.

Note that SPM will not do any saving/restoring of these registers on
behalf of the SP. This falls under the SP's responsibility.

Also note that if the SP gets preempted, it might not get a chance to
save/restore FP/SIMD registers first. This patch does not address this
problem. It only serves as a temporary solution to unblock development
on the secure partition side.

Change-Id: I3b8ccdebdac0219f6ac96ad66ab2be0be8374ad3
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
6 years agoFix doc for bl31_plat_get_next_image_ep_info()
Sandrine Bailleux [Mon, 14 May 2018 12:25:47 +0000 (14:25 +0200)]
Fix doc for bl31_plat_get_next_image_ep_info()

In the porting guide, fix the function name and the argument type to
reflect the code.

Change-Id: Iac8d69af403194de5586bc0d5890da531e3c8da2
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
6 years agoReplace bootwrapped kernel instructions from User Guide
Antonio Nino Diaz [Mon, 14 May 2018 08:12:34 +0000 (09:12 +0100)]
Replace bootwrapped kernel instructions from User Guide

The instructions to boot the bootwrapped kernel were outdated.

Also, the bootwrapped kernel boot flow isn't really useful. It was meant
to be a replacement for the Trusted Firmware-A, not to be used as the next
step during boot.

The instructions have been removed in favour of the new build option
ARM_LINUX_KERNEL_AS_BL33. This new system directly boots the Linux
kernel from BL31, and requires RESET_TO_BL31 to be 1. Also, the kernel
has to be preloaded in memory, so PRELOADED_BL33_BASE has to be set to its
address. This way, the runtime services of the Trusted Firmware-A are
available for the kernel in the least possible amount of time.

This new system requires the DTB to be patched so that the kernel knows
where the ramdisk is. A short script to add this information to the DTB
has been added to the User Guide. The information related to it can be
found in the following file in the Linux kernel tree:
``Documentation/devicetree/bindings/chosen.txt``

Change-Id: Ide135580959e09f6aa8e4425f37ea55d97439178
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agocss: Do not map the non-secure RAM as secure
Chris Kay [Thu, 10 May 2018 13:43:28 +0000 (14:43 +0100)]
css: Do not map the non-secure RAM as secure

Change-Id: I7e73c0ab134da11c49f990b739245110c59eac2b
Signed-off-by: Chris Kay <chris.kay@arm.com>
6 years agocss: Fix erroneous non-secure RAM base address/size for SGI-575
Chris Kay [Thu, 10 May 2018 13:27:45 +0000 (14:27 +0100)]
css: Fix erroneous non-secure RAM base address/size for SGI-575

SGI-575's NSRAM is neither in the same place nor the same size as Juno's.

Change-Id: Id6d692e9c7e9c1360014bb525eda966ebe29c823
Signed-off-by: Chris Kay <chris.kay@arm.com>
6 years agoplat/arm: Fix incorrect bounds check in ARM_CASSERT_MMAP
Chris Kay [Wed, 9 May 2018 14:46:07 +0000 (15:46 +0100)]
plat/arm: Fix incorrect bounds check in ARM_CASSERT_MMAP

The bounds check in ARM_CASSERT_MMAP does not take into account the
array sentinel in plat_arm_mmap. This commit fixes this, and adds an
additional check to ensure the number of entries in the array is
within the bounds of PLAT_ARM_MMAP_ENTRIES.

Change-Id: Ie6df10c0aa0890d62826bc3224ad7b3e36fd53e2
Signed-off-by: Chris Kay <chris.kay@arm.com>
6 years agoplat/arm: Fix incorrect number of reserved memory map entries
Chris Kay [Wed, 9 May 2018 14:14:06 +0000 (15:14 +0100)]
plat/arm: Fix incorrect number of reserved memory map entries

There are three calls to mmap_add_region() that always occur in
arm_setup_page_tables(), and two further calls based on whether coherent
memory is enabled, and whether SPM is enabled in BL31.

This commit adapts the ARM_BL_REGIONS definition to match the number of
calls made inside arm_setup_page_tables() so that the MAX_MMAP_REGIONS
is realigned with what is actually occurring.

Change-Id: I7adc05951abccf2cbd5c86280eb874911e6a1566
Signed-off-by: Chris Kay <chris.kay@arm.com>
6 years agoMerge pull request #1372 from antonio-nino-diaz-arm/an/arm-multi-console
Dimitris Papastamos [Fri, 11 May 2018 11:04:52 +0000 (12:04 +0100)]
Merge pull request #1372 from antonio-nino-diaz-arm/an/arm-multi-console

Arm platforms: Migrate to multi console driver

6 years agoplat/arm: Introduce ARM_LINUX_KERNEL_AS_BL33 build option
Antonio Nino Diaz [Fri, 11 May 2018 10:15:10 +0000 (11:15 +0100)]
plat/arm: Introduce ARM_LINUX_KERNEL_AS_BL33 build option

Normally, BL33 needs to contain a boot loader like U-Boot or UEFI that
eventually gives control to the OS. However, in some cases, this boot
sequence may be too slow. For example, when doing tests in a
cycle-accurate emulator, the user may only be interested in the
interaction between the Trusted Firmware and the OS, not in the boot
process itself.

The new option ARM_LINUX_KERNEL_AS_BL33 allows BL33 to contain the Linux
kernel image by changing the value of registers x0-x3 to the values
expected by the kernel. This option requires the device tree blob (DTB)
to be present in memory. Its address must be specified in the newly
introduced ARM_PRELOADED_DTB_BASE build option. For now, it only supports
AArch64 kernels.

This option is only available when RESET_TO_BL31=1. For this reason
the BL33 binary must be preloaded in memory and PRELOADED_BL33_BASE must
be used.

For example, if the kernel is loaded at 0x80080000 and the DTB is loaded
at address 0x82000000, the firmware could be built like this:

    CROSS_COMPILE=aarch64-linux-gnu-  \
    make PLAT=fvp DEBUG=1             \
    RESET_TO_BL31=1                   \
    ARM_LINUX_KERNEL_AS_BL33=1        \
    PRELOADED_BL33_BASE=0x80080000    \
    ARM_PRELOADED_DTB_BASE=0x82000000 \
    all fip

Change-Id: If9dc847c65ae2d0c27b51f0fd44fc06b28497db9
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoplat/arm: Migrate AArch64 port to the multi console driver
Antonio Nino Diaz [Fri, 4 May 2018 11:59:45 +0000 (12:59 +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 of BL31 has been increased in builds with SPM.

Change-Id: Icefd117dd1eb9c498921181a21318c2d2435c441
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agomulti console: Assert that consoles aren't registered twice
Antonio Nino Diaz [Mon, 30 Apr 2018 19:14:07 +0000 (20:14 +0100)]
multi console: Assert that consoles aren't registered twice

In the multi console driver, allowing to register the same console more
than once may result in an infinte loop when putc is called.

If, for example, a boot message is trying to be printed, but the
consoles in the loop in the linked list are runtime consoles, putc will
iterate forever looking for a console that can print boot messages (or
a NULL pointer that will never come).

This loop in the linked list can occur after restoring the system from a
system suspend. The boot console is registered during the cold boot in
BL31, but the runtime console is registered even in the warm boot path.
Consoles are always added to the start of the linked list when they are
registered, so this it what should happen if they were actually
different structures:

   console_list -> NULL
   console_list -> BOOT -> NULL
   console_list -> RUNTIME -> BOOT -> NULL
   console_list -> RUNTIME -> RUNTIME -> BOOT -> NULL

In practice, the two runtime consoles are the same one, so they create
this loop:

   console_list -> RUNTIME -.    X -> BOOT -> NULL
                       ^    |
                       `----'

This patch adds an assertion to detect this problem. The assertion will
fail whenever the same structure tries to be registered while being on
the list.

In order to assert this, console_is_registered() has been implemented.
It returns 1 if the specified console is registered, 0 if not.

Change-Id: I922485e743775ca9bd1af9cbd491ddd360526a6d
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agolib: el3_runtime: initialise actlr_el1 to hardware defaults
Varun Wadekar [Tue, 8 May 2018 17:52:36 +0000 (10:52 -0700)]
lib: el3_runtime: initialise actlr_el1 to hardware defaults

The context management library initialises the CPU context for the
secure/non-secure worlds to zero. This leads to zeros being stored
to the actual registers when we restore the CPU context, during a
world switch. Denver CPUs dont expect zero to be written to the
implementation defined, actlr_el1 register, at any point of time.
Writing a zero to some fields of this register, results in an
UNDEFINED exception.

This patch bases the context actlr_el1 value on the actual hardware
register, to maintain parity with the expected settings

Change-Id: I1c806d7ff12daa7fd1e5c72825494b81454948f2
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
6 years agoMerge pull request #1377 from robertovargas-arm/compiler-warnings
Dimitris Papastamos [Wed, 9 May 2018 12:40:35 +0000 (13:40 +0100)]
Merge pull request #1377 from robertovargas-arm/compiler-warnings

Compiler warnings

6 years agoxlat: Fix warning in CHECK_VIRT_ADDR_SPACE_SIZE
Roberto Vargas [Wed, 9 May 2018 10:27:30 +0000 (11:27 +0100)]
xlat: Fix warning in CHECK_VIRT_ADDR_SPACE_SIZE

When TF is compiled for aarch32 MAX_VIRT_ADDR_SPACE_SIZE is 2^32 in some cases,
which makes the test (size) <= MAX_VIRT_ADDR_SPACE_SIZE a tautology because
uintptr_t is a 32 bit value. The cast remove the warning for clang.

Change-Id: I1345f3400f8fbbe4ffd3caa990a90e7ba593dba5
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
6 years agoDon't use variables as tf_printf format strings
Roberto Vargas [Wed, 9 May 2018 09:49:24 +0000 (10:49 +0100)]
Don't use variables as tf_printf format strings

Using variables as format strings can generate security problems when
the user can control those strings. Some compilers generate warnings
in that cases, even when the variables are constants and are not
controlled by the user.

Change-Id: I65dee1d1b66feab38cbf298290a86fa56e6cca40
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
6 years agoMerge pull request #1368 from EvanLloyd/editorconfig
danh-arm [Tue, 8 May 2018 10:22:27 +0000 (11:22 +0100)]
Merge pull request #1368 from EvanLloyd/editorconfig

Add .editorconfig file

6 years agoMerge pull request #1354 from robertovargas-arm/mem_protect
danh-arm [Tue, 8 May 2018 10:21:04 +0000 (11:21 +0100)]
Merge pull request #1354 from robertovargas-arm/mem_protect

ARM platforms: Demonstrate mem_protect from el3_runtime

6 years agoARM Platforms: Support RAS
Jeenu Viswambharan [Tue, 6 Feb 2018 12:21:39 +0000 (12:21 +0000)]
ARM Platforms: Support RAS

  - Assign 0x10 for RAS exceptions on ARM platforms, and install
    EHF priority descriptor.

  - Call the common RAS initialisation from ARM BL31 setup.

  - Add empty definitions for platform error records and RAS interrupts.

Change-Id: I0675f299b7840be4c83a9c7a81073a95c605dc90
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
6 years agoRAS: Add fault injection support
Jeenu Viswambharan [Fri, 8 Dec 2017 12:13:51 +0000 (12:13 +0000)]
RAS: Add fault injection support

The ARMv8.4 RAS extensions introduce architectural support for software
to inject faults into the system in order to test fault-handling
software. This patch introduces the build option FAULT_HANDLING_SUPPORT
to allow for lower ELs to use registers in the Standard Error Record to
inject fault. The build option RAS_EXTENSIONS must also be enabled along
with fault injection.

This feature is intended for testing purposes only, and is advisable to
keep disabled for production images.

Change-Id: I6f7a4454b15aec098f9505a10eb188c2f928f7ea
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
6 years agoRAS: Allow individual interrupt registration
Jeenu Viswambharan [Tue, 12 Dec 2017 10:34:58 +0000 (10:34 +0000)]
RAS: Allow individual interrupt registration

EHF currently allows for registering interrupt handlers for a defined
priority ranges. This is primarily targeted at various EL3 dispatchers
to own ranges of secure interrupt priorities in order to delegate
execution to lower ELs.

The RAS support added by earlier patches necessitates registering
handlers based on interrupt number so that error handling agents shall
receive and handle specific Error Recovery or Fault Handling interrupts
at EL3.

This patch introduces a macro, RAS_INTERRUPTS() to declare an array of
interrupt numbers and handlers. Error handling agents can use this macro
to register handlers for individual RAS interrupts. The array is
expected to be sorted in the increasing order of interrupt numbers.

As part of RAS initialisation, the list of all RAS interrupts are sorted
based on their ID so that, given an interrupt, its handler can be looked
up with a simple binary search.

For an error handling agent that wants to handle a RAS interrupt,
platform must:

  - Define PLAT_RAS_PRI to be the priority of all RAS exceptions.

  - Enumerate interrupts to have the GIC driver program individual EL3
    interrupts to the required priority range. This is required by EHF
    even before this patch.

Documentation to follow.

Change-Id: I9471e4887ff541f8a7a63309e9cd8f771f76aeda
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
6 years agoRAS: Add support for node registration
Jeenu Viswambharan [Fri, 8 Dec 2017 15:38:21 +0000 (15:38 +0000)]
RAS: Add support for node registration

Previous patches added frameworks for handling RAS errors. This patch
introduces features that the platform can use to enumerate and iterate
RAS nodes:

  - The REGISTER_RAS_NODES() can be used to expose an array of
    ras_node_info_t structures. Each ras_node_info_t describes a RAS
    node, along with handlers for probing the node for error, and if
    did record an error, another handler to handle it.

  - The macro for_each_ras_node() can be used to iterate over the
    registered RAS nodes, probe for, and handle any errors.

The common platform EA handler has been amended using error handling
primitives introduced by both this and previous patches.

Change-Id: I2e13f65a88357bc48cd97d608db6c541fad73853
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
6 years agoRAS: Add helpers to access Standard Error Records
Jeenu Viswambharan [Thu, 7 Dec 2017 08:43:05 +0000 (08:43 +0000)]
RAS: Add helpers to access Standard Error Records

The ARMv8 RAS Extensions introduced Standard Error Records which are a
set of standard registers through which:

  - Platform can configure RAS node policy; e.g., notification
    mechanism;

  - RAS nodes can record and expose error information for error handling
    agents.

Standard Error Records can either be accessed via. memory-mapped
or System registers. This patch adds helper functions to access
registers and fields within an error record.

Change-Id: I6594ba799f4a1789d7b1e45b3e17fd40e7e0ba5c
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
6 years agoAArch64: Introduce RAS handling
Jeenu Viswambharan [Wed, 4 Apr 2018 15:07:11 +0000 (16:07 +0100)]
AArch64: Introduce RAS handling

RAS extensions are mandatory for ARMv8.2 CPUs, but are also optional
extensions to base ARMv8.0 architecture.

This patch adds build system support to enable RAS features in ARM
Trusted Firmware. A boolean build option RAS_EXTENSION is introduced for
this.

With RAS_EXTENSION, an Exception Synchronization Barrier (ESB) is
inserted at all EL3 vector entry and exit. ESBs will synchronize pending
external aborts before entering EL3, and therefore will contain and
attribute errors to lower EL execution. Any errors thus synchronized are
detected via. DISR_EL1 register.

When RAS_EXTENSION is set to 1, HANDLE_EL3_EA_FIRST must also be set to 1.

Change-Id: I38a19d84014d4d8af688bd81d61ba582c039383a
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
6 years agoAArch64: Introduce External Abort handling
Jeenu Viswambharan [Thu, 30 Nov 2017 12:54:15 +0000 (12:54 +0000)]
AArch64: Introduce External Abort handling

At present, any External Abort routed to EL3 is reported as an unhandled
exception and cause a panic. This patch enables ARM Trusted Firmware to
handle External Aborts routed to EL3.

With this patch, when an External Abort is received at EL3, its handling
is delegated to plat_ea_handler() function. Platforms can provide their
own implementation of this function. This patch adds a weak definition
of the said function that prints out a message and just panics.

In order to support handling External Aborts at EL3, the build option
HANDLE_EA_EL3_FIRST must be set to 1.

Before this patch, HANDLE_EA_EL3_FIRST wasn't passed down to
compilation; this patch fixes that too.

Change-Id: I4d07b7e65eb191ff72d63b909ae9512478cd01a1
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
6 years agoAArch64: Refactor GP register restore to separate function
Jeenu Viswambharan [Wed, 29 Nov 2017 16:59:34 +0000 (16:59 +0000)]
AArch64: Refactor GP register restore to separate function

At present, the function that restores general purpose registers also
does ERET. Refactor the restore code to restore general purpose
registers without ERET to complement the save function.

The macro save_x18_to_x29_sp_el0 was used only once, and is therefore
removed, and its contents expanded inline for readability.

No functional changes, but with this patch:

  - The SMC return path will incur an branch-return and an additional
    register load.

  - The unknown SMC path restores registers x0 to x3.

Change-Id: I7a1a63e17f34f9cde810685d70a0ad13ca3b7c50
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
6 years agoMerge pull request #1374 from jonathanwright-ARM/jw/fix-memory-leaks-in-fiptool
danh-arm [Thu, 3 May 2018 15:48:50 +0000 (16:48 +0100)]
Merge pull request #1374 from jonathanwright-ARM/jw/fix-memory-leaks-in-fiptool

Fix memory leaks in fiptool

6 years agoMerge pull request #1370 from antonio-nino-diaz-arm/an/fix-parange
danh-arm [Thu, 3 May 2018 15:48:14 +0000 (16:48 +0100)]
Merge pull request #1370 from antonio-nino-diaz-arm/an/fix-parange

xlat: Have all values of PARange for 8.x architectures

6 years agoMerge pull request #1367 from robertovargas-arm/ndebug
danh-arm [Thu, 3 May 2018 15:46:44 +0000 (16:46 +0100)]
Merge pull request #1367 from robertovargas-arm/ndebug

Remove the unused macro NDEBUG

6 years agoMerge pull request #1366 from antonio-nino-diaz-arm/an/ignore-spdx
danh-arm [Thu, 3 May 2018 15:46:25 +0000 (16:46 +0100)]
Merge pull request #1366 from antonio-nino-diaz-arm/an/ignore-spdx

checkpatch: Ignore SPDX_LICENSE_TAG

6 years agoMerge pull request #1365 from jonathanwright-ARM/jw/fix-cert-create-makefile
danh-arm [Thu, 3 May 2018 15:45:17 +0000 (16:45 +0100)]
Merge pull request #1365 from jonathanwright-ARM/jw/fix-cert-create-makefile

Fix the makefile to remove the cert_create executable on 'make realclean'

6 years agoMerge pull request #1364 from Yann-lms/bl2_at_el3_mmu
danh-arm [Thu, 3 May 2018 15:45:01 +0000 (16:45 +0100)]
Merge pull request #1364 from Yann-lms/bl2_at_el3_mmu

BL2_AT_EL3: do not try to disable MMU twice on AARCH32

6 years agoMerge pull request #1371 from antonio-nino-diaz-arm/an/fix-checkpatch
danh-arm [Thu, 3 May 2018 15:42:07 +0000 (16:42 +0100)]
Merge pull request #1371 from antonio-nino-diaz-arm/an/fix-checkpatch

smccc: Fix checkpatch error in header file

6 years agotools/fiptool: fix memory leaks in fiptool
Jonathan Wright [Thu, 3 May 2018 14:05:09 +0000 (15:05 +0100)]
tools/fiptool: fix memory leaks in fiptool

Free desc->image->buffer before freeing desc->image. We make sure that
the desc->image is non-null before attempting this.

Change-Id: I35c5674629a41d7cf1a78b7b41ca4b930d0fb688
Signed-off-by: Jonathan Wright <jonathan.wright@arm.com>
6 years agoxlat: Have all values of PARange for 8.x architectures
Antonio Nino Diaz [Wed, 2 May 2018 10:23:56 +0000 (11:23 +0100)]
xlat: Have all values of PARange for 8.x architectures

In AArch64, the field ID_AA64MMFR0_EL1.PARange has a different set of
allowed values depending on the architecture version.

Previously, we only compiled the Trusted Firmware with the values that
were allowed by the architecture. However, given that this field is
read-only, it is easier to compile the code with all values regardless
of the target architecture.

Change-Id: I57597ed103dd0189b1fb738a9ec5497391c10dd1
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agosmccc: Fix checkpatch error in header file
Antonio Nino Diaz [Wed, 2 May 2018 08:52:35 +0000 (09:52 +0100)]
smccc: Fix checkpatch error in header file

Change-Id: Ice141dcc17f504025f922acace94d98f84acba9e
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoAdd .editorconfig file
Evan Lloyd [Wed, 6 Dec 2017 19:05:40 +0000 (19:05 +0000)]
Add .editorconfig file

The .editorconfig file provides an editor agnostic definition of a
project's file format requirements.
Details can be found at http://editorconfig.org/

This change should have little impact on users, but, it is hoped, will
help those who move across projects avoid making mistakes because of
foreign project editor configuration settings.

Change-Id: I8776526b5ab96b543d3d3e445c60e06b62049e68
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
6 years agoMerge pull request #1362 from robertovargas-arm/dtc-warnings
danh-arm [Tue, 1 May 2018 16:13:11 +0000 (17:13 +0100)]
Merge pull request #1362 from robertovargas-arm/dtc-warnings

Remove dtc warnings

6 years agoMerge pull request #1361 from vchong/tool_add_img
danh-arm [Tue, 1 May 2018 16:12:51 +0000 (17:12 +0100)]
Merge pull request #1361 from vchong/tool_add_img

poplar: rename FIP_ADD_IMG to TOOL_ADD_IMG

6 years agoRemove the unused macro NDEBUG
Roberto Vargas [Fri, 15 Dec 2017 15:28:50 +0000 (15:28 +0000)]
Remove the unused macro NDEBUG

The C standards specify that this macro is used to
disable asserts but, in our code, the assert macro
is controlled with ENABLE_ASSERTIONS. Having this macro
here creates confusion about the behaviour of assert.

Change-Id: Iab8689a14dc2b8790729857d56585ce43c0c4f51
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>