[PATCH v1 00/12] Cleanup use of 'struct ppc_inst'

From: Christophe Leroy
Date: Wed May 19 2021 - 10:44:13 EST


This series is a cleanup of the use of 'struct ppc_inst'.

A confusion is made between internal representation of powerpc
instructions with 'struct ppc_inst' and in-memory code which is
and will always be an array of 'unsigned int'.

This series cleans it up.

First patch is fixing detection of missing '__user' flag by sparse
when using get_user_instr().

Last part of the series does some source code cleanup in
optprobes, it is put at the ends of this series because of
clashes with the 'struct ppc_inst' cleanups.

Christophe Leroy (12):
powerpc/inst: Fix sparse detection on get_user_instr()
powerpc/inst: Reduce casts in get_user_instr()
powerpc/inst: Improve readability of get_user_instr() and friends
powerpc/inst: Avoid pointer dereferencing in ppc_inst_equal()
powerpc: Do not dereference code as 'struct ppc_inst' (uprobe,
code-patching, feature-fixups)
powerpc/lib/code-patching: Make instr_is_branch_to_addr() static
powerpc/lib/code-patching: Don't use struct 'ppc_inst' for runnable
code in tests.
powerpc: Don't use 'struct ppc_inst' to reference instruction location
powerpc/inst: Refactor PPC32 and PPC64 versions
powerpc/optprobes: Minimise casts
powerpc/optprobes: Compact code source a bit.
powerpc/optprobes: use PPC_RAW_ macros

arch/powerpc/include/asm/code-patching.h | 23 ++-
arch/powerpc/include/asm/inst.h | 95 +++++--------
arch/powerpc/include/asm/ppc-opcode.h | 11 +-
arch/powerpc/include/asm/uprobes.h | 4 +-
arch/powerpc/kernel/crash_dump.c | 4 +-
arch/powerpc/kernel/epapr_paravirt.c | 4 +-
arch/powerpc/kernel/jump_label.c | 2 +-
arch/powerpc/kernel/kgdb.c | 6 +-
arch/powerpc/kernel/kprobes.c | 17 ++-
arch/powerpc/kernel/mce_power.c | 2 +-
arch/powerpc/kernel/optprobes.c | 124 +++++-----------
arch/powerpc/kernel/setup_32.c | 2 +-
arch/powerpc/kernel/trace/ftrace.c | 26 ++--
arch/powerpc/kernel/uprobes.c | 6 +-
arch/powerpc/lib/code-patching.c | 165 ++++++++++++----------
arch/powerpc/lib/feature-fixups.c | 98 ++++++-------
arch/powerpc/perf/core-book3s.c | 4 +-
arch/powerpc/platforms/86xx/mpc86xx_smp.c | 2 +-
arch/powerpc/platforms/powermac/smp.c | 4 +-
arch/powerpc/xmon/xmon.c | 10 +-
20 files changed, 274 insertions(+), 335 deletions(-)

--
2.25.0