xref: /openbmc/linux/arch/powerpc/kernel/jump_label.c (revision 762f99f4f3cb41a775b5157dd761217beba65873)
12874c5fdSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
2ac5f89c7SMichael Ellerman /*
3ac5f89c7SMichael Ellerman  * Copyright 2010 Michael Ellerman, IBM Corp.
4ac5f89c7SMichael Ellerman  */
5ac5f89c7SMichael Ellerman 
6ac5f89c7SMichael Ellerman #include <linux/kernel.h>
7ac5f89c7SMichael Ellerman #include <linux/jump_label.h>
8ac5f89c7SMichael Ellerman #include <asm/code-patching.h>
975346251SJordan Niethe #include <asm/inst.h>
10ac5f89c7SMichael Ellerman 
arch_jump_label_transform(struct jump_entry * entry,enum jump_label_type type)11ac5f89c7SMichael Ellerman void arch_jump_label_transform(struct jump_entry *entry,
12ac5f89c7SMichael Ellerman 			       enum jump_label_type type)
13ac5f89c7SMichael Ellerman {
14*69d4d6e5SChristophe Leroy 	u32 *addr = (u32 *)jump_entry_code(entry);
15ac5f89c7SMichael Ellerman 
1676b235c6SPeter Zijlstra 	if (type == JUMP_LABEL_JMP)
17b0b3b2c7SChristophe Leroy 		patch_branch(addr, jump_entry_target(entry), 0);
18ac5f89c7SMichael Ellerman 	else
19f30becb5SChristophe Leroy 		patch_instruction(addr, ppc_inst(PPC_RAW_NOP()));
20ac5f89c7SMichael Ellerman }
21