]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: alternative: add auto-nop infrastructure
authorMark Rutland <mark.rutland@arm.com>
Wed, 7 Sep 2016 10:07:08 +0000 (11:07 +0100)
committerWill Deacon <will.deacon@arm.com>
Mon, 12 Sep 2016 09:45:34 +0000 (10:45 +0100)
commit6a7fb5212122023a30581894cf7f421d81d2e00b
tree52f01226f44f92ab1a3ce474b1373244bccaf40b
parent69d0430989dcf46305e3d5c4d4b3ce31e844beed
arm64: alternative: add auto-nop infrastructure

In some cases, one side of an alternative sequence is simply a number of
NOPs used to balance the other side. Keeping track of this manually is
tedious, and the presence of large chains of NOPs makes the code more
painful to read than necessary.

To ameliorate matters, this patch adds a new alternative_else_nop_endif,
which automatically balances an alternative sequence with a trivial NOP
sled.

In many cases, we would like a NOP-sled in the default case, and
instructions patched in in the presence of a feature. To enable the NOPs
to be generated automatically for this case, this patch also adds a new
alternative_if, and updates alternative_else and alternative_endif to
work with either alternative_if or alternative_endif.

Cc: Andre Przywara <andre.przywara@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dave Martin <dave.martin@arm.com>
Cc: James Morse <james.morse@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
[will: use new nops macro to generate nop sequences]
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/alternative.h