• Dave Martin's avatar
    ARM: mcpm: introduce helpers for platform coherency exit/setup · 7fe31d28
    Dave Martin authored
    This provides helper methods to coordinate between CPUs coming down
    and CPUs going up, as well as documentation on the used algorithms,
    so that cluster teardown and setup
    operations are not done for a cluster simultaneously.
    
    For use in the power_down() implementation:
      * __mcpm_cpu_going_down(unsigned int cluster, unsigned int cpu)
      * __mcpm_outbound_enter_critical(unsigned int cluster)
      * __mcpm_outbound_leave_critical(unsigned int cluster)
      * __mcpm_cpu_down(unsigned int cluster, unsigned int cpu)
    
    The power_up_setup() helper should do platform-specific setup in
    preparation for turning the CPU on, such as invalidating local caches
    or entering coherency.  It must be assembler for now, since it must
    run before the MMU can be switched on.  It is passed the affinity level
    for which initialization should be performed.
    
    Because the mcpm_sync_struct content is looked-up and modified
    with the cache enabled or disabled depending on the code path, it is
    crucial to always ensure proper cache maintenance to update main memory
    right away.  The sync_cache_*() helpers are used to that end.
    
    Also, in order to prevent a cached writer from interfering with an
    adjacent non-cached writer, we ensure each state variable is located to
    a separate cache line.
    
    Thanks to Nicolas Pitre and Achin Gupta for the help with this
    patch.
    Signed-off-by: default avatarDave Martin <dave.martin@linaro.org>
    Signed-off-by: default avatarNicolas Pitre <nico@linaro.org>
    Reviewed-by: default avatarWill Deacon <will.deacon@arm.com>
    7fe31d28
mcpm_head.S 4.24 KB