• W
    arm64: Fix minor issues with the dcache_by_line_op macro · 642580a3
    Will Deacon 提交于
    [ Upstream commit 33309ecda0070506c49182530abe7728850ebe78 ]
    
    The dcache_by_line_op macro suffers from a couple of small problems:
    
    First, the GAS directives that are currently being used rely on
    assembler behavior that is not documented, and probably not guaranteed
    to produce the correct behavior going forward. As a result, we end up
    with some undefined symbols in cache.o:
    
    $ nm arch/arm64/mm/cache.o
             ...
             U civac
             ...
             U cvac
             U cvap
             U cvau
    
    This is due to the fact that the comparisons used to select the
    operation type in the dcache_by_line_op macro are comparing symbols
    not strings, and even though it seems that GAS is doing the right
    thing here (undefined symbols by the same name are equal to each
    other), it seems unwise to rely on this.
    
    Second, when patching in a DC CVAP instruction on CPUs that support it,
    the fallback path consists of a DC CVAU instruction which may be
    affected by CPU errata that require ARM64_WORKAROUND_CLEAN_CACHE.
    
    Solve these issues by unrolling the various maintenance routines and
    using the conditional directives that are documented as operating on
    strings. To avoid the complexity of nested alternatives, we move the
    DC CVAP patching to __clean_dcache_area_pop, falling back to a branch
    to __clean_dcache_area_poc if DCPOP is not supported by the CPU.
    Reported-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
    Suggested-by: NRobin Murphy <robin.murphy@arm.com>
    Signed-off-by: NWill Deacon <will.deacon@arm.com>
    Signed-off-by: NSasha Levin <sashal@kernel.org>
    Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
    642580a3
assembler.h 16.5 KB