[PATCH 2/3] powerpc/lib/sstep: Fix fixed-point arithmetic instructions that set CA32

2017-09-28 Thread Sandipan Das
[.]) * Subtract From Carrying (subfc[.]) * Add Extended (adde[.]) * Subtract From Extended (subfe[.]) * Add to Minus One Extended (addme[.]) * Subtract From Minus One Extended (subfme[.]) * Add to Zero Extended (addze[.]) * Subtract From Zero Extended (subfze[.]) Signed-off-by: Sandipan Das

[PATCH 1/3] powerpc/lib/sstep: Add XER bits introduced in POWER ISA v3.0

2017-09-28 Thread Sandipan Das
accordingly. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- arch/powerpc/lib/sstep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index 5e8418c28bd8..16814bfc01da 100644 --- a/arch/powerpc/lib/sstep.c +++ b/arch/power

[PATCH 3/3] powerpc/lib/sstep: Fix fixed-point shift instructions that set CA32

2017-09-28 Thread Sandipan Das
. The following instructions are affected: * Shift Right Algebraic Word Immediate (srawi[.]) * Shift Right Algebraic Word (sraw[.]) * Shift Right Algebraic Doubleword Immediate (sradi[.]) * Shift Right Algebraic Doubleword (srad[.]) Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.

[PATCH 1/1] bpf: take advantage of stack_depth tracking in powerpc JIT

2017-09-01 Thread Sandipan Das
Take advantage of stack_depth tracking, originally introduced for x64, in powerpc JIT as well. Round up allocated stack by 16 bytes to make sure it stays aligned for functions called from JITed bpf program. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- arch/powerpc/net/bpf

[PATCH v2] powerpc/lib/sstep: Fix count leading zeros instructions

2017-10-10 Thread Sandipan Das
[.]) * Count Leading Zeros Doubleword (cntlzd[.]) This fixes the emulated behaviour of these instructions by adding an additional check for this special case. Fixes: 3cdfcbfd32b9d ("powerpc: Change analyse_instr so it doesn't modify *regs") Signed-off-by: Sandipan Das <sandi...@linux

[PATCH] powerpc/lib/sstep: Fix count leading zeros instructions

2017-10-09 Thread Sandipan Das
[.]) * Count Leading Zeros Doubleword (cntlzd[.]) This fixes the emulated behaviour of these instructions by adding an additional check for this special case. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- arch/powerpc/lib/sstep.c | 12 ++-- 1 file changed, 10 insertions

[RFC][PATCH bpf v3 4/5] tools: bpf: sync bpf uapi header

2018-05-14 Thread Sandipan Das
Syncing the bpf.h uapi header with tools so that struct bpf_prog_info has the new fields for storing the kernel symbol addresses for the JITed functions in a program. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- tools/include/uapi/linux/bpf.h | 2 ++ 1 file changed, 2 inse

[RFC][PATCH bpf v3 2/5] bpf: powerpc64: add JIT support for multi-function programs

2018-05-14 Thread Sandipan Das
of the instruction to determine the callee's address. Instead, we use the alternative method of getting it from the list of function addresses in the auxillary data of the caller by using the off field as an index. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- v3: Mention briefly abo

[RFC][PATCH bpf v3 5/5] tools: bpftool: resolve call addresses without using imm field

2018-05-14 Thread Sandipan Das
for this list to lookup a callee's symbol's address and resolve its name. Suggested-by: Daniel Borkmann <dan...@iogearbox.net> Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- tools/bpf/bpftool/prog.c | 33 + tools/bpf/bpftool/xlated_d

[RFC][PATCH bpf v3 1/5] bpf: allow 64-bit offsets for bpf function calls

2018-05-14 Thread Sandipan Das
instructions and using it to index into the list mentioned above and lookup the callee's address. To make sure that the existing JIT compilers continue to work without requiring changes, we keep the imm field as it is. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- v3: Rephrase

[RFC][PATCH bpf v3 3/5] bpf: get JITed function addresses via syscall

2018-05-14 Thread Sandipan Das
of a callee's corresponding symbol by using the imm field as an index for the list of function addresses now available from the program info. Suggested-by: Daniel Borkmann <dan...@iogearbox.net> Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- include/uapi/linu

Re: [PATCH bpf 5/6] tools: bpftool: resolve calls without using imm field

2018-05-17 Thread Sandipan Das
Hi Jakub, On 05/18/2018 12:21 AM, Jakub Kicinski wrote: > On Thu, 17 May 2018 12:05:47 +0530, Sandipan Das wrote: >> Currently, we resolve the callee's address for a JITed function >> call by using the imm field of the call instruction as an offset >> from __bpf_call_base

[PATCH bpf 1/6] bpf: support 64-bit offsets for bpf function calls

2018-05-17 Thread Sandipan Das
instructions and using it to index into the list mentioned above and lookup the callee's address. To make sure that the existing JIT compilers continue to work without requiring changes, we keep the imm field as it is. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- kern

[PATCH bpf 0/6] bpf: enhancements for multi-function programs

2018-05-17 Thread Sandipan Das
from the bpf system call. Sandipan Das (6): bpf: support 64-bit offsets for bpf function calls bpf: powerpc64: add JIT support for multi-function programs bpf: get kernel symbol addresses via syscall tools: bpf: sync bpf uapi header tools: bpftool: resolve calls without using imm

[PATCH bpf 6/6] bpf: fix JITed dump for multi-function programs via syscall

2018-05-17 Thread Sandipan Das
0: nop 4: nop 8: mflrr0 c: std r0,16(r1) 10: stdur1,-112(r1) 14: std r31,104(r1) 18: addir31,r1,48 1c: li r3,10 ... Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- kernel/bpf/syscall.

[PATCH bpf 4/6] tools: bpf: sync bpf uapi header

2018-05-17 Thread Sandipan Das
Syncing the bpf.h uapi header with tools so that struct bpf_prog_info has the two new fields for passing on the addresses of the kernel symbols corresponding to each function in a JITed program. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- tools/include/uapi/linux/bpf

[PATCH bpf 5/6] tools: bpftool: resolve calls without using imm field

2018-05-17 Thread Sandipan Das
for this list to lookup a callee's symbol's address and resolve its name. Suggested-by: Daniel Borkmann <dan...@iogearbox.net> Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- tools/bpf/bpftool/prog.c | 31 +++ tools/bpf/bpftool/xlated_d

[PATCH bpf 3/6] bpf: get kernel symbol addresses via syscall

2018-05-17 Thread Sandipan Das
of a callee's corresponding symbol by using the imm field as an index for the list of kernel symbol addresses now available from the program info. Suggested-by: Daniel Borkmann <dan...@iogearbox.net> Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- include/uapi

[PATCH bpf 2/6] bpf: powerpc64: add JIT support for multi-function programs

2018-05-17 Thread Sandipan Das
of the instruction to determine the callee's address. Instead, we use the alternative method of getting it from the list of function addresses in the auxillary data of the caller by using the off field as an index. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- arch/powerpc/net/bpf_jit_co

Re: [PATCH bpf v2 6/6] bpf: fix JITed dump for multi-function programs via syscall

2018-05-21 Thread Sandipan Das
Hi Daniel, On 05/18/2018 09:21 PM, Daniel Borkmann wrote: > On 05/18/2018 02:50 PM, Sandipan Das wrote: >> Currently, for multi-function programs, we cannot get the JITed >> instructions using the bpf system call's BPF_OBJ_GET_INFO_BY_FD >> command. Because of

Re: [PATCH bpf-next v3 10/10] tools: bpftool: add delimiters to multi-function JITed dumps

2018-05-23 Thread Sandipan Das
On 05/23/2018 02:38 PM, Daniel Borkmann wrote: > On 05/22/2018 09:55 PM, Jakub Kicinski wrote: >> On Tue, 22 May 2018 22:46:13 +0530, Sandipan Das wrote: >>> + if (info.nr_jited_func_lens && info.jited_func_lens) { >>> +

Re: [PATCH bpf-next v3 10/10] tools: bpftool: add delimiters to multi-function JITed dumps

2018-05-23 Thread Sandipan Das
On 05/23/2018 07:20 PM, Daniel Borkmann wrote: > On 05/23/2018 12:37 PM, Sandipan Das wrote: > [...] >> Other than that, for powerpc64, there is a problem with the way the >> binutils disassembler code (in "opcodes/ppc-dis.c") passes arguments >

[PATCH bpf-next v4 01/10] bpf: support 64-bit offsets for bpf function calls

2018-05-24 Thread Sandipan Das
instructions and using it to index into the list mentioned above and lookup the callee's address. To make sure that the existing JIT compilers continue to work without requiring changes, we keep the imm field as it is. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- kern

[PATCH bpf-next v4 03/10] bpf: powerpc64: add JIT support for multi-function programs

2018-05-24 Thread Sandipan Das
of the instruction to determine the callee's address. Instead, we use the alternative method of getting it from the list of function addresses in the auxiliary data of the caller by using the off field as an index. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- v3: - Fix memory leak for ji

[PATCH bpf-next v4 08/10] bpf: get JITed image lengths of functions via syscall

2018-05-24 Thread Sandipan Das
applications like bpftool to split up the contiguous JITed dump, also obtained via the system call, into more relatable chunks corresponding to each function. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- include/uapi/linux/bpf.h | 2 ++ kernel/bpf/syscall.c

[PATCH bpf-next v4 02/10] bpf: powerpc64: pad function address loads with NOPs

2018-05-24 Thread Sandipan Das
required to load this address may vary from what was previously generated. This can make the JITed image grow or shrink. To avoid this, we should generate a constant five-instruction when loading function addresses by padding the optimized load sequence with NOPs. Signed-off-by: Sandipan Das <sa

[PATCH bpf-next v4 09/10] tools: bpf: sync bpf uapi header

2018-05-24 Thread Sandipan Das
Syncing the bpf.h uapi header with tools so that struct bpf_prog_info has the two new fields for passing on the JITed image lengths of each function in a multi-function program. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- tools/include/uapi/linux/bpf.h | 2 ++ 1 file chan

[PATCH bpf-next v4 00/10] bpf: enhancements for multi-function programs

2018-05-24 Thread Sandipan Das
after the last pass due to the way the instruction sequence used to load a callee's address maybe optimized. - Make additional changes to the bpf system call and bpftool to make multi-function JITed dumps easier to correlate. v2: - Incorporate review comments from Jakub. Sandipan Das

[PATCH bpf-next v4 05/10] tools: bpf: sync bpf uapi header

2018-05-24 Thread Sandipan Das
Syncing the bpf.h uapi header with tools so that struct bpf_prog_info has the two new fields for passing on the addresses of the kernel symbols corresponding to each function in a program. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- v3: - Move new fields to t

[PATCH bpf-next v4 07/10] bpf: fix multi-function JITed dump obtained via syscall

2018-05-24 Thread Sandipan Das
0: nop 4: nop 8: mflrr0 c: std r0,16(r1) 10: stdur1,-112(r1) 14: std r31,104(r1) 18: addir31,r1,48 1c: li r3,10 ... Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- v4: - If the image allocated in use

[PATCH bpf-next v4 06/10] tools: bpftool: resolve calls without using imm field

2018-05-24 Thread Sandipan Das
for this list to lookup a callee's symbol's address and resolve its name. Suggested-by: Daniel Borkmann <dan...@iogearbox.net> Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> Reviewed-by: Jakub Kicinski <jakub.kicin...@netronome.com> --- v3: - Avoid using redundant pointers. - Fi

[PATCH bpf-next v4 10/10] tools: bpftool: add delimiters to multi-function JITed dumps

2018-05-24 Thread Sandipan Das
t;: ["%rbp" ] },{ ... },{ "pc": "0x71", "operation": "retq", "operands": [null ] } ] },{ "name&

[PATCH bpf-next v4 04/10] bpf: get kernel symbol addresses via syscall

2018-05-24 Thread Sandipan Das
of a callee's corresponding symbol by using the imm field as an index for the list of kernel symbol addresses now available from the program info. Suggested-by: Daniel Borkmann <dan...@iogearbox.net> Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- v3: - Co

Re: [PATCH bpf-next v4 02/10] bpf: powerpc64: pad function address loads with NOPs

2018-05-24 Thread Sandipan Das
On 05/24/2018 01:04 PM, Daniel Borkmann wrote: > On 05/24/2018 08:56 AM, Sandipan Das wrote: >> For multi-function programs, loading the address of a callee >> function to a register requires emitting instructions whose >> count varies from one to five depending on the nat

[PATCH bpf v2 5/6] tools: bpftool: resolve calls without using imm field

2018-05-18 Thread Sandipan Das
for this list to lookup a callee's symbol's address and resolve its name. Suggested-by: Daniel Borkmann <dan...@iogearbox.net> Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- v2: - Order variables from longest to shortest - Make sure that ksyms_ptr and ksyms_len are always

Re: [PATCH bpf v2 1/6] bpf: support 64-bit offsets for bpf function calls

2018-05-18 Thread Sandipan Das
On 05/18/2018 08:45 PM, Daniel Borkmann wrote: > On 05/18/2018 02:50 PM, Sandipan Das wrote: >> The imm field of a bpf instruction is a signed 32-bit integer. >> For JIT bpf-to-bpf function calls, it stores the offset of the >> start address of the callee's JITed image

[PATCH bpf v2 3/6] bpf: get kernel symbol addresses via syscall

2018-05-18 Thread Sandipan Das
of a callee's corresponding symbol by using the imm field as an index for the list of kernel symbol addresses now available from the program info. Suggested-by: Daniel Borkmann <dan...@iogearbox.net> Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- include/uapi

[PATCH bpf v2 1/6] bpf: support 64-bit offsets for bpf function calls

2018-05-18 Thread Sandipan Das
instructions and using it to index into the list mentioned above and lookup the callee's address. To make sure that the existing JIT compilers continue to work without requiring changes, we keep the imm field as it is. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- kern

[PATCH bpf v2 0/6] bpf: enhancements for multi-function programs

2018-05-18 Thread Sandipan Das
from the bpf system call. v2: - Incorporate review comments from Jakub Sandipan Das (6): bpf: support 64-bit offsets for bpf function calls bpf: powerpc64: add JIT support for multi-function programs bpf: get kernel symbol addresses via syscall tools: bpf: sync bpf uapi header tools

[PATCH bpf v2 4/6] tools: bpf: sync bpf uapi header

2018-05-18 Thread Sandipan Das
Syncing the bpf.h uapi header with tools so that struct bpf_prog_info has the two new fields for passing on the addresses of the kernel symbols corresponding to each function in a JITed program. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- tools/include/uapi/linux/bpf

[PATCH bpf v2 2/6] bpf: powerpc64: add JIT support for multi-function programs

2018-05-18 Thread Sandipan Das
of the instruction to determine the callee's address. Instead, we use the alternative method of getting it from the list of function addresses in the auxillary data of the caller by using the off field as an index. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- arch/powerpc/net/bpf_jit_co

[PATCH bpf v2 6/6] bpf: fix JITed dump for multi-function programs via syscall

2018-05-18 Thread Sandipan Das
0: nop 4: nop 8: mflrr0 c: std r0,16(r1) 10: stdur1,-112(r1) 14: std r31,104(r1) 18: addir31,r1,48 1c: li r3,10 ... Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- kernel/bpf/syscall.

[PATCH bpf-next v3 01/10] bpf: support 64-bit offsets for bpf function calls

2018-05-22 Thread Sandipan Das
instructions and using it to index into the list mentioned above and lookup the callee's address. To make sure that the existing JIT compilers continue to work without requiring changes, we keep the imm field as it is. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- kern

[PATCH bpf-next v3 05/10] tools: bpf: sync bpf uapi header

2018-05-22 Thread Sandipan Das
Syncing the bpf.h uapi header with tools so that struct bpf_prog_info has the two new fields for passing on the addresses of the kernel symbols corresponding to each function in a program. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- v3: - Move new fields to t

[PATCH bpf-next v3 04/10] bpf: get kernel symbol addresses via syscall

2018-05-22 Thread Sandipan Das
of a callee's corresponding symbol by using the imm field as an index for the list of kernel symbol addresses now available from the program info. Suggested-by: Daniel Borkmann <dan...@iogearbox.net> Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- v3: - Co

[PATCH bpf-next v3 09/10] tools: bpf: sync bpf uapi header

2018-05-22 Thread Sandipan Das
Syncing the bpf.h uapi header with tools so that struct bpf_prog_info has the two new fields for passing on the JITed image lengths of each function in a multi-function program. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- tools/include/uapi/linux/bpf.h | 2 ++ 1 file chan

[PATCH bpf-next v3 00/10] bpf: enhancements for multi-function programs

2018-05-22 Thread Sandipan Das
changes to the bpf system call and bpftool to make multi-function JITed dumps easier to correlate. v2: - Incorporate review comments from Jakub. Sandipan Das (10): bpf: support 64-bit offsets for bpf function calls bpf: powerpc64: pad function address loads with NOPs bpf: powerpc64: add JIT

[PATCH bpf-next v3 02/10] bpf: powerpc64: pad function address loads with NOPs

2018-05-22 Thread Sandipan Das
required to load this address may vary from what was previously generated. This can make the JITed image grow or shrink. To avoid this, we should generate a constant five-instruction when loading function addresses by padding the optimized load sequence with NOPs. Signed-off-by: Sandipan Das <sa

[PATCH bpf-next v3 03/10] bpf: powerpc64: add JIT support for multi-function programs

2018-05-22 Thread Sandipan Das
of the instruction to determine the callee's address. Instead, we use the alternative method of getting it from the list of function addresses in the auxiliary data of the caller by using the off field as an index. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- v3: - Fix memory leak for ji

[PATCH bpf-next v3 06/10] tools: bpftool: resolve calls without using imm field

2018-05-22 Thread Sandipan Das
for this list to lookup a callee's symbol's address and resolve its name. Suggested-by: Daniel Borkmann <dan...@iogearbox.net> Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- v3: - Avoid using redundant pointers. - Fix indentation. v2: - Order variables from longest to shortest.

[PATCH bpf-next v3 07/10] bpf: fix multi-function JITed dump obtained via syscall

2018-05-22 Thread Sandipan Das
0: nop 4: nop 8: mflrr0 c: std r0,16(r1) 10: stdur1,-112(r1) 14: std r31,104(r1) 18: addir31,r1,48 1c: li r3,10 ... Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- kernel/bpf/syscall.

[PATCH bpf-next v3 08/10] bpf: get JITed image lengths of functions via syscall

2018-05-22 Thread Sandipan Das
applications like bpftool to split up the contiguous JITed dump, also obtained via the system call, into more relatable chunks corresponding to each function. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- include/uapi/linux/bpf.h | 2 ++ kernel/bpf/syscall.c

[PATCH bpf-next v3 10/10] tools: bpftool: add delimiters to multi-function JITed dumps

2018-05-22 Thread Sandipan Das
a8: mr r3,r8 ac: blr bpf_prog_196af774a3477707_F: 0: nop 4: nop 8: mflrr0 c: std r0,16(r1) 10: stdur1,-112(r1) 14: std r31,104(r1) ... 88: mr r3,r8 8c: blr Signed-off-by: Sandipan Das

[RFC][PATCH bpf v2 1/2] bpf: allow 64-bit offsets for bpf function calls

2018-02-12 Thread Sandipan Das
nsn as a way to index into aux->func and also set aux->func_cnt so that this can be used for performing basic upper bound checks for the off field. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- v2: Make aux->func point to the list of functions determined by the ve

[RFC][PATCH bpf v2 2/2] bpf: powerpc64: add JIT support for multi-function programs

2018-02-12 Thread Sandipan Das
is performed. Since it is seen that the offsets may be as large as 64 bits for powerpc64, we use the aux data associated with each caller to get the correct branch target address rather than using the imm field of the BPF_CALL instruction. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- v

Re: [RFC][PATCH bpf 1/2] bpf: allow 64-bit offsets for bpf function calls

2018-02-10 Thread Sandipan Das
On 02/10/2018 06:08 AM, Alexei Starovoitov wrote: > On 2/9/18 8:54 AM, Naveen N. Rao wrote: >> Naveen N. Rao wrote: >>> Alexei Starovoitov wrote: >>>> On 2/8/18 4:03 AM, Sandipan Das wrote: >>>>> The imm field of a bpf_insn is a signed 32-bit intege

[RFC][PATCH bpf 2/2] bpf: powerpc64: add JIT support for multi-function programs

2018-02-08 Thread Sandipan Das
is performed. Since it is seen that the offsets may be as large as 64 bits for powerpc64, we use the aux data associated with each caller to get the correct branch target address rather than using the imm field of the BPF_CALL instruction. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> ---

[RFC][PATCH bpf 1/2] bpf: allow 64-bit offsets for bpf function calls

2018-02-08 Thread Sandipan Das
this cannot be accomodated in the imm field without truncation. To resolve this, we additionally use the aux data within each bpf_prog associated with the caller functions to store the addresses of their respective callees. Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com> --- kern

Re: [PATCH 6/6] powerpc sstep: Add modsd, modud instruction emulation

2018-09-05 Thread Sandipan Das
Hi Segher, On Wednesday 05 September 2018 02:51 AM, Segher Boessenkool wrote: > On Mon, Sep 03, 2018 at 08:49:38PM +0530, Sandipan Das wrote: >> +#ifdef __powerpc64__ >> +case 265: /* modud */ >> +if (!cpu_has_fea

Re: [PATCH 1/6] powerpc sstep: Add maddhd, maddhdu, maddld instruction emulation

2018-09-05 Thread Sandipan Das
Hi Segher, On Wednesday 05 September 2018 03:42 AM, Segher Boessenkool wrote: > On Mon, Sep 03, 2018 at 08:49:33PM +0530, Sandipan Das wrote: >> +#ifdef __powerpc64__ >> +case 4: >> +if (!cpu_has_feature(CPU_FTR_ARCH_300)) >> +

[RFC][PATCH bpf] tools: bpftool: Fix tags for bpf-to-bpf calls

2018-02-27 Thread Sandipan Das
) r0 = 2 4: (95) exit With this patch, it will look like this: 0: (85) call pc+2#bpf_prog_8f85936f29a7790a+3 1: (b7) r0 = 1 2: (95) exit 3: (b7) r0 = 2 4: (95) exit where 8f85936f29a7790a is the tag of the bpf program and 3 is the offset to the start of the subprog from t

Re: [PATCH] powerpc/64: Fix kernel stack 16-byte alignment

2018-11-16 Thread Sandipan Das
On 15/11/18 8:04 AM, Nicholas Piggin wrote: > Commit 4c2de74cc869 ("powerpc/64: Interrupts save PPR on stack rather > than thread_struct") changed sizeof(struct pt_regs) % 16 from 0 to 8, > which causes the interrupt frame allocation on kernel entry to put the > kernel stack out of alignment. > >

[PATCH 5/6] powerpc sstep: Add modsw, moduw instruction emulation

2018-09-03 Thread Sandipan Das
From: PrasannaKumar Muralidharan This adds emulation support for the following integer instructions: * Modulo Signed Word (modsw) * Modulo Unsigned Word (moduw) Signed-off-by: PrasannaKumar Muralidharan Signed-off-by: Sandipan Das --- arch/powerpc/lib/sstep.c | 14 ++ 1 file

[PATCH 0/6] powerpc sstep: Extend instruction emulation support

2018-09-03 Thread Sandipan Das
This series adds emulation support for some additional ISA 3.0 instructions, most of which are now generated by a recent compiler (e.g. gcc-8.x) when building the kernel with CONFIG_POWER9_CPU = y. PrasannaKumar Muralidharan (1): powerpc sstep: Add modsw, moduw instruction emulation Sandipan

[PATCH 3/6] powerpc sstep: Add cnttzw, cnttzd instruction emulation

2018-09-03 Thread Sandipan Das
This adds emulation support for the following integer instructions: * Count Trailing Zeros Word (cnttzw[.]) * Count Trailing Zeros Doubleword (cnttzd[.]) Signed-off-by: Sandipan Das --- arch/powerpc/lib/sstep.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/arch/powerpc

[PATCH 2/6] powerpc sstep: Add darn instruction emulation

2018-09-03 Thread Sandipan Das
This adds emulation support for the following integer instructions: * Deliver A Random Number (darn) Signed-off-by: Sandipan Das --- arch/powerpc/lib/sstep.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index

[PATCH 6/6] powerpc sstep: Add modsd, modud instruction emulation

2018-09-03 Thread Sandipan Das
This adds emulation support for the following integer instructions: * Modulo Signed Doubleword (modsd) * Modulo Unsigned Doubleword (modud) Signed-off-by: Sandipan Das --- arch/powerpc/lib/sstep.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/arch

[PATCH 1/6] powerpc sstep: Add maddhd, maddhdu, maddld instruction emulation

2018-09-03 Thread Sandipan Das
This adds emulation support for the following integer instructions: * Multiply-Add High Doubleword (maddhd) * Multiply-Add High Doubleword Unsigned (maddhdu) * Multiply-Add Low Doubleword (maddld) Signed-off-by: Sandipan Das --- arch/powerpc/lib/sstep.c | 35

[PATCH 4/6] powerpc sstep: Add extswsli instruction emulation

2018-09-03 Thread Sandipan Das
This adds emulation support for the following integer instructions: * Extend-Sign Word and Shift Left Immediate (extswsli[.]) Signed-off-by: Sandipan Das --- arch/powerpc/lib/sstep.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc

[PATCH bpf] bpf: powerpc64: optimize JIT passes for bpf function calls

2018-12-03 Thread Sandipan Das
as everything else would still remain exactly the same. This also reduces the number of writes to the JITed image. [3] Do not regenerate the prologue and the epilogue during the extra pass as that would be redundant. Signed-off-by: Sandipan Das --- arch/powerpc/net/bpf_jit_comp64.c

Re: [PATCH bpf] bpf: powerpc64: optimize JIT passes for bpf function calls

2018-12-03 Thread Sandipan Das
Hi Daniel, On 03/12/18 6:18 PM, Daniel Borkmann wrote: > > Thanks for the patch, just to clarify, it's targeted at bpf-next and > not bpf, correct? > This patch is targeted at the bpf tree. This depends on commit e2c95a61656d ("bpf, ppc64: generalize fetching subprog into

[PATCH bpf] bpf: fix default unprivileged allocation limit

2018-12-06 Thread Sandipan Das
in case of an architecture like powerpc64 which uses 64K as the default page size (i.e. CONFIG_PPC_64K_PAGES is set). So, instead of depending on the page size, use a constant value. Fixes: ede95a63b5e8 ("bpf: add bpf_jit_limit knob to restrict unpriv allocations") Signed-off-by: Sa

[PATCH bpf] bpf: powerpc: fix broken uapi for BPF_PROG_TYPE_PERF_EVENT

2018-12-06 Thread Sandipan Das
ernel definitions of struct pt_regs") Signed-off-by: Sandipan Das --- arch/powerpc/include/asm/perf_event.h | 2 ++ arch/powerpc/include/uapi/asm/Kbuild | 1 - arch/powerpc/include/uapi/asm/bpf_perf_event.h | 9 + 3 files changed, 11 insertions(+), 1 deletion(-) create m

Re: [PATCH 1/3] powerpc: sstep: Add tests for compute type instructions

2019-02-21 Thread Sandipan Das
Hi Michael, On 21/02/19 4:43 PM, Michael Ellerman wrote: > Sandipan Das writes: >> This enhances the current selftest framework for validating >> the in-kernel instruction emulation infrastructure by adding >> support for compute type instructions i.e. integer ALU-

[PATCH v2 5/6] powerpc sstep: Add support for modsw, moduw instructions

2019-02-21 Thread Sandipan Das
From: PrasannaKumar Muralidharan This adds emulation support for the following integer instructions: * Modulo Signed Word (modsw) * Modulo Unsigned Word (moduw) Signed-off-by: PrasannaKumar Muralidharan Signed-off-by: Sandipan Das --- arch/powerpc/lib/sstep.c | 14 ++ 1 file

[PATCH v2 6/6] powerpc sstep: Add support for modsd, modud instructions

2019-02-21 Thread Sandipan Das
This adds emulation support for the following integer instructions: * Modulo Signed Doubleword (modsd) * Modulo Unsigned Doubleword (modud) Signed-off-by: Sandipan Das --- arch/powerpc/lib/sstep.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/arch

[PATCH v2 4/6] powerpc sstep: Add support for extswsli instruction

2019-02-21 Thread Sandipan Das
This adds emulation support for the following integer instructions: * Extend-Sign Word and Shift Left Immediate (extswsli[.]) Signed-off-by: Sandipan Das --- arch/powerpc/lib/sstep.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc

[PATCH v2 1/6] powerpc: sstep: Add support for maddhd, maddhdu, maddld instructions

2019-02-21 Thread Sandipan Das
inline assembly to retain compatibility with older binutils. Signed-off-by: Sandipan Das --- arch/powerpc/include/asm/ppc-opcode.h | 15 +++- arch/powerpc/lib/sstep.c | 35 ++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/arch

[PATCH v2 3/6] powerpc sstep: Add support for cnttzw, cnttzd instructions

2019-02-21 Thread Sandipan Das
This adds emulation support for the following integer instructions: * Count Trailing Zeros Word (cnttzw[.]) * Count Trailing Zeros Doubleword (cnttzd[.]) Signed-off-by: Sandipan Das --- arch/powerpc/lib/sstep.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/arch/powerpc

[PATCH v2 2/6] powerpc: sstep: Add support for darn instruction

2019-02-21 Thread Sandipan Das
This adds emulation support for the following integer instructions: * Deliver A Random Number (darn) As suggested by Michael, this uses a raw .long for specifying the instruction word when using inline assembly to retain compatibility with older binutils. Signed-off-by: Sandipan Das --- arch

[PATCH v2 0/6] powerpc: sstep: Extend instruction emulation support

2019-02-21 Thread Sandipan Das
arn instructions via inline assembly because older binutils may not be able to recognize them (as pointed out by Michael). PrasannaKumar Muralidharan (1): powerpc sstep: Add support for modsw, moduw instructions Sandipan Das (5): powerpc: sstep: Add support for maddhd, maddhdu, mad

[PATCH 2/3] powerpc: sstep: Add tests for add[.] instruction

2019-02-19 Thread Sandipan Das
This adds test cases for the add[.] instruction. Signed-off-by: Sandipan Das --- arch/powerpc/lib/test_emulate_step.c | 176 +++ 1 file changed, 176 insertions(+) diff --git a/arch/powerpc/lib/test_emulate_step.c b/arch/powerpc/lib/test_emulate_step.c index

[PATCH 1/3] powerpc: sstep: Add tests for compute type instructions

2019-02-19 Thread Sandipan Das
of the GPRs can be validated, support for SPRs is limited to LR, CR and XER for now. When writing the test cases, one must ensure that the Stack Pointer (GPR1) or the Thread Pointer (GPR13) are not touched by any means as these are vital non-volatile registers. Signed-off-by: Sandipan Das --- arch

[PATCH 3/3] powerpc: sstep: Add tests for addc[.] instruction

2019-02-19 Thread Sandipan Das
This adds test cases for the addc[.] instruction. Signed-off-by: Sandipan Das --- arch/powerpc/include/asm/ppc-opcode.h | 1 + arch/powerpc/lib/test_emulate_step.c | 192 ++ 2 files changed, 193 insertions(+) diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch

[PATCH 0/3] powerpc: sstep: Emulation test infrastructure

2019-02-19 Thread Sandipan Das
ing the macros in the current infrastructure. - Add a message to indicate that the tests are being run based on suggestions from Daniel. Sandipan Das (3): powerpc: sstep: Add tests for compute type instructions powerpc: sstep: Add tests for add[.] instruction powerpc: sstep: Add te

Re: [PATCH 2/6] powerpc sstep: Add darn instruction emulation

2019-02-20 Thread Sandipan Das
Hi Michael, On 20/02/19 6:20 AM, Michael Ellerman wrote: > Sandipan Das writes: > >> This adds emulation support for the following integer instructions: >> * Deliver A Random Number (darn) > > This doesn't build with old binutils. We need to support old binutils.

Re: [RFC PATCH 5/5] powerpc: sstep: Add selftests for addc[.] instruction

2019-02-11 Thread Sandipan Das
On 11/02/19 6:30 AM, Daniel Axtens wrote: > Hi Sandipan, > >> +{ >> +.descr = "RA = LONG_MIN | INT_MIN, RB = >> LONG_MIN | INT_MIN", >> +.instr = PPC_INST_ADDC | ___PPC_RT(20) | >> ___PPC_RA(21) | ___PPC_RB(22), >> +

Re: [RFC PATCH 3/5] powerpc: sstep: Add instruction emulation selftests

2019-02-11 Thread Sandipan Das
On 11/02/19 6:17 AM, Daniel Axtens wrote: > Hi Sandipan, > > I'm not really confident to review the asm, but I did have a couple of > questions about the C: > >> +#define MAX_INSNS 32 > This doesn't seem to be used... > True. Thanks for pointing this out. >> +int execute_instr(struct

[RFC PATCH 0/5] powerpc: sstep: Emulation test infrastructure

2019-02-03 Thread Sandipan Das
demonstrate this for different scenarios where the CA and CA32 bits of XER should be set. Sandipan Das (5): powerpc: Add bitmasks for D-form instruction fields powerpc: Add bitmask for Rc instruction field powerpc: sstep: Add instruction emulation selftests powerpc: sstep: Add selftests

[RFC PATCH 2/5] powerpc: Add bitmask for Rc instruction field

2019-02-03 Thread Sandipan Das
This adds the bitmask definition for the Record bit that is available at the end (bit 31) of some instructions. Signed-off-by: Sandipan Das --- arch/powerpc/include/asm/ppc-opcode.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include

[RFC PATCH 3/5] powerpc: sstep: Add instruction emulation selftests

2019-02-03 Thread Sandipan Das
if CONFIG_DEBUG_KERNEL, CONFIG_PPC64 and CONFIG_EMULATE_STEP_SELFTEST were set before the kernel build. When writing the tests, one must not use any instructions that might overwrite the Stack Pointer (GPR1) or the Thread Pointer (GPR13). Signed-off-by: Sandipan Das --- arch/powerpc/Kconfig.debug

[RFC PATCH 1/5] powerpc: Add bitmasks for D-form instruction fields

2019-02-03 Thread Sandipan Das
This adds the bitmask definitions of D, SI and UI fields found in D-form instructions. Signed-off-by: Sandipan Das --- arch/powerpc/include/asm/ppc-opcode.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h

[RFC PATCH 4/5] powerpc: sstep: Add selftests for add[.] instruction

2019-02-03 Thread Sandipan Das
This adds test cases for the add[.] instruction. Signed-off-by: Sandipan Das --- arch/powerpc/lib/sstep_tests.c | 194 + 1 file changed, 194 insertions(+) diff --git a/arch/powerpc/lib/sstep_tests.c b/arch/powerpc/lib/sstep_tests.c index a610c778044d

[RFC PATCH 5/5] powerpc: sstep: Add selftests for addc[.] instruction

2019-02-03 Thread Sandipan Das
This adds test cases for the addc[.] instruction. Signed-off-by: Sandipan Das --- arch/powerpc/include/asm/ppc-opcode.h | 1 + arch/powerpc/lib/sstep_tests.c| 212 ++ 2 files changed, 213 insertions(+) diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch

Re: [PATCH 0/2] powerpc/bpf: DIV64 instruction fix

2019-06-12 Thread Sandipan Das
/bpf_jit_comp64.c | 8 > .../testing/selftests/bpf/verifier/div_overflow.c | 14 ++ > 4 files changed, 16 insertions(+), 9 deletions(-) > For the series Acked-by: Sandipan Das

[PATCH stable 4.14 1/6] powerpc/mm: Fixup tlbie vs store ordering issue on POWER9

2019-10-17 Thread Sandipan Das
ted to v4.14] Signed-off-by: Sandipan Das --- arch/powerpc/include/asm/cputable.h| 4 ++- arch/powerpc/kernel/dt_cpu_ftrs.c | 3 ++ arch/powerpc/kvm/book3s_64_mmu_radix.c | 3 ++ arch/powerpc/kvm/book3s_hv_rm_mmu.c| 11 +++ arch/powerpc/mm/hash_native_64.c | 16 +++

[PATCH stable 4.14 4/6] powerpc/mm: Fixup tlbie vs mtpidr/mtlpidr ordering issue on POWER9

2019-10-17 Thread Sandipan Das
store queue marking flush. Cc: sta...@vger.kernel.org # v4.14 Signed-off-by: Aneesh Kumar K.V Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20190924035254.24612-3-aneesh.ku...@linux.ibm.com [sandipan: Backported to v4.14] Signed-off-by: Sandipan Das --- arch/powerpc/include

[PATCH stable 4.14 3/6] powerpc/book3s64/radix: Rename CPU_FTR_P9_TLBIE_BUG feature flag

2019-10-17 Thread Sandipan Das
to v4.14] Signed-off-by: Sandipan Das --- arch/powerpc/include/asm/cputable.h| 4 ++-- arch/powerpc/kernel/dt_cpu_ftrs.c | 6 +++--- arch/powerpc/kvm/book3s_64_mmu_radix.c | 2 +- arch/powerpc/kvm/book3s_hv_rm_mmu.c| 2 +- arch/powerpc/mm/hash_native_64.c | 2 +- arch/po

[PATCH stable 4.14 5/6] selftests/powerpc: Add test case for tlbie vs mtpidr ordering issue

2019-10-17 Thread Sandipan Das
-aneesh.ku...@linux.ibm.com [sandipan: Backported to v4.14] Signed-off-by: Sandipan Das --- tools/testing/selftests/powerpc/mm/Makefile | 2 + .../testing/selftests/powerpc/mm/tlbie_test.c | 734 ++ 2 files changed, 736 insertions(+) create mode 100644 tools/testing/selftests/

[PATCH stable 4.14 2/6] powerpc/book3s64/mm: Don't do tlbie fixup for some hardware revisions

2019-10-17 Thread Sandipan Das
r.kernel.org # v4.14 Fixes: a5d4b5891c2f ("powerpc/mm: Fixup tlbie vs store ordering issue on POWER9") Signed-off-by: Aneesh Kumar K.V Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20190924035254.24612-1-aneesh.ku...@linux.ibm.com [sandipan: Backported to v4.1

  1   2   3   4   >