1. 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
  2. 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
  3. 29 Jul, 2020 1 commit
  4. 21 Jul, 2020 1 commit
  5. 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
  6. 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
  7. 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
  8. 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
  9. 07 Apr, 2020 3 commits
  10. 06 Apr, 2020 1 commit
  11. 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
  12. 10 Mar, 2020 1 commit
  13. 04 Feb, 2020 1 commit
  14. 28 Jan, 2020 1 commit
  15. 19 Nov, 2019 1 commit
  16. 15 Nov, 2019 1 commit
    • Alexei Fedorov's avatar
      GIC-600: Fix power up sequence · 7a7fbb12
      Alexei Fedorov authored
      
      
      Arm's GIC-600 features a Power Register (GICR_PWRR),
      which needs to be programmed to enable redistributor
      operation. Section 3.6.1 in the GIC-600 TRM describes
      the power-up and power-down sequence in pseudo code,
      which deviates from the current TF-A implementation
      in drivers/arm/gic/v3/gic600.c.
      For powering on a redistributor, the pseudo code suggests
      to loop over the whole sequence (check for transition,
      write request bit) instead of just looping over the
      ready bit read as TF-A does in gic600_pwr_on().
      This patch fixes GIC-600 power up sequence according
      to the TRM.
      
      Change-Id: I445c480e96ba356b69a2d8e5308ffe6c0a97f45b
      Signed-off-by: default avatarAlexei Fedorov <Alexei.Fedorov@arm.com>
      7a7fbb12
  17. 11 Nov, 2019 1 commit
  18. 26 Sep, 2019 1 commit
    • Madhukar Pappireddy's avatar
      GICv3: Enable multi socket GIC redistributor frame discovery · ec834925
      Madhukar Pappireddy authored
      
      
      This patch provides declaration and definition of new GICv3 driver
      API: gicv3_rdistif_probe().This function delegates the responsibility
      of discovering the corresponding Redistributor base frame to each CPU
      itself. It is a modified version of gicv3_rdistif_base_addrs_probe()
      and is executed by each CPU in the platform unlike the previous
      approach in which only the Primary CPU did the discovery of all the
      Redistributor frames for every CPU.
      
      The flush operations as part of gicv3_driver_init() function are
      made necessary even for platforms with WARMBOOT_ENABLE_DCACHE_EARLY
      because the GICv3 driver data structure contents are accessed by CPU
      with D-Cache turned off during power down operations.
      
      Change-Id: I1833e81d3974b32a3e4a3df4766a33d070982268
      Signed-off-by: default avatarMadhukar Pappireddy <madhukar.pappireddy@arm.com>
      ec834925
  19. 13 Sep, 2019 1 commit
  20. 01 Aug, 2019 1 commit
    • Julius Werner's avatar
      Switch AARCH32/AARCH64 to __aarch64__ · 402b3cf8
      Julius Werner authored
      
      
      NOTE: AARCH32/AARCH64 macros are now deprecated in favor of __aarch64__.
      
      All common C compilers pre-define the same macros to signal which
      architecture the code is being compiled for: __arm__ for AArch32 (or
      earlier versions) and __aarch64__ for AArch64. There's no need for TF-A
      to define its own custom macros for this. In order to unify code with
      the export headers (which use __aarch64__ to avoid another dependency),
      let's deprecate the AARCH32 and AARCH64 macros and switch the code base
      over to the pre-defined standard macro. (Since it is somewhat
      unintuitive that __arm__ only means AArch32, let's standardize on only
      using __aarch64__.)
      
      Change-Id: Ic77de4b052297d77f38fc95f95f65a8ee70cf200
      Signed-off-by: default avatarJulius Werner <jwerner@chromium.org>
      402b3cf8
  21. 05 Jun, 2019 1 commit
    • James kung's avatar
      Prevent pending G1S interrupt become G0 interrupt · acc29852
      James kung authored
      
      
      According to Arm GIC spec(IHI0069E, section 4.6.1),
      when GICD_CTLR.DS == 0, Secure Group 1 interrupts
      are treated as Group 0 by a CPU interface if:
      - The PE does not implement EL3.
      - ICC_SRE_EL1(S).SRE == 0
      
      When a cpu enter suspend or deep idle, it might be
      powered off. When the cpu resume, according to
      the GIC spec(IHI0069E, section 9.2.15, 9.2.16 and
      9.2.22) the ICC_SRE_EL1.SRE reset value is 0 (if
      write is allowed) and G0/G1S/G1NS interrupt of the
      GIC cpu interface are all disabled.
      
      If a G1S SPI interrupt occurred and the target cpu
      of the SPI is assigned to a specific cpu which is
      in suspend and is powered off, when the cpu resume
      and start to initial the GIC cpu interface, the
      initial sequence might affect the interrupt group
      type of the pending interrupt on the cpu interface.
      
      Current initial sequence on the cpu interface is:
      1. Enable G0 interrupt
      2. Enable G1S interrupt
      3. Enable ICC_SRE_EL1(S).SRE
      
      It is possible to treat the pending G1S interrupt
      as G0 interrupt on the cpu interface if the G1S
      SPI interrupt occurred between step2 and step3.
      
      To prevent the above situation happend, the initial
      sequence should be changed as follows:
      1. Enable ICC_SRE_EL1(S).SRE
      2. Enable G0 interrupt
      3. Enable G1S interrupt
      
      Change-Id: Ie34f6e0b32eb9a1677ff72571fd4bfdb5cae25b0
      Signed-off-by: default avatarJames Kung <kong1191@gmail.com>
      acc29852
  22. 28 Feb, 2019 1 commit
  23. 04 Feb, 2019 1 commit
    • Soby Mathew's avatar
      GICv3: Allow probe for fewer GICR interfaces than exposed by the frame · 5dc2c3f9
      Soby Mathew authored
      
      
      Previously the GICv3 redistributor probe function
      (gicv3_rdistif_base_addrs_probe()) asserted that the number of
      per-CPU redistributor interfaces expected to be probed by the
      platform is equal to the number exported by the redistributor
      frame. This is a problem in case the number of CPUs in the
      platform is less than the number of redistributor interfaces
      in the frame. Hence this patch removes the assertion check
      and allows probe for fewer redistributor interfaces as required
      by the platform.
      
      Change-Id: I3449763a3ad70817224442cbe184d001030c9874
      Signed-off-by: default avatarSoby Mathew <soby.mathew@arm.com>
      5dc2c3f9
  24. 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
  25. 08 Nov, 2018 1 commit
    • Antonio Nino Diaz's avatar
      Standardise header guards across codebase · c3cf06f1
      Antonio Nino Diaz authored
      
      
      All identifiers, regardless of use, that start with two underscores are
      reserved. This means they can't be used in header guards.
      
      The style that this project is now to use the full name of the file in
      capital letters followed by 'H'. For example, for a file called
      "uart_example.h", the header guard is UART_EXAMPLE_H.
      
      The exceptions are files that are imported from other projects:
      
      - CryptoCell driver
      - dt-bindings folders
      - zlib headers
      
      Change-Id: I50561bf6c88b491ec440d0c8385c74650f3c106e
      Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
      c3cf06f1
  26. 03 Oct, 2018 1 commit
  27. 28 Sep, 2018 1 commit
  28. 03 Sep, 2018 1 commit
  29. 30 Aug, 2018 5 commits
  30. 26 Jul, 2018 1 commit
  31. 12 Jun, 2018 2 commits
    • Daniel Boulby's avatar
      Fix MISRA Rule 5.3 Part 2 · 896a5902
      Daniel Boulby authored
      
      
      Use a _ prefix for Macro arguments to prevent that argument from
      hiding variables of the same name in the outer scope
      
      Rule 5.3: An identifier declared in an inner scope shall not
                hide an identifier declared in an outer scope
      
      Fixed For:
          make LOG_LEVEL=50 PLAT=fvp
      
      Change-Id: I67b6b05cbad4aeca65ce52981b4679b340604708
      Signed-off-by: default avatarDaniel Boulby <daniel.boulby@arm.com>
      896a5902
    • Daniel Boulby's avatar
      Fix MISRA Rule 5.1 · 87d3aacc
      Daniel Boulby authored
      
      
      Rule 5.1: External identifiers shall be distinct
      
      Some of the identifier names in the GICv3 driver were so long that the
      first 31 characters were identical. This patch shortens these names to
      make sure they are different.
      
      Fixed for:
          LOG_LEVEL=50 PLAT=fvp
      
      Change-Id: Iecd551e3a015d144716b87b42c83dd3ab8c34d90
      Signed-off-by: default avatarDaniel Boulby <daniel.boulby@arm.com>
      87d3aacc
  32. 27 Apr, 2018 1 commit
  33. 03 Apr, 2018 1 commit
    • Andre Przywara's avatar
      gicv3: Fix support for systems without secure interrupts · 205cf6e7
      Andre Przywara authored
      
      
      Accessing the interrupt_props array only happens inside a loop over
      interrupt_props_num, so the GICv3 driver can cope with no secure
      interrupts. This allows us to relax the asserts that insists on
      a non-NULL interrupt_props pointer and at least one secure interrupt.
      This enables GICv3 platforms which have no need for a secure interrupt.
      
      This only covers the non-deprecated code paths.
      
      Change-Id: I49db291906512f56af065772f69acb281dfbdcfb
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      205cf6e7