Commit Graph

7114 Commits

Author SHA1 Message Date
Masahiro Yamada a7739bc7b1 linker_script: move bss section to bl_common.ld.h
Move the bss section to the common header. This adds BAKERY_LOCK_NORMAL
and PMF_TIMESTAMP, which previously existed only in BL31. This is not
a big deal because unused data should not be compiled in the first
place. I believe this should be controlled by BL*_SOURCES in Makefiles,
not by linker scripts.

I investigated BL1, BL2, BL2U, BL31 for plat=fvp, and BL2-AT-EL3,
BL31, BL31 for plat=uniphier. I did not see any more  unexpected
code addition.

The bss section has bigger alignment. I added BSS_ALIGN for this.

Currently, SORT_BY_ALIGNMENT() is missing in sp_min.ld.S, and with this
change, the BSS symbols in SP_MIN will be sorted by the alignment.
This is not a big deal (or, even better in terms of the image size).

Change-Id: I680ee61f84067a559bac0757f9d03e73119beb33
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-04-02 13:38:24 +09:00
Masahiro Yamada 0a0a7a9ac8 linker_script: replace common read-only data with RODATA_COMMON
The common section data are repeated in many linker scripts (often
twice in each script to support SEPARATE_CODE_AND_RODATA). When you
add a new read-only data section, you end up with touching lots of
places.

After this commit, you will only need to touch bl_common.ld.h when
you add a new section to RODATA_COMMON.

Replace a series of RO section with RODATA_COMMON, which contains
6 sections, some of which did not exist before.

This is not a big deal because unneeded data should not be compiled
in the first place. I believe this should be controlled by BL*_SOURCES
in Makefiles, not by linker scripts.

When I was working on this commit, the BL1 image size increased
due to the fconf_populator. Commit c452ba159c ("fconf: exclude
fconf_dyn_cfg_getter.c from BL1_SOURCES") fixed this issue.

I investigated BL1, BL2, BL2U, BL31 for plat=fvp, and BL2-AT-EL3,
BL31, BL31 for plat=uniphier. I did not see any more  unexpected
code addition.

Change-Id: I5d14d60dbe3c821765bce3ae538968ef266f1460
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-04-02 13:30:17 +09:00
Masahiro Yamada 9fb288a03e linker_script: move more common code to bl_common.ld.h
These are mostly used to collect data from special structure,
and repeated in many linker scripts.

To differentiate the alignment size between aarch32/aarch64, I added
a new macro STRUCT_ALIGN.

While I moved the PMF_SVC_DESCS, I dropped #if ENABLE_PMF conditional.
As you can see in include/lib/pmf/pmf_helpers.h, PMF_REGISTER_SERVICE*
are no-op when ENABLE_PMF=0. So, pmf_svc_descs and pmf_timestamp_array
data are not populated.

Change-Id: I3f4ab7fa18f76339f1789103407ba76bda7e56d0
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-04-02 12:33:18 +09:00
Sandrine Bailleux 0a43db84af Merge "doc: Fix broken external link for Odroid C2" 2020-04-01 07:21:51 +00:00
Mark Dykes 0edfd3772a Merge "plat: imx: imx8qx: provide debug uart num as build param" into integration 2020-03-31 21:27:39 +00:00
Mark Dykes e0ca555ed1 Merge "Update code freeze and release target date for 2.3" into integration 2020-03-31 20:33:30 +00:00
Mark Dykes 787d848a1e Merge "xlat_tables_v2: add enable_mmu()" into integration 2020-03-31 19:56:31 +00:00
Mark Dykes 614be75df6 Merge "Add get_current_el_maybe_constant()" into integration 2020-03-31 19:55:44 +00:00
Mark Dykes 426d5f9c9e Merge "Build: define IMAGE_AT_EL1 or IMAGE_AT_EL3 globally for C files" into integration 2020-03-31 19:55:06 +00:00
laurenw-arm fa65b0e45a Update code freeze and release target date for 2.3
Signed-off-by: Lauren Wehrmeister <lauren.wehrmeister@arm.com>
Change-Id: Icf0a5737852e4f025dd8ce3748594ad25da43045
2020-03-31 14:21:55 -05:00
Mark Dykes dc341a1a88 Merge "fconf: exclude fconf_dyn_cfg_getter.c from BL1_SOURCES" into integration 2020-03-31 18:50:44 +00:00
Mark Dykes 0603a064a1 Merge "bl32: sp_min: reduce the alignment for fconf_populator" into integration 2020-03-31 18:50:20 +00:00
Mark Dykes 4ed750a4cb Merge "plat: pass -D option to BL*_CPPFLAGS instead of BL*_CFLAGS" into integration 2020-03-31 18:49:48 +00:00
Mark Dykes f80f2d1c4d Merge "Build: introduce per-BL CPPFLAGS and ASFLAGS" into integration 2020-03-31 18:48:00 +00:00
Heinrich Schuchardt db059ea4d9 doc: Fix broken external link for Odroid C2
The file README.odroid-c2 has been moved in the U-Boot repository.

Reference the official uplink repository.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Change-Id: Ie72c7aefd6363a406f88ad2c87faee1c7a2125a3
2020-03-31 20:38:01 +02:00
Olivier Deprez 8eceb1c9c4 Merge "Create separate header for ARM specific SMCCC defines" into integration 2020-03-31 14:16:40 +00:00
Sandrine Bailleux a7062b7daa Merge "Makefile: don't use $(CC) before value is explicit set" into integration 2020-03-31 14:00:10 +00:00
Ahmad Fatoum 32b209bfea Makefile: don't use $(CC) before value is explicit set
Unless specified in the environment, $(CC) expands to some generic
host C compiler like cc or c99. We set our own value for $(CC), but
only few lines later.

Move the first use of the $(CC) variable behind the definition to
correct this.

Change-Id: I45344e063d21ddfe22b7ad77954e85c1c46087bd
Fixes: 1684b8733 ("Use clang assembler when clang compiler is used")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
2020-03-31 11:34:16 +00:00
Manish Pandey 27c5e15ee4 Merge "TF-A GICv3 driver: Introduce makefile" into integration 2020-03-31 11:22:38 +00:00
Sandrine Bailleux 93b2434f67 Merge "Tegra: fixup GIC init from the 'on_finish' handler" into integration 2020-03-31 07:42:46 +00:00
Sandrine Bailleux 3be86517ed Merge "Tegra186: increase memory mapped regions" into integration 2020-03-31 07:38:26 +00:00
Masahiro Yamada c452ba159c fconf: exclude fconf_dyn_cfg_getter.c from BL1_SOURCES
fconf_dyn_cfg_getter.c calls FCONF_REGISTER_POPULATOR(), which populates
the fconf_populator structure.

However, bl1/bl1.ld.S does not have:

        __FCONF_POPULATOR_START__ = .;
        KEEP(*(.fconf_populator))
        __FCONF_POPULATOR_END__ = .;

So, this is not linked to bl1.elf

We could change either bl1/bl1.lds.S or lib/fconf/fconf.mk to make
them consistent.

I chose to fix up fconf.mk to keep the current behavior.

This is a groundwork to factor out the common code from linker scripts.

Change-Id: I07b7ad4db4ec77b57acf1588fffd0b06306d7293
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-03-31 16:08:21 +09:00
Masahiro Yamada 85ee795ca2 bl32: sp_min: reduce the alignment for fconf_populator
sp_min.ld.S is used for aarch32.

ALIGN(4) is used for alignment of the other structures. I do not think
struct fconf_populator is a special case. Let's use ALIGN(4) here too.

Perhaps, this is just a copy-paste mistake of commit 26d1e0c330
("fconf: necessary modifications to support fconf in BL31 & SP_MIN").

Change-Id: I29f4c68680842c1b5ef913934b4ccf378e9bfcfb
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-03-31 16:08:21 +09:00
Masahiro Yamada 11a3c5ee73 plat: pass -D option to BL*_CPPFLAGS instead of BL*_CFLAGS
-D is a preprocessor flag that defines a macro. So, adding it to
BL*_CPPFLAGS makes more sense. You can reference it not only from
.c files but also from .S files.

Change-Id: Ib4f2f27a3ed3eae476a6a32da7ab5225ad0649de
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-03-31 16:08:21 +09:00
Masahiro Yamada 848a7e8ce1 Build: introduce per-BL CPPFLAGS and ASFLAGS
Currently, BL*_CFLAGS and BL*_LDFLAGS are supported.

For completion, this adds BL*_CPPFLAGS and BL*_ASFLAGS.

My main motivation is to pass -D<macro> to BL*_CPPFLAGS so that
the macro can be used from all source files.

Change-Id: I0ca1e4e26386bef7fed999af140ee7cce7c2f8ef
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-03-31 16:08:21 +09:00
Masahiro Yamada f554773520 xlat_tables_v2: add enable_mmu()
enable_mmu_* has a different function name, so it is not handy in the
shared code. enable_mmu() calls an appropriate one depending on the
exception level.

Change-Id: I0657968bfcb91c32733f75f9259f550a5c35b1c3
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-03-31 11:51:56 +09:00
Masahiro Yamada fd092be239 Add get_current_el_maybe_constant()
There are some cases where we want to run EL-dependent code in the
shared code.

We could use #ifdef, but it leaves slight possibility where we do not
know the exception level at the build-time (e.g. library code).

The counter approach is to use get_current_el(), but it is run-time
detection, so all EL code is linked, some of which might be unneeded.

This commit adds get_current_el_maybe_constant(). This is a static
inline function that returns a constant value if we know the exception
level at build-time. This is mostly the case.

    if (get_current_el_maybe_constant() == 1) {
            /* do something for EL1 */
    } else if (get_current_el_maybe_constant() == 3) {
            /* do something for EL3 */
    }

If get_current_el_maybe_constant() is build-time constant, the compiler
will optimize out the unreachable code.

If such code is included from the library code, it is not built-time
constant. In this case, it falls back to get_current_el(), so it still
works.

Change-Id: Idb03c20342a5b5173fe2d6b40e1fac7998675ad3
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-03-31 11:51:56 +09:00
Masahiro Yamada d5e97a1d2c Build: define IMAGE_AT_EL1 or IMAGE_AT_EL3 globally for C files
The build system defines the IMAGE_BL* macro when compiling each image.
This is useful to distinguish which image the current file is being
built for by using #if defined(IMAGE_BL2) or #if defined(IMAGE_BL31),
or whatever.

There are some cases where we are more interested in which exception
level the current file is being built for.

include/lib/cpus/{aarch32,aarch64}/cpu_macros.S defines IMAGE_AT_EL3,
but we do not have it globally.

Pass IMAGE_AT_EL1 or IMAGE_AT_EL3 to BL*_CFLAGS so that it is available
from all C code.

The library code (libc.a, libmbedtls.a, etc.) is exceptional cases,
where the code can be shared between BL images.

Other than that, we know the exception level at the build time, and
this macro will be useful in the shared code.

Change-Id: I7c8a1da10726906adfba981cfe8464dff111d6b0
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-03-31 11:51:56 +09:00
Manish Pandey 0a81158f0d Merge "plat/sgm775: Add support for dynamic config using fconf" into integration 2020-03-30 21:41:50 +00:00
Madhukar Pappireddy ebe1f2cfd7 plat/sgm775: Add support for dynamic config using fconf
1. Necessary changes to platform makefile to include fw_config
device tree and package it in fip.bin

2. Removed hw_config node from fw_config dts as there is no
HW_CONFIG device tree source for sgm775

3. Added mbedtls_heap related properties for TBBR functionality

Change-Id: I26b940c65b17ad2fb5537141f8649785bb0fd4ad
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
2020-03-30 16:14:55 -05:00
Olivier Deprez e97841eba4 Merge "Flush dcache when storing timestamp" into integration 2020-03-30 15:29:00 +00:00
Olivier Deprez de8f9cd4cd Merge changes from topic "ddr_map" into integration
* changes:
  stm32mp1: use stm32mp_get_ddr_ns_size() function
  stm32mp1: set XN attribute for some areas in BL2
  stm32mp1: dynamically map DDR later and non-cacheable during its test
  stm32mp1: add a function to get non-secure DDR size
2020-03-30 15:27:32 +00:00
Manish V Badarkhe 53adebad8b Create separate header for ARM specific SMCCC defines
Moved SMCCC defines from plat_arm.h to new <smccc_def.h> header
and include this header in all ARM platforms.

Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
Change-Id: I4cbc69c7b9307461de87b7c7bf200dd9b810e485
2020-03-30 12:21:38 +00:00
Alexei Fedorov a6ea06f563 TF-A GICv3 driver: Introduce makefile
This patch moves all GICv3 driver files into new added
'gicv3.mk' makefile for the benefit of the generic driver
which can evolve in the future without affecting platforms.
The patch adds GICv3 driver configuration flags
'GICV3_IMPL', 'GICV3_IMPL_GIC600_MULTICHIP' and
'GICV3_OVERRIDE_DISTIF_PWR_OPS' described in
'GICv3 driver options' section of 'build-option.rst'
document.

NOTE: Platforms with GICv3 driver need to be modified to
include 'drivers/arm/gic/v3/gicv3.mk' in their makefiles.

Change-Id: If055f6770ff20f5dee5a3c99ae7ced7cdcac5c44
Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-03-30 10:54:01 +00:00
Manish Pandey ee91cd2ed3 Merge "plat/arm/sgi: fix the incorrect check for SCMI channel ID" into integration 2020-03-27 21:24:33 +00:00
Aditya Angadi 5c215de249 plat/arm/sgi: fix the incorrect check for SCMI channel ID
Use ARRAY_SIZE macro instead of sizeof operator to obtain the maximum
number of SCMI channels supported on the platform.

Change-Id: Id922bb548af98ac99b4ac0c34e38e589e5a80b2d
Signed-off-by: Aditya Angadi <aditya.angadi@arm.com>
2020-03-27 21:24:27 +00:00
Manish Pandey 527ac2e7e5 Merge changes from topic "os/bl31-fpga-port" into integration
* changes:
  plat/arm/board/arm_fpga: Compile with additional CPU libraries
  plat/arm/board/arm_fpga: Enable position-independent execution
  plat/arm/board/arm_fpga: Enable port for alternative cluster configurations
  plat/arm/board/arm_fpga: Initialize the Generic Interrupt Controller
  plat/arm/board/arm_fpga: Initialize the System Counter
  plat/arm/board/arm_fpga: Add PSCI implementation for FPGA images
  plat/arm/board/arm_fpga: Use preloaded BL33 alternative boot flow
  plat/arm/board/arm_fpga: Enable basic BL31 port for an FPGA image
2020-03-27 17:54:21 +00:00
Manish Pandey 3f0b298fe9 Merge "Changelog updates for recent commits" into integration 2020-03-27 17:48:31 +00:00
Manish Pandey b3250f58a8 Merge "doc: add spm and spmd related build options" into integration 2020-03-27 16:17:51 +00:00
Zelalem f27b6924d6 Flush dcache when storing timestamp
On DynamIQ CPU FVPs, stats test cases are failing when
hardware-assisted coherency is enabled due to a corrupt
timestamp value. Investigation of the issue indicates that
on these models the timestamp value is stored in cache
instead of memory. This patch flushes the dcache when the
timestamp is stored to make sure it is stored in memory.

Change-Id: I05cd54ba5991a5a96dd07f1e08b5212273201411
Signed-off-by: Zelalem <zelalem.aweke@arm.com>
2020-03-27 09:41:12 -05:00
Olivier Deprez 21e22c74cd Merge "fconf: notify if fw_config dt is not used" into integration 2020-03-27 13:13:16 +00:00
Olivier Deprez 4c65b4decf doc: add spm and spmd related build options
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Change-Id: I93892dbe76611a7a4b852af3272a0e6271ae037b
2020-03-27 13:54:42 +01:00
Manish Pandey f98f464e2a fconf: notify if fw_config dt is not used
Notify if fw_config dt is either not available or not loaded from fip.

Change-Id: I4dfcbe5032503d97f532a3287c5312c581578b68
Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
2020-03-27 11:21:03 +00:00
Oliver Swede 4b5793c9a8 plat/arm/board/arm_fpga: Compile with additional CPU libraries
This change is part of the goal of enabling the port to be compatible
with multiple FPGA images.

BL31 behaves differently depending on whether or not the CPUs in the
system use cache coherency, and as a result any CPU libraries that are
compiled together must serve processors that are consistent in this
regard.

This compiles a different set of CPU libraries depending on whether or
not the HW_ASSISTED_COHERENCY is enabled at build-time to indicate the
CPUs support hardware-level support for cache coherency. This build
flag is used in the makefile in the same way as the Arm FVP port.

Signed-off-by: Oliver Swede <oli.swede@arm.com>
Change-Id: I18300b4443176b89767015e3688c0f315a91c27e
2020-03-26 20:41:59 +00:00
Oliver Swede 62056e4e8f plat/arm/board/arm_fpga: Enable position-independent execution
This allows the BL31 port to run with position-independent execution
enabled so that it can be ran from any address in the system.
This increases the flexibility of the image, allowing it to be ran from
other locations rather than only its hardcoded absolute address
(currently set to the typical DRAM base of 2GB). This may be useful for
future images that describe system configurations with other memory
layouts (e.g. where SRAM is included).

It does this by setting ENABLE_PIE=1 and changing the absolute
address to 0. The load address of bl31.bin can then be specified by
the -l [load address] argument in the fpga-run command (additionally,
this address is required by any preceding payloads that specify the
start address. For ELF payloads this is usually extracted automatically
by reading the entrypoint address in the header, however bl31.bin is a
different file format so has this additional dependency).

Signed-off-by: Oliver Swede <oli.swede@arm.com>
Change-Id: Idd74787796ab0cf605fe2701163d9c4b3223a143
2020-03-26 20:41:59 +00:00
Oliver Swede e726c75814 plat/arm/board/arm_fpga: Enable port for alternative cluster configurations
This change is part of the goal of enabling the port to be compatible
with multiple FPGA images.

The BL31 port that is uploaded as a payload to the FPGA with an image
should cater for a wide variety of system configurations. This patch
makes the necessary changes to enable it to function with images whose
cluster configurations may be larger (either by utilizing more
clusters, more CPUs per cluster, more threads in each CPU, or a
combination) than the initial image being used for testing.

As part of this, the hard-coded values that configure the size of the
array describing the topology of the power domain tree are increased
to max. 8 clusters, max. 8 cores per cluster & max 4 threads per core.
This ensures the port works with cluster configurations up to these
sizes. When there are too many entries for the number of available PEs,
e.g. if there is a variable number of CPUs between clusters, then there
will be empty entries in the array. This is permitted and the PSCI
library will still function as expected. While this increases its size,
this shouldn't be an issue in the context of the size of BL31, and is
worth the trade-off for the extra compatibility.

Signed-off-by: Oliver Swede <oli.swede@arm.com>
Change-Id: I7d4ae1e20b2e99fdbac428d122a2cf9445394363
2020-03-26 20:41:59 +00:00
Oliver Swede 87762bce84 plat/arm/board/arm_fpga: Initialize the Generic Interrupt Controller
This initializes the GIC using the Arm GIC drivers in TF-A.
The initial FPGA image uses a GIC600 implementation, and so that its
power controller is enabled, this platform port calls the corresponding
implementation-specific routines.

Signed-off-by: Oliver Swede <oli.swede@arm.com>
Change-Id: I88d5a073eead4b653b1ca73273182cd98a95e4c5
2020-03-26 20:41:58 +00:00
Oliver Swede 2d696d1811 plat/arm/board/arm_fpga: Initialize the System Counter
This sets the frequency of the system counter so that the Delay Timer
driver programs the correct value to CNTCRL. This value depends on
the FPGA image being used, and is 10MHz for the initial test image.
Once configured, the BL31 platform setup sequence then enables the
system counter.

Signed-off-by: Oliver Swede <oli.swede@arm.com>
Change-Id: Ieb036a36fd990f350b5953357424a255b8ac5d5a
2020-03-26 20:40:50 +00:00
Oliver Swede 7ee4db6e47 plat/arm/board/arm_fpga: Add PSCI implementation for FPGA images
This adds a basic PSCI implementation allow secondary CPUs to be
released from an initial state and continue through to the warm boot
entrypoint.

Each secondary CPU is kept in a holding pen, whereby it polls the value
representing its hold state, by reading this from an array that acts as
a table for all the PEs. The hold states are initially set to 0 for all
cores to indicate that the executing core should continue polling.
To prevent the secondary CPUs from interfering with the platform's
initialization, they are only updated by the primary CPU once the cold
boot sequence has completed and fpga_pwr_domain_on(mpidr) is called.
The polling target CPU will then read 1 (which indicates that it should
branch to the warm reset entrypoint) and then jump to that address
rather than continue polling.

In addition to the initial polling behaviour of the secondary CPUs
before their warm boot reset sequence, they are also placed in a
low-power wfe() state at the end of each poll; accordingly, the PSCI
fpga_pwr_domain_on(mpidr) function also signals an event to all cores
(after updating the target CPU's hold entry) to wake them from this
state, allowing any secondary CPUs that are still polling to check
their hold state again.
This method is in accordance with both the PSCI and Linux kernel
recommendations, as the lessened overhead reduces the energy
consumption associated with the busy-loop.

The table of hold entries is implemented by a global array as shared SRAM
(which is used by other platforms in similar implementations) is not
available on the FPGA images.

Signed-off-by: Oliver Swede <oli.swede@arm.com>
Change-Id: I65cfd1892f8be1dfcb285f0e1e94e7a9870cdf5a
2020-03-26 20:40:48 +00:00
Oliver Swede 5cfe699f2b plat/arm/board/arm_fpga: Use preloaded BL33 alternative boot flow
This makes use of the PRELOADED_BL33_BASE flag to indicate to BL31 that
the BL33 payload (kernel) has already been loaded and resides in memory;
BL31 will then jump to the non-secure address.

For this port the BL33 payload is the Linux kernel, and in accordance
with the pre-kernel setup requirements (as specified in the `Booting
AArch64 Linux' documentation:
https://www.kernel.org/doc/Documentation/arm64/booting.txt),
this change also sets up the primary CPU's registers x0-x3 so they are
the expected values, which includes the address of the DTB at x0.

An external linker script is currently required to combine BL31, the
BL33 payload, and any other software images to create an ELF file that
can be uploaded to the FPGA board along with the bit file. It therefore
has dependencies on the value of PRELOADED_BL33_BASE (kernel base) and
the DTB base (plus any other relevant base addresses used to
distinguish the different ELF sections), both of which are set in this
patch.

Signed-off-by: Oliver Swede <oli.swede@arm.com>
Change-Id: If7ae8ee82d1e09fb05f553f6077ae13680dbf66b
2020-03-26 20:22:33 +00:00