1. 10 Apr, 2018 1 commit
    • Summer Qin's avatar
      plat/arm: Allow override of default TZC regions · 23411d2c
      Summer Qin authored
      
      
      This patch allows the ARM Platforms to specify the TZC regions to be
      specified to the ARM TZC helpers in arm_tzc400.c and arm_tzc_dmc500.c.
      If the regions are not specified then the default TZC region will be
      configured by these helpers.
      
      This override mechanism allows specifying special regions for TZMP1
      usecase.
      Signed-off-by: default avatarSummer Qin <summer.qin@arm.com>
      23411d2c
  2. 09 Apr, 2018 1 commit
  3. 07 Apr, 2018 2 commits
    • Jiafei Pan's avatar
      fix instruction address range limitation · b4ad9768
      Jiafei Pan authored
      
      
      For the adr instruction, it require the label's offset from the
      address of this instruction must be in the range +/-1MB. If the
      option "BL2_IN_XIP_MEM" is set to '1', in some cases, BL2's RW
      memory will not in the range of +/-1MB from BL2's RO memory region.
      so we need to use ldr instruction to cover this case.
      Signed-off-by: default avatarJiafei Pan <Jiafei.Pan@nxp.com>
      b4ad9768
    • Jiafei Pan's avatar
      Add support for BL2 in XIP memory · 7d173fc5
      Jiafei Pan authored
      
      
      In some use-cases BL2 will be stored in eXecute In Place (XIP) memory,
      like BL1. In these use-cases, it is necessary to initialize the RW sections
      in RAM, while leaving the RO sections in place. This patch enable this
      use-case with a new build option, BL2_IN_XIP_MEM. For now, this option
      is only supported when BL2_AT_EL3 is 1.
      Signed-off-by: default avatarJiafei Pan <Jiafei.Pan@nxp.com>
      7d173fc5
  4. 31 Mar, 2018 1 commit
    • Michalis Pappas's avatar
      qemu: don't use C functions for the crash console callbacks · 0e24ea81
      Michalis Pappas authored
      
      
      Use the console_pl011_core_* functions directly in the crash console
      callbacks.
      
      This bypasses the MULTI_CONSOLE_API for the crash console (UART1), but
      allows using the crash console before the C runtime has been initialized
      (eg to call ASM_ASSERT). This retains backwards compatibility with respect
      to functionality when the old API is used.
      
      Use the MULTI_CONSOLE_API to register UART0 as the boot and runtime
      console.
      
      Fixes ARM-software/tf-issues#572
      Signed-off-by: default avatarMichalis Pappas <mpappas@fastmail.fm>
      0e24ea81
  5. 27 Mar, 2018 1 commit
    • Joel Hutton's avatar
      Clean usage of void pointers to access symbols · 9f85f9e3
      Joel Hutton authored
      
      
      Void pointers have been used to access linker symbols, by declaring an
      extern pointer, then taking the address of it. This limits symbols
      values to aligned pointer values. To remove this restriction an
      IMPORT_SYM macro has been introduced, which declares it as a char
      pointer and casts it to the required type.
      
      Change-Id: I89877fc3b13ed311817bb8ba79d4872b89bfd3b0
      Signed-off-by: default avatarJoel Hutton <Joel.Hutton@Arm.com>
      9f85f9e3
  6. 26 Mar, 2018 2 commits
  7. 24 Mar, 2018 1 commit
  8. 21 Mar, 2018 1 commit
    • Antonio Nino Diaz's avatar
      Rename 'smcc' to 'smccc' · 085e80ec
      Antonio Nino Diaz authored
      
      
      When the source code says 'SMCC' it is talking about the SMC Calling
      Convention. The correct acronym is SMCCC. This affects a few definitions
      and file names.
      
      Some files have been renamed (smcc.h, smcc_helpers.h and smcc_macros.S)
      but the old files have been kept for compatibility, they include the
      new ones with an ERROR_DEPRECATED guard.
      
      Change-Id: I78f94052a502436fdd97ca32c0fe86bd58173f2f
      Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
      085e80ec
  9. 14 Mar, 2018 2 commits
  10. 02 Mar, 2018 1 commit
    • Soby Mathew's avatar
      Remove sp_min functions from plat_common.c · 0ed8c001
      Soby Mathew authored
      
      
      This patch removes default platform implementations of sp_min
      platform APIs from plat/common/aarch32/plat_common.c. The APIs
      are now implemented in `plat_sp_min_common.c` file within the
      same folder.
      
      The ARM platform layer had a weak definition of sp_min_platform_setup2()
      which conflicted with the weak definition in the common file. Hence this
      patch fixes that by introducing a `plat_arm_` version of the API thus
      allowing individual boards within ARM platforms to override it if they
      wish to.
      
      Fixes ARM-software/tf-issues#559
      
      Change-Id: I11a74ecae8191878ccc7ea03f12bdd5ae88faba5
      Signed-off-by: default avatarSoby Mathew <soby.mathew@arm.com>
      0ed8c001
  11. 01 Mar, 2018 2 commits
    • Dan Handley's avatar
      Emit warnings when using deprecated GIC init · dcf01a0a
      Dan Handley authored
      
      
      Emit runtime warnings when intializing the GIC drivers using the
      deprecated method of defining integer interrupt arrays in the GIC driver
      data structures; interrupt_prop_t arrays should be used instead. This
      helps platforms detect that they have migration work to do. Previously,
      no warning was emitted in this case. This affects both the GICv2 and GICv3
      drivers.
      
      Also use the __deprecated attribute to emit a build time warning if these
      deprecated fields are used. These warnings are suppressed in the GIC
      driver compatibility functions but will be visible if platforms use them.
      
      Change-Id: I6b6b8f6c3b4920c448b6dcb82fc18442cfdf6c7a
      Signed-off-by: default avatarDan Handley <dan.handley@arm.com>
      dcf01a0a
    • Dan Handley's avatar
      Improve MULTI_CONSOLE_API deprecation warnings · bc1a03c7
      Dan Handley authored
      
      
      For platforms that have not migrated to MULTI_CONSOLE_API == 1, there
      are a lot of confusing deprecated declaration warnings relating to
      use of console_init() and console_uninit(). Some of these relate to use
      by the generic code, not the platform code. These functions are not really
      deprecated but *removed* when MULTI_CONSOLE_API == 1.
      
      This patch consolidates these warnings into a single preprocessor warning.
      The __deprecated attribute is removed from the console_init() and
      console_uninit() declarations.
      
      For preprocessor warnings like this to not cause fatal build errors,
      this patch adds -Wno-error=cpp to the build flags when
      ERROR_DEPRECATED == 0.
      This option (and -Wno-error=deprecated-declarations) is now added to
      CPPFLAGS instead of TF_CFLAGS to ensure the build flags are used in the
      assembler as well as the compiler.
      
      This patch also disentangles the MULTI_CONSOLE_API and ERROR_DEPRECATED
      build flags by defaulting MULTI_CONSOLE_API to 0 instead of
      ERROR_DEPRECATED. This allows platforms that have not migrated to
      MULTI_CONSOLE_API to use ERROR_DEPRECATED == 1 to emit a more meaningful
      build error.
      
      Finally, this patch bans use of MULTI_CONSOLE_API == 1 and AARCH32, since
      the AArch32 console implementation does not support
      MULTI_CONSOLE_API == 1.
      
      Change-Id: If762165ddcb90c28aa7a4951aba70cb15c2b709c
      Signed-off-by: default avatarDan Handley <dan.handley@arm.com>
      bc1a03c7
  12. 28 Feb, 2018 5 commits
  13. 27 Feb, 2018 7 commits
    • David Cunado's avatar
      Update ULL() macro and instances of ull to comply with MISRA · 5724481f
      David Cunado authored
      
      
      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: default avatarDavid Cunado <david.cunado@arm.com>
      5724481f
    • Jeenu Viswambharan's avatar
      EHF: Introduce preempted return code parameter to ehf_allow_ns_preemption() · af34cd72
      Jeenu Viswambharan authored
      
      
      When a Yielding SMC is preempted, it's possible that Non-secure world is
      resumed afterwards. In this case, Non-secure execution would find itself
      in a state where the SMC has returned. However, the dispatcher might not
      get an opportunity to populate the corrected return code for having
      been preempted, and therefore the caller of the Yielding SMC cannot
      reliably determine whether the SMC had successfully completed or had
      been preempted.
      
      To solve this, this patch introduces a new parameter to the
      ehf_allow_ns_preemption() API. An SPD, through this parameter, would
      provide the expected error code when a Yielding SMC is preempted. EHF
      can then populate the specified value in x0 of the Non-secure context so
      that the caller of the Yielding SMC correctly identifies the SMC return
      as a preemption.
      
      Documentation updates to follow.
      
      Change-Id: Ia9c3f8f03f9d72d81aa235eaae2ee0374b972e1e
      Signed-off-by: default avatarJeenu Viswambharan <jeenu.viswambharan@arm.com>
      af34cd72
    • Dimitris Papastamos's avatar
      MISRA fixes for Cortex A75 AMU implementation · 714b21ff
      Dimitris Papastamos authored
      
      
      Change-Id: I61c9fdfda0c0b3c3ec6249519db23602cf4c2100
      Signed-off-by: default avatarDimitris Papastamos <dimitris.papastamos@arm.com>
      714b21ff
    • Dimitris Papastamos's avatar
      Refactor AMU support for Cortex A75 · f06890ea
      Dimitris Papastamos authored
      
      
      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: default avatarDimitris Papastamos <dimitris.papastamos@arm.com>
      f06890ea
    • Dimitris Papastamos's avatar
      Factor out CPU AMU helpers · a2e702a2
      Dimitris Papastamos authored
      
      
      This patch also fixes `cpuamu_write_cpuamcntenclr_el0()` to use an MSR
      instruction instead of an MRS instruction.
      
      Change-Id: Ia6531f64b5ebc60ba432124eaa8d8eaccba40ed0
      Signed-off-by: default avatarDimitris Papastamos <dimitris.papastamos@arm.com>
      a2e702a2
    • Dimitris Papastamos's avatar
      Implement {spe,sve}_supported() helpers and refactor code · 2ff8fbf3
      Dimitris Papastamos authored
      
      
      Implement helpers to test if the core supports SPE/SVE.  We have a
      similar helper for AMU and this patch makes all extensions consistent
      in their implementation.
      
      Change-Id: I3e6f7522535ca358259ad142550b19fcb883ca67
      Signed-off-by: default avatarDimitris Papastamos <dimitris.papastamos@arm.com>
      2ff8fbf3
    • Antonio Nino Diaz's avatar
      Add comments about mismatched TCR_ELx and xlat tables · 883d1b5d
      Antonio Nino Diaz authored
      
      
      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: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
      883d1b5d
  14. 26 Feb, 2018 11 commits
    • Soby Mathew's avatar
      Dynamic cfg: MISRA fixes · da5f2745
      Soby Mathew authored
      
      
      Change-Id: I1d85b76af002b8b672fcaeca94939b7420bc8243
      Signed-off-by: default avatarSoby Mathew <soby.mathew@arm.com>
      da5f2745
    • Soby Mathew's avatar
      ARM Platforms: Load HW_CONFIG in BL2 · cab0b5b0
      Soby Mathew authored
      
      
      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: default avatarSoby Mathew <soby.mathew@arm.com>
      cab0b5b0
    • Soby Mathew's avatar
      ARM Platorms: Load TB_FW_CONFIG in BL1 · c228956a
      Soby Mathew authored
      
      
      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: default avatarSoby Mathew <soby.mathew@arm.com>
      c228956a
    • Soby Mathew's avatar
      Dynamic cfg: Introduce fdt wrappers · e5674e1f
      Soby Mathew authored
      
      
      Change-Id: I9b1cdaf2430a1998a69aa366ea1461224a3d43dc
      Co-Authoured-by: default avatarJeenu Viswambharan <Jeenu.Viswambharan@arm.com>
      Signed-off-by: default avatarSoby Mathew <soby.mathew@arm.com>
      e5674e1f
    • Soby Mathew's avatar
      Add dynamic config image IDs · bf9ce61b
      Soby Mathew authored
      
      
      Change-Id: I147031dea9487dc1976e31ad40c89b221e44edbc
      Signed-off-by: default avatarSoby Mathew <soby.mathew@arm.com>
      bf9ce61b
    • Soby Mathew's avatar
      BL1: Deprecate the `bl1_init_bl2_mem_layout()` API · 101d01e2
      Soby Mathew authored
      
      
      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: default avatarSoby Mathew <soby.mathew@arm.com>
      101d01e2
    • Soby Mathew's avatar
      ARM Platforms: Migrate to new BL handover interface · 0c306cc0
      Soby Mathew authored
      
      
      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: default avatarSoby Mathew <soby.mathew@arm.com>
      0c306cc0
    • Soby Mathew's avatar
      Introduce the new BL handover interface · a6f340fe
      Soby Mathew authored
      
      
      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: default avatarSoby Mathew <soby.mathew@arm.com>
      a6f340fe
    • Soby Mathew's avatar
      Dynamic cfg: Add HW and TB_FW configs to CoT · 6d31020e
      Soby Mathew authored
      
      
      This patch adds image IDs to `hw_config` and `tb_fw_config` and
      includes them in the default Chain Of Trust (CoT).
      
      Change-Id: If7bb3e9be8a5e48be76614b35bf43d58fc7fed12
      Signed-off-by: default avatarSoby Mathew <soby.mathew@arm.com>
      6d31020e
    • Soby Mathew's avatar
      Dynamic cfg: Update the tools · e24659df
      Soby Mathew authored
      
      
      This patch updates the `fiptool` and `cert_create` for the
      `hw_config` and `tb_fw_config` dynamic configuration files.
      The necessary UUIDs and OIDs are assigned to these files and
      the `cert_create` is updated to generate appropriate hashes
      and include them in the "Trusted Boot FW Certificate". The
      `fiptool` is updated to allow the configs to be specified
      via cmdline and included in the generated FIP.
      
      Change-Id: I940e751a49621ae681d14e162aa1f5697eb0cb15
      Signed-off-by: default avatarSoby Mathew <soby.mathew@arm.com>
      e24659df
    • Soby Mathew's avatar
      Add image_id to bl1_plat_handle_post/pre_image_load() · 566034fc
      Soby Mathew authored
      
      
      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: default avatarSoby Mathew <soby.mathew@arm.com>
      566034fc
  15. 24 Feb, 2018 1 commit
  16. 15 Feb, 2018 1 commit
    • Antonio Nino Diaz's avatar
      Redefine SMC_UNK as -1 instead of 0xFFFFFFFF · 4abd7fa7
      Antonio Nino Diaz authored
      
      
      According to the SMC Calling Convention (ARM DEN0028B):
      
          The Unknown SMC Function Identifier is a sign-extended value of
          (-1) that is returned in R0, W0 or X0 register.
      
      The value wasn't sign-extended because it was defined as a 32-bit
      unsigned value (0xFFFFFFFF).
      
      SMC_PREEMPT has been redefined as -2 for the same reason.
      
      NOTE: This might be a compatibility break for some AArch64 platforms
      that don't follow the previous version of the SMCCC (ARM DEN0028A)
      correctly. That document specifies that only the bottom 32 bits of the
      returned value must be checked. If a platform relies on the top 32 bits
      of the result being 0 (so that SMC_UNK is 0x00000000FFFFFFFF), it will
      have to fix its code to comply with the SMCCC.
      
      Change-Id: I7f7b109f6b30c114fe570aa0ead3c335383cb54d
      Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
      4abd7fa7