1. 26 Feb, 2018 9 commits
    • 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
  2. 24 Feb, 2018 1 commit
  3. 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
  4. 06 Feb, 2018 1 commit
  5. 02 Feb, 2018 1 commit
  6. 01 Feb, 2018 4 commits
    • Masahiro Yamada's avatar
      image_decompress: add APIs for decompressing images · 2e379d2f
      Masahiro Yamada authored
      
      
      These APIs are used by platforms that need to decompress images.
      
      image_decompress_init():
        This registers a temporary buffer and a decompressor callback.
        This should be called from platform init code.
      
      image_decompress_prepare():
        This should be called before each compressed image is loaded.  The
        best location to call this will be bl*_plat_handle_pre_image_load().
      
      image_decompress():
        This should be called after each compressed image is loaded.  The
        best location to call this will be bl*_plat_handle_post_image_load().
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      2e379d2f
    • Masahiro Yamada's avatar
      bl1: add bl1_plat_handle_{pre,post}_image_load() · 11f001cb
      Masahiro Yamada authored
      
      
      Just like bl2_, add pre/post image load handlers for BL1.  No argument
      is needed since BL2 is the only image loaded by BL1.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      11f001cb
    • Masahiro Yamada's avatar
      bl2: add bl2_plat_handle_pre_image_load() · ba68ef55
      Masahiro Yamada authored
      
      
      There are cases where we need to manipulate image information before
      the load.  For example, for decompressing data, we cannot load the
      compressed images to their final destination.  Instead, we need to
      load them to the temporary buffer for the decompressor.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      ba68ef55
    • Masahiro Yamada's avatar
      zlib: add gunzip() support · c43d6851
      Masahiro Yamada authored
      
      
      This commit adds some more files to use zlib from TF.
      
      To use zlib, ->zalloc and ->zfree hooks are needed.  The implementation
      depends on the system.  For user-space, the libc provides malloc() and
      friends.  Unfortunately, ARM Trusted Firmware does not provide malloc()
      or any concept of dynamic memory allocation.
      
      I implemented very simple calloc() and free() for this.  Stupidly,
      zfree() never frees memory, but it works enough for this.
      
      The purpose of using zlib is to implement gunzip() - this function
      takes compressed data from in_buf, then dumps the decompressed data
      to oub_buf.  The work_buf is used for memory allocation during the
      decompress.  Upon exit, it updates in_buf and out_buf.  If successful,
      in_buf points to the end of input data, out_buf to the end of the
      decompressed data.
      
      To use this feature, you need to do:
      
       - include lib/zlib/zlib.mk from your platform.mk
      
       - add $(ZLIB_SOURCES) to your BL*_SOURCES
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      c43d6851
  7. 31 Jan, 2018 2 commits
  8. 29 Jan, 2018 2 commits
  9. 22 Jan, 2018 2 commits
    • Julius Werner's avatar
      Make div_round_up() correct for divisors that are not a power of 2 · 7baa7bca
      Julius Werner authored
      
      
      The current div_round_up() implementation relies on round_up() which
      only works correctly for boundaries that are a power of 2. It is
      documented as such, but this still seems dangerously easy to overlook,
      especially since many other environments (e.g. the Linux kernel) have a
      similar macro without these limitations.
      
      There is a different way to calculate this that can deal with all kinds
      of divisors without other drawbacks, so let's just use that instead.
      
      Change-Id: Id382736683f5d4e880ef00c53cfa23a2f9208440
      Signed-off-by: default avatarJulius Werner <jwerner@chromium.org>
      7baa7bca
    • Sughosh Ganu's avatar
      SPM: Declare explicit width based types in secure_partition_boot_info_t structure · 6dafcebc
      Sughosh Ganu authored
      
      
      The secure_partition_boot_info_t structure is used to communicate boot
      parameters with the StandaloneMM code executing at S-EL0 through a
      shared buffer. Certain data types used for members of this structure
      are opaque with their size depending on the toolchain being used.
      
      Declare the members of the structure with explicit width based data
      types, which would maintain compatibility across toolchains.
      Signed-off-by: default avatarSughosh Ganu <sughosh.ganu@arm.com>
      6dafcebc
  10. 19 Jan, 2018 5 commits
    • Julius Werner's avatar
      coreboot: Add support for CBMEM console · 1c5f5031
      Julius Werner authored
      
      
      coreboot supports an in-memory console to store firmware logs even when
      no serial console is available. It is widely supported by
      coreboot-compatible bootloaders (including SeaBIOS and GRUB) and can be
      read by the Linux kernel.
      
      This patch allows BL31 to add its own log messages to this console. The
      driver will be registered automatically if coreboot support is compiled
      in and detects the presence of a console buffer in the coreboot tables.
      
      Change-Id: I31254dfa0c2fdeb7454634134b5707b4b4154907
      Signed-off-by: default avatarJulius Werner <jwerner@chromium.org>
      1c5f5031
    • Julius Werner's avatar
      Add platform-independent coreboot support library · 3429c77a
      Julius Werner authored
      
      
      This patch adds the foundation for a platform-independent coreboot
      support library that can be shared by all platforms that boot BL31 from
      coreboot (acting as BL2). It adds code to parse the "coreboot table", a
      data structure that coreboot uses to communicate different kinds of
      information to later-stage firmware and certain OS drivers.
      
      As a first small use case for this information, allow platforms to
      access the serial console configuration used by coreboot, removing the
      need to hardcode base address and divisors and allowing Trusted Firmware
      to benefit from coreboot's user configuration (e.g. which UART to pick
      and which baud rate to use).
      
      Change-Id: I2bfb39cd2609ce6640b844ab68df6c9ae3f28e9e
      Signed-off-by: default avatarJulius Werner <jwerner@chromium.org>
      3429c77a
    • Julius Werner's avatar
      drivers: cadence: cdns: Update CDNS driver to support MULTI_CONSOLE_API · 38ba8e93
      Julius Werner authored
      
      
      This patch updates the Cadence CDNS console driver to support the new
      console API. The driver will continue to support the old API as well by
      checking the MULTI_CONSOLE_API compile-time flag.
      
      Change-Id: I2ef8fb0d6ab72696997db1e0243a533499569d6b
      Signed-off-by: default avatarJulius Werner <jwerner@chromium.org>
      38ba8e93
    • Julius Werner's avatar
      drivers: arm: pl011: Update PL011 driver to support MULTI_CONSOLE_API · 4a0c4571
      Julius Werner authored
      
      
      This patch updates the ARM PL011 console driver to support the new
      console API. The driver will continue to support the old API as well by
      checking the MULTI_CONSOLE_API compile-time flag.
      
      Change-Id: Ic34e4158addbb0c5fae500c9cff899c05a4f4206
      Signed-off-by: default avatarJulius Werner <jwerner@chromium.org>
      4a0c4571
    • Julius Werner's avatar
      drivers: ti: uart: Update 16550 UART driver to support MULTI_CONSOLE_API · 36c42ca1
      Julius Werner authored
      
      
      This patch updates the TI 16550 console driver to support the new
      console API. The driver will continue to support the old API as well by
      checking the MULTI_CONSOLE_API compile-time flag.
      
      Change-Id: I60a44b7ba3c35c74561824c04b8dbe3e3039324c
      Signed-off-by: default avatarJulius Werner <jwerner@chromium.org>
      36c42ca1
  11. 18 Jan, 2018 5 commits
    • Dimitris Papastamos's avatar
      Workaround for CVE-2017-5715 for Cortex A9, A15 and A17 · e4b34efa
      Dimitris Papastamos authored
      
      
      A per-cpu vbar is installed that implements the workaround by
      invalidating the branch target buffer (BTB) directly in the case of A9
      and A17 and indirectly by invalidating the icache in the case of A15.
      
      For Cortex A57 and A72 there is currently no workaround implemented
      when EL3 is in AArch32 mode so report it as missing.
      
      For other vulnerable CPUs (e.g. Cortex A73 and Cortex A75), there are
      no changes since there is currently no upstream AArch32 EL3 support
      for these CPUs.
      
      Change-Id: Ib42c6ef0b3c9ff2878a9e53839de497ff736258f
      Signed-off-by: default avatarDimitris Papastamos <dimitris.papastamos@arm.com>
      e4b34efa
    • Dimitris Papastamos's avatar
      sp_min: Implement workaround for CVE-2017-5715 · 7343505d
      Dimitris Papastamos authored
      
      
      This patch introduces two workarounds for ARMv7 systems.  The
      workarounds need to be applied prior to any `branch` instruction in
      secure world.  This is achieved using a custom vector table where each
      entry is an `add sp, sp, #1` instruction.
      
      On entry to monitor mode, once the sequence of `ADD` instructions is
      executed, the branch target buffer (BTB) is invalidated.  The bottom
      bits of `SP` are then used to decode the exception entry type.
      
      A side effect of this change is that the exception vectors are
      installed before the CPU specific reset function.  This is now
      consistent with how it is done on AArch64.
      
      Note, on AArch32 systems, the exception vectors are typically tightly
      integrated with the secure payload (e.g. the Trusted OS).  This
      workaround will need porting to each secure payload that requires it.
      
      The patch to modify the AArch32 per-cpu vbar to the corresponding
      workaround vector table according to the CPU type will be done in a
      later patch.
      
      Change-Id: I5786872497d359e496ebe0757e8017fa98f753fa
      Signed-off-by: default avatarDimitris Papastamos <dimitris.papastamos@arm.com>
      7343505d
    • Roberto Vargas's avatar
      Mark functions defined in assembly files · d1f7292e
      Roberto Vargas authored
      
      
      This patch change the name of the section containing the functions
      defined in assembly files from text.* to text.asm.*. This change
      makes possible to select in the linker script the functions
      defined in those files.
      
      Change-Id: If35e44ef1b43ffd951dfac5e052db75d7198e2e0
      Signed-off-by: default avatarRoberto Vargas <roberto.vargas@arm.com>
      d1f7292e
    • Roberto Vargas's avatar
      bl2-el3: Add BL2 at EL3 support in FVP · 81528dbc
      Roberto Vargas authored
      
      
      This patch add supports for the new API added for BL2 at EL3 for
      FVP. We don't have a non-TF Boot ROM for FVP, but this option can be
      tested setting specific parameters in the model.
      
      The bl2 image is loaded directly in memory instead of being loaded
      by a non-TF Boot ROM and the reset address is changed:
      
      	--data cluster0.cpu0=bl2.bin@0x4001000
      	-C cluster0.cpu0.RVBAR=0x4001000
      
      These parameters mean that in the cold boot path the processor will
      jump to BL2 again. For this reason, BL2 is loaded in dram in this
      case, to avoid other images reclaiming BL2 memory.
      
      Change-Id: Ieb2ff8535a9e67ccebcd8c2212cad366e7776422
      Signed-off-by: default avatarRoberto Vargas <roberto.vargas@arm.com>
      81528dbc
    • Roberto Vargas's avatar
      bl2-el3: Add BL2_EL3 image · b1d27b48
      Roberto Vargas authored
      
      
      This patch enables BL2 to execute at the highest exception level
      without any dependancy on TF BL1. This enables platforms which already
      have a non-TF Boot ROM to directly load and execute BL2 and subsequent BL
      stages without need for BL1.  This is not currently possible because
      BL2 executes at S-EL1 and cannot jump straight to EL3.
      
      Change-Id: Ief1efca4598560b1b8c8e61fbe26d1f44e929d69
      Signed-off-by: default avatarRoberto Vargas <roberto.vargas@arm.com>
      b1d27b48
  12. 17 Jan, 2018 1 commit
  13. 16 Jan, 2018 1 commit
  14. 11 Jan, 2018 5 commits