[PATCH 0/3] Add generic data patching functions
Benjamin Gray
bgray at linux.ibm.com
Tue Feb 7 12:56:40 AEDT 2023
There are issues on ppc64 with using patch_instruction() for arbitrary data.
Add dedicated functions for patching data. More details in the first patch.
Just to explain a couple of quirks:
* ppc32 patch_instruction() is noinline to prevent a mis-optimisation where
patch_memory() is inlined into patch_branch(), preventing it from being
inlined into patch_instruction().
* The val32 variable is a big endian workaround. The alternative would be to
pass the data indirectly through a void*, which would probably not optimise
as well.
* IS_ENABLED(CONFIG_PPC64) is required to help the ppc32 code optimise out
the is_dword param.
Benjamin Gray (3):
powerpc/code-patching: Add generic memory patching
powerpc/64: Convert patch_instruction() to patch_u32()
powerpc/32: Convert patch_instruction() to patch_uint()
arch/powerpc/include/asm/code-patching.h | 33 ++++++++++++
arch/powerpc/kernel/module_64.c | 5 +-
arch/powerpc/kernel/static_call.c | 2 +-
arch/powerpc/lib/code-patching.c | 69 +++++++++++++++++-------
arch/powerpc/platforms/powermac/smp.c | 2 +-
5 files changed, 88 insertions(+), 23 deletions(-)
base-commit: 0bfb97203f5f300777624a2ad6f8f84aea3e8658
--
2.39.1
More information about the Linuxppc-dev
mailing list