1. 17 Feb, 2014 2 commits
    • Jeenu Viswambharan's avatar
      Add support for handling runtime service requests · caa84939
      Jeenu Viswambharan authored
      
      
      This patch uses the reworked exception handling support to handle
      runtime service requests through SMCs following the SMC calling
      convention. This is a giant commit since all the changes are
      inter-related. It does the following:
      
      1. Replace the old exception handling mechanism with the new one
      2. Enforce that SP_EL0 is used C runtime stacks.
      3. Ensures that the cold and warm boot paths use the 'cpu_context'
         structure to program an ERET into the next lower EL.
      4. Ensures that SP_EL3 always points to the next 'cpu_context'
         structure prior to an ERET into the next lower EL
      5. Introduces a PSCI SMC handler which completes the use of PSCI as a
         runtime service
      
      Change-Id: I661797f834c0803d2c674d20f504df1b04c2b852
      Co-authored-by: default avatarAchin Gupta <achin.gupta@arm.com>
      caa84939
    • Achin Gupta's avatar
      psci: Use context library for preserving EL3 state · ef7a28c9
      Achin Gupta authored
      This patch uses the context library to save and restore EL3 state on
      the 'cpu_context' data structures allocated by PSCI for managing
      non-secure state context on each cpu.
      
      Change-Id: I19c1f26578204a7cd9e0a6c582ced0d97ee4cf80
      ef7a28c9
  2. 20 Jan, 2014 3 commits
    • Achin Gupta's avatar
      psci: fix affinity level upgrade issue · 75f7367b
      Achin Gupta authored
      The psci implementation does not track target affinity level requests
      specified during cpu_suspend calls correctly as per the following
      example.
      
      1. cpu0.cluster0 calls cpu_suspend with the target affinity level as 0
      2. Only the cpu0.cluster0 is powered down while cluster0 remains
         powered up
      3. cpu1.cluster0 calls cpu_off to power itself down to highest
         possible affinity level
      4. cluster0 will be powered off even though cpu0.cluster0 does not
         allow cluster shutdown
      
      This patch introduces reference counts at affinity levels > 0 to track
      the number of cpus which want an affinity instance at level X to
      remain powered up. This instance can be turned off only if its
      reference count is 0. Cpus still undergo the normal state transitions
      (ON, OFF, ON_PENDING, SUSPEND) but the higher levels can only be
      either ON or OFF depending upon their reference count.
      
      The above issue is thus fixed as follows:
      
      1. cluster0's reference count is incremented by two when cpu0 and cpu1
         are initially powered on.
      
      2. cpu0.cluster0 calls cpu_suspend with the target affinity level as
         0. This does not affect the cluster0 reference count.
      
      3. Only the cpu0.cluster0 is powered down while cluster0 remains
         powered up as it has a non-zero reference count.
      
      4. cpu1.cluster0 call cpu_off to power itself down to highest possible
         affinity level. This decrements the cluster0 reference count.
      
      5. cluster0 is still not powered off since its reference count will at
         least be 1 due to the restriction placed by cpu0.
      
      Change-Id: I433dfe82b946f5f6985b1602c2de87800504f7a9
      75f7367b
    • Achin Gupta's avatar
      psci: preserve target affinity level during suspend · a45e3973
      Achin Gupta authored
      This patch adds support to save and restore the target affinity level
      specified during a cpu_suspend psci call. This ensures that we
      traverse only through the affinity levels that we originally intended
      to after resuming from suspend.
      
      Change-Id: I0900ae49a50b496da137cfec8f158da0397ec56c
      a45e3973
    • Achin Gupta's avatar
      psci: replace secure context with suspend context · a59caa4c
      Achin Gupta authored
      The secure context saved and restored across a cpu_suspend operation
      can be more than just the state of the secure system registers e.g. we
      also need to save the affinity level till which the cpu is being
      powered down. This patch creates a suspend_context data structure
      which includes the system register context. This will allow other bits
      to be saved and restored as well in subsequent patches.
      
      Change-Id: I1c1f7d25497388b54b7d6ee4fab77e8c6a9992c4
      a59caa4c
  3. 17 Jan, 2014 1 commit
  4. 05 Dec, 2013 3 commits
    • Achin Gupta's avatar
      psci: rectify and homogenise generic code · 0959db5c
      Achin Gupta authored
      This patch performs a major rework of the psci generic implementation
      to achieve the following:
      
      1. replace recursion with iteration where possible to aid code
         readability e.g. affinity instance states are changed iteratively
         instead of recursively.
      
      2. acquire pointers to affinity instance nodes at the beginning of a
         psci operation. All subsequent actions use these pointers instead
         of calling psci_get_aff_map_node() repeatedly e.g. management of
         locks has been abstracted under functions which use these pointers
         to ensure correct ordering. Helper functions have been added to
         create these abstractions.
      
      3. assertions have been added to cpu level handlers to ensure correct
         state transition
      
      4. the affinity level extents specified to various functions have the
         same meaning i.e. start level is always less than the end level.
      
      Change-Id: If0508c3a7b20ea3ddda2a66128429382afc3dfc8
      0959db5c
    • Achin Gupta's avatar
      psci: fix error due to a non zero context id · c8afc789
      Achin Gupta authored
      In the previous psci implementation, the psci_afflvl_power_on_finish()
      function would run into an error condition if the value of the context
      id parameter in the cpu_on and cpu_suspend psci calls was != 0. The
      parameter was being restored as the return value of the affinity level
      0 finisher function. A non zero context id would be treated as an
      error condition. This would prevent successful wake up of the cpu from
      a power down state. Also, the contents of the general purpose
      registers were not being cleared upon return to the non-secure world
      after a cpu power up. This could potentially allow the non-secure
      world to view secure data.
      
      This patch ensures that all general purpose registers are set to ~0
      prior to the final eret that drops the execution to the non-secure
      world. The context id is used to initialize the general purpose
      register x0 prior to re-entry into the non-secure world and is no
      longer restored as a function return value. A platform helper
      (platform_get_stack()) has been introduced to facilitate this change.
      
      Change-Id: I2454911ffd75705d6aa8609a5d250d9b26fa097c
      c8afc789
    • Dan Handley's avatar
      Enable third party contributions · ab2d31ed
      Dan Handley authored
      - Add instructions for contributing to ARM Trusted Firmware.
      
      - Update copyright text in all files to acknowledge contributors.
      
      Change-Id: I9311aac81b00c6c167d2f8c889aea403b84450e5
      ab2d31ed
  5. 27 Nov, 2013 1 commit
    • Sandrine Bailleux's avatar
      Unmask SError and Debug exceptions. · 3738274d
      Sandrine Bailleux authored
      Any asynchronous exception caused by the firmware should be handled
      in the firmware itself.  For this reason, unmask SError exceptions
      (and Debug ones as well) on all boot paths.  Also route external
      abort and SError interrupts to EL3, otherwise they will target EL1.
      
      Change-Id: I9c191d2d0dcfef85f265641c8460dfbb4d112092
      3738274d
  6. 25 Oct, 2013 1 commit