1. 04 Dec, 2015 1 commit
    • Soby Mathew's avatar
      Rename GICv3 interrupt group macros · 03ffb6bd
      Soby Mathew authored
      This patch renames the GICv3 interrupt group macros from
      INT_TYPE_G0, INT_TYPE_G1S and INT_TYPE_G1NS to INTR_GROUP0,
      INTR_GROUP1S and INTR_GROUP1NS respectively.
      
      Change-Id: I40c66f589ce6234fa42205adcd91f7d6ad8f33d4
      03ffb6bd
  2. 26 Nov, 2015 2 commits
    • Soby Mathew's avatar
      Add ARM GICv2 driver · 464ce2bb
      Soby Mathew authored
      This patch adds a driver for ARM GICv2 systems, example GIC-400. Unlike
      the existing GIC driver in `include/drivers/arm/arm_gic.h`, this driver
      is optimised for GICv2 and does not support GICv3 systems in GICv2
      compatibility mode. The driver interface has been implemented in
      `drivers/arm/gic/v2/gicv2_main.c`. The corresponding header is in
      `include/drivers/arm/gicv2.h`. Helper functions are implemented in
      `drivers/arm/gic/v2/gicv2_helpers.c` and are accessible through the
      `drivers/arm/gic/v2/gicv2_private.h` header.
      
      Change-Id: I09fffa4e621fb99ba3c01204839894816cd89a2a
      464ce2bb
    • Achin Gupta's avatar
      Add ARM GICv3 driver without support for legacy operation · df373737
      Achin Gupta authored
      This patch adds a driver for ARM GICv3 systems that need to run software
      stacks where affinity routing is enabled across all privileged exception
      levels for both security states. This driver is a partial implementation
      of the ARM Generic Interrupt Controller Architecture Specification, GIC
      architecture version 3.0 and version 4.0 (ARM IHI 0069A). The driver does
      not cater for legacy support of interrupts and asymmetric configurations.
      
      The existing GIC driver has been preserved unchanged. The common code for
      GICv2 and GICv3 systems has been refactored into a new file,
      `drivers/arm/gic/common/gic_common.c`. The corresponding header is in
      `include/drivers/arm/gic_common.h`.
      
      The driver interface is implemented in `drivers/arm/gic/v3/gicv3_main.c`.
      The corresponding header is in `include/drivers/arm/gicv3.h`. Helper
      functions are implemented in `drivers/arm/gic/v3/arm_gicv3_helpers.c`
      and are accessible through the `drivers/arm/gic/v3/gicv3_private.h`
      header.
      
      Change-Id: I8c3c834a1d049d05b776b4dcb76b18ccb927444a
      df373737
  3. 01 Sep, 2015 1 commit
    • Vikram Kanigiri's avatar
      Remove EL2/EL1 GICv3 register updates · 889fce42
      Vikram Kanigiri authored
      From Linux 3.17 onwards, the mainline kernel has support for GICv3
      systems and if EL3 exists, it only needs to initialise ICC_SRE_EL3.SRE
      and ICC_SRE_EL3.Enable to 1. Hence, this patch removes the redundant
      updates of ICC_SRE_EL2 and ICC_PMR_EL1.
      
      NOTE: For partner software's which enter kernel in EL1,
      ICC_SRE_EL2.Enable and ICC_SRE_EL2.SRE bit needs to be set to 1
      in EL2 before jumping to linux.
      
      Change-Id: I09ed47869351b08a3b034735f532bc677eaa6917
      889fce42
  4. 09 Jul, 2015 1 commit
    • Juan Castillo's avatar
      Use uintptr_t as base address type in ARM driver APIs · 02462972
      Juan Castillo authored
      This patch changes the type of the base address parameter in the
      ARM device driver APIs to uintptr_t (GIC, CCI, TZC400, PL011). The
      uintptr_t type allows coverage of the whole memory space and to
      perform arithmetic operations on the addresses. ARM platform code
      has also been updated to use uintptr_t as GIC base address in the
      configuration.
      
      Fixes ARM-software/tf-issues#214
      
      Change-Id: I1b87daedadcc8b63e8f113477979675e07d788f1
      02462972
  5. 19 May, 2015 1 commit
    • Achin Gupta's avatar
      Fix reporting of interrupt ID in ARM GIC driver · ca0225a5
      Achin Gupta authored
      The ARM GIC driver treats the entire contents of the GICC_HPPIR as the interrupt
      ID instead of just bits[9:0]. This could result in an SGI being treated as a
      Group 1 interrupt on a GICv2 system.
      
      This patch introduces a mask to retrieve only the ID from a read of GICC_HPPIR,
      GICC_IAR and similar registers. The value read from these registers is masked
      with this constant prior to use as an interrupt ID.
      
      Fixes ARM-software/tf-issues#306
      
      Change-Id: Ie3885157de33b71df9781a41f6ef015a30c4608d
      ca0225a5
  6. 20 Mar, 2015 1 commit
    • Achin Gupta's avatar
      Set group status of PPIs and SGIs correctly on GICv3 systems · 8cfc3fd2
      Achin Gupta authored
      On a GICv2 system, the group status of PPIs and SGIs is set in the GICD_IGROUPR0
      register. On a GICv3 system, if affinity routing is enabled for the non-secure
      state, then the group status of PPIs and SGIs should be set in the GICR_IGROUPR0
      register. ARM Trusted firmware sets the group status using the GICv2
      sequence. On a GICv3 system, if the group status of an interrupt is set to Group
      1 through a write to the GICD_IGROUPR0, then the GICR_IGROUPR0 is updated as
      well.
      
      The current sequence is incorrect since it first marks all PPIs and SGIs as
      Group 1. It then clears the bits in GICD_IGROUPR0 corresponding to secure
      interrupts to set their group status to Group 0. This operation is a no-op. It
      leaves the secure generic timer interrupt (#29) used by the TSP marked as Group
      1. This causes the interrupt to interfere with the execution of non-secure
      software. Once an interrupt has been marked as Group 1, the GICR_IGROUPR0 should
      be programmed to change its group status.
      
      This patch rectifies this issue by setting the group status of only the
      non-secure PPI and SGIs to Group 1 in the first place. GICD_IGROUPR0 resets to
      0. So secure interrupts are marked as Group 0 by default.
      
      Change-Id: I958b4b15f3e2b2444ce4c17764def36216498d00
      8cfc3fd2
  7. 31 Oct, 2014 1 commit
    • Juan Castillo's avatar
      Improvements to ARM GIC driver · eb57fa56
      Juan Castillo authored
      This patch introduces several improvements to the ARM GIC driver:
      
      * In function gicd_set_itargetsr(), target CPU is specified using
        the same bit mask detailed in the GICD_ITARGETSRn register instead
        of the CPU linear ID, removing the dependency between bit position
        and linear ID in the platform porting. The current CPU bit mask
        may be obtained by reading GICD_ITARGETSR0.
      
      * PPIs and SGIs are initialized in arm_gic_pcpu_distif_setup().
        SPIs are initialized in arm_gic_distif_setup().
      
      * By default, non secure interrupts are assigned the maximum
        priority allowed to a non secure interrupt (defined by
        GIC_HIGHEST_NS_PRIORITY).
      
      * GICR base address is allowed to be NULL for GICv1 and GICv2.
      
      Change-Id: Ie2837fe860d43b2282e582dfdb13c39c6186f232
      eb57fa56
  8. 28 Jul, 2014 1 commit
    • Juan Castillo's avatar
      Rework incorrect use of assert() and panic() in codebase · d3280beb
      Juan Castillo authored
      Assert a valid security state using the macro sec_state_is_valid().
      Replace assert() with panic() in those cases that might arise
      because of runtime errors and not programming errors.
      Replace panic() with assert() in those cases that might arise
      because of programming errors.
      
      Fixes ARM-software/tf-issues#96
      
      Change-Id: I51e9ef0439fd5ff5e0edfef49050b69804bf14d5
      d3280beb
  9. 09 Jul, 2014 1 commit
    • Dan Handley's avatar
      Refactor fvp gic code to be a generic driver · 1e8c5c4f
      Dan Handley authored
      Refactor the FVP gic code in plat/fvp/fvp_gic.c to be a generic ARM
      GIC driver in drivers/arm/gic/arm_gic.c. Provide the platform
      specific inputs in the arm_gic_setup() function so that the driver
      has no explicit dependency on platform code.
      
      Provide weak implementations of the platform interrupt controller
      API in a new file, plat/common/plat_gic.c. These simply call through
      to the ARM GIC driver.
      
      Move the only remaining FVP GIC function, fvp_gic_init() to
      plat/fvp/aarch64/fvp_common.c and remove plat/fvp/fvp_gic.c
      
      Fixes ARM-software/tf-issues#182
      
      Change-Id: Iea82fe095fad62dd33ba9efbddd48c57717edd21
      1e8c5c4f
  10. 10 Jun, 2014 1 commit
    • Andrew Thoelke's avatar
      Make system register functions inline assembly · 5c3272a7
      Andrew Thoelke authored
      Replace the current out-of-line assembler implementations of
      the system register and system instruction operations with
      inline assembler.
      
      This enables better compiler optimisation and code generation
      when accessing system registers.
      
      Fixes ARM-software/tf-issues#91
      
      Change-Id: I149af3a94e1e5e5140a3e44b9abfc37ba2324476
      5c3272a7
  11. 22 May, 2014 1 commit
    • Achin Gupta's avatar
      Introduce interrupt registration framework in BL3-1 · e1333f75
      Achin Gupta authored
      This patch introduces a framework for registering interrupts routed to
      EL3. The interrupt routing model is governed by the SCR_EL3.IRQ and
      FIQ bits and the security state an interrupt is generated in. The
      framework recognizes three type of interrupts depending upon which
      exception level and security state they should be handled in
      i.e. Secure EL1 interrupts, Non-secure interrupts and EL3
      interrupts. It provides an API and macros that allow a runtime service
      to register an handler for a type of interrupt and specify the routing
      model. The framework validates the routing model and uses the context
      management framework to ensure that it is applied to the SCR_EL3 prior
      to entry into the target security state. It saves the handler in
      internal data structures. An API is provided to retrieve the handler
      when an interrupt of a particular type is asserted. Registration is
      expected to be done once by the primary CPU. The same handler and
      routing model is used for all CPUs.
      
      Support for EL3 interrupts will be added to the framework in the
      future. A makefile flag has been added to allow the FVP port choose
      between ARM GIC v2 and v3 support in EL3. The latter version is
      currently unsupported.
      
      A framework for handling interrupts in BL3-1 will be introduced in
      subsequent patches. The default routing model in the absence of any
      handlers expects no interrupts to be routed to EL3.
      
      Change-Id: Idf7c023b34fcd4800a5980f2bef85e4b5c29e649
      e1333f75
  12. 13 May, 2014 1 commit
    • Juan Castillo's avatar
      Fix C accessors to GIC distributor registers with set/clear semantics · 42a52d89
      Juan Castillo authored
      This patch fixes C accessors to GIC registers that follow a set/clear
      semantic to change the state of an interrupt, instead of read/write/modify.
      These registers are:
        Set-Enable
        Clear-Enable
        Set-Pending
        Clear-Pending
        Set-Active
        Clear-Active
      For instance, to enable an interrupt we write a one to the corresponding bit
      in the Set-Enable register, whereas to disable it we write a one to the
      corresponding bit in the Clear-Enable register.
      
      Fixes ARM-software/tf-issues#137
      
      Change-Id: I3b66bad94d0b28e0fe08c9042bac0bf5ffa07944
      42a52d89
  13. 07 May, 2014 1 commit
    • Andrew Thoelke's avatar
      Correct usage of data and instruction barriers · 8cec598b
      Andrew Thoelke authored
      The current code does not always use data and instruction
      barriers as required by the architecture and frequently uses
      barriers excessively due to their inclusion in all of the
      write_*() helper functions.
      
      Barriers should be used explicitly in assembler or C code
      when modifying processor state that requires the barriers in
      order to enable review of correctness of the code.
      
      This patch removes the barriers from the helper functions and
      introduces them as necessary elsewhere in the code.
      
      PORTING NOTE: check any port of Trusted Firmware for use of
      system register helper functions for reliance on the previous
      barrier behaviour and add explicit barriers as necessary.
      
      Fixes ARM-software/tf-issues#92
      
      Change-Id: Ie63e187404ff10e0bdcb39292dd9066cb84c53bf
      8cec598b
  14. 06 May, 2014 3 commits
    • Dan Handley's avatar
      Reduce deep nesting of header files · 97043ac9
      Dan Handley authored
      Reduce the number of header files included from other header
      files as much as possible without splitting the files. Use forward
      declarations where possible. This allows removal of some unnecessary
      "#ifndef __ASSEMBLY__" statements.
      
      Also, review the .c and .S files for which header files really need
      including and reorder the #include statements alphabetically.
      
      Fixes ARM-software/tf-issues#31
      
      Change-Id: Iec92fb976334c77453e010b60bcf56f3be72bd3e
      97043ac9
    • Dan Handley's avatar
      Refactor GIC header files · 8a4fb6f6
      Dan Handley authored
      Move the function prototypes from gic.h into either gic_v2.h or
      gic_v3.h as appropriate. Update the source files to include the
      correct headers.
      
      Change-Id: I368cfda175cdcbd3a68f46e2332738ec49048e19
      8a4fb6f6
    • Dan Handley's avatar
      Move include and source files to logical locations · 4ecca339
      Dan Handley authored
      Move almost all system include files to a logical sub-directory
      under ./include. The only remaining system include directories
      not under ./include are specific to the platform. Move the
      corresponding source files to match the include directory
      structure.
      
      Also remove pm.h as it is no longer used.
      
      Change-Id: Ie5ea6368ec5fad459f3e8a802ad129135527f0b3
      4ecca339