Commit Graph

8067 Commits

Author SHA1 Message Date
Madhukar Pappireddy 1123a5e2f9 libc: Import strlcat from FreeBSD project
From commit: 21571b1d140ae7bb44e94c0afba2ec61456b275b
Made small changes to fit into TF-A project

Change-Id: I07fd7fe1037857f6b299c35367c104fb51fa5cfa
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
2020-09-09 13:48:04 -05:00
Mark Dykes 0b96df769f Merge "libc: memset: improve performance by avoiding single byte writes" into integration 2020-09-09 18:36:08 +00:00
Madhukar Pappireddy 7fbb3dbac4 Merge "mediatek: Add jedec info" into integration 2020-09-09 17:03:28 +00:00
Manish Pandey f831ed7378 Merge "plat/arm: Add dependencies to configuration files" into integration 2020-09-09 09:52:33 +00:00
Olivier Deprez 6bea7468f8 Merge "plat: Fix build issue for qemu and rpi3 platforms" into integration 2020-09-09 09:44:13 +00:00
Olivier Deprez fc5961b390 Merge "Fix: fixing coverity issue for SPM Core." into integration 2020-09-09 09:04:37 +00:00
Saurabh Gorecha 9ac093b651 Addition of standard APIs in qtiseclib interface
Follwing APIs wrappers are exposed to qtiseclib
* strcmp
* memset
* memmove

Change-Id: I79d50f358239cfda607d5f1a53314aa3b8f430cb
Signed-off-by: Saurabh Gorecha <sgorecha@codeaurora.org>
2020-09-09 12:27:02 +05:30
Madhukar Pappireddy ed39d5e3c0 Merge "Enabling DPU in dts file for TC0" into integration 2020-09-08 14:22:45 +00:00
Avinash Mehta 0dc522943c Enabling DPU in dts file for TC0
This change replaces hdlcd with DPU in dts file for TC0

Change-Id: If25dfd3ddffc07279ab487f65e1bb82b27a26604
Signed-off-by: Avinash Mehta <avinash.mehta@arm.com>
2020-09-08 08:56:29 +01:00
joanna.farley 70b6701b8a Merge "doc: Improve contribution guidelines" into integration 2020-09-07 16:49:21 +00:00
Max Shvetsov f7fb0bf77f Fix: fixing coverity issue for SPM Core.
spmd_get_context_by_mpidr was using potentially negative value as an
array index. plat_core_pos_by_mpidr could return -1 on failure which is
utilized by some platforms.

Signed-off-by: Max Shvetsov <maksims.svecovs@arm.com>
Change-Id: I7f8827e77f18da389c9cafdc1fc841aba9f03120
2020-09-07 16:16:35 +01:00
Rui Miguel Silva 23875c3f63 fdts: corstone700: add NXP isp1763 node to device tree
Add USB IP node as the MPS3 board has the NXP isp1763 host controller.

Change-Id: I47c57e4c8345d244c46895b52fcaecc1c6f1b504
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: lakshmi Kailasanathan <lakshmi.Kailasanathan@arm.com>
2020-09-07 13:13:04 +01:00
Manish V Badarkhe dad2934c49 plat: Fix build issue for qemu and rpi3 platforms
Coverity build periodically throws below errors(non-consistently)
for 'QEMU' and 'RPI3' platforms.

/bin/sh: 1: cannot create build/qemu/debug/rot_key.pem: Directory
nonexistent
plat/qemu/qemu/platform.mk:86: recipe for target 'build/qemu/debug/
rot_key.pem' failed
make: *** [build/qemu/debug/rot_key.pem] Error 2

/bin/sh: 1: cannot create /work/workspace/workspace/tf-coverity/build
/rpi3/debug/rot_key.pem: Directory nonexistent
plat/rpi/rpi3/platform.mk:214: recipe for target '/work/workspace/
workspace/tf-coverity/build/rpi3/debug/rot_key.pem' failed
make: *** [/work/workspace/workspace/tf-coverity/build/rpi3/debug/
rot_key.pem] Error 2

Issue seems to be occurred when 'ROT key' is generated before creating
the platform build folder(for e.g.build/qemu/debug).

Changes are made to fix this issue by adding orderly dependancy of
the platform folder for the 'ROT key' creation which ensures that
platform folder is created before generating 'ROT key'.

Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
Change-Id: I20c82172dde84e4c7f2373c0bd095d353f845d38
2020-09-07 13:00:14 +01:00
Manish V Badarkhe b13e3f9f98 tools: Set the tool's default binary name
This patch: fafd3ec9c assumes that tools must build from
the main makefile folder.
This assumption leads to the error when somebody wants to
build a tool from the tool's folder.
Hence changes are done to provide the default binary name
in the tool's makefile.

Change-Id: Iae570a7f8d322151376b6feb19e739300eecc3fc
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2020-09-07 12:58:24 +01:00
Andre Przywara 75fab6496e libc: memset: improve performance by avoiding single byte writes
Currently our memset() implementation is safe, but slow. The main reason
for that seems to be the single byte writes that it issues, which can
show horrible performance, depending on the implementation of the
load/store subsystem.

Improve the algorithm by trying to issue 64-bit writes. As this only
works with aligned pointers, have a head and a tail section which
covers unaligned pointers, and leave the bulk of the work to the middle
section that does use 64-bit writes.

Put through some unit tests, which exercise all combinations of nasty
input parameters (pointers with various alignments, various odd and even
sizes, corner cases of content to write (-1, 256)).

Change-Id: I28ddd3d388cc4989030f1a70447581985368d5bb
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2020-09-03 23:00:24 +01:00
Manish Pandey 7ef3e0b31b Merge "lib: cpu: Check SCU presence in DSU before accessing DSU registers" into integration 2020-09-03 21:16:17 +00:00
Manish Pandey 86f75c2492 Merge "psci: utility api to invoke stop for other cores" into integration 2020-09-03 16:56:49 +00:00
Madhukar Pappireddy cd62b83499 Merge "Add Chris Kay as code owner for CMake Build Definitions." into integration 2020-09-03 16:44:38 +00:00
Javier Almansa Sobrino aec40abcf9 Add Chris Kay as code owner for CMake Build Definitions.
Signed-off-by: Javier Almansa Sobrino <javier.almansasobrino@arm.com>
Change-Id: I69365d4aed1160af41e291f6e4b1dd31cbd12e02
2020-09-03 10:29:24 +01:00
Sandeep Tripathy 2274490945 psci: utility api to invoke stop for other cores
The API can be used to invoke a 'stop_func' callback for all
other cores from any initiating core. Optionally it can also
wait for other cores to power down. There may be various use
of such API by platform. Ex: Platform may use this to power
down all other cores from a crashed core.

Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
Change-Id: I4f9dc8a38d419f299c021535d5f1bcc6883106f9
2020-09-03 09:29:22 +00:00
Madhukar Pappireddy a41ca4c344 Merge "spd: trusty: allow clients to retrieve service UUID" into integration 2020-09-02 18:53:56 +00:00
Madhukar Pappireddy 959a04864e Merge "maintainers: step down as code owner of UniPhier platform" into integration 2020-09-02 18:53:24 +00:00
Alexei Fedorov e3f2b1a932 plat/arm: Introduce and use libc_asm.mk makefile
Trace analysis of FVP_Base_AEMv8A 0.0/6063 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.99% of CPU execution time is spent in memset() function
written in C using single byte write operations,
see lib\libc\memset.c.
This patch introduces new libc_asm.mk makefile which
replaces C memset() implementation with assembler
version giving the following results:
- for Aarch32 in auth_signature() call memset() CPU time
reduced to 20.56%.
The number of CPU instructions (Inst) executed during
TF-A boot stage before start of BL33 in RELEASE builds
for different versions is presented in the tables below,
where:
- C TF-A: existing TF-A C code;
- C musl: "lightweight code" C "implementation of the
  standard library for Linux-based systems"
https://git.musl-libc.org/cgit/musl/tree/src/string/memset.c
- Asm Opt: assemler version from "Arm Optimized Routines"
  project
https://github.com/ARM-software/optimized-routines/blob/
master/string/arm/memset.S
- Asm Linux: assembler version from Linux kernel
https://github.com/torvalds/linux/blob/master/arch/arm/lib/memset.S
- Asm TF-A: assembler version from this patch

Aarch32:
+-----------+------+------+--------------+----------+
| Variant   | Set  | Size |    Inst 	 |  Ratio   |
+-----------+------+------+--------------+----------+
| C TF-A    | T32  | 16   | 2122110003   | 1.000000 |
| C musl    | T32  | 156  | 1643917668   | 0.774662 |
| Asm Opt   | T32  | 84   | 1604810003   | 0.756233 |
| Asm Linux | A32  | 168  | 1566255018   | 0.738065 |
| Asm TF-A  | A32  | 160  | 1525865101   | 0.719032 |
+-----------+------+------+--------------+----------+

AArch64:
+-----------+------+------------+----------+
| Variant   | Size |    Inst    |  Ratio   |
+-----------+------+------------+----------+
| C TF-A    | 28   | 2732497518 | 1.000000 |
| C musl    | 212  | 1802999999 | 0.659836 |
| Asm TF-A  | 140  | 1680260003 | 0.614917 |
+-----------+------+------------+----------+

This patch modifies 'plat\arm\common\arm_common.mk'
by overriding libc.mk makefile with libc_asm.mk and
does not effect other platforms.

Change-Id: Ie89dd0b74ba1079420733a0d76b7366ad0157c2e
Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-09-02 16:21:34 +00:00
André Przywara 29b76f2e9f Merge "arm_fpga: Add support to populate the CPU nodes in the DTB" into integration 2020-09-02 16:06:27 +00:00
Pramod Kumar 942013e1dd lib: cpu: Check SCU presence in DSU before accessing DSU registers
The DSU contains system control registers in the SCU and L3 logic to
control the functionality of the cluster. If "DIRECT CONNECT" L3
memory system variant is used, there won't be any L3 cache,
snoop filter, and SCU logic present hence no system control register
will be present. Hence check SCU presence before accessing DSU register
for DSU_936184 errata.

Signed-off-by: Pramod Kumar <pramod.kumar@broadcom.com>
Change-Id: I1ffa8afb0447ae3bd1032c9dd678d68021fe5a63
2020-09-02 21:25:43 +05:30
Madhukar Pappireddy d5794b0e42 Merge "Tegra: common: fixup the bl31 code size to be copied at reset" into integration 2020-09-02 15:50:12 +00:00
Javier Almansa Sobrino 20ff991e92 arm_fpga: Add support to populate the CPU nodes in the DTB
At the moment BL31 dynamically discovers the CPU topology of an FPGA
system at runtime, but does not export it to the non-secure world.
Any BL33 user would typically looks at the devicetree to learn about
existing CPUs.

This patch exports a minimum /cpus node in a devicetree to satisfy
the binding. This means that no cpumaps or caches are described.
This could be added later if needed.

An existing /cpus node in the DT will make the code bail out with a
message.

Signed-off-by: Javier Almansa Sobrino <javier.almansasobrino@arm.com>
Change-Id: I589a2b3412411a3660134bdcef3a65e8200e1d7e
2020-09-02 16:46:48 +01:00
Anders Dellien 3ab336a125 plat/arm: Add dependencies to configuration files
This patch adds dependencies to the generated configuration
files that are included in the FIP. This fixes occasional
build errors that occur when the FIP happens to be built first.

Change-Id: I5a2bf724ba3aee13954403b141f2f19b4fd51d1b
Signed-off-by: Anders Dellien <anders.dellien@arm.com>
2020-09-02 16:46:18 +01:00
Manish Pandey 675e3f759a Merge "Move static vars into functions in bl1" into integration 2020-09-02 13:50:49 +00:00
Alexei Fedorov c19a4e6b4b Merge "plat/arm: Get the base address of nv-counters from device tree" into integration 2020-09-02 12:14:51 +00:00
Alexei Fedorov ee99356b78 Merge "dtsi: Update the nv-counter node in the device tree" into integration 2020-09-02 12:14:43 +00:00
Madhukar Pappireddy 9b2bf15016 Merge changes from topic "tegra-downstream-08282020" into integration
* changes:
  Tegra: common: disable GICC after domain off
  cpus: denver: skip DCO enable/disable for recent SKUs
2020-09-01 23:01:06 +00:00
Madhukar Pappireddy e98d934aee Merge "Remove Jack Bond-Preston as CMake Build Definitions code owner" into integration 2020-09-01 22:33:13 +00:00
Varun Wadekar 75e1dfa038 spmd: remove assert for SPMC PC value
This patch removes the assert that expects the SPMC PC
value to be same as BL32_BASE. This assumption is not
true for all platforms e.g. Tegra, and so will be removed
from the SPMD.

Platforms can always add this check to the platform files,
if required.

Change-Id: Ic40620b43d160feb4f72f4af18e6d01861d4bf37
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2020-09-01 15:17:11 -07:00
Mark Dykes 1376389f00 Merge "Add support to export a /cpus node to the device tree." into integration 2020-09-01 18:21:46 +00:00
Javier Almansa Sobrino 780dd2b310 Add support to export a /cpus node to the device tree.
This patch creates and populates the /cpus node in a device tree
based on the existing topology. It uses the minimum required nodes
and properties to satisfy the binding as specified in
https://www.kernel.org/doc/Documentation/devicetree/bindings/arm/cpus.txt

Signed-off-by: Javier Almansa Sobrino <javier.almansasobrino@arm.com>
Change-Id: I03bf4e9a6427da0a3b8ed013f93d7bc43b5c4df0
2020-09-01 18:17:11 +01:00
Mark Dykes 5903ac1e91 Merge "sp_min: Avoid platform security reconfiguration" into integration 2020-09-01 16:27:14 +00:00
Mark Dykes b020586a50 Merge "doc: Update the cot-binding for nv-counter node" into integration 2020-09-01 16:26:22 +00:00
Hsin-Yi Wang 74a3460039 mediatek: Add jedec info
Add jedec info for mt8173, mt8183, and mt8192.

[1] http://www.softnology.biz/pdf/JEP106AV.pdf

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Change-Id: Iab36fd580131f0b09b27223fba0e9d1e187d9196
2020-09-01 16:57:13 +08:00
Varun Wadekar d35403feab Merge changes from topic "tegra-downstream-08282020" into integration
* changes:
  Tegra: platform specific BL31_SIZE
  Tegra186: sanity check power state type
  Tegra: fixup CNTPS_TVAL_EL1 delay timer reads
  Tegra: add platform specific 'runtime_setup' handler
  Tegra: remove ENABLE_SVE_FOR_NS = 0
  lib: cpus: denver: add MIDR PN9 variant
  cpus: denver: introduce macro to declare cpu_ops
2020-08-31 22:46:37 +00:00
Varun Wadekar fc19818874 spd: trusty: allow clients to retrieve service UUID
This patch implements support for the 64-bit and 32-bit versions of
0xBF00FF01 SMC function ID, as documented by the SMCCC, to allow
non-secure world clients to query SPD's UUID.

In order to service this FID, the Trusty SPD now increases the range
of SMCs that it services. To restrict Trusty from receiving the extra
SMC FIDs, this patch drops any unsupported FID.

Verified with TFTF tests for UID query and internal gtest for Trusty.

Change-Id: If96fe4993f7e641595cfe67cc6b4210a0d52403f
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2020-08-31 12:56:49 -07:00
anzhou a565d16cd1 Tegra: common: fixup the bl31 code size to be copied at reset
If the CPU doesn't run from BL31_BASE, the firmware needs to be
copied from load address to BL31_BASE during cold boot. The size
should be the actual size of the code, which is indicated by the
__RELA_END__ linker variable.

This patch updates the copy routine to use this variable as a
result.

Signed-off-by: anzhou <anzhou@nvidia.com>
Change-Id: Ie3a48dd54cda1dc152204903d609da3117a0ced9
2020-08-31 11:21:17 -07:00
anzhou c23f5e1cb9 Tegra: common: disable GICC after domain off
The the GIC CPU interface should be disabled after cpu off. The
Tegra power management code should mark the connected core as asleep
as part of the CPU off sequence.

This patch disables the GICC after CPU off as a result.

Signed-off-by: anzhou <anzhou@nvidia.com>
Change-Id: Ib1a3d8903f5e6d55bd2ee0c16134dbe2562235ea
2020-08-31 11:21:17 -07:00
Varun Wadekar 5f902752e5 cpus: denver: skip DCO enable/disable for recent SKUs
DCO is not supported by the SKUs released after MIDR_PN4. This
patch skips enabling or disabling the DCO on these SKUs.

Change-Id: Ic31a829de3ae560314d0fb5c5e867689d4ba243b
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2020-08-31 11:21:15 -07:00
anzhou 5a22eb421d Tegra: platform specific BL31_SIZE
This patch moves the BL31_SIZE to the Tegra SoC specific
tegra_def.h. This helps newer platforms configure the size of
the memory available for BL31.

Signed-off-by: anzhou <anzhou@nvidia.com>
Change-Id: I43c60b82fa7e43d5b05d87fbe7d673d729380d82
2020-08-31 10:43:44 -07:00
Varun Wadekar 26c22a5e33 Tegra186: sanity check power state type
This patch sanity checks the power state type before use,
from the platform's PSCI handler.

Verified with TFTF Standard Test Suite.

Change-Id: Icd45faac6c023d4ce7f3597b698d01b91a218124
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2020-08-31 10:43:44 -07:00
anzhou 923c221b6d Tegra: fixup CNTPS_TVAL_EL1 delay timer reads
The delay_timer driver for Tegra uses the CNTPS_TVAL_EL1 secure, physical,
decrementing timer as the source. The current logic incorrectly marks this
as an incrementing timer, by negating the timer value.

This patch fixes the anomaly and updates the driver to remove this logic.

Signed-off-by: anzhou <anzhou@nvidia.com>
Change-Id: I60490bdcaf0b66bf4553a6de3f4e4e32109017f4
2020-08-31 10:43:44 -07:00
Kalyani Chidambaram Vaidyanathan 3ff448f9a7 Tegra: add platform specific 'runtime_setup' handler
Tegra SoCs would like the flexibility to perform chip specific actions
before we complete cold boot. This patch introduces a platform specific
'runtime_setup' handler to provide that flexibility.

Change-Id: I13b2489f631f775cae6f92acf51a240cd036ef11
Signed-off-by: Kalyani Chidambaram Vaidyanathan <kalyanic@nvidia.com>
2020-08-31 10:43:44 -07:00
Kalyani Chidambaram Vaidyanathan 0da7e2dd8e Tegra: remove ENABLE_SVE_FOR_NS = 0
The SVE CPU extension library reads the id_aa64pfr0_el1 register to
check if SVE is enabled. Tegra platforms disabled ENABLE_SVE_FOR_NS for
pre-8.2 platforms, but this flag can safely be enabled now that the
library can enable the feature at runtime.

This patch updates the makefile to remove "ENABLE_SVE_FOR_NS = 0"
as a result.

Change-Id: Ia2a89ac90644f8c0d39b41d321e04458ff6be6e1
Signed-off-by: Kalyani Chidambaram Vaidyanathan <kalyanic@nvidia.com>
2020-08-31 10:43:44 -07:00
Hemant Nigam c6d25c0042 lib: cpus: denver: add MIDR PN9 variant
This patch introduces support for PN9 variant for some
Denver based platforms.

Original change by: Hemant Nigam <hnigam@nvidia.com>

Signed-off-by: Kalyani Chidambaram Vaidyanathan <kalyanic@nvidia.com>
Change-Id: I331cd3a083721fd1cd1b03f4a11b32fd306a21f3
2020-08-31 10:43:44 -07:00