1. 12 Oct, 2020 1 commit
    • Jimmy Brisson's avatar
      Increase type widths to satisfy width requirements · d7b5f408
      Jimmy Brisson authored
      
      
      Usually, C has no problem up-converting types to larger bit sizes. MISRA
      rule 10.7 requires that you not do this, or be very explicit about this.
      This resolves the following required rule:
      
          bl1/aarch64/bl1_context_mgmt.c:81:[MISRA C-2012 Rule 10.7 (required)]<None>
          The width of the composite expression "0U | ((mode & 3U) << 2U) | 1U |
          0x3c0U" (32 bits) is less that the right hand operand
          "18446744073709547519ULL" (64 bits).
      
      This also resolves MISRA defects such as:
      
          bl2/aarch64/bl2arch_setup.c:18:[MISRA C-2012 Rule 12.2 (required)]
          In the expression "3U << 20", shifting more than 7 bits, the number
          of bits in the essential type of the left expression, "3U", is
          not allowed.
      
      Further, MISRA requires that all shifts don't overflow. The definition of
      PAGE_SIZE was (1U << 12), and 1U is 8 bits. This caused about 50 issues.
      This fixes the violation by changing the definition to 1UL << 12. Since
      this uses 32bits, it should not create any issues for aarch32.
      
      This patch also contains a fix for a build failure in the sun50i_a64
      platform. Specifically, these misra fixes removed a single and
      instruction,
      
          92407e73        and     x19, x19, #0xffffffff
      
      from the cm_setup_context function caused a relocation in
      psci_cpus_on_start to require a linker-generated stub. This increased the
      size of the .text section and caused an alignment later on to go over a
      page boundary and round up to the end of RAM before placing the .data
      section. This sectionn is of non-zero size and therefore causes a link
      error.
      
      The fix included in this reorders the functions during link time
      without changing their ording with respect to alignment.
      
      Change-Id: I76b4b662c3d262296728a8b9aab7a33b02087f16
      Signed-off-by: default avatarJimmy Brisson <jimmy.brisson@arm.com>
      d7b5f408
  2. 09 Oct, 2020 1 commit
  3. 07 Oct, 2020 1 commit
  4. 05 Oct, 2020 2 commits
  5. 02 Oct, 2020 1 commit
    • Andre Przywara's avatar
      libfdt: Upgrade libfdt source files · 3b456661
      Andre Przywara authored
      
      
      Update the libfdt source files, the upstream commit is 73e0f143b73d
      ("libfdt: fdt_strerror(): Fix comparison warning").
      
      This brings us the fixes for the signed/unsigned comparison warnings,
      so platforms can enable -Wsign-compare now.
      
      Change-Id: I303d891c82ffea0acefdde27289339db5ac5a289
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      3b456661
  6. 01 Oct, 2020 1 commit
  7. 29 Sep, 2020 2 commits
    • Andre Przywara's avatar
      fdt: Add function to adjust GICv3 redistributor size · 9f7bab42
      Andre Przywara authored
      
      
      We now have code to detect the CPU topology at runtime, and can also
      populate the CPU nodes in a devicetree accordingly. This is used by the
      ARM FPGA port, for instance.
      But also a GICv3 compatible interrupt controller provides MMIO frames
      per core, so the size of this region needs to be adjusted in the DT,
      to match the number of cores as well.
      
      Provide a generic function to find the GICv3 interrupt controller in
      the DT, then adjust the "reg" entry to match the number of detected
      cores. Since the size of the GICR frame per cores differs between
      GICv4 and GICv3, this size is supplied as a parameter to the function.
      The caller should determine the applicable value by either hardcoding
      it or by observing GICR_TYPER.VLPIS.
      
      Change-Id: Ic2a6445c2c5381a36bf24263f52fcbefad378c05
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      9f7bab42
    • Andre Przywara's avatar
      drivers: arm: gicv3: Allow detecting number of cores · 79d89e3d
      Andre Przywara authored
      
      
      A GICv3 interrupt controller will be instantiated for a certain number
      of cores. This will result in the respective number of GICR frames. The
      last frame will have the "Last" bit set in its GICR_TYPER register.
      
      For platforms with a topology unknown at build time (the Arm FPGAs, for
      instance), we need to learn the number of used cores at runtime, to size
      the GICR region in the devicetree accordingly.
      
      Add a generic function that iterates over all GICR frames until it
      encounters one with the "Last" bit set. It returns the number of cores
      the GICv3 has been configured for.
      
      Change-Id: I79f033c50dfc1c275aba7122725868811abcc4f8
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      79d89e3d
  8. 28 Sep, 2020 1 commit
  9. 25 Sep, 2020 2 commits
  10. 24 Sep, 2020 3 commits
    • Yann Gautier's avatar
      drivers: st: add missing includes in ETZPC header · 0adc87c7
      Yann Gautier authored
      
      
      Depending on compiler, the issue about bool or uint*_t not defined can
      appear.
      Correct this by adding stdbool.h and stdint.h includes in etzpc.h.
      
      Change-Id: If1419dc511efbe682459fa4a776481fa52a38aa3
      Signed-off-by: default avatarYann Gautier <yann.gautier@st.com>
      0adc87c7
    • Lionel Debieve's avatar
      nand: raw_nand: fix timeout issue in nand_wait_ready · ea306945
      Lionel Debieve authored
      
      
      nand_wait_ready is called with a millisecond delay
      but the timeout used a micro second. Fixing the conversion
      in the timeout call.
      The prototype of the function is also changed to use an unsigned int
      parameter.
      
      Change-Id: Ia3281be7980477dfbfdb842308d35ecd8b926fb8
      Signed-off-by: default avatarLionel Debieve <lionel.debieve@st.com>
      Signed-off-by: default avatarYann Gautier <yann.gautier@st.com>
      ea306945
    • Yann Gautier's avatar
      fdts: stm32mp1: realign device tree with kernel · 277d6af5
      Yann Gautier authored
      
      
      There is one dtsi file per SoC version:
      - STM32MP151: common part for all version, Single Cortex-A7
      - STM32MP153: Dual Cortex-A7
      - STM32MP157: + GPU and DSI, but not needed for TF-A
      
      The STM32MP15xC include a cryptography peripheral, add it in a dedicated
      file.
      
      There are 4 packages available, for which  the IOs number change. Have one
      file for each package. The 2 packages AB and AD are added.
      
      STM32157A-DK1 and STM32MP157C-DK2 share most of their features, a common
      dkx file is then created.
      
      Some reordering is done in other files, and realign with kernel DT files.
      
      The DDR files are generated with our internal tool, no changes in the
      registers values.
      
      Change-Id: I9f2ef00306310abe34b94c2f10fc7a77a10493d1
      Signed-off-by: default avatarYann Gautier <yann.gautier@st.com>
      277d6af5
  11. 22 Sep, 2020 1 commit
  12. 18 Sep, 2020 1 commit
  13. 15 Sep, 2020 1 commit
  14. 11 Sep, 2020 1 commit
  15. 09 Sep, 2020 1 commit
  16. 03 Sep, 2020 1 commit
  17. 02 Sep, 2020 1 commit
    • Pramod Kumar's avatar
      lib: cpu: Check SCU presence in DSU before accessing DSU registers · 942013e1
      Pramod Kumar authored
      
      
      The DSU contains system control registers in the SCU and L3 logic to
      control the functionality of the cluster. If "DIRECT CONNECT" L3
      memory system variant is used, there won't be any L3 cache,
      snoop filter, and SCU logic present hence no system control register
      will be present. Hence check SCU presence before accessing DSU register
      for DSU_936184 errata.
      Signed-off-by: default avatarPramod Kumar <pramod.kumar@broadcom.com>
      Change-Id: I1ffa8afb0447ae3bd1032c9dd678d68021fe5a63
      942013e1
  18. 01 Sep, 2020 1 commit
  19. 31 Aug, 2020 1 commit
  20. 28 Aug, 2020 2 commits
  21. 26 Aug, 2020 1 commit
  22. 20 Aug, 2020 2 commits
  23. 18 Aug, 2020 3 commits
    • Manish V Badarkhe's avatar
      runtime_exceptions: Update AT speculative workaround · 3b8456bd
      Manish V Badarkhe authored
      As per latest mailing communication [1], we decided to
      update AT speculative workaround implementation in order to
      disable page table walk for lower ELs(EL1 or EL0) immediately
      after context switching to EL3 from lower ELs.
      
      Previous implementation of AT speculative workaround is available
      here: 45aecff0
      
      AT speculative workaround is updated as below:
      1. Avoid saving and restoring of SCTLR and TCR registers for EL1
         in context save and restore routine respectively.
      2. On EL3 entry, save SCTLR and TCR registers for EL1.
      3. On EL3 entry, update EL1 system registers to disable stage 1
         page table walk for lower ELs (EL1 and EL0) and enable EL1
         MMU.
      4. On EL3 exit, restore SCTLR and TCR registers for EL1 which
         are saved in step 2.
      
      [1]:
      https://lists.trustedfirmware.org/pipermail/tf-a/2020-July/000586.html
      
      
      
      Change-Id: Iee8de16f81dc970a8f492726f2ddd57e7bd9ffb5
      Signed-off-by: default avatarManish V Badarkhe <Manish.Badarkhe@arm.com>
      3b8456bd
    • Manish V Badarkhe's avatar
      el3_runtime: Rearrange context offset of EL1 sys registers · cb55615c
      Manish V Badarkhe authored
      
      
      SCTLR and TCR registers of EL1 plays role in enabling/disabling of
      page table walk for lower ELs (EL0 and EL1).
      Hence re-arranged EL1 context offsets to have SCTLR and TCR registers
      values one after another in the stack so that these registers values
      can be saved and restored using stp and ldp instruction respectively.
      
      Change-Id: Iaa28fd9eba82a60932b6b6d85ec8857a9acd5f8b
      Signed-off-by: default avatarManish V Badarkhe <Manish.Badarkhe@arm.com>
      cb55615c
    • Manish V Badarkhe's avatar
      Add wrapper for AT instruction · 86ba5853
      Manish V Badarkhe authored
      
      
      In case of AT speculative workaround applied, page table walk
      is disabled for lower ELs (EL1 and EL0) in EL3.
      Hence added a wrapper function which temporarily enables page
      table walk to execute AT instruction for lower ELs and then
      disables page table walk.
      
      Execute AT instructions directly for lower ELs (EL1 and EL0)
      assuming page table walk is enabled always when AT speculative
      workaround is not applied.
      
      Change-Id: I4ad4c0bcbb761448af257e9f72ae979473c0dde8
      Signed-off-by: default avatarManish V Badarkhe <Manish.Badarkhe@arm.com>
      86ba5853
  24. 14 Aug, 2020 3 commits
    • Manish Pandey's avatar
      plat/arm: enable support for Plat owned SPs · 990d972f
      Manish Pandey authored
      
      
      For Arm platforms SPs are loaded by parsing tb_fw_config.dts and
      adding them to SP structure sequentially, which in-turn is appended to
      loadable image list.
      
      With recently introduced dualroot CoT for SPs where they are owned
      either by SiP or by Platform. SiP owned SPs index starts at SP_PKG1_ID
      and Plat owned SPs index starts at SP_PKG5_ID. As the start index of SP
      depends on the owner, there should be a mechanism to parse owner of a SP
      and put it at the correct index in SP structure.
      
      This patch adds support for parsing a new optional field "owner" and
      based on it put SP details(UUID & Load-address) at the correct index in
      SP structure.
      
      Change-Id: Ibd255b60d5c45023cc7fdb10971bef6626cb560b
      Signed-off-by: default avatarManish Pandey <manish.pandey2@arm.com>
      990d972f
    • Jimmy Brisson's avatar
      Specify signed-ness of constants · e1d5be56
      Jimmy Brisson authored
      
      
      We relyed on the default signed-ness of constants, which is usually
      signed. This can create MISRA violations, such as:
      
           bl1/bl1_main.c:257:[MISRA C-2012 10.8 (required)] Cast of composite
           expression off essential type signed to essential type unsigned
      
      These constants were only used as unsigned, so this patch makes them
      explicitly unsigned.
      
      Change-Id: I5f1310c881e936077035fbb1d5ffb449b45de3ad
      Signed-off-by: default avatarJimmy Brisson <jimmy.brisson@arm.com>
      e1d5be56
    • Jimmy Brisson's avatar
      Prevent colliding identifiers · d74c6b83
      Jimmy Brisson authored
      
      
      There was a collision between the name of the typedef in the CASSERT and
      something else, so we make the name of the typedef unique to the
      invocation of DEFFINE_SVC_UUID2 by appending the name that's passed into
      the macro. This eliminates the following MISRA violation:
      
          bl1/bl1_main.c:233:[MISRA C-2012 Rule 5.6 (required)] Identifier
          "invalid_svc_uuid" is already used to represent a typedef.
      
      This also resolves MISRA rule 5.9.
      
      These renamings are as follows:
        * tzram -> secram. This matches the function call name as it has
        sec_mem in it's  name
        * fw_config_base -> config_base. This file does not mess with
        hw_conig, so there's little chance of confusion
      
      Change-Id: I8734ba0956140c8e29b89d0596d10d61a6ef351e
      Signed-off-by: default avatarJimmy Brisson <jimmy.brisson@arm.com>
      d74c6b83
  25. 12 Aug, 2020 2 commits
    • Manish Pandey's avatar
      dualroot: add chain of trust for Platform owned SPs · 2947412d
      Manish Pandey authored
      
      
      For dualroot CoT there are two sets of SP certificates, one owned by
      Silicon Provider(SiP) and other owned by Platform. Each certificate can
      have a maximum of 4 SPs.
      
      This patch reduces the number of SiP owned SPs from 8 to 4 and adds
      the remaining 4 to Plat owned SP.
      Plat owned SP certificate is signed using Platform RoT key and
      protected against anti-rollback using the Non-trusted Non-volatile
      counter.
      
      Change-Id: Idc3ddd87d6d85a5506a7435f45a6ec17c4c50425
      Signed-off-by: default avatarManish Pandey <manish.pandey2@arm.com>
      2947412d
    • Manish Pandey's avatar
      cert_create: add Platform owned secure partitions support · 23d5f03a
      Manish Pandey authored
      
      
      Add support to generate a certificate named "plat-sp-cert" for Secure
      Partitions(SP) owned by Platform.
      Earlier a single certificate file "sip-sp-cert" was generated which
      contained hash of all 8 SPs, with this change SPs are divided into
      two categories viz "SiP owned" and "Plat owned" containing 4 SPs each.
      
      Platform RoT key pair is used for signing.
      Signed-off-by: default avatarManish Pandey <manish.pandey2@arm.com>
      Change-Id: I5bd493cfce4cf3fc14b87c8ed1045f633d0c92b6
      23d5f03a
  26. 11 Aug, 2020 1 commit
    • Stefan Chulski's avatar
      plat: marvell: ap807: implement workaround for errata-id 3033912 · 5e4c97d0
      Stefan Chulski authored
      
      
      ERRATA ID: RES-3033912 - Internal Address Space Init state causes
      a hang upon accesses to [0xf070_0000, 0xf07f_ffff]
      Workaround: Boot Firmware (ATF) should configure CCU_RGF_WIN(4) to
      split [0x6e_0000, 0xff_ffff] to values [0x6e_0000, 0x6f_ffff] and
      [0x80_0000, 0xff_ffff] that cause accesses to the segment of
      [0xf070_0000, 0xf07f_ffff] to act as RAZWI. Reuse common
      work-around code for both AP806 and AP807.
      
      Change-Id: Ia91a4802d02917d1682faa0c81571093d1687d97
      Signed-off-by: default avatarStefan Chulski <stefanc@marvell.com>
      5e4c97d0
  27. 10 Aug, 2020 2 commits
    • Alexei Fedorov's avatar
      TF-A AMU extension: fix detection of group 1 counters. · f3ccf036
      Alexei Fedorov authored
      
      
      This patch fixes the bug when AMUv1 group1 counters was
      always assumed being implemented without checking for its
      presence which was causing exception otherwise.
      The AMU extension code was also modified as listed below:
      - Added detection of AMUv1 for ARMv8.6
      - 'PLAT_AMU_GROUP1_NR_COUNTERS' build option is removed and
      number of group1 counters 'AMU_GROUP1_NR_COUNTERS' is now
      calculated based on 'AMU_GROUP1_COUNTERS_MASK' value
      - Added bit fields definitions and access functions for
      AMCFGR_EL0/AMCFGR and AMCGCR_EL0/AMCGCR registers
      - Unification of amu.c Aarch64 and Aarch32 source files
      - Bug fixes and TF-A coding style compliant changes.
      
      Change-Id: I14e407be62c3026ebc674ec7045e240ccb71e1fb
      Signed-off-by: default avatarAlexei Fedorov <Alexei.Fedorov@arm.com>
      f3ccf036
    • Alexei Fedorov's avatar
      plat/arm: Reduce size of BL31 binary · fa1fdb22
      Alexei Fedorov authored
      
      
      BL31 binary size is aligned to 4KB because of the
      code in include\plat\arm\common\arm_reclaim_init.ld.S:
          __INIT_CODE_UNALIGNED__ = .;
          . = ALIGN(PAGE_SIZE);
          __INIT_CODE_END__ = .;
      with all the zero data after the last instruction of
      BL31 code to the end of the page.
      This causes increase in size of BL31 binary stored in FIP
      and its loading time by BL2.
      This patch reduces the size of BL31 image by moving
      page alignment from __INIT_CODE_END__ to __STACKS_END__
      which also increases the stack size for secondary CPUs.
      
      Change-Id: Ie2ec503fc774c22c12ec506d74fd3ef2b0b183a9
      Signed-off-by: default avatarAlexei Fedorov <Alexei.Fedorov@arm.com>
      fa1fdb22