livepatch: Remove klp_arch_set_pc() and asm/livepatch.h

All three versions of klp_arch_set_pc() do exactly the same: they
call ftrace_instruction_pointer_set().

Call ftrace_instruction_pointer_set() directly and remove
klp_arch_set_pc().

As klp_arch_set_pc() was the only thing remaining in asm/livepatch.h
on x86 and s390, remove asm/livepatch.h

livepatch.h remains on powerpc but its content is exclusively used
by powerpc specific code.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: Petr Mladek <pmladek@suse.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Petr Mladek <pmladek@suse.com>

authored by Christophe Leroy and committed by Petr Mladek 5d7c8545 d111c9f0

+3 -58
-2
MAINTAINERS
··· 11338 11338 F: Documentation/ABI/testing/sysfs-kernel-livepatch 11339 11339 F: Documentation/livepatch/ 11340 11340 F: arch/powerpc/include/asm/livepatch.h 11341 - F: arch/s390/include/asm/livepatch.h 11342 - F: arch/x86/include/asm/livepatch.h 11343 11341 F: include/linux/livepatch.h 11344 11342 F: kernel/livepatch/ 11345 11343 F: lib/livepatch/
+1 -9
arch/powerpc/include/asm/livepatch.h
··· 7 7 #ifndef _ASM_POWERPC_LIVEPATCH_H 8 8 #define _ASM_POWERPC_LIVEPATCH_H 9 9 10 - #include <linux/module.h> 11 - #include <linux/ftrace.h> 10 + #include <linux/sched.h> 12 11 #include <linux/sched/task_stack.h> 13 - 14 - #ifdef CONFIG_LIVEPATCH 15 - static inline void klp_arch_set_pc(struct ftrace_regs *fregs, unsigned long ip) 16 - { 17 - ftrace_instruction_pointer_set(fregs, ip); 18 - } 19 - #endif /* CONFIG_LIVEPATCH */ 20 12 21 13 #ifdef CONFIG_LIVEPATCH_64 22 14 static inline void klp_init_thread_info(struct task_struct *p)
-1
arch/powerpc/kernel/irq.c
··· 63 63 #include <asm/machdep.h> 64 64 #include <asm/udbg.h> 65 65 #include <asm/smp.h> 66 - #include <asm/livepatch.h> 67 66 #include <asm/hw_irq.h> 68 67 #include <asm/softirq_stack.h> 69 68
+1 -1
arch/powerpc/kernel/setup_64.c
··· 59 59 #include <asm/udbg.h> 60 60 #include <asm/kexec.h> 61 61 #include <asm/code-patching.h> 62 - #include <asm/livepatch.h> 62 + #include <asm/ftrace.h> 63 63 #include <asm/opal.h> 64 64 #include <asm/cputhreads.h> 65 65 #include <asm/hw_irq.h>
-22
arch/s390/include/asm/livepatch.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0+ */ 2 - /* 3 - * livepatch.h - s390-specific Kernel Live Patching Core 4 - * 5 - * Copyright (c) 2013-2015 SUSE 6 - * Authors: Jiri Kosina 7 - * Vojtech Pavlik 8 - * Jiri Slaby 9 - */ 10 - 11 - #ifndef ASM_LIVEPATCH_H 12 - #define ASM_LIVEPATCH_H 13 - 14 - #include <linux/ftrace.h> 15 - #include <asm/ptrace.h> 16 - 17 - static inline void klp_arch_set_pc(struct ftrace_regs *fregs, unsigned long ip) 18 - { 19 - ftrace_instruction_pointer_set(fregs, ip); 20 - } 21 - 22 - #endif
-20
arch/x86/include/asm/livepatch.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 - /* 3 - * livepatch.h - x86-specific Kernel Live Patching Core 4 - * 5 - * Copyright (C) 2014 Seth Jennings <sjenning@redhat.com> 6 - * Copyright (C) 2014 SUSE 7 - */ 8 - 9 - #ifndef _ASM_X86_LIVEPATCH_H 10 - #define _ASM_X86_LIVEPATCH_H 11 - 12 - #include <asm/setup.h> 13 - #include <linux/ftrace.h> 14 - 15 - static inline void klp_arch_set_pc(struct ftrace_regs *fregs, unsigned long ip) 16 - { 17 - ftrace_instruction_pointer_set(fregs, ip); 18 - } 19 - 20 - #endif /* _ASM_X86_LIVEPATCH_H */
-2
include/linux/livepatch.h
··· 16 16 17 17 #if IS_ENABLED(CONFIG_LIVEPATCH) 18 18 19 - #include <asm/livepatch.h> 20 - 21 19 /* task patch states */ 22 20 #define KLP_UNDEFINED -1 23 21 #define KLP_UNPATCHED 0
+1 -1
kernel/livepatch/patch.c
··· 118 118 if (func->nop) 119 119 goto unlock; 120 120 121 - klp_arch_set_pc(fregs, (unsigned long)func->new_func); 121 + ftrace_instruction_pointer_set(fregs, (unsigned long)func->new_func); 122 122 123 123 unlock: 124 124 ftrace_test_recursion_unlock(bit);