[RESEND PATCH v5 09/11] ppc64/kexec_file: prepare elfcore header for crashing kernel

2020-07-26 Thread Hari Bathini
ff-by: Hari Bathini Tested-by: Pingfan Liu Reviewed-by: Thiago Jung Bauermann --- v4 -> v5: * Unchanged. Added Reviewed-by tag from Thiago. v3 -> v4: * Added a FIXME tag to indicate issue in adding opal/rtas regions to core image. * Folded prepare_elf_headers() function into load_elfcore

[RESEND PATCH v5 10/11] ppc64/kexec_file: add appropriate regions for memory reserve map

2020-07-26 Thread Hari Bathini
While initrd, elfcorehdr and backup regions are already added to the reserve map, there are a few missing regions that need to be added to the memory reserve map. Add them here. And now that all the changes to load panic kernel are in place, claim likewise. Signed-off-by: Hari Bathini Tested-by

[RESEND PATCH v5 11/11] ppc64/kexec_file: fix kexec load failure with lack of memory hole

2020-07-26 Thread Hari Bathini
address isn't available while loading, are placed in an intermediate location till a flush to the actual destination address happens during kexec boot sequence. Signed-off-by: Hari Bathini Tested-by: Pingfan Liu Reviewed-by: Thiago Jung Bauermann --- v4 -> v5: * Unchanged. v3 -> v4:

Re: [RESEND PATCH v5 07/11] ppc64/kexec_file: enable early kernel's OPAL calls

2020-07-28 Thread Hari Bathini
On 28/07/20 7:16 pm, Michael Ellerman wrote: Hari Bathini writes: Kernel built with CONFIG_PPC_EARLY_DEBUG_OPAL enabled expects r8 & r9 to be filled with OPAL base & entry addresses respectively. Setting these registers allows the kernel to perform OPAL calls before the device

Re: [RESEND PATCH v5 06/11] ppc64/kexec_file: restrict memory usage of kdump kernel

2020-07-28 Thread Hari Bathini
On 28/07/20 7:14 pm, Michael Ellerman wrote: Hari Bathini writes: diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c index 2df6f4273ddd..8df085a22fd7 100644 --- a/arch/powerpc/kexec/file_load_64.c +++ b/arch/powerpc/kexec/file_load_64.c @@ -17,9 +17,21

[PATCH v6 00/11] ppc64: enable kdump support for kexec_file_load syscall

2020-07-29 Thread Hari Bathini
reserved for crashkernel. * Used the appropriate license header for the new files added. * Added an option to merge ranges to minimize reallocations while adding memory ranges. * Dropped within_crashkernel parameter for add_opal_mem_range() & add_rtas_mem_range() functions as it is not re

[PATCH v6 01/11] kexec_file: allow archs to handle special regions while locating memory hole

2020-07-29 Thread Hari Bathini
hole. Also, add the missing declarations for arch overridable functions and and drop the __weak descriptors in the declarations to avoid non-weak definitions from becoming weak. Reported-by: kernel test robot [lkp: In v1, arch_kimage_file_post_load_cleanup() declaration was missing] Signed-off-by:

[PATCH v6 02/11] powerpc/kexec_file: mark PPC64 specific code

2020-07-29 Thread Hari Bathini
Some of the kexec_file_load code isn't PPC64 specific. Move PPC64 specific code from kexec/file_load.c to kexec/file_load_64.c. Also, rename purgatory/trampoline.S to purgatory/trampoline_64.S in the same spirit. No functional changes. Signed-off-by: Hari Bathini Tested-by: Pingfan Liu Rev

[PATCH v6 03/11] powerpc/kexec_file: add helper functions for getting memory ranges

2020-07-29 Thread Hari Bathini
erstanding the subsequent changes better and make it easy to setup the different memory ranges listed above, as and when appropriate. Signed-off-by: Hari Bathini Tested-by: Pingfan Liu Reviewed-by: Thiago Jung Bauermann --- v5 -> v6: * Dropped email address from copyright header of the n

[PATCH v6 04/11] ppc64/kexec_file: avoid stomping memory used by special regions

2020-07-29 Thread Hari Bathini
ride arch_kexec_locate_mem_hole() to locate a memory hole taking these ranges into account. Signed-off-by: Hari Bathini Reviewed-by: Thiago Jung Bauermann --- v5 -> v6: * Implemented all the add_foo_mem_ranges() functions that get used while setting up exclude memory ranges. v4 -> v5: * Unchan

[PATCH v6 05/11] powerpc/drmem: make lmb walk a bit more flexible

2020-07-29 Thread Hari Bathini
n an error is encountered in the callback function. Signed-off-by: Hari Bathini Tested-by: Pingfan Liu Reviewed-by: Thiago Jung Bauermann --- v5 -> v6: * Unchanged. v4 -> v5: * Unchanged. v3 -> v4: * Unchanged. Added Reviewed-by tag from Thiago. v2 -> v3: * Unchanged. Added Tested-by

[PATCH v6 06/11] ppc64/kexec_file: restrict memory usage of kdump kernel

2020-07-29 Thread Hari Bathini
as applicable. Restrict kdump kernel memory to use only these regions by setting up usable-memory DT property. Also, tell the kdump kernel to run at the loaded address by setting the magic word at 0x5c. Signed-off-by: Hari Bathini Tested-by: Pingfan Liu Reviewed-by: Thiago Jung Bauermann --- v5

[PATCH v6 07/11] ppc64/kexec_file: setup backup region for kdump kernel

2020-07-29 Thread Hari Bathini
x27;s memory to avoid kdump kernel from accidentially using that memory. Signed-off-by: Hari Bathini Reviewed-by: Thiago Jung Bauermann --- v5 -> v6: * Added Reviewed-by tag from Thiago. * The comment explaining why a source buffer is needed for backup segment is moved to appropriate place. *

[PATCH v6 08/11] ppc64/kexec_file: prepare elfcore header for crashing kernel

2020-07-29 Thread Hari Bathini
ff-by: Hari Bathini Tested-by: Pingfan Liu Reviewed-by: Thiago Jung Bauermann --- v5 -> v6: * Unchanged. v4 -> v5: * Unchanged. Added Reviewed-by tag from Thiago. v3 -> v4: * Added a FIXME tag to indicate issue in adding opal/rtas regions to core image. * Folded prepare_elf_headers()

[PATCH v6 09/11] ppc64/kexec_file: add appropriate regions for memory reserve map

2020-07-29 Thread Hari Bathini
While initrd, elfcorehdr and backup regions are already added to the reserve map, there are a few missing regions that need to be added to the memory reserve map. Add them here. And now that all the changes to load panic kernel are in place, claim likewise. Signed-off-by: Hari Bathini Tested-by

[PATCH v6 10/11] ppc64/kexec_file: fix kexec load failure with lack of memory hole

2020-07-29 Thread Hari Bathini
address isn't available while loading, are placed in an intermediate location till a flush to the actual destination address happens during kexec boot sequence. Signed-off-by: Hari Bathini Tested-by: Pingfan Liu Reviewed-by: Thiago Jung Bauermann --- v5 -> v6: * Unchanged. v4 -> v5:

[PATCH v6 11/11] ppc64/kexec_file: enable early kernel's OPAL calls

2020-07-29 Thread Hari Bathini
Kernel built with CONFIG_PPC_EARLY_DEBUG_OPAL enabled expects r8 & r9 to be filled with OPAL base & entry addresses respectively. Setting these registers allows the kernel to perform OPAL calls before the device tree is parsed. Signed-off-by: Hari Bathini Reviewed-by: Thiago Jung B

Re: [RESEND PATCH v5 00/11] ppc64: enable kdump support for kexec_file_load syscall

2020-07-29 Thread Hari Bathini
On 28/07/20 8:02 am, piliu wrote: On 07/27/2020 03:36 AM, Hari Bathini wrote: Sorry! There was a gateway issue on my system while posting v5, due to which some patches did not make it through. Resending... This patch series enables kdump support for kexec_file_load system call (kexec -s

Re: [PATCH 06/15] powerpc: fadamp: simplify fadump_reserve_crash_area()

2020-08-01 Thread Hari Bathini
On 01/08/20 3:48 pm, Mike Rapoport wrote: On Thu, Jul 30, 2020 at 10:15:13PM +1000, Michael Ellerman wrote: Mike Rapoport writes: From: Mike Rapoport fadump_reserve_crash_area() reserves memory from a specified base address till the end of the RAM. Replace iteration through the memblock.

Re: [PATCH v2 2/4] powerpc/mem: Store the dt_root_size/addr cell values for later usage

2020-08-17 Thread Hari Bathini
On 06/08/20 9:53 pm, Aneesh Kumar K.V wrote: dt_root_addr_cells and dt_root_size_cells are __initdata variables. So make a copy of the same which can be used post init. This avoids doing the same thing at multiple places. So, thanks for the patch, Aneesh. Looks good to me. but nitpick bel

Re: [PATCH] powerpc/book3s64/radix: Fix boot failure with large amount of guest memory

2020-08-17 Thread Hari Bathini
switch to hash. Update the memblock limit after mmu_early_init_devtree() if the kernel is going to use radix translation. This forces some of the memblock allocations we do before mmu_early_init_devtree() to be within the RMA limit. Minor comments below. Nonetheless... Reviewed-by: Hari Bathini

Re: [RFC PATCH] powerpc/drmem: use global variable instead of fetching again

2020-08-17 Thread Hari Bathini
On 06/08/20 6:22 pm, Aneesh Kumar K.V wrote: use mem_addr_cells/mem_size_cells instead of fetching the values again from device tree. Looks good to me. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/drmem.c | 24 ++-- 1 file changed, 6 insertions(+), 18 deleti

[PATCH v2 0/8] bpf powerpc: Add BPF_PROBE_MEM support in powerpc JIT compiler

2021-09-17 Thread Hari Bathini
c: Add BPF_PROBE_MEM support for 64bit JIT") Hari Bathini (4): bpf powerpc: refactor JIT compiler code powerpc/ppc-opcode: introduce PPC_RAW_BRANCH() macro bpf ppc32: Add BPF_PROBE_MEM support for JIT bpf ppc32: Add addr > TASK_SIZE_MAX explicit check Ravi Bangoria (4): bpf pow

[PATCH v2 1/8] bpf powerpc: Remove unused SEEN_STACK

2021-09-17 Thread Hari Bathini
From: Ravi Bangoria SEEN_STACK is unused on PowerPC. Remove it. Also, have SEEN_TAILCALL use 0x4000. Signed-off-by: Ravi Bangoria --- * No changes in v2. arch/powerpc/net/bpf_jit.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/net/bpf_jit.h b/arch/po

[PATCH v2 2/8] bpf powerpc: Remove extra_pass from bpf_jit_build_body()

2021-09-17 Thread Hari Bathini
From: Ravi Bangoria In case of extra_pass, usual JIT passes are always skipped. So, extra_pass is always false while calling bpf_jit_build_body() and thus it can be removed. Signed-off-by: Ravi Bangoria --- Changes in v2: * Updated the changelog wording a bit. arch/powerpc/net/bpf_jit.h

[PATCH v2 4/8] powerpc/ppc-opcode: introduce PPC_RAW_BRANCH() macro

2021-09-17 Thread Hari Bathini
Define and use PPC_RAW_BRANCH() macro instead of open coding it. This macro is used while adding BPF_PROBE_MEM support. Signed-off-by: Hari Bathini --- Changes in v2: * New patch to introduce PPC_RAW_BRANCH() macro. arch/powerpc/include/asm/ppc-opcode.h | 2 ++ arch/powerpc/net/bpf_jit.h

[PATCH v2 5/8] bpf ppc64: Add BPF_PROBE_MEM support for JIT

2021-09-17 Thread Hari Bathini
re chosen random, not real) Signed-off-by: Ravi Bangoria Signed-off-by: Hari Bathini --- Changes in v2: * Used JITing code after refactoring. * Replaced 'xor reg,reg,reg' with 'li reg,0' where appropriate. * Avoided unnecessary init during declaration. arch/powerpc/n

[PATCH v2 6/8] bpf ppc64: Add addr > TASK_SIZE_MAX explicit check

2021-09-17 Thread Hari Bathini
-by: Hari Bathini --- Changes in v2: * Refactored the code based on Christophe's comments. arch/powerpc/net/bpf_jit_comp64.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c index 2fc1

[PATCH v2 3/8] bpf powerpc: refactor JIT compiler code

2021-09-17 Thread Hari Bathini
Refactor powerpc JITing. This simplifies adding BPF_PROBE_MEM support. Signed-off-by: Hari Bathini --- Changes in v2: * New patch to refactor a bit of JITing code. arch/powerpc/net/bpf_jit_comp32.c | 50 +++- arch/powerpc/net/bpf_jit_comp64.c | 76

[PATCH v2 7/8] bpf ppc32: Add BPF_PROBE_MEM support for JIT

2021-09-17 Thread Hari Bathini
up=0xffe4 | / 0x4298 -->| insn=0xfe14 | | fixup=0xffe8 | +--+ (Addresses shown here are chosen random, not real) Signed-off-by: Hari Bathini --- Changes in v2: * New patch to add BPF_PROBE_MEM support for PPC32. arch/powerpc/net/bpf_jit.h

[PATCH v2 8/8] bpf ppc32: Add addr > TASK_SIZE_MAX explicit check

2021-09-17 Thread Hari Bathini
BPF exception table. [Alexei suggested for x86] Suggested-by: Alexei Starovoitov Signed-off-by: Hari Bathini --- Changes in v2: * New patch to handle bad userspace pointers on PPC32. arch/powerpc/net/bpf_jit_comp32.c | 39 +++ 1 file changed, 39 insertions(+) diff --

Re: [PATCH v2 3/8] bpf powerpc: refactor JIT compiler code

2021-09-20 Thread Hari Bathini
Hi Christophe, Thanks for reviewing the series. On 17/09/21 9:40 pm, Christophe Leroy wrote: Le 17/09/2021 à 17:30, Hari Bathini a écrit : Refactor powerpc JITing. This simplifies adding BPF_PROBE_MEM support. Could you describe a bit more what you are refactoring exactly ? I am trying

[PATCH v3 0/8] bpf powerpc: Add BPF_PROBE_MEM support in powerpc JIT compiler

2021-09-21 Thread Hari Bathini
IT compilers respectively. Patch #6 & #8 handle bad userspace pointers for PPC64 & PPC32 cases respectively. Changes in v3: * Addressed all the review comments from Christophe. Hari Bathini (4): bpf powerpc: refactor JIT compiler code powerpc/ppc-opcode: introduce PPC_RAW_BRANCH() ma

[PATCH v3 1/8] bpf powerpc: Remove unused SEEN_STACK

2021-09-21 Thread Hari Bathini
From: Ravi Bangoria SEEN_STACK is unused on PowerPC. Remove it. Also, have SEEN_TAILCALL use 0x4000. Signed-off-by: Ravi Bangoria Reviewed-by: Christophe Leroy --- Changes in v3: * Added Reviewed-by tag from Chris. arch/powerpc/net/bpf_jit.h | 3 +-- 1 file changed, 1 insertion(+), 2 d

[PATCH v3 2/8] bpf powerpc: Remove extra_pass from bpf_jit_build_body()

2021-09-21 Thread Hari Bathini
From: Ravi Bangoria In case of extra_pass, usual JIT passes are always skipped. So, extra_pass is always false while calling bpf_jit_build_body() and can be removed. Signed-off-by: Ravi Bangoria --- Changes in v3: * Updated the changelog wording a bit. arch/powerpc/net/bpf_jit.h| 2

[PATCH v3 3/8] bpf powerpc: refactor JIT compiler code

2021-09-21 Thread Hari Bathini
Refactor powerpc LDX JITing code to simplify adding BPF_PROBE_MEM support. Signed-off-by: Hari Bathini --- Changes in v3: * Dropped ST(X) JITing coderefactoring and ensured the changes are minimal and relevant to BPF_PROBE_MEM support. * Added a default for size switch case to ensure compiler

[PATCH v3 4/8] powerpc/ppc-opcode: introduce PPC_RAW_BRANCH() macro

2021-09-21 Thread Hari Bathini
Define and use PPC_RAW_BRANCH() macro instead of open coding it. This macro is used while adding BPF_PROBE_MEM support. Signed-off-by: Hari Bathini Reviewed-by: Christophe Leroy --- Changes in v3: * Added Reviewed-by tag from Chris. arch/powerpc/include/asm/ppc-opcode.h | 2 ++ arch/powerpc

[PATCH v3 5/8] bpf ppc64: Add BPF_PROBE_MEM support for JIT

2021-09-21 Thread Hari Bathini
re chosen random, not real) Signed-off-by: Ravi Bangoria Signed-off-by: Hari Bathini --- Changes in v3: * Made all changes for bpf_add_extable_entry() in this patch instead of updating it again in patch #7. * Fixed a coding style issue. arch/powerpc/net/bpf_jit.h|

[PATCH v3 6/8] bpf ppc64: Access only if addr is kernel address

2021-09-21 Thread Hari Bathini
: Hari Bathini --- Changes in v3: * Used is_kernel_addr() logic instead of using TASK_SIZE_MAX check all the time. * Addressed other comments from Christophe. arch/powerpc/net/bpf_jit_comp64.c | 29 + 1 file changed, 29 insertions(+) diff --git a/arch/powerpc/net

[PATCH v3 7/8] bpf ppc32: Add BPF_PROBE_MEM support for JIT

2021-09-21 Thread Hari Bathini
up=0xffe4 | / 0x4298 -->| insn=0xfe14 | | fixup=0xffe8 | +--+ (Addresses shown here are chosen random, not real) Signed-off-by: Hari Bathini --- Changes in v3: * Changed how BPF_FIXUP_LEN is defined based on Chris' suggestion. arch

[PATCH v3 8/8] bpf ppc32: Access only if addr is kernel address

2021-09-21 Thread Hari Bathini
exception table. [Alexei suggested for x86] Suggested-by: Alexei Starovoitov Signed-off-by: Hari Bathini --- Changes in v3: * Updated jump for PPC_BCC to always be the same while emitting a NOP instruction when needed. arch/powerpc/net/bpf_jit_comp32.c | 35 +++ 1

[PATCH v4 2/8] bpf powerpc: Remove extra_pass from bpf_jit_build_body()

2021-09-29 Thread Hari Bathini
From: Ravi Bangoria In case of extra_pass, usual JIT passes are always skipped. So, extra_pass is always false while calling bpf_jit_build_body() and can be removed. Signed-off-by: Ravi Bangoria --- * No changes in v4. arch/powerpc/net/bpf_jit.h| 2 +- arch/powerpc/net/bpf_jit_comp.

[PATCH v4 0/8] bpf powerpc: Add BPF_PROBE_MEM support in powerpc JIT compiler

2021-09-29 Thread Hari Bathini
IT compilers respectively. Patch #6 & #8 handle bad userspace pointers for PPC64 & PPC32 cases respectively. Changes in v4: * Addressed all the review comments from Christophe. Hari Bathini (4): bpf powerpc: refactor JIT compiler code powerpc/ppc-opcode: introduce PPC_RAW_BRANCH() ma

[PATCH v4 1/8] bpf powerpc: Remove unused SEEN_STACK

2021-09-29 Thread Hari Bathini
From: Ravi Bangoria SEEN_STACK is unused on PowerPC. Remove it. Also, have SEEN_TAILCALL use 0x4000. Signed-off-by: Ravi Bangoria Reviewed-by: Christophe Leroy --- * No changes in v4. arch/powerpc/net/bpf_jit.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/

[PATCH v4 4/8] powerpc/ppc-opcode: introduce PPC_RAW_BRANCH() macro

2021-09-29 Thread Hari Bathini
Define and use PPC_RAW_BRANCH() macro instead of open coding it. This macro is used while adding BPF_PROBE_MEM support. Signed-off-by: Hari Bathini Reviewed-by: Christophe Leroy --- * No changes in v4. arch/powerpc/include/asm/ppc-opcode.h | 2 ++ arch/powerpc/net/bpf_jit.h| 4

[PATCH v4 5/8] bpf ppc64: Add BPF_PROBE_MEM support for JIT

2021-09-29 Thread Hari Bathini
re chosen random, not real) Signed-off-by: Ravi Bangoria Signed-off-by: Hari Bathini --- Changes in v4: * Dropped explicit fallthrough statement for empty switch cases. arch/powerpc/net/bpf_jit.h| 8 +++- arch/powerpc/net/bpf_jit_comp.c | 70 --- arch/po

[PATCH v4 6/8] bpf ppc64: Access only if addr is kernel address

2021-09-29 Thread Hari Bathini
: Hari Bathini --- Changes in v4: * Used IS_ENABLED() instead of #ifdef. * Dropped the else case that is not applicable for PPC64. arch/powerpc/net/bpf_jit_comp64.c | 26 ++ 1 file changed, 26 insertions(+) diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc

[PATCH v4 7/8] bpf ppc32: Add BPF_PROBE_MEM support for JIT

2021-09-29 Thread Hari Bathini
up=0xffe4 | / 0x4298 -->| insn=0xfe14 | | fixup=0xffe8 | +--+ (Addresses shown here are chosen random, not real) Signed-off-by: Hari Bathini --- Changes in v4: * Dropped explicit fallthrough statement for empty switch cases. arch/powe

[PATCH v4 3/8] bpf powerpc: refactor JIT compiler code

2021-09-29 Thread Hari Bathini
Refactor powerpc LDX JITing code to simplify adding BPF_PROBE_MEM support. Signed-off-by: Hari Bathini --- Changes in v4: * Dropped the default case in the switch statement for bpf size. * Dropped explicit fallthrough statement for empty switch cases. arch/powerpc/net/bpf_jit_comp32.c | 33

[PATCH v4 8/8] bpf ppc32: Access only if addr is kernel address

2021-09-29 Thread Hari Bathini
exception table. [Alexei suggested for x86] Suggested-by: Alexei Starovoitov Signed-off-by: Hari Bathini --- Changes in v4: * Adjusted the emit code to avoid using temporary reg. arch/powerpc/net/bpf_jit_comp32.c | 34 +++ 1 file changed, 34 insertions(+) diff

[RESEND PATCH v4 2/8] bpf powerpc: Remove extra_pass from bpf_jit_build_body()

2021-10-12 Thread Hari Bathini
From: Ravi Bangoria In case of extra_pass, usual JIT passes are always skipped. So, extra_pass is always false while calling bpf_jit_build_body() and can be removed. Signed-off-by: Ravi Bangoria --- * No changes in v4. arch/powerpc/net/bpf_jit.h| 2 +- arch/powerpc/net/bpf_jit_comp.

[RESEND PATCH v4 3/8] bpf powerpc: refactor JIT compiler code

2021-10-12 Thread Hari Bathini
Refactor powerpc LDX JITing code to simplify adding BPF_PROBE_MEM support. Signed-off-by: Hari Bathini Reviewed-by: Christophe Leroy --- Changes in v4: * Dropped the default case in the switch statement for bpf size. * Dropped explicit fallthrough statement for empty switch cases. arch

[RESEND PATCH v4 5/8] bpf ppc64: Add BPF_PROBE_MEM support for JIT

2021-10-12 Thread Hari Bathini
re chosen random, not real) Signed-off-by: Ravi Bangoria Signed-off-by: Hari Bathini Reviewed-by: Christophe Leroy --- Changes in v4: * Dropped explicit fallthrough statement for empty switch cases. arch/powerpc/net/bpf_jit.h| 8 +++- arch/powerpc/net/bpf_jit_comp.c | 66 +

[RESEND PATCH v4 6/8] bpf ppc64: Access only if addr is kernel address

2021-10-12 Thread Hari Bathini
: Hari Bathini Reviewed-by: Christophe Leroy --- Changes in v4: * Used IS_ENABLED() instead of #ifdef. * Dropped the else case that is not applicable for PPC64. arch/powerpc/net/bpf_jit_comp64.c | 26 ++ 1 file changed, 26 insertions(+) diff --git a/arch/powerpc/net

[RESEND PATCH v4 4/8] powerpc/ppc-opcode: introduce PPC_RAW_BRANCH() macro

2021-10-12 Thread Hari Bathini
Define and use PPC_RAW_BRANCH() macro instead of open coding it. This macro is used while adding BPF_PROBE_MEM support. Signed-off-by: Hari Bathini Reviewed-by: Christophe Leroy --- * No changes in v4. arch/powerpc/include/asm/ppc-opcode.h | 2 ++ arch/powerpc/net/bpf_jit.h| 2

[RESEND PATCH v4 7/8] bpf ppc32: Add BPF_PROBE_MEM support for JIT

2021-10-12 Thread Hari Bathini
up=0xffe4 | / 0x4298 -->| insn=0xfe14 | | fixup=0xffe8 | +--+ (Addresses shown here are chosen random, not real) Signed-off-by: Hari Bathini Reviewed-by: Christophe Leroy --- Changes in v4: * Dropped explicit fallthrough statement for empty swi

[RESEND PATCH v4 8/8] bpf ppc32: Access only if addr is kernel address

2021-10-12 Thread Hari Bathini
exception table. [Alexei suggested for x86] Suggested-by: Alexei Starovoitov Signed-off-by: Hari Bathini Reviewed-by: Christophe Leroy --- Changes in v4: * Adjusted the emit code to avoid using temporary reg. arch/powerpc/net/bpf_jit_comp32.c | 34 +++ 1 file

[RESEND PATCH v4 0/8] bpf powerpc: Add BPF_PROBE_MEM support in powerpc JIT compiler

2021-10-12 Thread Hari Bathini
.@linux.vnet.ibm.com/ ("[v2,00/10] powerpc/bpf: Various fixes") Also, added Reviewed-by tag from Christophe for patches #3, #5, #6, #7 & #8. Hari Bathini (4): bpf powerpc: refactor JIT compiler code powerpc/ppc-opcode: introduce PPC_RAW_BRANCH() macro bpf ppc32: Add BPF_PROBE_MEM s

[RESEND PATCH v4 1/8] bpf powerpc: Remove unused SEEN_STACK

2021-10-12 Thread Hari Bathini
From: Ravi Bangoria SEEN_STACK is unused on PowerPC. Remove it. Also, have SEEN_TAILCALL use 0x4000. Signed-off-by: Ravi Bangoria Reviewed-by: Christophe Leroy --- * No changes in v4. arch/powerpc/net/bpf_jit.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/

Re: [PATCH] powerpc/kexec_file: Add of_node_put() before goto

2021-10-18 Thread Hari Bathini
-off-by: Wan Jiabing Thanks for fixing this! Acked-by: Hari Bathini --- arch/powerpc/kexec/file_load_64.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c index 5056e175ca2c..b4981b651d9a 100644 --- a/arch/powerpc/kexec

[PATCH] powerpc/bpf: fix write protecting JIT code

2021-10-24 Thread Hari Bathini
holding off write protection of JIT code until the extra pass, where branch target addresses fixup happens. Cc: sta...@vger.kernel.org Fixes: 62e3d4210ac9 ("powerpc/bpf: Write protect JIT code") Signed-off-by: Hari Bathini --- arch/powerpc/net/bpf_jit_comp.c | 2 +- 1 file changed, 1

[PATCH] ppc64/fadump: fix inaccurate CPU state info in vmcore generated with panic

2021-11-10 Thread Hari Bathini
mit bab26238bbd4 ("powerpc: Offline CPU in stop_this_cpu()") reverted that change. To avoid vmcore from showing only one CPU as online in panic path, skip marking non panic'ing CPUs as offline while stopping them during fadump crash. Signed-off-by: Hari Bathini --- arch/powerpc/

Re: [PATCH] ppc64/fadump: fix inaccurate CPU state info in vmcore generated with panic

2021-11-11 Thread Hari Bathini
On 11/11/21 11:44 am, Michael Ellerman wrote: Hari Bathini writes: In panic path, fadump is triggered via a panic notifier function. Before calling panic notifier functions, smp_send_stop() gets called, which stops all CPUs except the panic'ing CPU. Commit 8389b37dffdc (&qu

Re: [PATCH] ppc64/fadump: fix inaccurate CPU state info in vmcore generated with panic

2021-11-16 Thread Hari Bathini
On 11/11/21 6:50 pm, Nicholas Piggin wrote: Excerpts from Hari Bathini's message of November 11, 2021 10:06 pm: On 11/11/21 11:44 am, Michael Ellerman wrote: Hari Bathini writes: In panic path, fadump is triggered via a panic notifier function. Before calling panic notifier func

[PATCH v2 1/2] powerpc: handle kdump appropriately with crash_kexec_post_notifiers option

2021-11-25 Thread Hari Bathini
sion in panic path"). Override this kdump friendly weak function to handle crash_kexec_post_notifiers option appropriately on powerpc. Signed-off-by: Hari Bathini --- * New patch to handle the case where kdump is triggered after panic notifiers. arch/powerpc/kernel/smp.c | 26 +++

[PATCH v2 2/2] ppc64/fadump: fix inaccurate CPU state info in vmcore generated with panic

2021-11-25 Thread Hari Bathini
crash_kexec_post_notifiers option. Also, as register data for all CPUs is captured by f/w, skip IPI callbacks here for fadump, to avoid any complications in finding the right backtraces. Signed-off-by: Hari Bathini --- Changes in v2: * Let panic(0 take crash friendly path when fadump is enabled

[PATCH] powerpc/fadump: account for memory_limit while reserving memory

2020-05-27 Thread Hari Bathini
test robot Fixes: 140777a3d8df ("powerpc/fadump: consider reserved ranges while reserving memory") Cc: sta...@vger.kernel.org Signed-off-by: Hari Bathini --- For reference: - https://lists.ozlabs.org/pipermail/linuxppc-dev/2020-May/211136.html arch/powerpc/kernel/fadump.c |2 +

[PATCH 00/11] ppc64: enable kdump support for kexec_file_load syscall

2020-06-26 Thread Hari Bathini
laims kdump support as all the necessary changes are added. Tested the changes successfully on P8, P9 lpars & an OpenPOWER box. --- Hari Bathini (11): kexec_file: allow archs to handle special regions while locating memory hole powerpc/kexec_file: mark PPC64 specific code

[PATCH 05/11] powerpc/drmem: make lmb walk a bit more flexible

2020-06-26 Thread Hari Bathini
n an error is encountered in the callback function. Signed-off-by: Hari Bathini --- arch/powerpc/include/asm/drmem.h |9 ++-- arch/powerpc/kernel/prom.c | 13 +++--- arch/powerpc/mm/drmem.c | 87 +- arch/powerpc/mm/numa.c |

[PATCH 06/11] ppc64/kexec_file: restrict memory usage of kdump kernel

2020-06-26 Thread Hari Bathini
as applicable. Restrict kdump kernel memory to use only these regions by setting up usable-memory DT property. Also, tell the kdump kernel to run at the loaded address by setting the magic word at 0x5c. Signed-off-by: Hari Bathini --- arch/powerpc/kexec/file_load_64.c | 400

[PATCH 07/11] ppc64/kexec_file: add support to relocate purgatory

2020-06-26 Thread Hari Bathini
pointer and applying RELA relocations as needed. Signed-off-by: Hari Bathini --- arch/powerpc/kexec/file_load_64.c | 338 arch/powerpc/purgatory/trampoline_64.S |8 + 2 files changed, 346 insertions(+) diff --git a/arch/powerpc/kexec/file_load_64.c b/arch

[PATCH 08/11] ppc64/kexec_file: setup the stack for purgatory

2020-06-26 Thread Hari Bathini
To avoid any weird errors, the purgatory should run with its own stack. Set one up by adding the stack buffer to .data section of the purgatory. Signed-off-by: Hari Bathini --- arch/powerpc/include/asm/kexec.h |4 arch/powerpc/kexec/file_load_64.c | 14 +- arch

[PATCH 09/11] ppc64/kexec_file: setup backup region for kdump kernel

2020-06-26 Thread Hari Bathini
ry to avoid kdump kernel from accidentially using that memory. Signed-off-by: Hari Bathini --- arch/powerpc/include/asm/crashdump-ppc64.h |5 + arch/powerpc/include/asm/kexec.h |7 ++ arch/powerpc/kexec/elf_64.c|9 +++ arch/powerpc/kexec/file_load_64.c |

[PATCH 11/11] ppc64/kexec_file: add appropriate regions for memory reserve map

2020-06-26 Thread Hari Bathini
While initrd, elfcorehdr and backup regions are already added to the reserve map, there are a few missing regions that need to be added to the memory reserve map. Add them here. And now that all the changes to load panic kernel are in place, claim likewise. Signed-off-by: Hari Bathini --- arch

Re: [PATCH 04/11] ppc64/kexec_file: avoid stomping memory used by special regions

2020-06-28 Thread Hari Bathini
On 28/06/20 7:44 am, piliu wrote: > Hi Hari, Hi Pingfan, > > After a quick through for this series, I have a few question/comment on > this patch for the time being. Pls see comment inline. > > On 06/27/2020 03:05 AM, Hari Bathini wrote: >> crashkernel region co

Re: [PATCH 01/11] kexec_file: allow archs to handle special regions while locating memory hole

2020-06-28 Thread Hari Bathini
add_buffer definition for archs to override & take >> care of special regions before trying to locate a memory hole. >> >> Signed-off-by: Hari Bathini Thanks Hari

Re: [PATCH 02/11] powerpc/kexec_file: mark PPC64 specific code

2020-06-28 Thread Hari Bathini
Hi Christophe Thanks for the review... On 27/06/20 12:12 pm, Christophe Leroy wrote: > > > Le 26/06/2020 à 21:04, Hari Bathini a écrit : >> Some of the kexec_file_load code isn't PPC64 specific. Move PPC64 >> specific code from kexec/file_load.c to kexec/file_

Re: [PATCH 01/11] kexec_file: allow archs to handle special regions while locating memory hole

2020-06-29 Thread Hari Bathini
Hi Petr, On 29/06/20 5:09 pm, Petr Tesarik wrote: > Hi Hari, > > is there any good reason to add two more functions with a very similar > name to an existing function? AFAICS all you need is a way to call a > PPC64-specific function from within kexec_add_buffer (PATCH 4/11), so > you could add so

Re: [PATCH 04/11] ppc64/kexec_file: avoid stomping memory used by special regions

2020-06-29 Thread Hari Bathini
On 30/06/20 9:00 am, piliu wrote: > > > On 06/29/2020 01:55 PM, Hari Bathini wrote: >> >> >> On 28/06/20 7:44 am, piliu wrote: >>> Hi Hari, >> >> Hi Pingfan, >> >>> >>> After a quick through for this series, I have a fe

Re: [PATCH 04/11] ppc64/kexec_file: avoid stomping memory used by special regions

2020-07-01 Thread Hari Bathini
On 01/07/20 1:10 pm, Dave Young wrote: > Hi Hari, > On 06/27/20 at 12:35am, Hari Bathini wrote: >> crashkernel region could have an overlap with special memory regions >> like opal, rtas, tce-table & such. These regions are referred to as >> exclude memory rang

Re: [PATCH 01/11] kexec_file: allow archs to handle special regions while locating memory hole

2020-07-01 Thread Hari Bathini
On 01/07/20 1:16 pm, Dave Young wrote: > On 06/29/20 at 05:26pm, Hari Bathini wrote: >> Hi Petr, >> >> On 29/06/20 5:09 pm, Petr Tesarik wrote: >>> Hi Hari, >>> >>> is there any good reason to add two more functions with a very similar >>&g

[PATCH v2 00/12] ppc64: enable kdump support for kexec_file_load syscall

2020-07-02 Thread Hari Bathini
ed an option to merge ranges to minimize reallocations while adding memory ranges. * Dropped within_crashkernel parameter for add_opal_mem_range() & add_rtas_mem_range() functions as it is not really needed. --- Hari Bathini (12): kexec_file: allow archs to handle special regions while locating

[PATCH v2 01/12] kexec_file: allow archs to handle special regions while locating memory hole

2020-07-02 Thread Hari Bathini
hole. Also, add the missing declarations for arch overridable functions and and drop the __weak descriptors in the declarations to avoid non-weak definitions from becoming weak. Reported-by: kernel test robot [lkp: In v1, arch_kimage_file_post_load_cleanup() declaration was missing] Signed-off-by:

[PATCH v2 02/12] powerpc/kexec_file: mark PPC64 specific code

2020-07-02 Thread Hari Bathini
Some of the kexec_file_load code isn't PPC64 specific. Move PPC64 specific code from kexec/file_load.c to kexec/file_load_64.c. Also, rename purgatory/trampoline.S to purgatory/trampoline_64.S in the same spirit. Signed-off-by: Hari Bathini --- Changes in v2: * No changes. arch/po

[PATCH v2 03/12] powerpc/kexec_file: add helper functions for getting memory ranges

2020-07-02 Thread Hari Bathini
erstanding the subsequent changes better and make it easy to setup the different memory ranges listed above, as and when appropriate. Signed-off-by: Hari Bathini --- Changes in v2: * Added an option to merge ranges while sorting to minimize reallocations for memory ranges list.

[PATCH v2 04/12] ppc64/kexec_file: avoid stomping memory used by special regions

2020-07-02 Thread Hari Bathini
ride arch_kexec_locate_mem_hole() to locate a memory hole taking these ranges into account. Signed-off-by: Hari Bathini --- Changes in v2: * Did arch_kexec_locate_mem_hole() override to handle special regions. * Ensured holes in the memory are accounted for while locating mem hole. * Updated add_rtas_mem_r

[PATCH v2 06/12] ppc64/kexec_file: restrict memory usage of kdump kernel

2020-07-02 Thread Hari Bathini
as applicable. Restrict kdump kernel memory to use only these regions by setting up usable-memory DT property. Also, tell the kdump kernel to run at the loaded address by setting the magic word at 0x5c. Signed-off-by: Hari Bathini --- Changes in v2: * Fixed off-by-one error while setting up

[PATCH v2 05/12] powerpc/drmem: make lmb walk a bit more flexible

2020-07-02 Thread Hari Bathini
n an error is encountered in the callback function. Signed-off-by: Hari Bathini --- Changes in v2: * No changes. arch/powerpc/include/asm/drmem.h |9 ++-- arch/powerpc/kernel/prom.c | 13 +++--- arch/powerpc/mm/drmem.c | 87 +- arch/powerp

[PATCH v2 07/12] ppc64/kexec_file: add support to relocate purgatory

2020-07-02 Thread Hari Bathini
pointer and applying RELA relocations as needed. Reported-by: kernel test robot [lkp: In v1, 'struct mem_sym' was declared in parameter list] Signed-off-by: Hari Bathini --- Changes in v2: * Fixed wrong use of 'struct mem_sym' in local_entry_offset() as reported by lkp. lkp

[PATCH v2 08/12] ppc64/kexec_file: setup the stack for purgatory

2020-07-02 Thread Hari Bathini
To avoid any weird errors, the purgatory should run with its own stack. Set one up by adding the stack buffer to .data section of the purgatory. Also, setup opal base & entry values in r8 & r9 registers to help early OPAL debugging. Signed-off-by: Hari Bathini --- Changes in v2: * Se

[PATCH v2 09/12] ppc64/kexec_file: setup backup region for kdump kernel

2020-07-02 Thread Hari Bathini
ry to avoid kdump kernel from accidentially using that memory. Reported-by: kernel test robot [lkp: In v1, purgatory() declaration was missing] Signed-off-by: Hari Bathini --- Changes in v2: * Check if backup region is available before branching out. This is to keep `kexec -l -s` flow as before as

[PATCH v2 10/12] ppc64/kexec_file: prepare elfcore header for crashing kernel

2020-07-02 Thread Hari Bathini
ff-by: Hari Bathini --- Changes in v2: * Tried merging adjacent memory ranges on hitting maximum ranges limit to reduce reallocations for memory ranges and also, minimize PT_LOAD segments for elfcore. * Updated add_rtas_mem_range() & add_opal_mem_range() callsites based on the new prototype

[PATCH v2 11/12] ppc64/kexec_file: add appropriate regions for memory reserve map

2020-07-02 Thread Hari Bathini
While initrd, elfcorehdr and backup regions are already added to the reserve map, there are a few missing regions that need to be added to the memory reserve map. Add them here. And now that all the changes to load panic kernel are in place, claim likewise. Signed-off-by: Hari Bathini

[PATCH v2 12/12] ppc64/kexec_file: fix kexec load failure with lack of memory hole

2020-07-02 Thread Hari Bathini
address isn't available while loading, are placed in an intermediate location till a flush to the actual destination address happens during kexec boot sequence. Signed-off-by: Hari Bathini --- Changes in v2: * New patch to fix locating memory hole for kexec_file_load (kexec -s -l) when memo

[PATCH] powerpc/kexec: blacklist functions called in real mode for kprobe

2021-07-14 Thread Hari Bathini
As kprobe does not handle events happening in real mode, blacklist the functions that only get called in real mode or in kexec sequence with MMU turned off. Signed-off-by: Hari Bathini --- arch/powerpc/kernel/head_64.S|2 ++ arch/powerpc/kexec/core_64.c |6

[PATCH V2] powerpc/fadump: register for fadump as early as possible

2021-07-28 Thread Hari Bathini
roc/vmcore at all due to incomplete configuration in the userspace at the time of crash. Commit 0823c68b054b ("powerpc/fadump: re-register firmware-assisted dump if already registered") ensures this change does not break userspace. Signed-off-by: Hari Bathini --- Changes in V2:

Re: [PATCH v2 09/16] powernv/fadump: process architected register state data provided by firmware

2019-05-08 Thread Hari Bathini
On 07/05/19 9:30 PM, Segher Boessenkool wrote: On Tue, May 07, 2019 at 07:43:56PM +0530, Mahesh J Salgaonkar wrote: Can we use SPRN_* #defines which are already present in asm/reg.h instead of hard coding numbers for switch cases ? You may want to add new #defines for NIP, MSR and CCR. But no

Re: [PATCH v2 12/16] powerpc/powernv: export /proc/opalcore for analysing opal crashes

2019-05-08 Thread Hari Bathini
On 08/05/19 5:55 AM, Nicholas Piggin wrote: Hari Bathini's on April 16, 2019 8:35 pm: From: Hari Bathini Export /proc/opalcore file to analyze opal crashes. Since opalcore can be generated independent of CONFIG_FA_DUMP support in kernel, add this support under a new kernel config o

Re: [PATCH v2 15/16] powernv/fadump: consider f/w load area

2019-05-08 Thread Hari Bathini
On 07/05/19 10:43 PM, Mahesh J Salgaonkar wrote: On 2019-04-16 16:06:13 Tue, Hari Bathini wrote: OPAL loads kernel & initrd at 512MB offset (256MB size), also exported as ibm,opal/dump/fw-load-area. So, if boot memory size of FADump is less than 768MB, kernel memory to be exported as &#

[PATCH v3 1/2] powerpc: handle kdump appropriately with crash_kexec_post_notifiers option

2021-12-07 Thread Hari Bathini
sion in panic path"). Override this kdump friendly weak function to handle crash_kexec_post_notifiers option appropriately on powerpc. Signed-off-by: Hari Bathini [Fixed signature of crash_stop_this_cpu() - reported by l...@intel.com] Reported-by: kernel test robot

<    1   2   3   4   5   6   7   8   9   >