Commit 78b92c73 authored by Mark Rutland's avatar Mark Rutland Committed by Will Deacon
Browse files

arm64: insn: decouple patching from insn code



Currently, <asm/insn.h> includes <asm/patching.h>. We intend that
<asm/insn.h> will be usable from userspace, so it doesn't make sense to
include headers for kernel-only features such as the patching routines,
and we'd intended to restrict <asm/insn.h> to instruction encoding
details.

Let's decouple the patching code from <asm/insn.h>, and explicitly
include <asm/patching.h> where it is needed. Since <asm/patching.h>
isn't included from assembly, we can drop the __ASSEMBLY__ guards.

At the same time, sort the kprobes includes so that it's easier to see
what is and isn't incldued.

Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20210609102301.17332-2-mark.rutland@arm.com


Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent 71766b81
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@
#include <linux/types.h>

#include <asm/alternative.h>
#include <asm/patching.h>

#ifndef __ASSEMBLY__
/*
+0 −2
Original line number Diff line number Diff line
@@ -4,12 +4,10 @@

#include <linux/types.h>

#ifndef __ASSEMBLY__
int aarch64_insn_read(void *addr, u32 *insnp);
int aarch64_insn_write(void *addr, u32 insn);

int aarch64_insn_patch_text_nosync(void *addr, u32 insn);
int aarch64_insn_patch_text(void *addrs[], u32 insns[], int cnt);
#endif /* __ASSEMBLY__ */

#endif	/* __ASM_PATCHING_H */
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#include <asm/debug-monitors.h>
#include <asm/ftrace.h>
#include <asm/insn.h>
#include <asm/patching.h>

#ifdef CONFIG_DYNAMIC_FTRACE
/*
+1 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
#include <linux/kernel.h>
#include <linux/jump_label.h>
#include <asm/insn.h>
#include <asm/patching.h>

void arch_jump_label_transform(struct jump_entry *entry,
			       enum jump_label_type type)
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@

#include <asm/debug-monitors.h>
#include <asm/insn.h>
#include <asm/patching.h>
#include <asm/traps.h>

struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = {
Loading