arm64: Avoid flush_icache_range() in alternatives patching code
authorWill Deacon <will.deacon@arm.com>
Fri, 22 Jun 2018 08:31:15 +0000 (09:31 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 27 Jun 2018 17:21:53 +0000 (18:21 +0100)
commit429388682dc266e7a693f9c27e3aabd341d55343
treeadab7d6b539fcbddbe26923454597ca3dfd803d5
parent7838306f5ace5183086ad507c58f5988913690e4
arm64: Avoid flush_icache_range() in alternatives patching code

The implementation of flush_icache_range() includes instruction sequences
which are themselves patched at runtime, so it is not safe to call from
the patching framework.

This patch reworks the alternatives cache-flushing code so that it rolls
its own internal D-cache maintenance using DC CIVAC before invalidating
the entire I-cache after all alternatives have been applied at boot.
Modules don't cause any issues, since flush_icache_range() is safe to
call by the time they are loaded.

Acked-by: Mark Rutland <mark.rutland@arm.com>
Reported-by: Rohit Khanna <rokhanna@nvidia.com>
Cc: Alexander Van Brunt <avanbrunt@nvidia.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/alternative.h
arch/arm64/kernel/alternative.c
arch/arm64/kernel/module.c