x86/alternative: Support ALTERNATIVE_TERNARY
authorJuergen Gross <jgross@suse.com>
Thu, 11 Mar 2021 14:23:11 +0000 (15:23 +0100)
committerBorislav Petkov <bp@suse.de>
Thu, 11 Mar 2021 15:57:31 +0000 (16:57 +0100)
commite208b3c4a9748b2c17aa09ba663b5096ccf82dce
treeab88643be1f56858ec128c38a394878685c4d667
parentdda7bb76484978316bb412a353789ebc5901de36
x86/alternative: Support ALTERNATIVE_TERNARY

Add ALTERNATIVE_TERNARY support for replacing an initial instruction
with either of two instructions depending on a feature:

  ALTERNATIVE_TERNARY "default_instr", FEATURE_NR,
                      "feature_on_instr", "feature_off_instr"

which will start with "default_instr" and at patch time will,
depending on FEATURE_NR being set or not, patch that with either
"feature_on_instr" or "feature_off_instr".

 [ bp: Add comment ontop. ]

Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20210311142319.4723-7-jgross@suse.com
arch/x86/include/asm/alternative.h