1. 24 May, 2019 1 commit
    • Alexei Fedorov's avatar
      Add support for Branch Target Identification · 9fc59639
      Alexei Fedorov authored
      
      
      This patch adds the functionality needed for platforms to provide
      Branch Target Identification (BTI) extension, introduced to AArch64
      in Armv8.5-A by adding BTI instruction used to mark valid targets
      for indirect branches. The patch sets new GP bit [50] to the stage 1
      Translation Table Block and Page entries to denote guarded EL3 code
      pages which will cause processor to trap instructions in protected
      pages trying to perform an indirect branch to any instruction other
      than BTI.
      BTI feature is selected by BRANCH_PROTECTION option which supersedes
      the previous ENABLE_PAUTH used for Armv8.3-A Pointer Authentication
      and is disabled by default. Enabling BTI requires compiler support
      and was tested with GCC versions 9.0.0, 9.0.1 and 10.0.0.
      The assembly macros and helpers are modified to accommodate the BTI
      instruction.
      This is an experimental feature.
      Note. The previous ENABLE_PAUTH build option to enable PAuth in EL3
      is now made as an internal flag and BRANCH_PROTECTION flag should be
      used instead to enable Pointer Authentication.
      Note. USE_LIBROM=1 option is currently not supported.
      
      Change-Id: Ifaf4438609b16647dc79468b70cd1f47a623362e
      Signed-off-by: default avatarAlexei Fedorov <Alexei.Fedorov@arm.com>
      9fc59639
  2. 21 May, 2019 1 commit
    • Madhukar Pappireddy's avatar
      Rework smc_unknown return code path in smc_handler · cc485e27
      Madhukar Pappireddy authored
      
      
      The intention of this patch is to leverage the existing el3_exit() return
      routine for smc_unknown return path rather than a custom set of instructions.
      In order to leverage el3_exit(), the necessary counteraction (i.e., saving the
      system registers apart from GP registers) must be performed. Hence a series of
      instructions which save system registers( like SPSR_EL3, SCR_EL3 etc) to stack
      are moved to the top of group of instructions which essentially decode the OEN
      from the smc function identifier and obtain the specific service handler in
      rt_svc_descs_array. This ensures that the control flow for both known and
      unknown smc calls will be similar.
      
      Change-Id: I67f94cfcba176bf8aee1a446fb58a4e383905a87
      Signed-off-by: default avatarMadhukar Pappireddy <madhukar.pappireddy@arm.com>
      cc485e27
  3. 05 Apr, 2019 1 commit
  4. 25 Mar, 2019 1 commit
  5. 18 Mar, 2019 1 commit
  6. 07 Mar, 2019 1 commit
    • Alexei Fedorov's avatar
      BL31: Enable pointer authentication support in warm boot path · 7dcbb4f3
      Alexei Fedorov authored
      In the current Pointer Authentication support added in
      commit b86048c4
      
      
      PAuth gets enabled in BL31 cold boot entrypoint only,
      (see bl31_entrypoint() in bl31\aarch64\bl31_entrypoint.S)
      but not in bl31_warm_entrypoint().
      This results in EnIA bit [31] in SCTLR_EL3 not being set
      and pointer authentication disabled after CPU wake-up event.
      
      Fixes ARM-software/tf-issues#684
      
      Change-Id: I27a67804764dfba2a6d72ca119ca2bcff4f536d6
      Signed-off-by: default avatarAlexei Fedorov <Alexei.Fedorov@arm.com>
      7dcbb4f3
  7. 28 Feb, 2019 1 commit
  8. 27 Feb, 2019 3 commits
    • Antonio Nino Diaz's avatar
      BL31: Enable pointer authentication support · 88cfd9a6
      Antonio Nino Diaz authored
      
      
      The size increase after enabling options related to ARMv8.3-PAuth is:
      
      +----------------------------+-------+-------+-------+--------+
      |                            |  text |  bss  |  data | rodata |
      +----------------------------+-------+-------+-------+--------+
      | CTX_INCLUDE_PAUTH_REGS = 1 |  +192 | +1536 |   +0  |   +0   |
      |                            |  0.3% |  3.1% |       |        |
      +----------------------------+-------+-------+-------+--------+
      | ENABLE_PAUTH = 1           | +1848 | +1536 |  +16  |   +0   |
      |                            |  3.3% |  3.1% |  3.1% |        |
      +----------------------------+-------+-------+-------+--------+
      
      Results calculated with the following build configuration:
      
          make PLAT=fvp SPD=tspd DEBUG=1 \
          SDEI_SUPPORT=1                 \
          EL3_EXCEPTION_HANDLING=1       \
          TSP_NS_INTR_ASYNC_PREEMPT=1    \
          CTX_INCLUDE_PAUTH_REGS=1       \
          ENABLE_PAUTH=1
      
      Change-Id: I43db7e509a4f39da6599ec2faa690d197573ec1b
      Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
      88cfd9a6
    • Antonio Nino Diaz's avatar
      Add support for pointer authentication · b86048c4
      Antonio Nino Diaz authored
      
      
      The previous commit added the infrastructure to load and save
      ARMv8.3-PAuth registers during Non-secure <-> Secure world switches, but
      didn't actually enable pointer authentication in the firmware.
      
      This patch adds the functionality needed for platforms to provide
      authentication keys for the firmware, and a new option (ENABLE_PAUTH) to
      enable pointer authentication in the firmware itself. This option is
      disabled by default, and it requires CTX_INCLUDE_PAUTH_REGS to be
      enabled.
      
      Change-Id: I35127ec271e1198d43209044de39fa712ef202a5
      Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
      b86048c4
    • Antonio Nino Diaz's avatar
      Add ARMv8.3-PAuth registers to CPU context · 5283962e
      Antonio Nino Diaz authored
      
      
      ARMv8.3-PAuth adds functionality that supports address authentication of
      the contents of a register before that register is used as the target of
      an indirect branch, or as a load.
      
      This feature is supported only in AArch64 state.
      
      This feature is mandatory in ARMv8.3 implementations.
      
      This feature adds several registers to EL1. A new option called
      CTX_INCLUDE_PAUTH_REGS has been added to select if the TF needs to save
      them during Non-secure <-> Secure world switches. This option must be
      enabled if the hardware has the registers or the values will be leaked
      during world switches.
      
      To prevent leaks, this patch also disables pointer authentication in the
      Secure world if CTX_INCLUDE_PAUTH_REGS is 0. Any attempt to use it will
      be trapped in EL3.
      
      Change-Id: I27beba9907b9a86c6df1d0c5bf6180c972830855
      Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
      5283962e
  9. 08 Feb, 2019 1 commit
  10. 07 Feb, 2019 1 commit
    • Varun Wadekar's avatar
      locks: linker variables to calculate per-cpu bakery lock size · 596929b9
      Varun Wadekar authored
      
      
      This patch introduces explicit linker variables to mark the start and
      end of the per-cpu bakery lock section to help bakery_lock_normal.c
      calculate the size of the section. This patch removes the previously
      used '__PERCPU_BAKERY_LOCK_SIZE__' linker variable to make the code
      uniform across GNU linker and ARM linker.
      
      Change-Id: Ie0c51702cbc0fe8a2076005344a1fcebb48e7cca
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      596929b9
  11. 30 Jan, 2019 1 commit
  12. 22 Jan, 2019 2 commits
  13. 15 Jan, 2019 2 commits
    • Ard Biesheuvel's avatar
      spm: permit platform to override the VMA placement of the vector table · 32e83537
      Ard Biesheuvel authored
      
      
      On some systems, it may be preferred to place the secure EL1/0 vector
      table outside of the static placement of the BL31 image itself, for
      instance when the latter is located in non-shareable SRAM which does
      not tolerate inner shareable WBWA mappings (as is the case on SynQuacer)
      
      So permit the platform to #define SPM_SHIM_EXCEPTIONS_VMA in its
      supplementary linker script, in which case it will be used as the
      VMA region for the vector table. Note that the LMA does not change,
      and it is up to the platform to copy the contents to the right place
      at init time.
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      32e83537
    • Paul Beesley's avatar
      Correct typographical errors · 8aabea33
      Paul Beesley authored
      
      
      Corrects typos in core code, documentation files, drivers, Arm
      platforms and services.
      
      None of the corrections affect code; changes are limited to comments
      and other documentation.
      
      Change-Id: I5c1027b06ef149864f315ccc0ea473e2a16bfd1d
      Signed-off-by: default avatarPaul Beesley <paul.beesley@arm.com>
      8aabea33
  14. 04 Jan, 2019 1 commit
    • Antonio Nino Diaz's avatar
      Sanitise includes across codebase · 09d40e0e
      Antonio Nino Diaz authored
      Enforce full include path for includes. Deprecate old paths.
      
      The following folders inside include/lib have been left unchanged:
      
      - include/lib/cpus/${ARCH}
      - include/lib/el3_runtime/${ARCH}
      
      The reason for this change is that having a global namespace for
      includes isn't a good idea. It defeats one of the advantages of having
      folders and it introduces problems that are sometimes subtle (because
      you may not know the header you are actually including if there are two
      of them).
      
      For example, this patch had to be created because two headers were
      called the same way: e0ea0928 ("Fix gpio includes of mt8173 platform
      to avoid collision."). More recently, this patch has had similar
      problems: 46f9b2c3 ("drivers: add tzc380 support").
      
      This problem was introduced in commit 4ecca339
      
       ("Move include and
      source files to logical locations"). At that time, there weren't too
      many headers so it wasn't a real issue. However, time has shown that
      this creates problems.
      
      Platforms that want to preserve the way they include headers may add the
      removed paths to PLAT_INCLUDES, but this is discouraged.
      
      Change-Id: I39dc53ed98f9e297a5966e723d1936d6ccf2fc8f
      Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
      09d40e0e
  15. 17 Dec, 2018 1 commit
    • Soby Mathew's avatar
      BL31: correct GOT section omission · 5bfac4fc
      Soby Mathew authored
      When the patch SHA 931f7c61
      
       introduced PIE support for BL31,
      adding the GOT section when the SEPARATE_CODE_AND_RODATA=0
      to the linker script was erroneously omitted. This patch corrects
      the same.
      
      Also the patch reduces the alignment requirement for GOT and RELA
      sections from 16 bytes to 8. Comments are added explain the
      intent for alignment.
      
      Change-Id: I8035cbf75f346f99bd56b13f32e0b3b70dd2fe6c
      Signed-off-by: default avatarSoby Mathew <soby.mathew@arm.com>
      5bfac4fc
  16. 11 Dec, 2018 1 commit
  17. 10 Dec, 2018 1 commit
    • Antonio Nino Diaz's avatar
      SPM: Deprecate the current implementation · 2d7b9e5e
      Antonio Nino Diaz authored
      
      
      The current SPM is a prototype that only supports one secure partition
      in EL0. The objective of SPM is to have multiple partitions. The current
      MM interface isn't adequate for this, so it is needed to modify heavily
      the code to add proper support for it.
      
      However, there are platforms which are already using this (like SGI) and
      removing the code would break it.  For this reason, the current SPM code
      has been duplicated in order to temporarily preserve compatibility. All
      new improvements/changes to SPM will be done in the non-deprecated copy,
      that may change without notice.
      
      The new build option SPM_DEPRECATED has been introduced to select the SPM
      implementation. It defaults to 1, that selects the deprecated SPM.
      
      Change-Id: Ic9f80b53b450e97b4d3f47e4ef4a138ee8d87443
      Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
      2d7b9e5e
  18. 05 Dec, 2018 1 commit
  19. 14 Nov, 2018 1 commit
  20. 01 Nov, 2018 1 commit
  21. 29 Oct, 2018 1 commit
    • Soby Mathew's avatar
      PIE: Position Independant Executable support for BL31 · 931f7c61
      Soby Mathew authored
      
      
      This patch introduces Position Independant Executable(PIE) support
      in TF-A. As a initial prototype, only BL31 can support PIE. A trivial
      dynamic linker is implemented which supports fixing up Global Offset
      Table(GOT) and Dynamic relocations(.rela.dyn). The fixup_gdt_reloc()
      helper function implements this linker and this needs to be called
      early in the boot sequence prior to invoking C functions. The GOT is
      placed in the RO section of BL31 binary for improved security and the
      BL31 linker script is modified to export the appropriate symbols
      required for the dynamic linker.
      
      The C compiler always generates PC relative addresses to linker symbols
      and hence referencing symbols exporting constants are a problem when
      relocating the binary. Hence the reference to the
      `__PERCPU_TIMESTAMP_SIZE__` symbol in PMF is removed and is now calculated
      at runtime based on start and end addresses.
      
      Change-Id: I1228583ff92cf432963b7cef052e95d995cca93d
      Signed-off-by: default avatarSoby Mathew <soby.mathew@arm.com>
      931f7c61
  22. 16 Oct, 2018 1 commit
  23. 04 Oct, 2018 1 commit
  24. 03 Oct, 2018 1 commit
  25. 28 Sep, 2018 1 commit
  26. 18 Sep, 2018 1 commit
    • Antonio Nino Diaz's avatar
      BL31: Fix warning about BL32 init function · 74ad948f
      Antonio Nino Diaz authored
      
      
      The expected value for failure is 0, so the warning only has to be shown
      in that case. This is the way the TSPD has done it since it was
      introduced, and the way SPM and OP-TEE do it.
      
      Trusty wrongly returns 0 on success.
      
      In the case of TLK, the return value of tlkd_init() is passed from the
      secure world in register X1 when calling the SMC TLK_ENTRY_DONE.
      
      Change-Id: I39106d67631ee57f109619f8830bf4b9d96155e6
      Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
      74ad948f
  27. 06 Sep, 2018 1 commit
  28. 30 Aug, 2018 1 commit
  29. 20 Aug, 2018 2 commits
    • Jeenu Viswambharan's avatar
      EHF: MISRA fixes · 03b645ed
      Jeenu Viswambharan authored
      
      
      These changes address most of the required MISRA rules. In the process,
      some from generic code are also fixed.
      
      No functional changes.
      
      Change-Id: I19786070af7bc5e1f6d15bdba93e22a4451d8fe9
      Signed-off-by: default avatarJeenu Viswambharan <jeenu.viswambharan@arm.com>
      03b645ed
    • Jeenu Viswambharan's avatar
      AArch64: Enable MPAM for lower ELs · 5f835918
      Jeenu Viswambharan authored
      
      
      Memory Partitioning And Monitoring is an Armv8.4 feature that enables
      various memory system components and resources to define partitions.
      Software running at various ELs can then assign themselves to the
      desired partition to control their performance aspects.
      
      With this patch, when ENABLE_MPAM_FOR_LOWER_ELS is set to 1, EL3 allows
      lower ELs to access their own MPAM registers without trapping to EL3.
      This patch however doesn't make use of partitioning in EL3; platform
      initialisation code should configure and use partitions in EL3 if
      required.
      
      Change-Id: I5a55b6771ccaa0c1cffc05543d2116b60cbbcdcd
      Co-authored-by: default avatarJames Morse <james.morse@arm.com>
      Signed-off-by: default avatarJeenu Viswambharan <jeenu.viswambharan@arm.com>
      5f835918
  30. 17 Aug, 2018 1 commit
  31. 19 Jul, 2018 3 commits
    • Jeenu Viswambharan's avatar
      RAS: Introduce handler for EL3 EAs · eaeaa4d0
      Jeenu Viswambharan authored
      
      
      External Aborts while executing in EL3 is fatal in nature. This patch
      allows for the platform to define a handler for External Aborts received
      while executing in EL3. A default implementation is added which falls
      back to platform unhandled exception.
      
      Change-Id: I466f2c8113a33870f2c7d2d8f2bf20437d9fd354
      Signed-off-by: default avatarJeenu Viswambharan <jeenu.viswambharan@arm.com>
      eaeaa4d0
    • Jeenu Viswambharan's avatar
      RAS: Introduce handler for Double Faults · d5a23af5
      Jeenu Viswambharan authored
      
      
      Double fault is when the PE receives another error whilst one is being
      handled. To detect double fault condition, a per-CPU flag is introduced
      to track the status of error handling. The flag is checked/modified
      while temporarily masking external aborts on the PE.
      
      This patch routes double faults to a separate platform-defined handler.
      
      Change-Id: I70e9b7ba4c817273c55a0af978d9755ff32cc702
      Signed-off-by: default avatarJeenu Viswambharan <jeenu.viswambharan@arm.com>
      d5a23af5
    • Jeenu Viswambharan's avatar
      RAS: Introduce handler for Uncontainable errors · b56dc2a9
      Jeenu Viswambharan authored
      
      
      Uncontainable errors are the most severe form of errors, which typically
      mean that the system state can't be trusted any more. This further means
      that normal error recovery process can't be followed, and an orderly
      shutdown of the system is often desirable.
      
      This patch allows for the platform to define a handler for Uncontainable
      errors received. Due to the nature of Uncontainable error, the handler
      is expected to initiate an orderly shutdown of the system, and therefore
      is not expected to return. A default implementation is added which falls
      back to platform unhandled exception.
      
      Also fix ras_arch.h header guards.
      
      Change-Id: I072e336a391a0b382e77e627eb9e40729d488b55
      Signed-off-by: default avatarJeenu Viswambharan <jeenu.viswambharan@arm.com>
      b56dc2a9
  32. 17 Jul, 2018 2 commits