treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / powerpc / include / asm / livepatch.h
blob4a3d5d25fed5c0073fe084796d3a7bfd65d18937
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * livepatch.h - powerpc-specific Kernel Live Patching Core
5 * Copyright (C) 2015-2016, SUSE, IBM Corp.
6 */
7 #ifndef _ASM_POWERPC_LIVEPATCH_H
8 #define _ASM_POWERPC_LIVEPATCH_H
10 #include <linux/module.h>
11 #include <linux/ftrace.h>
12 #include <linux/sched/task_stack.h>
14 #ifdef CONFIG_LIVEPATCH
15 static inline void klp_arch_set_pc(struct pt_regs *regs, unsigned long ip)
17 regs->nip = ip;
20 #define klp_get_ftrace_location klp_get_ftrace_location
21 static inline unsigned long klp_get_ftrace_location(unsigned long faddr)
24 * Live patch works only with -mprofile-kernel on PPC. In this case,
25 * the ftrace location is always within the first 16 bytes.
27 return ftrace_location_range(faddr, faddr + 16);
30 static inline void klp_init_thread_info(struct task_struct *p)
32 /* + 1 to account for STACK_END_MAGIC */
33 task_thread_info(p)->livepatch_sp = end_of_stack(p) + 1;
35 #else
36 static inline void klp_init_thread_info(struct task_struct *p) { }
37 #endif /* CONFIG_LIVEPATCH */
39 #endif /* _ASM_POWERPC_LIVEPATCH_H */