powerpc/code-patching: Replace patch_instruction() by ppc_inst_write() in selftests
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Thu, 2 Dec 2021 12:00:27 +0000 (13:00 +0100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 23 Dec 2021 11:36:58 +0000 (22:36 +1100)
commit309a0a601864831510209531dd72da486225d8ae
treeab21cc80e9167a39c3bb6130d79fc637032d3d42
parentf30a578d7653f7dbb253a20daad4bcd9f881d6c9
powerpc/code-patching: Replace patch_instruction() by ppc_inst_write() in selftests

The purpose of selftests is to check that instructions are
properly formed. Not to check that they properly run.

For that test it uses normal memory, not special test
memory.

In preparation of a future patch enforcing patch_instruction()
to be used only on valid text areas, implement a ppc_inst_write()
instruction which is the complement of ppc_inst_read(). This
new function writes the formated instruction in valid kernel
memory and doesn't bother about icache.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/7cf5335cc07ca9b6f8cdaa20ca9887fce4df3bea.1638446239.git.christophe.leroy@csgroup.eu
arch/powerpc/include/asm/inst.h
arch/powerpc/lib/test-code-patching.c