Commit Graph

7954 Commits

Author SHA1 Message Date
Olivier Deprez 2111b0024c SPMC: manifest changes to support multicore boot
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Signed-off-by: Max Shvetsov <maksims.svecovs@arm.com>
Change-Id: Icf90c2ccce75257908ba3d4703926041d64b1dd3
2020-08-20 18:06:06 +01:00
Olivier Deprez a92bc73b8e SPMD: secondary cores PM on and off SPD hooks relayed to SPMC
Define SPMD PM hooks for warm boot and off events. svc_on_finish handler
enters the SPMC at the entry point defined by the secondary EP register
service. The svc_off handler notifies the SPMC that a physical core is
being turned off through a notification message.

Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Change-Id: I2609a75a0c6ffb9f6313fc09553be2b29a41de59
2020-08-20 18:06:06 +01:00
Olivier Deprez f0d743dbcd SPMD: handle SPMC message to register secondary core entry point
Upon booting, the SPMC running on the primary core shall register the
secondary core entry points to which a given secondary core being woken
up shall jump to into the SPMC . The current implementation assumes the
SPMC calls a registering service implemented in the SPMD for each core
identified by its MPIDR. This can typically happen in a simple loop
implemented in the early SPMC initialization routines by passing each
core identifier associated with an entry point address and context
information.
This service is implemented on top of a more generic SPMC<=>SPMD
interface using direct request/response message passing as defined by
the FF-A specification.

Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Signed-off-by: Max Shvetsov <maksims.svecovs@arm.com>
Change-Id: I1f70163b6b5cee0880bd2004e1fec41e3780ba35
2020-08-20 18:06:06 +01:00
Olivier Deprez c2901419b5 SPMD: introduce SPMC to SPMD messages
FF-A interface to handle SPMC to SPMD direct messages requests.

Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Signed-off-by: Max Shvetsov <maksims.svecovs@arm.com>
Change-Id: Ia707a308c55561a31dcfa86e554ea1c9e23f862a
2020-08-20 18:06:06 +01:00
Olivier Deprez a334c4e691 SPMD: register the SPD PM hooks
Change-Id: If88d64c0e3d60accd2638a55f9f3299ec700a8c8
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
2020-08-20 18:06:06 +01:00
Olivier Deprez b058f20a7e SPMD: add generic SPD PM handlers
This patch defines and registers the SPMD PM handler hooks.
This is intended to relay boot and PM events to the SPMC.

Change-Id: If5a758d22b8d2152cbbb83a0cad563b5e1c6bd49
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Signed-off-by: Max Shvetsov <maksims.svecovs@arm.com>
2020-08-20 18:06:06 +01:00
Olivier Deprez 9dcf63dd8b SPMD: enhance SPMC internal boot states
This patch adds SPMC states used by the SPMD to track SPMC boot phases
specifically on secondary cores.

Change-Id: If97af7352dda7f04a8e46a56892a2aeddcfab91b
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Signed-off-by: Max Shvetsov <maksims.svecovs@arm.com>
2020-08-20 18:06:06 +01:00
Olivier Deprez c0267cc994 SPMD: entry point info get helper
This patch provides a helper to get the entry_point_info
structure used by the boot CPU as it is used to initialise
the SPMC context on secondary CPUs.

Change-Id: I99087dc7a86a7258e545d24a2ff06aa25170f00c
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
2020-08-20 18:06:06 +01:00
Sandrine Bailleux 06ffa16694 doc: Recommend using C rather than assembly language
Add a section for that in the coding guidelines.

Change-Id: Ie6819c4df5889a861460eb96acf2bc9c0cfb494e
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2020-08-20 15:29:01 +00:00
Manish Pandey 1566bc3e53 Merge "plat: imx8m: Fix the race condition during cpu hotplug" into integration 2020-08-20 15:07:13 +00:00
Olivier Deprez 7638011146 Merge changes from topic "at_errata_fix" into integration
* changes:
  doc: Update description for AT speculative workaround
  lib/cpus: Report AT speculative erratum workaround
  Add wrapper for AT instruction
2020-08-20 14:40:06 +00:00
Jacky Bai fe5e1c145a plat: imx8m: Fix the race condition during cpu hotplug
CPU hotplug & cpuidle have some race condition when doing CPU hotplug
stress test. different CPU cores have the chance to access the same
GPC register(A53_AD), so lock is necessary to do exlusive access.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: I1296592e05fa78429c3f0fac066951521db755e3
2020-08-20 14:23:19 +00:00
Manish Pandey 15e54af35d Merge "SPM: Add third cactus partition to manifests" into integration 2020-08-20 09:57:07 +00:00
Sandrine Bailleux 9061c0c9ab doc: Minor formatting improvement in the coding guidelines document
Change-Id: I5362780db422772fd547dc8e68e459109edccdd0
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2020-08-20 10:41:36 +02:00
André Przywara e168b66d87 Merge changes from topic "aw_drivevbus" into integration
* changes:
  plat/allwinner: Only enable DRIVEVBUS if really needed
  plat/allwinner: Use common gicv2.mk
2020-08-19 22:29:58 +00:00
Mark Dykes e5c84ca63c Merge "libc/memset: Implement function in assembler" into integration 2020-08-19 18:53:55 +00:00
Alexei Fedorov e7d344de01 libc/memset: Implement function in assembler
Trace analysis of FVP_Base_AEMv8A model running in
Aarch32 mode with the build options listed below:
TRUSTED_BOARD_BOOT=1 GENERATE_COT=1
ARM_ROTPK_LOCATION=devel_ecdsa KEY_ALG=ecdsa
ROT_KEY=plat/arm/board/common/rotpk/arm_rotprivk_ecdsa.pem
shows that when auth_signature() gets called
71.84% of CPU execution time is spent in memset() function
written in C using single byte write operations,
see lib\libc\memset.c.
This patch replaces C memset() implementation with assembler
version giving the following results:
- for Aarch32 in auth_signature() call memset() CPU time
reduced to 24.84%.
- Number of CPU instructions executed during TF-A
boot stage before start of BL33 in RELEASE builds:
----------------------------------------------
|  Arch   |     C      |  assembler |    %   |
----------------------------------------------
| Aarch32 | 2073275460 | 1487400003 | -28.25 |
| Aarch64 | 2056807158 | 1244898303 | -39.47 |
----------------------------------------------
The patch also replaces memset.c with aarch64/memset.S
in plat\nvidia\tegra\platform.mk.

Change-Id: Ifbf085a2f577a25491e2d28446ee95a4ac891597
Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-08-19 18:21:39 +00:00
Manish Pandey e268ea271a Merge "SPM: Change condition on saving/restoring EL2 registers" into integration 2020-08-19 15:34:50 +00:00
Ruari Phipps 9de91c7542 SPM: Add third cactus partition to manifests
Add information about the third partition so it can be loaded into SPM
when running the tests

Signed-off-by: Ruari Phipps <ruari.phipps@arm.com>
Change-Id: I5544e88df391ef294ddf6b5750d468d3e74892b1
2020-08-19 15:18:54 +00:00
Ruari Phipps 6b704da34b SPM: Change condition on saving/restoring EL2 registers
Make this more scalable by explicitly checking internal and hardware
states at run_time

Signed-off-by: Ruari Phipps <ruari.phipps@arm.com>
Change-Id: I1c6ed1c1badb3538a93bff3ac5b5189b59cccfa1
2020-08-19 15:17:31 +00:00
Manish Pandey 572dea8534 Merge "plat: qti: Fix build failure" into integration 2020-08-19 11:44:55 +00:00
Manish Pandey a3b500449b Merge changes Ic701675c,Ie55e25c8 into integration
* changes:
  plat: imx8m: Correct the imr mask reg offset
  plat: imx8m: Keep A53 PLAT on in wait mode(ret)
2020-08-19 11:27:58 +00:00
Jacky Bai fb9212be17 plat: imx8m: Correct the imr mask reg offset
The number of gpc imr mask reg & the offset is different
on some SOC, so correct it & replace the magic number with
macro define.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: Ic701675cdd92e043dcd7f06722f2e871068aec74
2020-08-19 09:46:11 +00:00
Jacky Bai 9eb1bb63e1 plat: imx8m: Keep A53 PLAT on in wait mode(ret)
Keep A53 PLAT(SCU) power domain on in wait mode(ret).
RBC count only need to be set in PLAT OFF mode, so
change it accordingly.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: Ie55e25c8210d298506fc4dca7a9653583db45e0c
2020-08-19 09:46:05 +00:00
Manish Pandey 9ce37110f5 Merge "qemu/qemu_sbsa: enable SPM support" into integration 2020-08-19 09:38:19 +00:00
Manish Pandey 38294532db Merge changes from topic "tegra-downstream-07092020" into integration
* changes:
  Tegra: platform: add function to check t194 chip
  Tegra: common: make plat_psci_ops routines static
2020-08-19 09:37:38 +00:00
David Pu 43d22073d4 Tegra: platform: add function to check t194 chip
This patch adds tegra_chipid_is_t194() function to check if it is a
Tegra 194 chip.

Change-Id: I6da6d3a2c9676b748931e42fde1b174cbcb4fd40
Signed-off-by: David Pu <dpu@nvidia.com>
2020-08-18 22:59:05 +00:00
David Pu 57e92daf76 Tegra: common: make plat_psci_ops routines static
This patch makes Tegra platform psci ops routines to static. These
routines are called by PSCI framework and no external linkage is
necessary. This patch also fixes MISRA C-2012 Rule 8.6 violations.

Change-Id: Idd2381809f76dc0fd578c1c92c0f8eea124f2e88
Signed-off-by: David Pu <dpu@nvidia.com>
2020-08-18 22:58:54 +00:00
Masahisa Kojima 6a2426a94f qemu/qemu_sbsa: enable SPM support
Enable the spm_mm framework for the qemu_sbsa platform.
Memory layout required for spm_mm is created in secure SRAM.

Co-developed-by: Fu Wei <fu.wei@linaro.org>
Signed-off-by: Fu Wei <fu.wei@linaro.org>
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Change-Id: I104a623e8bc1e44d035b95f014a13b3f8b33a62a
2020-08-18 22:45:35 +00:00
Alexei Fedorov 3ee8e4d8de Merge "runtime_exceptions: Update AT speculative workaround" into integration 2020-08-18 16:53:25 +00:00
Alexei Fedorov faf7713c4e Merge "el3_runtime: Rearrange context offset of EL1 sys registers" into integration 2020-08-18 16:53:04 +00:00
Alexei Fedorov e4ded0c69e Merge "el3_runtime: Update context save and restore routines for EL1 and EL2" into integration 2020-08-18 16:50:23 +00:00
Manish Pandey 6b76d1e94e Merge changes from topic "soc-id" into integration
* changes:
  plat/arm: juno: Implement methods to retrieve soc-id information
  plat/arm: fvp: Implement methods to retrieve soc-id information
  plat/arm: remove common code for soc-id feature
2020-08-18 11:02:15 +00:00
Manish V Badarkhe e008a29a18 doc: Update description for AT speculative workaround
Documented the CPU specific build macros created for AT
speculative workaround.

Updated the description of 'ERRATA_SPECULATIVE_AT' errata
workaround option.

Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
Change-Id: Ie46a80d4e8183c1d5c8b153f08742a04d41a2af2
2020-08-18 10:49:27 +01:00
Manish V Badarkhe 3b8456bd1c runtime_exceptions: Update AT speculative workaround
As per latest mailing communication [1], we decided to
update AT speculative workaround implementation in order to
disable page table walk for lower ELs(EL1 or EL0) immediately
after context switching to EL3 from lower ELs.

Previous implementation of AT speculative workaround is available
here: 45aecff00

AT speculative workaround is updated as below:
1. Avoid saving and restoring of SCTLR and TCR registers for EL1
   in context save and restore routine respectively.
2. On EL3 entry, save SCTLR and TCR registers for EL1.
3. On EL3 entry, update EL1 system registers to disable stage 1
   page table walk for lower ELs (EL1 and EL0) and enable EL1
   MMU.
4. On EL3 exit, restore SCTLR and TCR registers for EL1 which
   are saved in step 2.

[1]:
https://lists.trustedfirmware.org/pipermail/tf-a/2020-July/000586.html

Change-Id: Iee8de16f81dc970a8f492726f2ddd57e7bd9ffb5
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2020-08-18 10:49:27 +01:00
Manish V Badarkhe cb55615c50 el3_runtime: Rearrange context offset of EL1 sys registers
SCTLR and TCR registers of EL1 plays role in enabling/disabling of
page table walk for lower ELs (EL0 and EL1).
Hence re-arranged EL1 context offsets to have SCTLR and TCR registers
values one after another in the stack so that these registers values
can be saved and restored using stp and ldp instruction respectively.

Change-Id: Iaa28fd9eba82a60932b6b6d85ec8857a9acd5f8b
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2020-08-18 10:49:27 +01:00
Manish V Badarkhe e1c4933372 lib/cpus: Report AT speculative erratum workaround
Reported the status (applies, missing) of AT speculative workaround
which is applicable for below CPUs.

 +---------+--------------+
 | Errata  |      CPU     |
 +=========+==============+
 | 1165522 |  Cortex-A76  |
 +---------+--------------+
 | 1319367 |  Cortex-A72  |
 +---------+--------------+
 | 1319537 |  Cortex-A57  |
 +---------+--------------+
 | 1530923 |  Cortex-A55  |
 +---------+--------------+
 | 1530924 |  Cortex-A53  |
 +---------+--------------+

Also, changes are done to enable common macro 'ERRATA_SPECULATIVE_AT'
if AT speculative errata workaround is enabled for any of the above
CPUs using 'ERRATA_*' CPU specific build macro.

Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
Change-Id: I3e6a5316a2564071f3920c3ce9ae9a29adbe435b
2020-08-18 10:49:27 +01:00
Manish V Badarkhe 86ba585300 Add wrapper for AT instruction
In case of AT speculative workaround applied, page table walk
is disabled for lower ELs (EL1 and EL0) in EL3.
Hence added a wrapper function which temporarily enables page
table walk to execute AT instruction for lower ELs and then
disables page table walk.

Execute AT instructions directly for lower ELs (EL1 and EL0)
assuming page table walk is enabled always when AT speculative
workaround is not applied.

Change-Id: I4ad4c0bcbb761448af257e9f72ae979473c0dde8
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2020-08-18 10:49:27 +01:00
Manish V Badarkhe fb2072b03d el3_runtime: Update context save and restore routines for EL1 and EL2
As per latest mailing communication [1], we decided
not to update SCTLR and TCR registers in EL1 and EL2 context
restore routine when AT speculative workaround is enabled
hence reverted the changes done as part of this commit: 45aecff00.

[1]:
https://lists.trustedfirmware.org/pipermail/tf-a/2020-July/000586.html

Change-Id: I8c5f31d81fcd53770a610e302a5005d98772b71f
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2020-08-18 10:48:48 +01:00
Manish V Badarkhe 3f34663ffd plat/arm: juno: Implement methods to retrieve soc-id information
Implemented platform functions to retrieve the soc-id information
for juno platform

Change-Id: Ie677120710b45e202a2d63a954459ece8a64b353
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2020-08-18 03:07:30 +00:00
Manish V Badarkhe ed9653ffa9 plat/arm: fvp: Implement methods to retrieve soc-id information
Implemented platform functions to retrieve the soc-id information
for FVP platform.

Change-Id: Id3df02ab290a210310e8d34ec9d706a59d817517
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2020-08-18 03:07:22 +00:00
Manish V Badarkhe 7f03d80d40 plat/arm: remove common code for soc-id feature
Removed common code for soc-id feature which is applicable
for all arm platforms.

In subsequent patches, added a platform based functions
for FVP and Juno to retrieve the soc-id information.

Change-Id: Idb632a935758a6caff2ca03a6eab8f663da8a93a
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2020-08-18 03:07:08 +00:00
Manish V Badarkhe 752ff3bfd8 plat: qti: Fix build failure
Fixed build failure due to the commit:905f93c77 by removing
the inclusion of non-existent 'stdinit.h' file.

Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
Change-Id: I8e3ca69c016b7a2354c58c4d384a492631c36286
2020-08-18 01:53:45 +00:00
Mark Dykes 0d4ad1fe03 Merge "plat/arm: Use common build flag for using generic sp804 driver" into integration 2020-08-17 21:08:44 +00:00
Madhukar Pappireddy fddfb3baf7 plat/arm: Use common build flag for using generic sp804 driver
SP804 TIMER is not platform specific, and current code base adds
multiple defines to use this driver. Like FVP_USE_SP804_TIMER and
FVP_VE_USE_SP804_TIMER.

This patch removes platform specific build flag and adds generic
flag `USE_SP804_TIMER` to be set to 1 by platform if needed.

Change-Id: I5ab792c189885fd1b98ddd187f3a38ebdd0baba2
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
2020-08-17 11:50:07 -05:00
Andre Przywara 93fa305c0a plat/allwinner: Only enable DRIVEVBUS if really needed
The DRIVEVBUS power rail of the AXP803 PMIC is mostly used to supply
the USB bus power on micro USB sockets, when used in host mode. As this
is a dynamic operation, and mostly we want micro USB sockets to act in
client mode initially, BL31 should not actually enable this power line.
However, on some boards DRIVEVBUS is used to supply power to normal
USB-A sockets. Failing to activate this line there results in
non-functional USB in U-Boot on those boards.

For that reason we were enabling DRIVEVBUS so far, as it did not seem to
cause any harm to the other boards. However it turns out that on the
Pinephone (and other systems with a battery), actually enabling DRIVEVBUS
unconditionally causes serious problems (reboot loop).

To accommodate both use cases, without reverting to a build time option,
check the default OTG configuration in the devicetree. For boards with
USB-A sockets this is set to "host", on boards with micro-B sockets to
"otg". Depending on this setting, we either enable DRIVEVBUS or leave it
alone.

This fixes TF-A on the Pinephone and potentially other battery powered
devices.

Change-Id: Iec0e07f218b2b4393bf4e05c3386261f8ed19e9f
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2020-08-17 11:13:59 +01:00
Andre Przywara 9bc28a5eb2 plat/allwinner: Use common gicv2.mk
Compiling BL31 for the Allwinner platform now produces a message about
the deprecation of gic_common.c.
Follow the advice and use include gicv2.mk instead.

Collect all includes at the beginning of the file on the way.

Change-Id: Iee46e21a630bfa831d28059f09aa7b049eb554bb
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2020-08-17 11:13:01 +01:00
Sandrine Bailleux c84539f2bd Merge "doc: Refactor the contribution guidelines" into integration 2020-08-17 08:29:11 +00:00
Madhukar Pappireddy 1b66266197 Merge "stm32mp1: use newly introduced GICv2 makefile" into integration 2020-08-16 23:05:12 +00:00
Varun Wadekar a409179e1a Merge "lib: cpus: denver: add some MIDR values" into integration 2020-08-14 20:32:44 +00:00