Commit Graph

6577 Commits

Author SHA1 Message Date
Sandrine Bailleux 3bff910dc1 Introduce COT build option
Allows to select the chain of trust to use when the Trusted Boot feature
is enabled. This affects both the cert_create tool and the firmware
itself.

Right now, the only available CoT is TBBR.

Change-Id: I7ab54e66508a1416cb3fcd3dfb0f055696763b3d
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2020-01-29 14:00:33 +01:00
Sandrine Bailleux 067f7e9c52 cert_create: Remove references to TBBR in common code
In preparation of supporting alternate chains of trust, reword comments
and error messages that explicitly mentioned TBBR.

Change-Id: I85a0b08e16d0cd82f3b767fcc092d1f20f45939f
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2020-01-29 14:00:32 +01:00
Sandrine Bailleux 43743ea57d cert_create: Introduce COT build option
It allows to select the desired chain of trust. Right now, only the TBBR
CoT is available.

At this stage, this build option only affects the tool itself. It is not
plugged into the rest of the build system yet. To use it:

 > make -C tools/cert_create COT=tbbr

Change-Id: I4484418f76d3c7b330d8653c978499a181534dcd
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2020-01-29 14:00:32 +01:00
Sandrine Bailleux 3b24b66edc cert_create: Introduce TBBR CoT makefile
Move all TBBR-specific stuff out of the tool's makefile into a
sub-makefile. This will make it easier to define and select an alternate
chain of trust in the future.

Change-Id: I92e366a1999b74cf51127d1771b64b807cd94b29
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2020-01-29 14:00:14 +01:00
Manish Pandey 91ff490d75 Merge "Neovers N1: added support to update presence of External LLC" into integration 2020-01-28 08:18:56 +00:00
Soby Mathew 0281e60c3d Merge changes from topic "pie" into integration
* changes:
  uniphier: make all BL images completely position-independent
  uniphier: make uniphier_mmap_setup() work with PIE
  uniphier: pass SCP base address as a function parameter
  uniphier: set buffer offset and length for io_block dynamically
  uniphier: use more mmap_add_dynamic_region() for loading images
  bl_common: add BL_END macro
  uniphier: turn on ENABLE_PIE
  TSP: add PIE support
  BL2_AT_EL3: add PIE support
  BL31: discard .dynsym .dynstr .hash sections to make ENABLE_PIE work
  PIE: pass PIE options only to BL31
  Build: support per-BL LDFLAGS
2020-01-27 17:01:07 +00:00
Manish Pandey f2d6b4ee57 Neovers N1: added support to update presence of External LLC
CPUECTLR_EL1.EXTLLC bit indicates the presense of internal or external
last level cache(LLC) in the system, the reset value is internal LLC.

To cater for the platforms(like N1SDP) which has external LLC present
introduce a new build option 'NEOVERSE_N1_EXTERNAL_LLC' which can be
enabled by platform port.

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: Ibf475fcd6fd44401897a71600f4eafe989921363
2020-01-27 14:44:35 +00:00
Manish Pandey 432e9ee243 Merge "plat/sgm: Always use SCMI for SGM platforms" into integration 2020-01-27 13:05:54 +00:00
Mark Dykes 9054018bd5 Merge "xilinx: Unify Platform specific defines for PSCI module" into integration 2020-01-24 17:03:17 +00:00
Chris Kay f2aa4e882b plat/sgm: Always use SCMI for SGM platforms
As on SGI platforms, SCPI is unsupported on SGM platforms.

Change-Id: I556ed095b9eb55b72447230ee2725d3c76160a08
Signed-off-by: Chris Kay <chris.kay@arm.com>
2020-01-24 16:33:12 +00:00
Deepika Bhavnani 6cdef9ba11 xilinx: Unify Platform specific defines for PSCI module
PLATFORM_CORE_COUNT - Unsigned int
PLATFORM_CLUSTER_COUNT - Unsigned int
PLATFORM_MAX_CPUS_PER_CLUSTER - Unsigned int
PLATFORM_CORE_COUNT_PER_CLUSTER - Unsigned int

Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com>
Change-Id: I76f5535f1cbdaf3fc1235cd824111d9afe8f7e1b
2020-01-24 10:02:15 -06:00
Masahiro Yamada 7af2131787 uniphier: make all BL images completely position-independent
This platform supports multiple SoCs. The next SoC will still keep
quite similar architecture, but the memory base will be changed.

The ENABLE_PIE improves the maintainability and usability. You can reuse
a single set of BL images for other SoC/board without re-compiling TF-A
at all. This will also keep the code cleaner because it avoids #ifdef
around various base addresses.

By defining ENABLE_PIE, BL2_AT_EL3, BL31, and BL32 (TSP) are really
position-independent now. You can load them anywhere irrespective of
their link address.

Change-Id: I8d5e3124ee30012f5b3bfa278b0baff8efd2fff7
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-01-24 22:34:50 +09:00
Masahiro Yamada c64873ab94 uniphier: make uniphier_mmap_setup() work with PIE
BL2_BASE, BL31_BASE, and BL32_BASE are defined in platform_def.h,
that is, determined at link-time.

On the other hand, BL2_END, BL31_END, and BL32_END are derived from
the symbols produced by the linker scripts. So, they are fixed-up
at run-time if ENABLE_PIE is enabled.

To make it work in a position-indepenent manner, use BL_CODE_BASE and
BL_END, both of which are relocatable.

Change-Id: Ic179a7c60eb64c5f3024b178690b3ac7cbd7521b
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-01-24 22:34:50 +09:00
Masahiro Yamada 577b24411a uniphier: pass SCP base address as a function parameter
Currently, UNIPHIER_SCP_BASE is hard-coded in uniphier_scp_start(),
which is not handy for PIE.

Towards the goal of making this really position-independent, pass in
image_info->image_base.

Change-Id: I88e020a1919c607b1d5ce70b116201d95773bb63
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-01-24 22:34:50 +09:00
Masahiro Yamada b79b3177d3 uniphier: set buffer offset and length for io_block dynamically
Currently, the .buffer field in io_block_dev_spec is statically set,
which is not handy for PIE.

Towards the goal of making this really position-independent, set the
buffer length and length in the uniphier_io_block_setup() function.

Change-Id: I22b20d7b58d6ffd38f64f967a2820fca4bd7dade
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-01-24 22:34:50 +09:00
Masahiro Yamada b5dd85f2c9 uniphier: use more mmap_add_dynamic_region() for loading images
Currently, uniphier_bl2_mmap hard-codes the memory region needed for
loading other images.

Towards the goal of making this really position-independent, call
mmap_add_dynamic_region() before that region gets accessed.

Change-Id: Ieb505b91ccf2483e5f1a280accda564b33f19f11
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-01-24 22:34:50 +09:00
Masahiro Yamada 2c74a29d55 bl_common: add BL_END macro
Currently, the end address macros are defined per BL, like BL2_END,
BL31_END, BL32_END. They are not handy in the common code shared
between multiple BL stages.

This commit introduces BL_END, which is equivalent to BL{2,31,32}_END,
and will be useful for the BL-common code.

Change-Id: I3c39bf6096d99ce920a5b9fa21c0f65456fbfe8a
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-01-24 22:34:25 +09:00
Masahiro Yamada 66b9d8890c uniphier: turn on ENABLE_PIE
Now that various issues in the PIE support have been fixed,
this platform can enable ENABLE_PIE.

I tested BL2_AT_EL3, BL31, TSP, and all of them worked.

Change-Id: Ibc499c6bad30b7f81a42bfa7e435ce25f820bd9c
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-01-24 22:34:25 +09:00
Masahiro Yamada d974301d22 TSP: add PIE support
This implementation simply mimics that of BL31.

Change-Id: Ibbaa4ca012d38ac211c52b0b3e97449947160e07
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-01-24 22:34:25 +09:00
Masahiro Yamada 69af7fcf99 BL2_AT_EL3: add PIE support
This implementation simply mimics that of BL31.

I did not implement the ENABLE_PIE support for BL2_IN_XIP_MEM=1 case.
It would make the linker script a bit uglier.

Change-Id: If3215abd99f2758dfb232e44b50320d04eba808b
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-01-24 22:34:25 +09:00
Masahiro Yamada 511046eaa2 BL31: discard .dynsym .dynstr .hash sections to make ENABLE_PIE work
When I tried ENABLE_PIE for my PLAT=uniphier platform, BL31 crashed
at its entry. When it is built with ENABLE_PIE=1, some sections are
inserted before the executable code.

$ make PLAT=uniphier CROSS_COMPILE=aarch64-linux-gnu- ENABLE_PIE=1 bl31
$ aarch64-linux-gnu-objdump -h build/uniphier/release/bl31/bl31.elf | head -n 13

build/uniphier/release/bl31/bl31.elf:     file format elf64-littleaarch64

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .dynsym       000002a0  0000000081000000  0000000081000000  00010000  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .dynstr       000002a0  00000000810002a0  00000000810002a0  000102a0  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .hash         00000124  0000000081000540  0000000081000540  00010540  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 ro            0000699c  0000000081000664  0000000081000664  00010664  2**11
                  CONTENTS, ALLOC, LOAD, CODE

The previous stage loader generally jumps over to the base address of
BL31, where no valid instruction exists.

I checked the linker script of Linux (arch/arm64/kernel/vmlinux.lds.S)
and U-Boot (arch/arm/cpu/armv8/u-boot.lds), both of which support
relocation. They simply discard those sections.

Do similar in TF-A too.

Change-Id: I6c33e9143856765d4ffa24f3924b0ab51a17cde9
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-01-24 22:34:25 +09:00
Masahiro Yamada 320920c15f PIE: pass PIE options only to BL31
docs/getting_started/build-options.rst clearly says ENABLE_PIE is
currently only supported in BL31, but in fact, it has a stronger
limitation:

  Defining ENABLE_PIE may corrupt BL1 and BL2. So, ENABLE_PIE is
  supported only for platforms where BL31 is the only image built
  in the TF-A tree.

Currently, ENABLE_PIE is enabled by two platforms,
plat/arm/common/arm_common.mk and ti/k3/common/plat_common.mk,
both of which enable ENABLE_PIE together with RESET_TO_BL31.

For platforms with the full boot sequence, ENABLE_PIE may break earlier
BL stages. For example, if I build PLAT=qemu with ENABLE_PIE=1, it
fails in BL1.

When ENABLE_PIE is enabled, PIE options are added to TF_CFLAGS and
TF_LDFLAGS, so all BL images are affected. It is problematic because
currently only the BL31 linker script handles it. Even if BL1/BL2
works, the image size would increase needlessly, at least.

Pass the PIE options only to BL images that support it.

Change-Id: I550e95148aa3c63571c8ad2081082c554a848f57
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-01-24 22:34:25 +09:00
Masahiro Yamada d986bae4e2 Build: support per-BL LDFLAGS
make_helpers/build_macros.mk supports per-BL CFLAGS. For example,
you can pass compiler flags only to BL31 by using BL31_CFLAGS.

This commit adds per-BL LDFLAGS support, which is useful as well.

My main motivation of this addition is to use it for ENABLE_PIE.
When ENABLE_PIE is enabled, some linker flags are added to TF_LDFLAGS,
which affects all the TF images. It will make more sense to pass the
relevant options only to BL images that support it.

Change-Id: I203acaab0091db5ae0ea6e66460ee7dc8d9c4d75
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-01-24 22:34:25 +09:00
Soby Mathew 262c5d3068 Merge "ti: Unify Platform specific defines for PSCI module" into integration 2020-01-24 13:15:57 +00:00
Deepika Bhavnani 79fadd8f36 ti: Unify Platform specific defines for PSCI module
PLATFORM_CORE_COUNT - Unsigned int
PLATFORM_CLUSTER_COUNT - Unsigned int
PLATFORM_MAX_CPUS_PER_CLUSTER - Unsigned int
PLATFORM_CORE_COUNT_PER_CLUSTER - Unsigned int

Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com>
Change-Id: Ia7072d82116b03904c1b3982f37d96347203e621
2020-01-24 13:15:54 +00:00
Soby Mathew 63c17293bc Merge "st: Unify Platform specific defines for PSCI module" into integration 2020-01-24 13:15:49 +00:00
Deepika Bhavnani f4f1d88dff st: Unify Platform specific defines for PSCI module
PLATFORM_CORE_COUNT - Unsigned int
PLATFORM_CLUSTER_COUNT - Unsigned int
PLATFORM_MAX_CPUS_PER_CLUSTER - Unsigned int
PLATFORM_CORE_COUNT_PER_CLUSTER - Unsigned int

Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com>
Change-Id: I3421336230981d4cda301fa2cef24b94b08353b1
2020-01-24 13:15:48 +00:00
Soby Mathew 596561b0cd Merge "layerscape: Unify Platform specific defines for PSCI module" into integration 2020-01-24 13:15:42 +00:00
Deepika Bhavnani 08a64471aa layerscape: Unify Platform specific defines for PSCI module
PLATFORM_CORE_COUNT - Unsigned int
PLATFORM_CLUSTER_COUNT - Unsigned int
PLATFORM_MAX_CPUS_PER_CLUSTER - Unsigned int
PLATFORM_CORE_COUNT_PER_CLUSTER - Unsigned int

Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com>
Change-Id: Ib9f97be1972405e54dc9550266f5b8a6a55b93bf
2020-01-24 13:15:40 +00:00
Soby Mathew 47eb228868 Merge "qemu: Unify Platform specific defines for PSCI module" into integration 2020-01-24 13:15:35 +00:00
Deepika Bhavnani 645ac02dd6 qemu: Unify Platform specific defines for PSCI module
PLATFORM_CORE_COUNT - Unsigned int
PLATFORM_CLUSTER_COUNT - Unsigned int
PLATFORM_MAX_CPUS_PER_CLUSTER - Unsigned int
PLATFORM_CORE_COUNT_PER_CLUSTER - Unsigned int

Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com>
Change-Id: I460b35f5a4ec47b13d4e811bb20881ce314e9259
2020-01-24 13:15:33 +00:00
Soby Mathew 88ea77e07e Merge "socionext: Unify Platform specific defines for PSCI module" into integration 2020-01-24 13:15:28 +00:00
Deepika Bhavnani 50dae22e25 socionext: Unify Platform specific defines for PSCI module
PLATFORM_CORE_COUNT - Unsigned int
PLATFORM_CLUSTER_COUNT - Unsigned int
PLATFORM_MAX_CPUS_PER_CLUSTER - Unsigned int
PLATFORM_CORE_COUNT_PER_CLUSTER - Unsigned int

Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com>
Change-Id: Iad91e99e9d13254de23eb10e5f655253f253cf0d
2020-01-24 13:15:26 +00:00
Soby Mathew b55d71bab1 Merge "mediatek: Unify Platform specific defines for PSCI module" into integration 2020-01-24 13:15:21 +00:00
Deepika Bhavnani 4dc3a96122 mediatek: Unify Platform specific defines for PSCI module
PLATFORM_CORE_COUNT - Unsigned int
PLATFORM_CLUSTER_COUNT - Unsigned int
PLATFORM_MAX_CPUS_PER_CLUSTER - Unsigned int
PLATFORM_CORE_COUNT_PER_CLUSTER - Unsigned int

Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com>
Change-Id: Iee98ded027c049d9f12d4bb5888c0496b3251b4e
2020-01-24 13:15:19 +00:00
Soby Mathew 1b567d3e16 Merge "intel: Unify Platform specific defines for PSCI module" into integration 2020-01-24 13:15:13 +00:00
Deepika Bhavnani dc2d366fac intel: Unify Platform specific defines for PSCI module
PLATFORM_CORE_COUNT - Unsigned int
PLATFORM_CLUSTER_COUNT - Unsigned int
PLATFORM_MAX_CPUS_PER_CLUSTER - Unsigned int
PLATFORM_CORE_COUNT_PER_CLUSTER - Unsigned int

Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com>
Change-Id: Id3d3efc7e7711d19f0223da823713b8390ad2f47
2020-01-24 13:15:11 +00:00
Soby Mathew 076d89753f Merge "marvell: Unify Platform specific defines for PSCI module" into integration 2020-01-24 13:14:57 +00:00
Deepika Bhavnani ac2f6d4353 marvell: Unify Platform specific defines for PSCI module
PLATFORM_CORE_COUNT - Unsigned int
PLATFORM_CLUSTER_COUNT - Unsigned int
PLATFORM_MAX_CPUS_PER_CLUSTER - Unsigned int
PLATFORM_CORE_COUNT_PER_CLUSTER - Unsigned int

Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com>
Change-Id: I7d660d5a9d7e44601353c77e9b6ee4096a277d76
2020-01-24 13:14:55 +00:00
Soby Mathew 713403cb4d Merge "rockchip: Unify Platform specific defines for PSCI module" into integration 2020-01-24 13:14:47 +00:00
Deepika Bhavnani ed7a56361c rockchip: Unify Platform specific defines for PSCI module
PLATFORM_CORE_COUNT - Unsigned int
PLATFORM_CLUSTER_COUNT - Unsigned int
PLATFORM_MAX_CPUS_PER_CLUSTER - Unsigned int
PLATFORM_CORE_COUNT_PER_CLUSTER - Unsigned int

Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com>
Change-Id: I624c15d569db477506a74964bc828e1a932181d4
2020-01-24 13:14:44 +00:00
Soby Mathew 133e6f7e9b Merge "allwinner: Unify Platform specific defines for PSCI module" into integration 2020-01-24 13:14:37 +00:00
Deepika Bhavnani e0b4cc7584 allwinner: Unify Platform specific defines for PSCI module
PLATFORM_CORE_COUNT - Unsigned int
PLATFORM_CLUSTER_COUNT - Unsigned int
PLATFORM_MAX_CPUS_PER_CLUSTER - Unsigned int
PLATFORM_CORE_COUNT_PER_CLUSTER - Unsigned int

Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com>
Change-Id: I7aea86891e54522c88af5ff16795a575f9a9322d
2020-01-24 13:14:34 +00:00
Soby Mathew 22d7dd7fc7 Merge "imx: Unify Platform specific defines for PSCI module" into integration 2020-01-24 13:14:22 +00:00
Deepika Bhavnani 7a57188b94 imx: Unify Platform specific defines for PSCI module
PLATFORM_CORE_COUNT - Unsigned int
PLATFORM_CLUSTER_COUNT - Unsigned int
PLATFORM_MAX_CPUS_PER_CLUSTER - Unsigned int
PLATFORM_CORE_COUNT_PER_CLUSTER - Unsigned int

Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com>
Change-Id: I8b19e833a4e1067e1cfcc9bfaede7854e0e63004
2020-01-24 13:14:08 +00:00
Soby Mathew 7adb7a86e7 Merge "hisilicon: Unify Platform specific defines for PSCI module" into integration 2020-01-24 13:11:18 +00:00
Deepika Bhavnani 28abb2c237 hisilicon: Unify Platform specific defines for PSCI module
PLATFORM_CORE_COUNT - Unsigned int
PLATFORM_CLUSTER_COUNT - Unsigned int
PLATFORM_MAX_CPUS_PER_CLUSTER - Unsigned int
PLATFORM_CORE_COUNT_PER_CLUSTER - Unsigned int

Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com>
Change-Id: I327a8a2ab0f0e49bd62f413296c3b326393422b6
2020-01-24 13:01:27 +00:00
Soby Mathew 90b686cf8c Merge changes from topic "tegra-downstream-01202020" into integration
* changes:
  Tegra194: mce: remove unused NVG functions
  Tegra194: support for NVG interface v6.6
  Tegra194: smmu: add PCIE0R1 mc reg to system suspend save list
  Tegra194: enable driver for general purpose DMA engine
  Tegra194: access XUSB_PADCTL registers on Si/FPGA platforms
  Tegra194: organize the memory/mmio map to make it linear
  Tegra194: memctrl: enable mc sid OVERRIDE for PCIE0R1
  Tegra194: support for boot params wider than 32-bits
  Tegra194: memctrl: set reorder depth limit for PCIE blocks
  Tegra194: memctrl: program MC_TXN_OVERRIDE reg for PTCR, MPCORE and MIU
  Tegra194: memctrl: set CGID_TAG_ADR instead of CGID_TAG_DEFAULT
  Tegra194: memctrl: update mss reprogramming as HW PROD settings
  Tegra194: memctrl: Disable PVARDC coalescer
  Tegra194: memctrl: force seswr/rd transactions as passsthru & coherent
  Tegra194: Request CG7 from last core in cluster
  Tegra194: toggle SE clock during context save/restore
  Tegra: bpmp: fix header file paths
2020-01-24 13:00:07 +00:00
Soby Mathew 064d3f6418 Merge "xlat_tables_v2: simplify end address checks in mmap_add_region_check()" into integration 2020-01-24 12:53:18 +00:00
Soby Mathew 5f3ed6aaed Merge "Prevent speculative execution past ERET" into integration 2020-01-24 10:04:10 +00:00