Skip to content
  • André Przywara's avatar
    armv8: Fix and simplify branch_if_master/branch_if_slave · 5ff4857d
    André Przywara authored and Tom Rini's avatar Tom Rini committed
    The branch_if_master macro jumps to a label if the CPU is the "master"
    core, which we define as having all affinity levels set to 0. To check
    for this condition, we need to mask off some bits from the MPIDR
    register, then compare the remaining register value against zero.
    
    The implementation of this was slighly broken (it preserved the upper
    RES0 bits), overly complicated and hard to understand, especially since
    it lacked comments. The same was true for the very similar
    branch_if_slave macro.
    
    Use a much shorter assembly sequence for those checks, use the same
    masking for both macros (just negate the final branch), and put some
    comments on them, to make it clear what the code does.
    This allows to drop the second temporary register for branch_if_master,
    so we adjust all call sites as well.
    
    Also use the opportunity to remove a misleading comment: the macro
    works fine on SoCs with multiple clusters. Judging by the commit
    message, the original problem ...
    5ff4857d