[PATCH v6 01/28] powerpc/xmon: Remove store_inst() for patch_instruction()

2020-04-27 Thread Jordan Niethe
(). Otherwise replace store_inst() with patch_instruction(). Reviewed-by: Nicholas Piggin Signed-off-by: Jordan Niethe --- v4: Read into a local variable --- arch/powerpc/xmon/xmon.c | 18 +- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/xmon/xmon.c b/arch

[PATCH v6 02/28] powerpc/xmon: Move breakpoint instructions to own array

2020-04-27 Thread Jordan Niethe
Signed-off-by: Jordan Niethe --- v4: New to series v5: - Do not use __section(), use a .space directive in .S file - Simplify in_breakpoint_table() calculation - Define BPT_SIZE v6: - Seperate moving to text section --- arch/powerpc/xmon/xmon.c | 21 - 1 file changed, 12 ins

[PATCH v6 03/28] powerpc/xmon: Move breakpoints to text section

2020-04-27 Thread Jordan Niethe
The instructions for xmon's breakpoint are stored bpt_table[] which is in the data section. This is problematic as the data section may be marked as no execute. Move bpt_table[] to the text section. Signed-off-by: Jordan Niethe --- v6: - New to series. Was part of the previous patch. -

[PATCH v6 04/28] powerpc/xmon: Use bitwise calculations in_breakpoint_table()

2020-04-27 Thread Jordan Niethe
ts are not set. Suggested-by: Christophe Leroy Signed-off-by: Jordan Niethe --- v6: New to series --- arch/powerpc/xmon/xmon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index f7ce3ea8694c..e922cde99db2 100644

[PATCH v6 05/28] powerpc: Change calling convention for create_branch() et. al.

2020-04-27 Thread Jordan Niethe
parameter to the function and use a non-zero return value to signify an error. Signed-off-by: Jordan Niethe --- v5: New to series v6: - setup_32.c: machine_init(): change insn to unsigned int - Fix typo in commit message - __ftrace_make_call(): test for err not !err --- arch/powerpc/include

[PATCH v6 06/28] powerpc: Use a macro for creating instructions from u32s

2020-04-27 Thread Jordan Niethe
represent prefixed instructions. Signed-off-by: Jordan Niethe --- v4: New to series v5: - Rename PPC_INST() -> ppc_inst(). - Use on epapr_paravirt.c, kgdb.c v6: - Use in setup_32.c - epapr_paravirt.c: early_init_dt_scan_epapr(): move the use of ppc_inst() earlier. --- arch/powe

[PATCH v6 07/28] powerpc: Use an accessor for instructions

2020-04-27 Thread Jordan Niethe
In preparation for introducing a more complicated instruction type to accomodate prefixed instructions use an accessor for getting an instruction as a u32. Signed-off-by: Jordan Niethe --- v4: New to series v5: Remove references to 'word' instructions v6: - test_emul

[PATCH v6 08/28] powerpc: Use a function for getting the instruction op code

2020-04-27 Thread Jordan Niethe
In preparation for using a data type for instructions that can not be directly used with the '>>' operator use a function for getting the op code of an instruction. Signed-off-by: Jordan Niethe --- v4: New to series v6: - Rename ppc_inst_primary() to ppc_inst_primary_opcod

[PATCH v6 09/28] powerpc: Use a function for byte swapping instructions

2020-04-27 Thread Jordan Niethe
Use a function for byte swapping instructions in preparation of a more complicated instruction type. Reviewed-by: Balamuruhan S Signed-off-by: Jordan Niethe --- arch/powerpc/include/asm/inst.h | 5 + arch/powerpc/kernel/align.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion

[PATCH v6 10/28] powerpc: Introduce functions for instruction equality

2020-04-27 Thread Jordan Niethe
In preparation for an instruction data type that can not be directly used with the '==' operator use functions for checking equality. Reviewed-by: Balamuruhan S Signed-off-by: Jordan Niethe --- v5: Remove ppc_inst_null() --- arch/powerpc/include/asm/inst.h| 5 + arch/powe

[PATCH v6 11/28] powerpc: Use a datatype for instructions

2020-04-27 Thread Jordan Niethe
prefixed and word instructions on powerpc64 while keeping it possible to exclusively have word instructions on powerpc32. Signed-off-by: Jordan Niethe --- v4: New to series v5: Add to epapr_paravirt.c, kgdb.c v6: - setup_32.c: machine_init(): Use type - feature-fixups.c: do_final_fixups(): Use type

[PATCH v6 12/28] powerpc: Use a function for reading instructions

2020-04-27 Thread Jordan Niethe
Prefixed instructions will mean there are instructions of different length. As a result dereferencing a pointer to an instruction will not necessarily give the desired result. Introduce a function for reading instructions from memory into the instruction data type. Signed-off-by: Jordan Niethe

[PATCH v6 13/28] powerpc: Add a probe_user_read_inst() function

2020-04-27 Thread Jordan Niethe
Introduce a probe_user_read_inst() function to use in cases where probe_user_read() is used for getting an instruction. This will be more useful for prefixed instructions. Signed-off-by: Jordan Niethe --- v6: - New to series --- arch/powerpc/include/asm/inst.h | 3 +++ arch/powerpc/lib

[PATCH v6 14/28] powerpc: Add a probe_kernel_read_inst() function

2020-04-27 Thread Jordan Niethe
Introduce a probe_kernel_read_inst() function to use in cases where probe_kernel_read() is used for getting an instruction. This will be more useful for prefixed instructions. Signed-off-by: Jordan Niethe --- v6: - This was previously just in ftrace.c --- arch/powerpc/include/asm/inst.h| 2

[PATCH v6 15/28] powerpc/kprobes: Use patch_instruction()

2020-04-27 Thread Jordan Niethe
Instead of using memcpy() and flush_icache_range() use patch_instruction() which not only accomplishes both of these steps but will also make it easier to add support for prefixed instructions. Signed-off-by: Jordan Niethe --- v6: New to series. --- arch/powerpc/kernel/kprobes.c | 5 + 1

[PATCH v6 16/28] powerpc: Define and use __get_user_instr{, inatomic}()

2020-04-27 Thread Jordan Niethe
Define specific __get_user_instr() and __get_user_instr_inatomic() macros for reading instructions from user space. Signed-off-by: Jordan Niethe --- arch/powerpc/include/asm/uaccess.h | 5 + arch/powerpc/kernel/align.c | 2 +- arch/powerpc/kernel/hw_breakpoint.c | 2 +- arch

[PATCH v6 17/28] powerpc: Introduce a function for reporting instruction length

2020-04-27 Thread Jordan Niethe
Currently all instructions have the same length, but in preparation for prefixed instructions introduce a function for returning instruction length. Signed-off-by: Jordan Niethe --- v6: - feature-fixups.c: do_final_fixups(): use here - ppc_inst_len(): change return type from bool to int

[PATCH v6 18/28] powerpc/xmon: Use a function for reading instructions

2020-04-27 Thread Jordan Niethe
Currently in xmon, mread() is used for reading instructions. In preparation for prefixed instructions, create and use a new function, mread_instr(), especially for reading instructions. Signed-off-by: Jordan Niethe --- v5: New to series, seperated from "Add prefixed instructio

[PATCH v6 19/28] powerpc/xmon: Move insertion of breakpoint for xol'ing

2020-04-27 Thread Jordan Niethe
instruction is inserted. Signed-off-by: Jordan Niethe --- arch/powerpc/xmon/xmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 716967f12063..ce2a0150d43c 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon

[PATCH v6 20/28] powerpc: Make test_translate_branch() independent of instruction length

2020-04-27 Thread Jordan Niethe
: Jordan Niethe --- v4: New to series --- arch/powerpc/lib/code-patching.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c index 85ad61aa0304..53b0d5cbc86a 100644 --- a/arch/powerpc/lib/code-patching.c

[PATCH v6 21/28] powerpc: Enable Prefixed Instructions

2020-04-27 Thread Jordan Niethe
repare for dealing with emulated prefixed instructions by checking for this bit. Reviewed-by: Nicholas Piggin Signed-off-by: Alistair Popple Signed-off-by: Jordan Niethe --- v4: - Squash "Check for prefixed instructions in facility_unavailable_exception()" here - Rem

[PATCH v6 22/28] powerpc: Define new SRR1 bits for a future ISA version

2020-04-27 Thread Jordan Niethe
used to indicate that an ISI was due to the access being no-exec or guarded. A future ISA version adds another purpose. It is also set if there is an access in a cache-inhibited location for prefixed instruction. Rename from SRR1_ISI_N_OR_G to SRR1_ISI_N_G_OR_CIP. Signed-off-by: Jordan Niethe

[PATCH v6 23/28] powerpc: Add prefixed instructions to instruction data type

2020-04-27 Thread Jordan Niethe
For powerpc64, redefine the ppc_inst type so both word and prefixed instructions can be represented. On powerpc32 the type will remain the same. Update places which had assumed instructions to be 4 bytes long. Signed-off-by: Jordan Niethe --- v4: New to series v5: - Distinguish normal

[PATCH v6 24/28] powerpc: Test prefixed code patching

2020-04-27 Thread Jordan Niethe
Expand the code-patching self-tests to includes tests for patching prefixed instructions. Signed-off-by: Jordan Niethe --- v6: New to series --- arch/powerpc/lib/Makefile | 2 +- arch/powerpc/lib/code-patching.c | 21 + arch/powerpc/lib/test_code-patching.S

[PATCH v6 25/28] powerpc: Test prefixed instructions in feature fixups

2020-04-27 Thread Jordan Niethe
Expand the feature-fixups self-tests to includes tests for prefixed instructions. Signed-off-by: Jordan Niethe --- v6: New to series --- arch/powerpc/lib/feature-fixups-test.S | 68 +++ arch/powerpc/lib/feature-fixups.c | 74 ++ 2 files changed

[PATCH v6 26/28] powerpc: Support prefixed instructions in alignment handler

2020-04-27 Thread Jordan Niethe
permitted to cross 64-byte boundaries. If they do the alignment interrupt is invoked with SRR1 BOUNDARY bit set. If this occurs send a SIGBUS to the offending process if in user mode. If in kernel mode call bad_page_fault(). Signed-off-by: Jordan Niethe --- v2: - Move __get_user_instr() and

[PATCH v6 27/28] powerpc sstep: Add support for prefixed load/stores

2020-04-27 Thread Jordan Niethe
-Precision (plxssp) * Prefixed Load VSX Vector [0|1] (plxv, plxv0, plxv1) * Prefixed Store VSX Scalar Doubleword (pstxsd) * Prefixed Store VSX Scalar Single-Precision (pstxssp) * Prefixed Store VSX Vector [0|1] (pstxv, pstxv0, pstxv1) Reviewed-by: Balamuruhan S Signed-off-by: Jordan Niethe

[PATCH v6 28/28] powerpc sstep: Add support for prefixed fixed-point arithmetic

2020-04-27 Thread Jordan Niethe
This adds emulation support for the following prefixed Fixed-Point Arithmetic instructions: * Prefixed Add Immediate (paddi) Reviewed-by: Balamuruhan S Signed-off-by: Jordan Niethe --- v3: Since we moved the prefixed loads/stores into the load/store switch statement it no longer makes sense

Re: [PATCH v6 03/28] powerpc/xmon: Move breakpoints to text section

2020-04-27 Thread Jordan Niethe
On Tue, Apr 28, 2020 at 3:20 PM Christophe Leroy wrote: > > > > Le 28/04/2020 à 03:57, Jordan Niethe a écrit : > > The instructions for xmon's breakpoint are stored bpt_table[] which is in > > the data section. This is problematic as the data section may be m

Re: [PATCH v6 03/28] powerpc/xmon: Move breakpoints to text section

2020-04-28 Thread Jordan Niethe
On Tue, Apr 28, 2020 at 3:36 PM Christophe Leroy wrote: > > > > Le 28/04/2020 à 07:30, Jordan Niethe a écrit : > > On Tue, Apr 28, 2020 at 3:20 PM Christophe Leroy > > wrote: > >> > >> > >> > >> Le 28/04/2020 à 03:57, Jordan Nieth

Re: [PATCH v6 00/28] Initial Prefixed Instruction support

2020-04-28 Thread Jordan Niethe
On Tue, Apr 28, 2020 at 8:07 PM Balamuruhan S wrote: > > On Tue, 2020-04-28 at 11:57 +1000, Jordan Niethe wrote: > > A future revision of the ISA will introduce prefixed instructions. A > > prefixed instruction is composed of a 4-byte prefix followed by a > > 4-byte suff

Re: [PATCH v6 10/28] powerpc: Introduce functions for instruction equality

2020-04-28 Thread Jordan Niethe
On Wed, Apr 29, 2020 at 11:59 AM Alistair Popple wrote: > > There seems to be a minor typo which breaks compilation when > CONFIG_MPROFILE_KERNEL is not enabled. See the fix below. > > --- > arch/powerpc/kernel/trace/ftrace.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git

Re: [PATCH v6 11/28] powerpc: Use a datatype for instructions

2020-04-28 Thread Jordan Niethe
On Wed, Apr 29, 2020 at 12:02 PM Alistair Popple wrote: > > Hi Jordan, > > I needed the below fix for building with CONFIG_STRICT_KERNEL_RWX enabled. > Hopefully it's correct, I have not yet had a chance to test it beyond building > it. Thanks, I'll get that working. > > - Alistair > > --- > arch

[PATCH v7 00/28] Initial Prefixed Instruction support

2020-04-30 Thread Jordan Niethe
r Popple (1): powerpc: Enable Prefixed Instructions Jordan Niethe (27): powerpc/xmon: Remove store_inst() for patch_instruction() powerpc/xmon: Move breakpoint instructions to own array powerpc/xmon: Move breakpoints to text section powerpc/xmon: Use bitwise calculations in_breakpoint_ta

[PATCH v7 01/28] powerpc/xmon: Remove store_inst() for patch_instruction()

2020-04-30 Thread Jordan Niethe
(). Otherwise replace store_inst() with patch_instruction(). Reviewed-by: Nicholas Piggin Signed-off-by: Jordan Niethe --- v4: Read into a local variable --- arch/powerpc/xmon/xmon.c | 18 +- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/xmon/xmon.c b/arch

[PATCH v7 02/28] powerpc/xmon: Move breakpoint instructions to own array

2020-04-30 Thread Jordan Niethe
Signed-off-by: Jordan Niethe --- v4: New to series v5: - Do not use __section(), use a .space directive in .S file - Simplify in_breakpoint_table() calculation - Define BPT_SIZE v6: - Seperate moving to text section --- arch/powerpc/xmon/xmon.c | 21 - 1 file changed, 12 ins

[PATCH v7 03/28] powerpc/xmon: Move breakpoints to text section

2020-04-30 Thread Jordan Niethe
The instructions for xmon's breakpoint are stored bpt_table[] which is in the data section. This is problematic as the data section may be marked as no execute. Move bpt_table[] to the text section. Signed-off-by: Jordan Niethe --- v6: - New to series. Was part of the previous patch. -

[PATCH v7 04/28] powerpc/xmon: Use bitwise calculations in_breakpoint_table()

2020-04-30 Thread Jordan Niethe
ts are not set. Suggested-by: Christophe Leroy Signed-off-by: Jordan Niethe --- v6: New to series --- arch/powerpc/xmon/xmon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index bbfea22f4a96..e122f0c8a044 100644

[PATCH v7 05/28] powerpc: Change calling convention for create_branch() et. al.

2020-04-30 Thread Jordan Niethe
parameter to the function and use a non-zero return value to signify an error. Signed-off-by: Jordan Niethe --- v5: New to series v6: - setup_32.c: machine_init(): change insn to unsigned int - Fix typo in commit message - __ftrace_make_call(): test for err not !err --- arch/powerpc/include

[PATCH v7 06/28] powerpc: Use a macro for creating instructions from u32s

2020-04-30 Thread Jordan Niethe
represent prefixed instructions. Signed-off-by: Jordan Niethe --- v4: New to series v5: - Rename PPC_INST() -> ppc_inst(). - Use on epapr_paravirt.c, kgdb.c v6: - Use in setup_32.c - epapr_paravirt.c: early_init_dt_scan_epapr(): move the use of ppc_inst() earlier. --- arch/powe

[PATCH v7 07/28] powerpc: Use an accessor for instructions

2020-04-30 Thread Jordan Niethe
In preparation for introducing a more complicated instruction type to accomodate prefixed instructions use an accessor for getting an instruction as a u32. Signed-off-by: Jordan Niethe --- v4: New to series v5: Remove references to 'word' instructions v6: - test_emul

[PATCH v7 08/28] powerpc: Use a function for getting the instruction op code

2020-04-30 Thread Jordan Niethe
In preparation for using a data type for instructions that can not be directly used with the '>>' operator use a function for getting the op code of an instruction. Signed-off-by: Jordan Niethe --- v4: New to series v6: - Rename ppc_inst_primary() to ppc_inst_primary_opcod

[PATCH v7 09/28] powerpc: Use a function for byte swapping instructions

2020-04-30 Thread Jordan Niethe
Use a function for byte swapping instructions in preparation of a more complicated instruction type. Reviewed-by: Balamuruhan S Signed-off-by: Jordan Niethe --- arch/powerpc/include/asm/inst.h | 5 + arch/powerpc/kernel/align.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion

[PATCH v7 10/28] powerpc: Introduce functions for instruction equality

2020-04-30 Thread Jordan Niethe
In preparation for an instruction data type that can not be directly used with the '==' operator use functions for checking equality. Reviewed-by: Balamuruhan S Signed-off-by: Jordan Niethe --- v5: Remove ppc_inst_null() v7: Fix compilation issue in expected_nop_sequence

[PATCH v7 11/28] powerpc: Use a datatype for instructions

2020-04-30 Thread Jordan Niethe
prefixed and word instructions on powerpc64 while keeping it possible to exclusively have word instructions on powerpc32. Signed-off-by: Jordan Niethe --- v4: New to series v5: Add to epapr_paravirt.c, kgdb.c v6: - setup_32.c: machine_init(): Use type - feature-fixups.c: do_final_fixups(): Use type

[PATCH v7 12/28] powerpc: Use a function for reading instructions

2020-04-30 Thread Jordan Niethe
Prefixed instructions will mean there are instructions of different length. As a result dereferencing a pointer to an instruction will not necessarily give the desired result. Introduce a function for reading instructions from memory into the instruction data type. Signed-off-by: Jordan Niethe

[PATCH v7 13/28] powerpc: Add a probe_user_read_inst() function

2020-04-30 Thread Jordan Niethe
Introduce a probe_user_read_inst() function to use in cases where probe_user_read() is used for getting an instruction. This will be more useful for prefixed instructions. Signed-off-by: Jordan Niethe --- v6: - New to series --- arch/powerpc/include/asm/inst.h | 3 +++ arch/powerpc/lib

[PATCH v7 14/28] powerpc: Add a probe_kernel_read_inst() function

2020-04-30 Thread Jordan Niethe
Introduce a probe_kernel_read_inst() function to use in cases where probe_kernel_read() is used for getting an instruction. This will be more useful for prefixed instructions. Signed-off-by: Jordan Niethe --- v6: - This was previously just in ftrace.c --- arch/powerpc/include/asm/inst.h| 2

[PATCH v7 15/28] powerpc/kprobes: Use patch_instruction()

2020-04-30 Thread Jordan Niethe
Instead of using memcpy() and flush_icache_range() use patch_instruction() which not only accomplishes both of these steps but will also make it easier to add support for prefixed instructions. Signed-off-by: Jordan Niethe --- v6: New to series. --- arch/powerpc/kernel/kprobes.c | 5 + 1

[PATCH v7 16/28] powerpc: Define and use __get_user_instr{, inatomic}()

2020-04-30 Thread Jordan Niethe
Define specific __get_user_instr() and __get_user_instr_inatomic() macros for reading instructions from user space. Signed-off-by: Jordan Niethe --- arch/powerpc/include/asm/uaccess.h | 5 + arch/powerpc/kernel/align.c | 2 +- arch/powerpc/kernel/hw_breakpoint.c | 2 +- arch

[PATCH v7 17/28] powerpc: Introduce a function for reporting instruction length

2020-04-30 Thread Jordan Niethe
Currently all instructions have the same length, but in preparation for prefixed instructions introduce a function for returning instruction length. Signed-off-by: Jordan Niethe --- v6: - feature-fixups.c: do_final_fixups(): use here - ppc_inst_len(): change return type from bool to int

[PATCH v7 18/28] powerpc/xmon: Use a function for reading instructions

2020-04-30 Thread Jordan Niethe
Currently in xmon, mread() is used for reading instructions. In preparation for prefixed instructions, create and use a new function, mread_instr(), especially for reading instructions. Signed-off-by: Jordan Niethe --- v5: New to series, seperated from "Add prefixed instructio

[PATCH v7 19/28] powerpc/xmon: Move insertion of breakpoint for xol'ing

2020-04-30 Thread Jordan Niethe
instruction is inserted. Signed-off-by: Jordan Niethe --- arch/powerpc/xmon/xmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 1947821e425d..fb2563079046 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon

[PATCH v7 20/28] powerpc: Make test_translate_branch() independent of instruction length

2020-04-30 Thread Jordan Niethe
: Jordan Niethe --- v4: New to series --- arch/powerpc/lib/code-patching.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c index 110f710500c8..5b2f66d06b1e 100644 --- a/arch/powerpc/lib/code-patching.c

[PATCH v7 21/28] powerpc: Enable Prefixed Instructions

2020-04-30 Thread Jordan Niethe
repare for dealing with emulated prefixed instructions by checking for this bit. Reviewed-by: Nicholas Piggin Signed-off-by: Alistair Popple Signed-off-by: Jordan Niethe --- v4: - Squash "Check for prefixed instructions in facility_unavailable_exception()" here - Rem

[PATCH v7 22/28] powerpc: Define new SRR1 bits for a future ISA version

2020-04-30 Thread Jordan Niethe
used to indicate that an ISI was due to the access being no-exec or guarded. A future ISA version adds another purpose. It is also set if there is an access in a cache-inhibited location for prefixed instruction. Rename from SRR1_ISI_N_OR_G to SRR1_ISI_N_G_OR_CIP. Signed-off-by: Jordan Niethe

[PATCH v7 23/28] powerpc: Add prefixed instructions to instruction data type

2020-04-30 Thread Jordan Niethe
For powerpc64, redefine the ppc_inst type so both word and prefixed instructions can be represented. On powerpc32 the type will remain the same. Update places which had assumed instructions to be 4 bytes long. Signed-off-by: Jordan Niethe --- v4: New to series v5: - Distinguish normal

[PATCH v7 24/28] powerpc: Test prefixed code patching

2020-04-30 Thread Jordan Niethe
Expand the code-patching self-tests to includes tests for patching prefixed instructions. Signed-off-by: Jordan Niethe --- v6: New to series --- arch/powerpc/lib/Makefile | 2 +- arch/powerpc/lib/code-patching.c | 21 + arch/powerpc/lib/test_code-patching.S

[PATCH v7 25/28] powerpc: Test prefixed instructions in feature fixups

2020-04-30 Thread Jordan Niethe
Expand the feature-fixups self-tests to includes tests for prefixed instructions. Signed-off-by: Jordan Niethe --- v6: New to series --- arch/powerpc/lib/feature-fixups-test.S | 68 +++ arch/powerpc/lib/feature-fixups.c | 74 ++ 2 files changed

[PATCH v7 26/28] powerpc: Support prefixed instructions in alignment handler

2020-04-30 Thread Jordan Niethe
permitted to cross 64-byte boundaries. If they do the alignment interrupt is invoked with SRR1 BOUNDARY bit set. If this occurs send a SIGBUS to the offending process if in user mode. If in kernel mode call bad_page_fault(). Signed-off-by: Jordan Niethe --- v2: - Move __get_user_instr() and

[PATCH v7 27/28] powerpc sstep: Add support for prefixed load/stores

2020-04-30 Thread Jordan Niethe
-Precision (plxssp) * Prefixed Load VSX Vector [0|1] (plxv, plxv0, plxv1) * Prefixed Store VSX Scalar Doubleword (pstxsd) * Prefixed Store VSX Scalar Single-Precision (pstxssp) * Prefixed Store VSX Vector [0|1] (pstxv, pstxv0, pstxv1) Reviewed-by: Balamuruhan S Signed-off-by: Jordan Niethe

[PATCH v7 28/28] powerpc sstep: Add support for prefixed fixed-point arithmetic

2020-04-30 Thread Jordan Niethe
This adds emulation support for the following prefixed Fixed-Point Arithmetic instructions: * Prefixed Add Immediate (paddi) Reviewed-by: Balamuruhan S Signed-off-by: Jordan Niethe --- v3: Since we moved the prefixed loads/stores into the load/store switch statement it no longer makes sense

Re: [PATCH v7 02/28] powerpc/xmon: Move breakpoint instructions to own array

2020-05-03 Thread Jordan Niethe
On Mon, May 4, 2020 at 3:41 PM Alistair Popple wrote: > > On Friday, 1 May 2020 1:41:54 PM AEST Jordan Niethe wrote: > > To execute an instruction out of line after a breakpoint, the NIP is set > > to the address of struct bpt::instr. Here a copy of the instruction that >

Re: [PATCH v7 04/28] powerpc/xmon: Use bitwise calculations in_breakpoint_table()

2020-05-05 Thread Jordan Niethe
On Tue, May 5, 2020 at 5:08 PM Michael Ellerman wrote: > > Jordan Niethe writes: > > A modulo operation is used for calculating the current offset from a > > breakpoint within the breakpoint table. As instruction lengths are > > always a power of 2, this can be replaced w

Re: [PATCH v7 25/28] powerpc: Test prefixed instructions in feature fixups

2020-05-05 Thread Jordan Niethe
g 0x700 to 1 << 26 but missed here. Changing that fixes this. > > Also for some reason these tests (and one of the code-patching tests) aren't > passing on big endian. Okay, will fix that. > > - Alistair > > On Friday, 1 May 2020 1:42:17 PM AEST Jordan

[PATCH v8 00/30] Initial Prefixed Instruction support

2020-05-05 Thread Jordan Niethe
nablement in the first place and as reported by Greg Kurz did not work correctly. Alistair Popple (1): powerpc: Enable Prefixed Instructions Jordan Niethe (29): powerpc/xmon: Remove store_inst() for patch_instruction() powerpc/xmon: Move breakpoint instructions to own array power

[PATCH v8 01/30] powerpc/xmon: Remove store_inst() for patch_instruction()

2020-05-05 Thread Jordan Niethe
(). Otherwise replace store_inst() with patch_instruction(). Reviewed-by: Nicholas Piggin Signed-off-by: Jordan Niethe --- v4: Read into a local variable --- arch/powerpc/xmon/xmon.c | 18 +- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/xmon/xmon.c b/arch

[PATCH v8 02/30] powerpc/xmon: Move breakpoint instructions to own array

2020-05-05 Thread Jordan Niethe
Reviewed-by: Alistair Popple Signed-off-by: Jordan Niethe --- v4: New to series v5: - Do not use __section(), use a .space directive in .S file - Simplify in_breakpoint_table() calculation - Define BPT_SIZE v6: - Seperate moving to text section --- arch/powerpc/xmon/xmon.c | 21

[PATCH v8 03/30] powerpc/xmon: Move breakpoints to text section

2020-05-05 Thread Jordan Niethe
The instructions for xmon's breakpoint are stored bpt_table[] which is in the data section. This is problematic as the data section may be marked as no execute. Move bpt_table[] to the text section. Signed-off-by: Jordan Niethe --- v6: - New to series. Was part of the previous patch. -

[PATCH v8 04/30] powerpc/xmon: Use bitwise calculations in_breakpoint_table()

2020-05-05 Thread Jordan Niethe
ts are not set. Suggested-by: Christophe Leroy Reviewed-by: Alistair Popple Signed-off-by: Jordan Niethe --- v6: New to series --- arch/powerpc/xmon/xmon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 4e

[PATCH v8 05/30] powerpc: Change calling convention for create_branch() et. al.

2020-05-05 Thread Jordan Niethe
parameter to the function and use a non-zero return value to signify an error. Reviewed-by: Alistair Popple Signed-off-by: Jordan Niethe --- v5: New to series v6: - setup_32.c: machine_init(): change insn to unsigned int - Fix typo in commit message - __ftrace_make_call(): test for err not

[PATCH v8 06/30] powerpc: Use a macro for creating instructions from u32s

2020-05-05 Thread Jordan Niethe
represent prefixed instructions. Reviewed-by: Alistair Popple Signed-off-by: Jordan Niethe --- v4: New to series v5: - Rename PPC_INST() -> ppc_inst(). - Use on epapr_paravirt.c, kgdb.c v6: - Use in setup_32.c - epapr_paravirt.c: early_init_dt_scan_epapr(): move the use of ppc_i

[PATCH v8 07/30] powerpc: Use an accessor for instructions

2020-05-05 Thread Jordan Niethe
In preparation for introducing a more complicated instruction type to accommodate prefixed instructions use an accessor for getting an instruction as a u32. Signed-off-by: Jordan Niethe --- v4: New to series v5: Remove references to 'word' instructions v6: - test_emul

[PATCH v8 08/30] powerpc: Use a function for getting the instruction op code

2020-05-05 Thread Jordan Niethe
In preparation for using a data type for instructions that can not be directly used with the '>>' operator use a function for getting the op code of an instruction. Reviewed-by: Alistair Popple Signed-off-by: Jordan Niethe --- v4: New to series v6: - Rename ppc_i

[PATCH v8 09/30] powerpc: Use a function for byte swapping instructions

2020-05-05 Thread Jordan Niethe
Use a function for byte swapping instructions in preparation of a more complicated instruction type. Reviewed-by: Balamuruhan S Signed-off-by: Jordan Niethe --- arch/powerpc/include/asm/inst.h | 5 + arch/powerpc/kernel/align.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion

[PATCH v8 10/30] powerpc: Introduce functions for instruction equality

2020-05-05 Thread Jordan Niethe
In preparation for an instruction data type that can not be directly used with the '==' operator use functions for checking equality. Reviewed-by: Balamuruhan S Signed-off-by: Jordan Niethe --- v5: Remove ppc_inst_null() v7: Fix compilation issue in expected_nop_sequence

[PATCH v8 11/30] powerpc: Use a datatype for instructions

2020-05-05 Thread Jordan Niethe
prefixed and word instructions on powerpc64 while keeping it possible to exclusively have word instructions on powerpc32. Signed-off-by: Jordan Niethe --- v4: New to series v5: Add to epapr_paravirt.c, kgdb.c v6: - setup_32.c: machine_init(): Use type - feature-fixups.c: do_final_fixups(): Use type

[PATCH v8 12/30] powerpc: Use a function for reading instructions

2020-05-05 Thread Jordan Niethe
Signed-off-by: Jordan Niethe --- v4: New to series v5: - Rename read_inst() -> probe_kernel_read_inst() - No longer modify uprobe probe type in this patch v6: - feature-fixups.c: do_final_fixups(): Use here - arch_prepare_kprobe(): patch_instruction(): no longer part of this pa

[PATCH v8 13/30] powerpc: Add a probe_user_read_inst() function

2020-05-05 Thread Jordan Niethe
Introduce a probe_user_read_inst() function to use in cases where probe_user_read() is used for getting an instruction. This will be more useful for prefixed instructions. Reviewed-by: Alistair Popple Signed-off-by: Jordan Niethe --- v6: - New to series --- arch/powerpc/include/asm/inst.h | 3

[PATCH v8 14/30] powerpc: Add a probe_kernel_read_inst() function

2020-05-05 Thread Jordan Niethe
Introduce a probe_kernel_read_inst() function to use in cases where probe_kernel_read() is used for getting an instruction. This will be more useful for prefixed instructions. Reviewed-by: Alistair Popple Signed-off-by: Jordan Niethe --- v6: - This was previously just in ftrace.c --- arch

[PATCH v8 15/30] powerpc/kprobes: Use patch_instruction()

2020-05-05 Thread Jordan Niethe
Instead of using memcpy() and flush_icache_range() use patch_instruction() which not only accomplishes both of these steps but will also make it easier to add support for prefixed instructions. Reviewed-by: Alistair Popple Signed-off-by: Jordan Niethe --- v6: New to series. --- arch/powerpc

[PATCH v8 16/30] powerpc: Define and use __get_user_instr{, inatomic}()

2020-05-05 Thread Jordan Niethe
Define specific __get_user_instr() and __get_user_instr_inatomic() macros for reading instructions from user space. Reviewed-by: Alistair Popple Signed-off-by: Jordan Niethe --- arch/powerpc/include/asm/uaccess.h | 5 + arch/powerpc/kernel/align.c | 2 +- arch/powerpc/kernel

[PATCH v8 17/30] powerpc: Introduce a function for reporting instruction length

2020-05-05 Thread Jordan Niethe
Currently all instructions have the same length, but in preparation for prefixed instructions introduce a function for returning instruction length. Reviewed-by: Alistair Popple Signed-off-by: Jordan Niethe --- v6: - feature-fixups.c: do_final_fixups(): use here - ppc_inst_len(): change

[PATCH v8 18/30] powerpc/xmon: Use a function for reading instructions

2020-05-05 Thread Jordan Niethe
Currently in xmon, mread() is used for reading instructions. In preparation for prefixed instructions, create and use a new function, mread_instr(), especially for reading instructions. Reviewed-by: Alistair Popple Signed-off-by: Jordan Niethe --- v5: New to series, seperated from "Add pre

[PATCH v8 19/30] powerpc/xmon: Move insertion of breakpoint for xol'ing

2020-05-05 Thread Jordan Niethe
instruction is inserted. Reviewed-by: Alistair Popple Signed-off-by: Jordan Niethe --- v8: style --- arch/powerpc/xmon/xmon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 7a9cbc6d9b21..4d6980d51456 100644 --- a/arch

[PATCH v8 20/30] powerpc: Make test_translate_branch() independent of instruction length

2020-05-05 Thread Jordan Niethe
: Alistair Popple Signed-off-by: Jordan Niethe --- v4: New to series --- arch/powerpc/lib/code-patching.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c index 435fc8e9f45d..d946f7d6bb32 100644 --- a/arch

[PATCH v8 21/30] powerpc: Enable Prefixed Instructions

2020-05-05 Thread Jordan Niethe
repare for dealing with emulated prefixed instructions by checking for this bit. Reviewed-by: Nicholas Piggin Signed-off-by: Alistair Popple Signed-off-by: Jordan Niethe --- v4: - Squash "Check for prefixed instructions in facility_unavailable_exception()" here - Rem

[PATCH v8 22/30] powerpc: Define new SRR1 bits for a future ISA version

2020-05-05 Thread Jordan Niethe
Signed-off-by: Jordan Niethe --- v2: Combined all the commits concerning SRR1 bits. --- arch/powerpc/include/asm/reg.h | 4 +++- arch/powerpc/kvm/book3s_hv_nested.c | 2 +- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/powerpc

[PATCH v8 23/30] powerpc: Add prefixed instructions to instruction data type

2020-05-05 Thread Jordan Niethe
For powerpc64, redefine the ppc_inst type so both word and prefixed instructions can be represented. On powerpc32 the type will remain the same. Update places which had assumed instructions to be 4 bytes long. Reviewed-by: Alistair Popple Signed-off-by: Jordan Niethe --- v4: New to series v5

[PATCH v8 24/30] powerpc: Test prefixed code patching

2020-05-05 Thread Jordan Niethe
Expand the code-patching self-tests to includes tests for patching prefixed instructions. Signed-off-by: Jordan Niethe --- v6: New to series v8: Use OP_PREFIX --- arch/powerpc/lib/Makefile | 2 +- arch/powerpc/lib/code-patching.c | 21 + arch/powerpc/lib

[PATCH v8 25/30] powerpc: Test prefixed instructions in feature fixups

2020-05-05 Thread Jordan Niethe
Expand the feature-fixups self-tests to includes tests for prefixed instructions. Signed-off-by: Jordan Niethe --- v6: New to series v8: Use OP_PREFIX --- arch/powerpc/lib/feature-fixups-test.S | 69 arch/powerpc/lib/feature-fixups.c | 73

[PATCH v8 26/30] powerpc/xmon: Don't allow breakpoints on suffixes

2020-05-05 Thread Jordan Niethe
Do not allow placing xmon breakpoints on the suffix of a prefix instruction. Signed-off-by: Jordan Niethe --- v8: Add this back from v3 --- arch/powerpc/xmon/xmon.c | 29 +++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/xmon/xmon.c b/arch

[PATCH v8 27/30] powerpc/kprobes: Don't allow breakpoints on suffixes

2020-05-05 Thread Jordan Niethe
Do not allow inserting breakpoints on the suffix of a prefix instruction in kprobes. Signed-off-by: Jordan Niethe --- v8: Add this back from v3 --- arch/powerpc/kernel/kprobes.c | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc

[PATCH v8 28/30] powerpc: Support prefixed instructions in alignment handler

2020-05-05 Thread Jordan Niethe
permitted to cross 64-byte boundaries. If they do the alignment interrupt is invoked with SRR1 BOUNDARY bit set. If this occurs send a SIGBUS to the offending process if in user mode. If in kernel mode call bad_page_fault(). Reviewed-by: Alistair Popple Signed-off-by: Jordan Niethe --- v2: - Move

[PATCH v8 29/30] powerpc sstep: Add support for prefixed load/stores

2020-05-05 Thread Jordan Niethe
-Precision (plxssp) * Prefixed Load VSX Vector [0|1] (plxv, plxv0, plxv1) * Prefixed Store VSX Scalar Doubleword (pstxsd) * Prefixed Store VSX Scalar Single-Precision (pstxssp) * Prefixed Store VSX Vector [0|1] (pstxv, pstxv0, pstxv1) Reviewed-by: Balamuruhan S Signed-off-by: Jordan Niethe

[PATCH v8 30/30] powerpc sstep: Add support for prefixed fixed-point arithmetic

2020-05-05 Thread Jordan Niethe
This adds emulation support for the following prefixed Fixed-Point Arithmetic instructions: * Prefixed Add Immediate (paddi) Reviewed-by: Balamuruhan S Signed-off-by: Jordan Niethe --- v3: Since we moved the prefixed loads/stores into the load/store switch statement it no longer makes sense

Re: [PATCH v8 11/30] powerpc: Use a datatype for instructions

2020-05-07 Thread Jordan Niethe
On Wed, May 6, 2020 at 1:45 PM Jordan Niethe wrote: > > Currently unsigned ints are used to represent instructions on powerpc. > This has worked well as instructions have always been 4 byte words. > However, a future ISA version will introduce some changes to > instructions that m

Re: [PATCH v8 11/30] powerpc: Use a datatype for instructions

2020-05-07 Thread Jordan Niethe
Hi mpe, On Wed, May 6, 2020 at 1:45 PM Jordan Niethe wrote: > > Currently unsigned ints are used to represent instructions on powerpc. > This has worked well as instructions have always been 4 byte words. > However, a future ISA version will introduce some changes to s/a future ISA

Re: [PATCH v8 22/30] powerpc: Define new SRR1 bits for a future ISA version

2020-05-07 Thread Jordan Niethe
Hi mpe, Could you please take some changes for the commit message. In the patch title s/a future ISA version/ISA v3.1/ On Wed, May 6, 2020 at 1:47 PM Jordan Niethe wrote: > > Add the BOUNDARY SRR1 bit definition for when the cause of an alignment > exception is a prefixed instruc

Re: [PATCH v8 11/30] powerpc: Use a datatype for instructions

2020-05-10 Thread Jordan Niethe
On Fri, May 8, 2020 at 5:17 PM Christophe Leroy wrote: > > > > Le 08/05/2020 à 03:51, Jordan Niethe a écrit : > > On Wed, May 6, 2020 at 1:45 PM Jordan Niethe wrote: > >> > >> Currently unsigned ints are used to represent instructions on powerpc. > >&

<    1   2   3   4   5   6   >