summaryrefslogtreecommitdiff
path: root/arch/riscv/include/asm/alternative.h
diff options
context:
space:
mode:
authorHeiko Stuebner <heiko@sntech.de>2022-05-11 21:29:12 +0200
committerPalmer Dabbelt <palmer@rivosinc.com>2022-05-11 21:36:31 -0700
commita8e910168bbad5c901202727470e601eb2489ec1 (patch)
tree52b0a290b18ae5e879f8d01b013e10a2097bd717 /arch/riscv/include/asm/alternative.h
parentd14ca1f8d3039970e812fec1f01e7b46b62cc5fc (diff)
riscv: implement module alternatives
This allows alternatives to also be applied when loading modules and follows the implementation of other architectures (e.g. arm64). Signed-off-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Philipp Tomsich <philipp.tomsich@vrull.eu> Link: https://lore.kernel.org/r/20220511192921.2223629-4-heiko@sntech.de Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to 'arch/riscv/include/asm/alternative.h')
-rw-r--r--arch/riscv/include/asm/alternative.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/riscv/include/asm/alternative.h b/arch/riscv/include/asm/alternative.h
index 0ff550667e94..0859529ff08e 100644
--- a/arch/riscv/include/asm/alternative.h
+++ b/arch/riscv/include/asm/alternative.h
@@ -20,8 +20,10 @@
#include <asm/hwcap.h>
#define RISCV_ALTERNATIVES_BOOT 0 /* alternatives applied during regular boot */
+#define RISCV_ALTERNATIVES_MODULE 1 /* alternatives applied during module-init */
void __init apply_boot_alternatives(void);
+void apply_module_alternatives(void *start, size_t length);
struct alt_entry {
void *old_ptr; /* address of original instruciton or data */
@@ -43,6 +45,7 @@ void sifive_errata_patch_func(struct alt_entry *begin, struct alt_entry *end,
#else /* CONFIG_RISCV_ALTERNATIVE */
static inline void apply_boot_alternatives(void) { }
+static inline void apply_module_alternatives(void *start, size_t length) { }
#endif /* CONFIG_RISCV_ALTERNATIVE */