Commit | Line | Data |
---|---|---|
caab277b | 1 | // SPDX-License-Identifier: GPL-2.0-only |
9732cafd JL |
2 | /* |
3 | * Copyright (C) 2013 Huawei Ltd. | |
4 | * Author: Jiang Liu <liuj97@gmail.com> | |
5 | * | |
6 | * Based on arch/arm/kernel/jump_label.c | |
9732cafd JL |
7 | */ |
8 | #include <linux/kernel.h> | |
9 | #include <linux/jump_label.h> | |
cfb00a35 | 10 | #include <linux/smp.h> |
9732cafd | 11 | #include <asm/insn.h> |
78b92c73 | 12 | #include <asm/patching.h> |
9732cafd | 13 | |
cfb00a35 WD |
14 | bool arch_jump_label_transform_queue(struct jump_entry *entry, |
15 | enum jump_label_type type) | |
9732cafd | 16 | { |
c296146c | 17 | void *addr = (void *)jump_entry_code(entry); |
9732cafd JL |
18 | u32 insn; |
19 | ||
76b235c6 | 20 | if (type == JUMP_LABEL_JMP) { |
c296146c AB |
21 | insn = aarch64_insn_gen_branch_imm(jump_entry_code(entry), |
22 | jump_entry_target(entry), | |
9732cafd JL |
23 | AARCH64_INSN_BRANCH_NOLINK); |
24 | } else { | |
25 | insn = aarch64_insn_gen_nop(); | |
26 | } | |
27 | ||
f6cc0c50 | 28 | aarch64_insn_patch_text_nosync(addr, insn); |
cfb00a35 WD |
29 | return true; |
30 | } | |
31 | ||
32 | void arch_jump_label_transform_apply(void) | |
33 | { | |
34 | kick_all_cpus_sync(); | |
9732cafd | 35 | } |