1. 31 May, 2020 1 commit
    • Alexei Fedorov's avatar
      TF-A: Fix BL31 linker script error · 34dd1e96
      Alexei Fedorov authored
      
      
      The patch fixes BL31 linker script error
      "Init code ends past the end of the stacks"
      for platforms with number of CPUs less than 4,
      which is caused by __STACKS_END__ address being
      lower than __INIT_CODE_END__.
      The modified BL31 linker script detects such cases
      and increases the total amount of stack memory,
      setting __STACKS_END__ = __INIT_CODE_END__, and
      CPUs' stacks are calculated by BL31 'plat_get_my_stack'
      function accordingly. For platforms with more than 4 CPUs
      and __INIT_CODE_END__ < __STACKS_END__ stack memory does not
      increase and allocated CPUs' stacks match the existing
      implementation.
      The patch removes exclusion of PSCI initialization
      functions from the reclaimed .init section in
      'arm_reclaim_init.ld.S' script, which increases the
      size of reclaimed memory region.
      
      Change-Id: I927773e00dd84e1ffe72f9ee534f4f2fc7b6153c
      Signed-off-by: default avatarAlexei Fedorov <Alexei.Fedorov@arm.com>
      34dd1e96
  2. 27 May, 2020 2 commits
    • Usama Arif's avatar
      plat/arm: Introduce TC0 platform · f5c58af6
      Usama Arif authored
      
      
      This patch adds support for Total Compute (TC0) platform. It is an
      initial port and additional features are expected to be added later.
      
      TC0 has a SCP which brings the primary Cortex-A out of reset
      which starts executing BL1. TF-A optionally authenticates the SCP
      ram-fw available in FIP and makes it available for SCP to copy.
      
      Some of the major features included and tested in this platform
      port include TBBR, PSCI, MHUv2 and DVFS.
      
      Change-Id: I1675e9d200ca7687c215009eef483d9b3ee764ef
      Signed-off-by: default avatarUsama Arif <usama.arif@arm.com>
      f5c58af6
    • Manish V Badarkhe's avatar
      Fix the build error for dualroot chain of trust. · b58956e9
      Manish V Badarkhe authored
      
      
      Fixed build error for dualroot chain of trust.
      Build error were thrown as below while compiling the code for
      dualroot chain of trust:
      
      aarch64-none-elf-ld.bfd: ./build/fvp/debug/bl1/tbbr_cot_bl1.o:
      (.bss.auth_img_flags+0x0): multiple definition of `auth_img_flags';
      ./build/fvp/debug/bl1/cot.o:(.bss.auth_img_flags+0x0): first defined here
      
      aarch64-none-elf-ld.bfd: ./build/fvp/debug/bl1/tbbr_cot_bl1.o:
      (.rodata.cot_desc_size+0x0): multiple definition of `cot_desc_size';
      ./build/fvp/debug/bl1/cot.o:(.rodata.cot_desc_size+0x0): first defined here
      
      aarch64-none-elf-ld.bfd: ./build/fvp/debug/bl1/tbbr_cot_bl1.o:
      (.rodata.cot_desc_ptr+0x0): multiple definition of `cot_desc_ptr';
      ./build/fvp/debug/bl1/cot.o:(.rodata.cot_desc_ptr+0x0): first defined here
      Signed-off-by: default avatarManish V Badarkhe <Manish.Badarkhe@arm.com>
      Change-Id: I1a426c4e7f5f8013d71dafc176c7467c1b329757
      b58956e9
  3. 25 May, 2020 1 commit
    • J-Alves's avatar
      SPCI is now called PSA FF-A · 662af36d
      J-Alves authored
      
      
      SPCI is renamed as PSA FF-A which stands for Platform Security
      Architecture Firmware Framework for A class processors.
      This patch replaces the occurrence of SPCI with PSA FF-A(in documents)
      or simply FFA(in code).
      
      Change-Id: I4ab10adb9ffeef1ff784641dfafd99f515133760
      Signed-off-by: default avatarJ-Alves <joao.alves@arm.com>
      662af36d
  4. 22 May, 2020 1 commit
  5. 21 May, 2020 2 commits
  6. 20 May, 2020 1 commit
    • Varun Wadekar's avatar
      Tegra: enable SDEI handling · d886628d
      Varun Wadekar authored
      
      
      This patch enables SDEI support for all Tegra platforms, with
      the following configuration settings.
      
      * SGI 8 as the source IRQ
      * Special Private Event 0
      * Three private, dynamic events
      * Three shared, dynamic events
      * Twelve general purpose explicit events
      
      Verified using TFTF SDEI test suite.
      
      ******************************* Summary *******************************
       Test suite 'SDEI'                                               Passed
       =================================
       Tests Skipped : 0
       Tests Passed  : 5
       Tests Failed  : 0
       Tests Crashed : 0
       Total tests   : 5
       =================================
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      Change-Id: I1922069931a7876a4594e53260ee09f2e4f09390
      d886628d
  7. 19 May, 2020 3 commits
    • johpow01's avatar
      Enable v8.6 WFE trap delays · 6cac724d
      johpow01 authored
      
      
      This patch enables the v8.6 extension to add a delay before WFE traps
      are taken. A weak hook plat_arm_set_twedel_scr_el3 has been added in
      plat/common/aarch64/plat_common.c that disables this feature by default
      but platform-specific code can override it when needed.
      
      The only hook provided sets the TWED fields in SCR_EL3, there are similar
      fields in HCR_EL2, SCTLR_EL2, and SCTLR_EL1 to control WFE trap delays in
      lower ELs but these should be configured by code running at EL2 and/or EL1
      depending on the platform configuration and is outside the scope of TF-A.
      Signed-off-by: default avatarJohn Powell <john.powell@arm.com>
      Change-Id: I0a9bb814205efeab693a3d0a0623e62144abba2d
      6cac724d
    • laurenw-arm's avatar
      plat/fvp: Populate GICv3 parameters dynamically · 8370c8ce
      laurenw-arm authored
      
      
      Query the GICD and GICR base addresses in runtime using fconf getter
      APIs.
      Signed-off-by: default avatarLauren Wehrmeister <lauren.wehrmeister@arm.com>
      Change-Id: I309fb2874f3329ddeb8677ddb53ed4c02199a1e9
      8370c8ce
    • Manish V Badarkhe's avatar
      Cleanup the code for TBBR CoT descriptors · ad43c49e
      Manish V Badarkhe authored
      
      
      CoT used for BL1 and BL2 are moved to tbbr_cot_bl1.c
      and tbbr_cot_bl2.c respectively.
      Common CoT used across BL1 and BL2 are moved to
      tbbr_cot_common.c.
      Signed-off-by: default avatarManish V Badarkhe <Manish.Badarkhe@arm.com>
      Change-Id: I2252ac8a6960b3431bcaafdb3ea4fb2d01b79cf5
      ad43c49e
  8. 17 May, 2020 1 commit
  9. 15 May, 2020 1 commit
  10. 13 May, 2020 2 commits
    • Olivier Deprez's avatar
      SPMD: extract SPMC DTB header size from SPMD · 23d5ba86
      Olivier Deprez authored
      
      
      Currently BL2 passes TOS_FW_CONFIG address and size through registers to
      BL31. This corresponds to SPMC manifest load address and size. The SPMC
      manifest is mapped in BL31 by dynamic mapping. This patch removes BL2
      changes from generic code (which were enclosed by SPD=spmd) and retrieves
      SPMC manifest size directly from within SPMD. The SPMC manifest load
      address is still passed through a register by generic code.
      Signed-off-by: default avatarOlivier Deprez <olivier.deprez@arm.com>
      Change-Id: I35c5abd95c616ae25677302f0b1d0c45c51c042f
      23d5ba86
    • Olivier Deprez's avatar
      SPMD: code/comments cleanup · 52696946
      Olivier Deprez authored
      As a follow-up to bdd2596d
      
      , and related to SPM Dispatcher
      EL3 component and SPM Core S-EL2/S-EL1 component: update
      with cosmetic and coding rules changes. In addition:
      -Add Armv8.4-SecEL2 arch detection helper.
      -Add an SPMC context (on current core) get helper.
      -Return more meaningful error return codes.
      -Remove complexity in few spmd_smc_handler switch-cases.
      -Remove unused defines and structures from spmd_private.h
      Signed-off-by: default avatarOlivier Deprez <olivier.deprez@arm.com>
      Change-Id: I99e642450b0dafb19d3218a2f0e2d3107e8ca3fe
      52696946
  11. 12 May, 2020 1 commit
    • Varun Wadekar's avatar
      Tegra: introduce support for SMCCC_ARCH_SOC_ID · b5b2923d
      Varun Wadekar authored
      
      
      This patch returns the SOC version and revision values from
      the 'plat_get_soc_version' and 'plat_get_soc_revision' handlers.
      
      Verified using TFTF SMCCC_ARCH_SOC_ID test.
      
      <snip>
      > Executing 'SMCCC_ARCH_SOC_ID test'
        TEST COMPLETE                                                 Passed
      SOC Rev = 0x102
      SOC Ver = 0x36b0019
      <snip>
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      Change-Id: Ibd7101619143b74f6f6660732daeac1a8bca3e44
      b5b2923d
  12. 11 May, 2020 2 commits
  13. 06 May, 2020 2 commits
  14. 05 May, 2020 7 commits
    • Andre Przywara's avatar
      arm_fpga: Read UART address from DT · dee3042c
      Andre Przywara authored
      
      
      The arm_fpga port requires a DTB, to launch a BL33 payload.
      To make this port more flexible, we can also use the information in the
      DT to configure the console driver.
      For a start, find the DT node pointed to by the stdout-path property, and
      read the base address from there.
      This assumes for now that the stdout-path points to a PL011 UART.
      
      This allows to remove platform specific addresses from the image. We
      keep the original base address for the crash console.
      
      Change-Id: I46a990de2315f81cae4d7913ae99a07b0bec5cb1
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      dee3042c
    • Andre Przywara's avatar
      plat/stm32: Use generic fdt_get_stdout_node_offset() · 7a61114d
      Andre Przywara authored
      
      
      Now that we have an implementation for getting the node offset of the
      stdout-path property in the generic fdt_wrappers code, use that to
      replace the current ST platform specific implementation.
      
      Change-Id: I5dd05684e7ca3cb563b5f71c885e1066393e057e
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      7a61114d
    • Andre Przywara's avatar
      arm_fpga: Read GICD and GICR base addresses from DT · 1a0f9366
      Andre Przywara authored
      
      
      Since we use a DTB with all platform information to pass this on to a
      kernel loaded as BL33, we can as well make use of it for our own
      purposes.
      
      Every DT would contain a node for the GIC(v3) interrupt controller, so
      we can read the base address for the distributor and redistributors from
      there.
      
      This avoids hard coding this information in the code and allows for a more
      flexible binary.
      
      Change-Id: Ic530e223a21a45bc30a07a21048116d5af69e972
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      1a0f9366
    • Andre Przywara's avatar
      fdt/wrappers: Introduce code to find UART DT node · 60e2e27d
      Andre Przywara authored
      
      
      The stdout-path property in the /chosen node of a DTB points to a device
      node, which is used for boot console output.
      On most (if not all) ARM based platforms this is the debug UART.
      The ST platform code contains a function to parse this property and
      chase down eventual aliases to learn the node offset of this UART node.
      
      Introduce a slightly more generalised version of this ST platform function
      in the generic fdt_wrappers code. This will be useful for other platforms
      as well.
      
      Change-Id: Ie6da47ace7833861b5e35fe8cba49835db3659a5
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      60e2e27d
    • Andre Przywara's avatar
      arm_fpga: Read generic timer counter frequency from DT · 670c66af
      Andre Przywara authored
      
      
      The ARM Generic Timer DT binding describes an (optional) property to
      declare the counter frequency. Its usage is normally discouraged, as the
      value should be read from the CNTFRQ_EL0 system register.
      
      However in our case we can use it to program this register in the first
      place, which avoids us to hard code a counter frequency into the code.
      We keep some default value in, if the DT lacks that property for
      whatever reason.
      
      Change-Id: I5b71176db413f904f21eb16f3302fbb799cb0305
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      670c66af
    • Andre Przywara's avatar
      plat/stm32: Use generic fdt_get_reg_props_by_name() · 7ad6d362
      Andre Przywara authored
      
      
      The STM32 platform port parse DT nodes to find base address to
      peripherals. It does this by using its own implementation, even though
      this functionality is generic and actually widely useful outside of the
      STM32 code.
      
      Re-implement fdt_get_reg_props_by_name() on top of the newly introduced
      fdt_get_reg_props_by_index() function, and move it to fdt_wrapper.c.
      This is removes the assumption that #address-cells and #size-cells are
      always one.
      
      Change-Id: I6d584930262c732b6e0356d98aea50b2654f789d
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      7ad6d362
    • Andre Przywara's avatar
      arm_fpga: Use Generic UART · 93bb7a0a
      Andre Przywara authored
      
      
      The SCP firmware on the ARM FPGA initialises the UART already. This allows
      us to treat the PL011 as an SBSA Generic UART, which does not require
      any further setup.
      
      This in particular removes the need for any baudrate and base clock related
      settings to be hard coded into the BL31 image.
      
      Change-Id: I16fc943526267356b97166a7068459e06ff77f0f
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      93bb7a0a
  15. 30 Apr, 2020 2 commits
    • Andre Przywara's avatar
      arm: fconf: Fix GICv3 dynamic configuration · 364ad245
      Andre Przywara authored
      
      
      At the moment the fconf_populate_gicv3_config() implementation is
      somewhat incomplete: First it actually fails to store the retrieved
      information (the local addr[] array is going nowhere), but also it makes
      quite some assumptions about the device tree passed to it: it needs to
      use two address-cells and two size-cells, and also requires all five
      register regions to be specified, where actually only the first two
      are mandatory according to the binding (and needed by our code).
      
      Fix this by introducing a proper generic function to retrieve "reg"
      property information from a DT node:
      We retrieve the #address-cells and #size-cells properties from the
      parent node, then use those to extract the right values from the "reg"
      property. The function takes an index to select one region of a reg
      property.
      
      This is loosely based on the STM32 implementation using "reg-names",
      which we will subsume in a follow-up patch.
      
      Change-Id: Ia59bfdf80aea4e36876c7b6ed4d153e303f482e8
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      364ad245
    • Louis Mayencourt's avatar
      fconf: Update dyn_config compatible string · 592c396d
      Louis Mayencourt authored
      
      
      Dynamic configuration properties are fconf properties. Modify the
      compatible string from "arm,.." to "fconf,.." to reflect this.
      Signed-off-by: default avatarLouis Mayencourt <louis.mayencourt@arm.com>
      Change-Id: I85eb75cf877c5f4d3feea3936d4c348ca843bc6c
      592c396d
  16. 29 Apr, 2020 2 commits
    • Andre Przywara's avatar
      plat/stm32: Implement fdt_read_uint32_default() as a wrapper · be858cff
      Andre Przywara authored
      
      
      The STM32 platform code uses its own set of FDT helper functions,
      although some of them are fairly generic.
      
      Remove the implementation of fdt_read_uint32_default() and implement it
      on top of the newly introduced fdt_read_uint32() function, then convert
      all users over.
      
      This also fixes two callers, which were slightly abusing the "default"
      semantic.
      
      Change-Id: I570533362b4846e58dd797a92347de3e0e5abb75
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      be858cff
    • Andre Przywara's avatar
      fdt/wrappers: Replace fdtw_read_cells() implementation · ff4e6c35
      Andre Przywara authored
      Our fdtw_read_cells() implementation goes to great lengths to
      sanity-check every parameter and result, but leaves a big hole open:
      The size of the storage the value pointer points at needs to match the
      number of cells given. This can't be easily checked at compile time,
      since we lose the size information by using a void pointer.
      Regardless the current usage of this function is somewhat wrong anyways,
      since we use it on single-element, fixed-length properties only, for
      which the DT binding specifies the size.
      Typically we use those functions dealing with a number of cells in DT
      context to deal with *dynamically* sized properties, which depend on
      other properties (#size-cells, #clock-cells, ...), to specify the number
      of cells needed.
      
      Another problem with the current implementation is the use of
      ambiguously sized types (uintptr_t, size_t) together with a certain
      expectation about their size. In general there is no relation between
      the length of a DT property and the bitness of the code that parses the
      DTB: AArch64 code could encounter 32-bit addresses (where the physical
      address space is limited to 4GB [1]), while AArch32 code could read
      64-bit sized properties (/memory nodes on LPAE systems, [2]).
      
      To make this more clear, fix the potential issues and also align more
      with other DT users (Linux and U-Boot), introduce functions to explicitly
      read uint32 and uint64 properties. As the other DT consumers, we do this
      based on the generic "read array" function.
      Convert all users to use either of those two new functions, and make
      sure we never use a pointer to anything other than uint32_t or uint64_t
      variables directly.
      
      This reveals (and fixes) a bug in plat_spmd_manifest.c, where we write
      4 bytes into a uint16_t variable (passed via a void pointer).
      
      Also we change the implementation of the function to better align with
      other libfdt users, by using the right types (fdt32_t) and common
      variable names (*prop, prop_names).
      
      [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi#n874
      [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/ecx-2000.dts
      
      
      
      Change-Id: I718de960515117ac7a3331a1b177d2ec224a3890
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      ff4e6c35
  17. 28 Apr, 2020 3 commits
    • Andre Przywara's avatar
      plat/stm32: Use generic fdt_read_uint32_array() implementation · 52a616b4
      Andre Przywara authored
      
      
      The device tree parsing code for the STM32 platform is using its own FDT
      helper functions, some of them being rather generic.
      In particular the existing fdt_read_uint32_array() implementation is now
      almost identical to the new generic code in fdt_wrappers.c, so we can
      remove the ST specific version and adjust the existing callers.
      
      Compared to the original ST implementation the new version takes a
      pointer to the DTB as the first argument, and also swaps the order of
      the number of cells and the pointer.
      
      Change-Id: Id06b0f1ba4db1ad1f733be40e82c34f46638551a
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      52a616b4
    • Andre Przywara's avatar
      fdt/wrappers: Generalise fdtw_read_array() · 6e3a89f4
      Andre Przywara authored
      
      
      Currently our fdtw_read_array() implementation requires the length of
      the property to exactly match the requested size, which makes it less
      flexible for parsing generic device trees.
      Also the name is slightly misleading, since we treat the cells of the
      array as 32 bit unsigned integers, performing the endianess conversion.
      
      To fix those issues and align the code more with other DT users (Linux
      kernel or U-Boot), rename the function to "fdt_read_uint32_array", and
      relax the length check to only check if the property covers at least the
      number of cells we request.
      This also changes the variable names to be more in-line with other DT
      users, and switches to the proper data types.
      
      This makes this function more useful in later patches.
      
      Change-Id: Id86f4f588ffcb5106d4476763ecdfe35a735fa6c
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      6e3a89f4
    • Marek Vasut's avatar
      rcar_gen3: plat: Zero-terminate the string in unsigned_num_print() · dcd08687
      Marek Vasut authored
      
      
      Make sure the string generated in unsigned_num_print() is zero-terminated.
      Signed-off-by: default avatarMarek Vasut <marek.vasut+renesas@gmail.com>
      Change-Id: Ic0ac1ebca255002522159a9152ab41991f043d05
      dcd08687
  18. 25 Apr, 2020 1 commit
    • Masahiro Yamada's avatar
      linker_script: move .data section to bl_common.ld.h · caa3e7e0
      Masahiro Yamada authored
      Move the data section to the common header.
      
      I slightly tweaked some scripts as follows:
      
      [1] bl1.ld.S has ALIGN(16). I added DATA_ALIGN macro, which is 1
          by default, but overridden by bl1.ld.S. Currently, ALIGN(16)
          of the .data section is redundant because commit 41286590
      
      
          ("Fix boot failures on some builds linked with ld.lld.") padded
          out the previous section to work around the issue of LLD version
          <= 10.0. This will be fixed in the future release of LLVM, so
          I am keeping the proper way to align LMA.
      
      [2] bl1.ld.S and bl2_el3.ld.S define __DATA_RAM_{START,END}__ instead
          of __DATA_{START,END}__. I put them out of the .data section.
      
      [3] SORT_BY_ALIGNMENT() is missing tsp.ld.S, sp_min.ld.S, and
          mediatek/mt6795/bl31.ld.S. This commit adds SORT_BY_ALIGNMENT()
          for all images, so the symbol order in those three will change,
          but I do not think it is a big deal.
      
      Change-Id: I215bb23c319f045cd88e6f4e8ee2518c67f03692
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      caa3e7e0
  19. 24 Apr, 2020 1 commit
  20. 23 Apr, 2020 2 commits
  21. 17 Apr, 2020 1 commit
  22. 15 Apr, 2020 1 commit