1. 08 Jun, 2021 1 commit
  2. 20 Apr, 2021 1 commit
    • Mikael Olsson's avatar
      Add SiP service to configure Arm Ethos-N NPU · 76a21174
      Mikael Olsson authored
      
      
      By default the Arm Ethos-N NPU will boot up in secure mode. In this mode
      the non-secure world cannot access the registers needed to use the NPU.
      To still allow the non-secure world to use the NPU, a SiP service has
      been added that can delegate non-secure access to the registers needed
      to use it.
      
      Only the HW_CONFIG for the Arm Juno platform has been updated to include
      the device tree for the NPU and the platform currently only loads the
      HW_CONFIG in AArch64 builds.
      Signed-off-by: default avatarMikael Olsson <mikael.olsson@arm.com>
      Change-Id: I65dfd864042ed43faae0a259dcf319cbadb5f3d2
      76a21174
  3. 01 Apr, 2021 1 commit
  4. 23 Mar, 2021 1 commit
    • Yann Gautier's avatar
      tzc400: add support for interrupts · 34c1a1a4
      Yann Gautier authored
      
      
      A new function tzc400_it_handler() is created to manage TZC400
      interrupts. The required helpers to read and clear interrupts are added
      as well.
      In case DEBUG is enabled, more information about the faulty access
      (address, NSAID, type of access) is displayed.
      
      Change-Id: Ie9ab1c199a8f12b2c9472d7120efbdf35711284a
      Signed-off-by: default avatarYann Gautier <yann.gautier@st.com>
      34c1a1a4
  5. 09 Feb, 2021 1 commit
    • Heyi Guo's avatar
      tzc400: adjust filter flag if it is set to FILTER_BIT_ALL · d4c61c38
      Heyi Guo authored
      
      
      TZC_400_REGION_ATTR_FILTER_BIT_ALL is a simple constant definition, so
      it can't get the real filter number to construct the bit flag for all
      existing filters. If the platform doesn't have 4 filters, passing
      FILTER_BIT_ALL to tzc400_configure_region() will cause assertion or
      misconfiguration. So adjust the bit flag against the real filter
      number.
      Signed-off-by: default avatarHeyi Guo <guoheyi@linux.alibaba.com>
      Change-Id: Ie5c48303485f3b5015772961ee7c34746121ee84
      d4c61c38
  6. 03 Feb, 2021 6 commits
    • Heyi Guo's avatar
      drivers/gicv3: also shift eSPI register offset in GICD_OFFSET_64() · 612b4a3f
      Heyi Guo authored
      
      
      ESPI register offset should also be shifted right by REG##R_SHIFT to
      keep consistent.
      
      It is not a functional issue, for GICD_OFFSET_64() is only used for
      GICD_IROUTER<E>, and IROUTER_SHIFT is 0.
      Signed-off-by: default avatarHeyi Guo <guoheyi@linux.alibaba.com>
      Change-Id: I76eee5c50e4300890e78e80bddde135ce88daa2d
      612b4a3f
    • Heyi Guo's avatar
      drivers/gicv3: add debug log for maximum INTID of SPI and eSPI · 705032de
      Heyi Guo authored
      
      
      Add debug log for the maximum supported INTID of SPI and eSPI on the
      current GIC implementation.
      Signed-off-by: default avatarHeyi Guo <guoheyi@linux.alibaba.com>
      Change-Id: Ie45ab1d85b39658c4ca4bc54ee433ac44e41d03f
      705032de
    • Heyi Guo's avatar
      drivers/gicv3: limit SPI ID to avoid misjudgement in GICD_OFFSET() · 4e42c227
      Heyi Guo authored
      
      
      The GICv3 architecture allows GICD_TYPER.ITLinesNumber to be 31, so
      the maximum possible value for num_ints is 1024. The value must be
      limited to (MAX_SPI_ID + 1), or GICD_OFFSET() will consider it as ESPI
      INTID and return wrong register address.
      Signed-off-by: default avatarHeyi Guo <guoheyi@linux.alibaba.com>
      Change-Id: Iddcb83d3e5d241b39f4176c19c2bceaa2c3dd653
      4e42c227
    • Heyi Guo's avatar
      drivers/gicv3: fix logical issue for num_eints · 69ae4427
      Heyi Guo authored
      
      
      In function gicv3_spis_config_defaults(), the variable num_ints is set
      to (maximum SPI INTID + 1), while num_eints is set to (maximum ESPI
      INTID). It introduces not only inconsistency to the code, but also
      logical bug in the "for" loops, for the INTID of num_eints is also
      valid and the check should be inclusive.
      
      Fix this by setting num_eints to (maximum ESPI INTID + 1) as well.
      
      Fix similar issues in gicv3_distif_save() and
      gicv3_distif_init_restore().
      Signed-off-by: default avatarHeyi Guo <guoheyi@linux.alibaba.com>
      Change-Id: I4425777d17e84e85f38853603340bd348640154f
      69ae4427
    • Heyi Guo's avatar
      drivers/gicv3: fix potential GICD context override with ESPI enabled · deb18901
      Heyi Guo authored
      
      
      RESTORE/SAVE_GICD_EREGS uses (int_id - (MIN_ESPI_ID - MIN_SPI_ID)) to
      get the context array index for ESPI, which will override the space of
      standard SPI starting from (MIN_SPI_ID + MIN_SPI_ID).
      
      However, using TOTAL_SPI_INTR_NUM to replace the above MIN_SPI_ID
      cannot totally fix the issue, for TOTAL_SPI_INTR_NUM is not well
      aligned and the array index will be rounded down by the shifting
      operation if being shifted more than 2 bits. It will cause buffer
      override again when the existing maximum SPI reaches 1019.
      
      So round up TOTAL_SPI_INTR_NUM with (1 << REG##R_SHIFT) for GICD
      context arrays.
      Signed-off-by: default avatarHeyi Guo <guoheyi@linux.alibaba.com>
      Change-Id: I5be2837c42f381a62f8d46a4ecd778009b1fe059
      deb18901
    • Heyi Guo's avatar
      drivers/gicv3: use mpidr to probe GICR for current CPU · 60cd8030
      Heyi Guo authored
      
      
      In function gicv3_rdistif_probe(), line #1322 implies
      gicv3_driver_data->mpidr_to_core_pos() may be null, but the original
      code uses this interface to get current CPU index unconditionally.
      
      It is better to use MPIDR to probe GICR which does not depend on
      gicv3_driver_data->mpidr_to_core_pos().
      Signed-off-by: default avatarHeyi Guo <guoheyi@linux.alibaba.com>
      Change-Id: I64add055385040fe0a56b977e2299608e2309a6e
      60cd8030
  7. 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
  8. 10 Oct, 2020 1 commit
    • johpow01's avatar
      Fix casting bug in gicv2_main.c · 20d38497
      johpow01 authored
      
      
      In the function gicv2_set_spi_routing, the signed value proc_num is cast
      to unsigned int before being compared to other unsigned values in two
      assert calls.  The value proc_num can be a negative value, and once the
      negative value is cast to unsigned it becomes a very large number which
      will trigger the assert.  This patch changes the assert cast so that the
      unsigned values are cast to signed instead, keeping the same functionality
      but allowing proc_num to be negative.
      
      This bug can be seen when running the SDEI RM_ANY routing mode test in
      TFTF on the Juno platform.
      
      This patch also makes the usage of the proc_num variable in other gicv2
      functions more clear.
      Signed-off-by: default avatarJohn Powell <john.powell@arm.com>
      Change-Id: If1b98eebb00bd9b73862e5e995e5e68c168170a6
      20d38497
  9. 09 Oct, 2020 1 commit
    • Jimmy Brisson's avatar
      Don't return error information from console_flush · 831b0e98
      Jimmy Brisson authored
      
      
      And from crash_console_flush.
      
      We ignore the error information return by console_flush in _every_
      place where we call it, and casting the return type to void does not
      work around the MISRA violation that this causes. Instead, we collect
      the error information from the driver (to avoid changing that API), and
      don't return it to the caller.
      
      Change-Id: I1e35afe01764d5c8f0efd04f8949d333ffb688c1
      Signed-off-by: default avatarJimmy Brisson <jimmy.brisson@arm.com>
      831b0e98
  10. 29 Sep, 2020 1 commit
    • 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
  11. 29 Jul, 2020 1 commit
  12. 27 Jul, 2020 1 commit
  13. 21 Jul, 2020 1 commit
  14. 20 Jul, 2020 1 commit
    • Alexei Fedorov's avatar
      TF-A GICv2 driver: Introduce makefile · 1322dc94
      Alexei Fedorov authored
      
      
      This patch moves all GICv2 driver files into new added
      'gicv2.mk' makefile for the benefit of the generic driver
      which can evolve in the future without affecting platforms.
      
      NOTE: Usage of 'drivers/arm/gic/common/gic_common.c' file
      is now deprecated and platforms with GICv2 driver need to
      be modified to include 'drivers/arm/gic/v2/gicv2.mk' in
      their makefiles.
      
      Change-Id: Ib10e71bdda0e5c7e80a049ddce2de1dd839602d1
      Signed-off-by: default avatarAlexei Fedorov <Alexei.Fedorov@arm.com>
      1322dc94
  15. 07 Jul, 2020 1 commit
    • Varun Wadekar's avatar
      drivers: arm: gicv3: auto-detect presence of GIC600-AE · 8e570b71
      Varun Wadekar authored
      
      
      This patch adds the IIDR value for GIC600-AE to the gicv3_is_gic600()
      helper function. This helps platforms supporting this version of the
      GIC600 interrupt controller to function with the generic GIC driver.
      
      Verified with tftf-validation test suite
      
      ******************************* Summary *******************************
      > Test suite 'Framework Validation'
                                                                      Passed
      > Test suite 'Timer framework Validation'
                                                                      Passed
      =================================
      Tests Skipped : 0
      Tests Passed  : 6
      Tests Failed  : 0
      Tests Crashed : 0
      Total tests   : 6
      =================================
      NOTICE:  Exiting tests.
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      Change-Id: I518ae7b56f7f372e374e453287d76ca370fc3574
      8e570b71
  16. 24 Jun, 2020 1 commit
  17. 22 Jun, 2020 1 commit
    • Sandeep Tripathy's avatar
      TF-A GIC driver: Add barrier before eoi · 5eb16c47
      Sandeep Tripathy authored
      
      
      It is desired to have the peripheral writes completed to clear the
      interrupt condition and de-assert the interrupt request to GIC before
      EOI write. Failing which spurious interrupt will occurred.
      
      A barrier is needed to ensure peripheral register write transfers are
      complete before EOI is done.
      
      GICv2 memory mapped DEVICE nGnR(n)E writes are ordered from core point
      of view. However these writes may pass over different interconnects,
      bridges, buffers leaving some rare chances for the actual write to
      complete out of order.
      
      GICv3 ICC EOI system register writes have no ordering against nGnR(n)E
      memory writes as they are over different interfaces.
      
      Hence a dsb can ensure from core no writes are issued before the previous
      writes are *complete*.
      Signed-off-by: default avatarSandeep Tripathy <sandeep.tripathy@broadcom.com>
      Change-Id: Ie6362009e2f91955be99dca8ece14ade7b4811d6
      5eb16c47
  18. 09 Jun, 2020 1 commit
    • Andre Przywara's avatar
      GICv3: GIC-600: Detect GIC-600 at runtime · b4ad365a
      Andre Przywara authored
      
      
      The only difference between GIC-500 and GIC-600 relevant to TF-A is the
      differing power management sequence.
      A certain GIC implementation is detectable at runtime, for instance by
      checking the IIDR register. Let's add that test before initiating the
      GIC-600 specific sequence, so the code can be used on both GIC-600 and
      GIC-500 chips alike, without deciding on a GIC chip at compile time.
      
      This means that the GIC-500 "driver" is now redundant. To allow minimal
      platform support, add a switch to disable GIC-600 support.
      
      Change-Id: I17ea97d9fb05874772ebaa13e6678b4ba3415557
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      b4ad365a
  19. 07 Apr, 2020 3 commits
  20. 06 Apr, 2020 1 commit
  21. 30 Mar, 2020 1 commit
    • Alexei Fedorov's avatar
      TF-A GICv3 driver: Introduce makefile · a6ea06f5
      Alexei Fedorov authored
      
      
      This patch moves all GICv3 driver files into new added
      'gicv3.mk' makefile for the benefit of the generic driver
      which can evolve in the future without affecting platforms.
      The patch adds GICv3 driver configuration flags
      'GICV3_IMPL', 'GICV3_IMPL_GIC600_MULTICHIP' and
      'GICV3_OVERRIDE_DISTIF_PWR_OPS' described in
      'GICv3 driver options' section of 'build-option.rst'
      document.
      
      NOTE: Platforms with GICv3 driver need to be modified to
      include 'drivers/arm/gic/v3/gicv3.mk' in their makefiles.
      
      Change-Id: If055f6770ff20f5dee5a3c99ae7ced7cdcac5c44
      Signed-off-by: default avatarAlexei Fedorov <Alexei.Fedorov@arm.com>
      a6ea06f5
  22. 10 Mar, 2020 1 commit
  23. 05 Mar, 2020 1 commit
    • Manish Pandey's avatar
      driver/arm/css: minor bug fix · cc7f89de
      Manish Pandey authored
      
      
      The cpu index was wrongly checked causing it to assert always.
      Since this code path is exercised only during TF test "NODE_HW_STAT",
      which queries Power state from SCP, this bug was not detected earlier.
      
      Change-Id: Ia25cef4c0aa23ed08092df39134937a2601c21ac
      Signed-off-by: default avatarManish Pandey <manish.pandey2@arm.com>
      cc7f89de
  24. 25 Feb, 2020 1 commit
  25. 13 Feb, 2020 1 commit
  26. 07 Feb, 2020 2 commits
  27. 04 Feb, 2020 1 commit
  28. 28 Jan, 2020 1 commit
  29. 10 Jan, 2020 1 commit
    • Deepika Bhavnani's avatar
      Unify type of "cpu_idx" across PSCI module. · 5b33ad17
      Deepika Bhavnani authored
      
      
      NOTE for platform integrators:
         API `plat_psci_stat_get_residency()` third argument
         `last_cpu_idx` is changed from "signed int" to the
         "unsigned int" type.
      
      Issue / Trouble points
      1. cpu_idx is used as mix of `unsigned int` and `signed int` in code
      with typecasting at some places leading to coverity issues.
      
      2. Underlying platform API's return cpu_idx as `unsigned int`
      and comparison is performed with platform specific defines
      `PLAFORM_xxx` which is not consistent
      
      Misra Rule 10.4:
      The value of a complex expression of integer type may only be cast to
      a type that is narrower and of the same signedness as the underlying
      type of the expression.
      
      Based on above points, cpu_idx is kept as `unsigned int` to match
      the API's and low-level functions and platform defines are updated
      where ever required
      Signed-off-by: default avatarDeepika Bhavnani <deepika.bhavnani@arm.com>
      Change-Id: Ib26fd16e420c35527204b126b9b91e8babcc3a5c
      5b33ad17
  30. 03 Jan, 2020 1 commit
    • Vishnu Banavath's avatar
      drivers: add a driver for snoop control unit · c20c0525
      Vishnu Banavath authored
      
      
      The SCU connects one to four Cortex-A5/Cortex-A9 processors
      to the memory system through the AXI interfaces.
      
      The SCU functions are to:
      - maintain data cache coherency between the Cortex-A5/Cortex-A9
        processors
      - initiate L2 AXI memory accesses
      - arbitrate between Cortex-A5/Cortex-A9 processors requesting
        L2 accesses
      - manage ACP accesses.
      
      Snoop Control Unit will enable to snoop on other CPUs caches.
      This is very important when it comes to synchronizing data between
      CPUs. As an example, there is a high chance that data might be
      cache'd and other CPUs can't see the change. In such cases,
      if snoop control unit is enabled, data is synchoronized immediately
      between CPUs and the changes are visible to other CPUs.
      
      This driver provides functionality to enable SCU as well as enabling
      user to know the following
      - number of CPUs present
      - is a particular CPU operating in SMP mode or AMP mode
      - data cache size of a particular CPU
      - does SCU has ACP port
      - is L2CPRESENT
      
      Change-Id: I0d977970154fa60df57caf449200d471f02312a0
      Signed-off-by: default avatarVishnu Banavath <vishnu.banavath@arm.com>
      c20c0525
  31. 06 Dec, 2019 1 commit
    • Bence Szépkúti's avatar
      libc: Consolidate unified definitions · b382ac68
      Bence Szépkúti authored
      
      
      As supporting architectures aside from AArch32 and AArch64 is not a
      concern, keeping identical definitions in two places for a large part
      of the libc seems counterproductive
      
      The int128 types were left un-unified as __int128 is not supported by
      gcc on AArch32
      Signed-off-by: default avatarBence Szépkúti <bence.szepkuti@arm.com>
      Change-Id: Idf08e6fab7e4680d9da62d3c57266ea2d80472cf
      b382ac68
  32. 19 Nov, 2019 1 commit