linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Add generic data patching functions
@ 2023-02-07  1:56 Benjamin Gray
  2023-02-07  1:56 ` [PATCH 1/3] powerpc/code-patching: Add generic memory patching Benjamin Gray
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Benjamin Gray @ 2023-02-07  1:56 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: erhard_f, npiggin, Benjamin Gray

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-02-10  0:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-07  1:56 [PATCH 0/3] Add generic data patching functions Benjamin Gray
2023-02-07  1:56 ` [PATCH 1/3] powerpc/code-patching: Add generic memory patching Benjamin Gray
2023-02-09  7:15   ` Christophe Leroy
2023-02-10  0:45     ` Benjamin Gray
2023-02-07  1:56 ` [PATCH 2/3] powerpc/64: Convert patch_instruction() to patch_u32() Benjamin Gray
2023-02-07  1:56 ` [PATCH 3/3] powerpc/32: Convert patch_instruction() to patch_uint() Benjamin Gray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).