Commit Graph

1323 Commits

Author SHA1 Message Date
davidcunado-arm fdcc08af3a
Merge pull request #1290 from jeenu-arm/dynamiq
DynamIQ on FVP
2018-02-28 20:10:29 +00:00
davidcunado-arm 73a9605197
Merge pull request #1282 from robertovargas-arm/misra-changes
Misra changes
2018-02-28 18:53:30 +00:00
Roberto Vargas fd116b9f6c Fix MISRA rule 8.4 Part 2
Rule 8.4: A compatible declaration shall be visible when
          an object or function with external linkage is defined

Fixed for:
	make DEBUG=1 PLAT=juno LOG_LEVEL=50 all

Change-Id: Ic8f611da734f356566e8208053296e6c62b54709
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-02-28 17:19:56 +00:00
Roberto Vargas 1af540ef2a Fix MISRA rule 8.4 Part 1
Rule 8.4: A compatible declaration shall be visible when
          an object or function with external linkage is defined

Fixed for:
	make DEBUG=1 PLAT=fvp LOG_LEVEL=50 all

Change-Id: I7c2ad3f5c015411c202605851240d5347e4cc8c7
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-02-28 17:19:55 +00:00
Roberto Vargas dc6aad2e13 Fix MISRA rule 8.3 Part 1
Rule 8.3: All declarations of an object or function shall
          use the same names and type qualifiers.

Fixed for:

	make DEBUG=1 PLAT=fvp LOG_LEVEL=50 all

Change-Id: I48201c9ef022f6bd42ea8644529afce70f9b3f22
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-02-28 17:19:55 +00:00
Roberto Vargas 7fabe1a899 Fix MISRA rule 8.4 in common code
Rule 8.4: A compatible declaration shall be visible when
          an object or function with external linkage is defined.

Change-Id: I26e042cb251a6f9590afa1340fdac73e42f23979
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-02-28 17:18:46 +00:00
Jeenu Viswambharan fe7210cdca FVP: Allow building for DynamIQ systems
FVPs that model DynamIQ configuration implements all CPUs in a single
cluster. I.e., such models have a single cluster with more than 4 CPUs.
This differs from existing default build configuration for FVP where up
to 4 CPUs are assumed per cluster.

To allow building for DynamIQ configuration, promote the macro
FVP_MAX_CPUS_PER_CLUSTER as a build option to have it set from the build
command line. The value of the build option defaults to 4.

Change-Id: Idc3853bc95f680869b434b011c2dbd733e40c6ce
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2018-02-28 15:05:35 +00:00
Sandrine Bailleux 01e808c6f9 Select SCMI/SDS drivers by default on Juno
The SCP binaries provided in the 17.10 Linaro release (and onwards)
have migrated to the SCMI/SDS protocols. Therefore, the ARM TF should
now use the corresponding drivers by default.

This patch changes the default value of the CSS_USE_SCMI_SDS_DRIVER
build option to 1 for Juno.

Change-Id: Idb7e3c6af582f49e332167a2158703c2d781b437
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2018-02-28 13:08:08 +01:00
davidcunado-arm bd8e6a99e0
Merge pull request #1287 from davidcunado-arm/dc/fix_misra
Update ULL() macro and instances of ull to comply with MISRA
2018-02-28 09:48:35 +00:00
davidcunado-arm c69145fc2a
Merge pull request #1286 from antonio-nino-diaz-arm/an/mmu-mismatch
Clarify comments in xlat tables lib and fixes related to the TLB
2018-02-28 01:26:21 +00:00
davidcunado-arm ba91a001f8
Merge pull request #1274 from dp-arm/dp/a75
AMU fixes for Cortex-A75
2018-02-27 21:58:42 +00:00
David Cunado 5724481fdd Update ULL() macro and instances of ull to comply with MISRA
MISRA C-2012 Rule 7.3 violation: lowercase l shall not be used as literal suffixes.

This patch resolves this for the ULL() macro by using ULL suffix instead
of the ull suffix.

Change-Id: Ia8183c399e74677e676956e8653e82375d0e0a01
Signed-off-by: David Cunado <david.cunado@arm.com>
2018-02-27 17:05:51 +00:00
Soby Mathew 09cc7a6df9 FVP: restrict dynamic config to Unix build environment
This patch restricts building the dynamic config DTBs to the Unix
build environment as the Device Tree compiler may not be available
on other build environments.

Change-Id: Ie690e80010a174300e966240fd977b37561156e0
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2018-02-27 13:32:59 +00:00
Dimitris Papastamos f06890ea89 Refactor AMU support for Cortex A75
This patch also fixes the assumption that the counters are disabled on
the resume path.  This is incorrect as the AMU counters are enabled
early in the CPU reset function before `cpuamu_context_restore()`
runs.

Change-Id: I38a94eb166a523f00de18e86860434ffccff2131
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
2018-02-27 13:28:41 +00:00
Dimitris Papastamos a2e702a2f3 Factor out CPU AMU helpers
This patch also fixes `cpuamu_write_cpuamcntenclr_el0()` to use an MSR
instruction instead of an MRS instruction.

Change-Id: Ia6531f64b5ebc60ba432124eaa8d8eaccba40ed0
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
2018-02-27 13:28:41 +00:00
Antonio Nino Diaz 883d1b5d4a Add comments about mismatched TCR_ELx and xlat tables
When the MMU is enabled and the translation tables are mapped, data
read/writes to the translation tables are made using the attributes
specified in the translation tables themselves. However, the MMU
performs table walks with the attributes specified in TCR_ELx. They are
completely independent, so special care has to be taken to make sure
that they are the same.

This has to be done manually because it is not practical to have a test
in the code. Such a test would need to know the virtual memory region
that contains the translation tables and check that for all of the
tables the attributes match the ones in TCR_ELx. As the tables may not
even be mapped at all, this isn't a test that can be made generic.

The flags used by enable_mmu_xxx() have been moved to the same header
where the functions are.

Also, some comments in the linker scripts related to the translation
tables have been fixed.

Change-Id: I1754768bffdae75f53561b1c4a5baf043b45a304
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-02-27 09:55:01 +00:00
Soby Mathew da5f274572 Dynamic cfg: MISRA fixes
Change-Id: I1d85b76af002b8b672fcaeca94939b7420bc8243
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2018-02-26 16:31:11 +00:00
Soby Mathew ce6d9643ad FVP: Add TB_FW_CONFIG and HW_CONFIG
This patch adds TB_FW_CONFIG for FVP and allows FVP
to select the appropriate HW_CONFIG to include in the
fip. The HW_CONFIG for FVP is selected via `FVP_HW_CONFIG_DTS`
build option. The TB_FW_CONFIG specifies the load address of
HW_CONFIG to BL2. Since currently the load address is different
between AARCH32 and AARCH64, 2 separate TB_FW_CONFIGs are
maintained for the 2 modes.

Change-Id: Ide8581e752dfa900087f5895c775073c841c0daf
Signed-Off-By: Soby Mathew <soby.mathew@arm.com>
2018-02-26 16:31:11 +00:00
Soby Mathew cab0b5b045 ARM Platforms: Load HW_CONFIG in BL2
The patch adds the necessary changes to load HW_CONFIG in BL2 for
ARM Platforms :

1. The load address of HW_CONFIG is specified via the `hw_config_addr`
property in TB_FW_CONFIG is loaded by BL1. The `hw_config_max_size`
property defines the maximum size to be expected for the HW_CONFIG.
The `arm_dyn_cfg_helpers.c` and corresponding header implements
utility functions to parse these DT properties defined.
The `arm_dyn_cfg.c` implements wrappers to these helpers to enable
them to be invoked from ARM platform layer.

2. `HW_CONFIG` is added to the `bl2_mem_params_descs[]` array which is
the list of images to be loaded by BL2.

3. The `libfdt` sources are now included when BL2 is built

4. A new helper `populate_next_bl_params_config()` is introduced in
desc_image_load.c to populate the subsequent executable BL images
with the `hw_config` and the corresponding `fw_config` if available.
The `plat_get_next_bl_params()` API for ARM platforms is modified to
invoke this new helper.

5. The implementation of `bl2_early_platform_setup2()` is modified to
consider `arg0` as well in addition to `arg1` passed from BL1.

6. Bump up the BL2 size for Juno to accommodate the inclusion of libfdt.

Change-Id: I80f1554adec41753e0d179a5237364f04fe13a3f
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2018-02-26 16:31:11 +00:00
Soby Mathew c228956afa ARM Platorms: Load TB_FW_CONFIG in BL1
This patch modifies the bl1_platform_setup() API to load and authenticate
TB_FW_CONFIG in BL1. The load address of the same is passed on to BL2 in
`arg0` of entrypoint info. The fvp_io_storage.c and arm_io_storage.c also
adds entries corresponding to TB_FW_CONFIG. A helper function
`arm_load_tb_fw_config()` is added to load and authenticate TB_FW_CONFIG
if present.

Change-Id: Ie7bce667b3fad2b1a083bbcbc0a773f9f04254b1
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2018-02-26 16:31:11 +00:00
Soby Mathew 101d01e2a2 BL1: Deprecate the `bl1_init_bl2_mem_layout()` API
The `bl1_init_bl2_mem_layout()` API is now deprecated. The default weak
implementation of `bl1_plat_handle_post_image_load()` calculates the
BL2 memory layout and populates the same in x1(r1). This ensures
compatibility for the deprecated API.

Change-Id: Id44bdc1f572dc42ee6ceef4036b3a46803689315
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2018-02-26 16:31:11 +00:00
Soby Mathew 0c306cc062 ARM Platforms: Migrate to new BL handover interface
This patch migrates the ARM Standard platforms to the new BL
handover interface. The arm_blx_early_platform_setup() functions
are also modified to take in 4 arguments. The `ARM_BL31_PLAT_PARAM_VAL`
value passed to BL31 from BL2 is now in arg3 in preparation of dynamic
configuration arguments.

Change-Id: I33e8e61325a19e7a7127b1ff203c3b86921bf153
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2018-02-26 16:31:11 +00:00
Soby Mathew a6f340fe58 Introduce the new BL handover interface
This patch introduces a new BL handover interface. It essentially allows
passing 4 arguments between the different BL stages. Effort has been made
so as to be compatible with the previous handover interface. The previous
blx_early_platform_setup() platform API is now deprecated and the new
blx_early_platform_setup2() variant is introduced. The weak compatiblity
implementation for the new API is done in the `plat_bl_common.c` file.
Some of the new arguments in the new API will be reserved for generic
code use when dynamic configuration support is implemented. Otherwise
the other registers are available for platform use.

Change-Id: Ifddfe2ea8e32497fe1beb565cac155ad9d50d404
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2018-02-26 16:31:10 +00:00
Soby Mathew 566034fc27 Add image_id to bl1_plat_handle_post/pre_image_load()
This patch adds an argument to bl1_plat_post/pre_image_load() APIs
to make it more future proof. The default implementation of
these are moved to `plat_bl1_common.c` file.

These APIs are now invoked appropriately in the FWU code path prior
to or post image loading by BL1 and are not restricted
to LOAD_IMAGE_V2.

The patch also reorganizes some common platform files. The previous
`plat_bl2_el3_common.c` and `platform_helpers_default.c` files are
merged into a new `plat_bl_common.c` file.

NOTE: The addition of an argument to the above mentioned platform APIs
is not expected to have a great impact because these APIs were only
recently added and are unlikely to be used.

Change-Id: I0519caaee0f774dd33638ff63a2e597ea178c453
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2018-02-26 16:29:29 +00:00
davidcunado-arm 5ff6da9487
Merge pull request #1273 from antonio-nino-diaz-arm/an/fix-tlbi-disable-mmu
Ensure the correct execution of TLBI instructions
2018-02-26 10:42:55 +00:00
davidcunado-arm 338770c642
Merge pull request #1262 from ssalko/ssalko_dev
qemu: Fix interrupt type check
2018-02-23 20:45:03 +00:00
Soby Mathew caf4eca135 ARM Platforms: Add CASSERT for BL2_BASE
Change-Id: I93e491fde2a991fc39584c2762f33cbea40541e3
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2018-02-22 15:19:03 +00:00
Soby Mathew 81bf6aae68 ARM Platforms: Don't build BL1 and BL2 if RESET_TO_SP_MIN=1
Change-Id: Iadb21bb56f2e61d7e6aec9b3b3efd30059521def
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2018-02-22 15:16:48 +00:00
Antonio Nino Diaz 6bf0e07930 Ensure the correct execution of TLBI instructions
After executing a TLBI a DSB is needed to ensure completion of the
TLBI.

rk3328: The MMU is allowed to load TLB entries for as long as it is
enabled. Because of this, the correct place to execute a TLBI is right
after disabling the MMU.

Change-Id: I8280f248d10b49a8c354a4ccbdc8f8345ac4c170
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-02-21 13:54:55 +00:00
davidcunado-arm 601abdba4a
Merge pull request #1271 from afaerber/tegra-fixes
tegra: Fix mmap_region_t struct mismatch
2018-02-19 23:27:24 +00:00
davidcunado-arm 1504715051
Merge pull request #1259 from hzhuang1/fix_uart
hikey960: avoid hardcode on uart port
2018-02-17 21:55:57 +00:00
Andreas Färber 28db3e96ef tegra: Fix mmap_region_t struct mismatch
Commit fdb1964c34 ("xlat: Introduce
MAP_REGION2() macro") added a granularity field to mmap_region_t.

Tegra platforms were using the v2 xlat_tables implementation in
common/tegra_common.mk, but v1 xlat_tables.h headers in soc/*/plat_setup.c
where arrays are being defined. This caused the next physical address to
be read as granularity, causing EINVAL error and triggering an assert.

Consistently use xlat_tables_v2.h header to avoid this.

Fixes ARM-software/tf-issues#548.

Signed-off-by: Andreas Färber <afaerber@suse.de>
2018-02-17 06:15:35 +01:00
Haojian Zhuang 135d713c7a hikey960: avoid hardcode on uart port
Avoid hardcode on uart port. The uart port could be auto detected
on HiKey960 platform.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2018-02-17 12:06:18 +08:00
Jeenu Viswambharan f2c83c1a54 ARM platforms: Fix console address for flush
The console core flush API expects the base address in the first
register, but ARM helpers currently sets the second register with the
base address. This causes an assert failure.

This patch fixes that.

Change-Id: Ic54c423cd60f2756902ab3cfc77b3de2ac45481e
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2018-02-12 15:12:53 +00:00
Santeri Salko 53a98be35f qemu: Fix interrupt type check
Function plat_ic_get_pending_interrupt_type() should return interrupt
type, not id. The function is used in aarch64 exception handling and
currently the irq/fiq forwarding fails if a secure interrupt happens while
running normal world.

The qemu-specific gic file does not contain any extra functionality so it
can be removed and common file can be used instead.

fixes arm-software/tf-issues#546

Signed-off-by: Santeri Salko <santeri.salko@gmail.com>
2018-02-09 20:49:57 +02:00
Victor Chong 3b12a6fc8e hikey*, poplar: platform.mk: Fix typo in variable assignments
Signed-off-by: Victor Chong <victor.chong@linaro.org>
2018-02-08 02:14:46 +09:00
Victor Chong f3d522be8e poplar: Support Trusted OS extra image (OP-TEE header) parsing
Signed-off-by: Victor Chong <victor.chong@linaro.org>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
2018-02-08 02:14:46 +09:00
Victor Chong 0d8052a4ea poplar: Add LOAD_IMAGE_V2 support
Signed-off-by: Victor Chong <victor.chong@linaro.org>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
2018-02-08 02:14:46 +09:00
Victor Chong 8ad132b3f1 poplar: Add build option for dram size
Signed-off-by: Victor Chong <victor.chong@linaro.org>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
2018-02-08 02:14:46 +09:00
Victor Chong ce2547f8d3 poplar: Fix typo
Signed-off-by: Victor Chong <victor.chong@linaro.org>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
2018-02-07 19:20:52 +09:00
Victor Chong b715f116ee poplar: Remove unused function prototype
Signed-off-by: Victor Chong <victor.chong@linaro.org>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
2018-02-07 19:20:52 +09:00
davidcunado-arm 5b75b4a725
Merge pull request #1173 from etienne-lms/armv7-qemu
support to boot OP-TEE on AArch32/Armv7+example with Cortex-A15/Qemu
2018-02-07 11:57:19 +08:00
davidcunado-arm 9fd2f13bd6
Merge pull request #1224 from masahir0y/gzip
Support GZIP-compressed images for faster loading and verification
2018-02-06 05:12:28 +00:00
Etienne Carriere 765ed9fc55 qemu: support ARMv7/Cortex-A15
Define Qemu AArch32 implementation for some platform functions
(core position, secondary boot cores, crash console). These are
derived from the AArch64 implementation.

BL31 on Qemu is needed only for ARMv8 and later. On ARMv7, BL32 is
the first executable image after BL2.

Support SP_MIN and OP-TEE as BL32: create a sp_min make script target
in Qemu, define mapping for IMAGE_BL32

Minor fix Qemu return value type for plat_get_ns_image_entrypoint().

Qemu model for the Cortex-A15 does not support the virtualization
extension although the core expects it. To overcome the issue, Qemu
ARMv7 configuration set ARCH_SUPPORTS_VIRTUALIZATION to 0.

Add missing AArch32 assembly macro arm_print_gic_regs from ARM platform
used by the Qemu platform.

Qemu Cortex-A15 model integrates a single cluster with up to 4 cores.

Change-Id: I65b44399071d6f5aa40d5183be11422b9ee9ca15
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
2018-02-05 10:42:47 +01:00
davidcunado-arm 10787b0519
Merge pull request #1249 from masahir0y/uniphier
uniphier: fix and improve memory layout
2018-02-02 22:59:16 +00:00
Masahiro Yamada 4f557c77f5 uniphier: add ULL to physical address literals
Looks like this is requirement in the pre-merge static analysis.

misra_violation: [Required] MISRA C-2012 Rule 7.2 violation:
Unsigned constants must be declared with U or u suffix.

Adding ULL as requested.  I used ULL() macros for BL*_{BASE,LIMIT}
because they are referenced from linker scripts.

Requested-by: David Cunado <david.cunado@arm.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-02-02 16:32:30 +09:00
Masahiro Yamada 9c740a58e1 uniphier: allocate xlat region of on-chip SRAM only when needed
Currently, the xlat region of the on-chip SRAM is always allocated
for all BL images.

The access to the on-chip SRAM is necessary for loading images from
a USB memory device (i.e. when updating firmware), so unneeded for
the usual boot procedure.

To avoid this waste, allocate the xlat region dynamically only for
BL2, and only when it is necessary.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-02-02 16:02:58 +09:00
Masahiro Yamada 7e51ca8daf uniphier: get back original BL31/32 location used before BL2-AT-EL3
Commit 247fc04351 ("uniphier: switch to BL2-AT-EL3 and remove BL1
support") accidentally changed the location of BL31 and BL32.  The
new memory map overlaps with the audio DSP images, also gives impact
to OP-TEE.  They are both out of control of ARM Trusted Firmware, so
not easy to change.  This commit restores the image layout that was
originally used prior to the BL2-AT-EL3 migration.

Reported-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-02-02 15:17:45 +09:00
davidcunado-arm 956defc720
Merge pull request #1247 from rockchip-linux/rk3399/fixes-memory-corruptions
rockchip/rk3399: Fix memory corruptions or illegal memory access
2018-02-01 23:29:34 +00:00
Masahiro Yamada 8951b058fc uniphier: support GZIP-compressed images
Allow to handle GZIP-compressed images by giving FIP_GZIP=1 from the
command line.

- Images are GZIP-compressed, then packed into FIP.  If Trusted Board
  Boot is enabled, certificates are generated based on the compressed
  images.

- GZIP decompressor is linked into BL2 to decompress images at
  run-time.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-02-02 00:19:24 +09:00