arm64 kexec kernel patches v16
Subsystems (7)
v16 cover arm64 kexec kernel patches v16
This series adds the core support for kexec re-boot and kdump on ARM64. This version of the series combines Takahiro's kdump patches with my kexec patches. Please consider all patches for inclusion.
To load a second stage kernel and execute a kexec re-boot or to work with kdump on ARM64 systems a series of patches to kexec-tools [2], which have not yet been merged upstream, are needed. Please update to the latest if you have been using an older version.
To examine vmcore (/proc/vmcore), you should use
- gdb v7.7 or later
- crash v7.1.1 or later
Some changes and additional patches come from James Morse's hibernate patchset v7 [3].
[1] https://git.kernel.org/cgit/linux/kernel/git/geoff/linux-kexec.git [2] https://git.kernel.org/cgit/linux/kernel/git/geoff/kexec-tools.git [3] http://lists.infradead.org/pipermail/linux-arm-kernel/2016-April/419427.html
Changes for v16 (Apr 14, 2016, 23m):
o Rebase to Linux-4.6-rc3.
o Don't try to explicitly enter EL2 at machine_kexec() when VHE in use
o Add unreachable() in case of ipi_cpu_crash_stop()
o Add more "#ifdef" to eliminate code unused when !CONFIG_KEXEC_CORE
o Fix a build error around ipi_cpu_crash_stop() when !CONFIG_HOTPLUG_CPU
o Revert "arm64: Add new hcall HVC_CALL_FUNC"
o Revert "Convert hcalls to use HVC immediate value"
(replaced by James' "hyp/kvm: Extend hyp-stub API to allow function calls
at EL2")
Modified by James:
o Add missing icache maintenance + isb to __kvm_hyp_reset()
o Rework kvm cpu hotplug for VHE
Added by James:
o arm64: head.S: el2_setup() to accept sctlr_el1 as an argument
o arm64: hyp/kvm: Extend hyp-stub API to allow function calls at EL2
o arm64: kvm: Move lr save/restore from do_el2_call into EL1
o arm64: kvm: Move the do_el2_call macro to a header file
Changes for v15 (Mar 14, 2016, 22m):
o Rebase to Linux-4.5.
o Remove DEBUG conditional in 'Add pr_debug output'.
Changes for v14 (Mar 4, 2016, 22m):
o Rebase to Linux-4.5-rc6.
o Rename setup_mm_for_reboot to cpu_install_idmap.
o kdump: leave non-boot cpus online at crash dump
As we don't have to make non-boot (crashed) cpus offline at crash dump, this patch adds a variant of smp_send_stop().
o kdump: use a new device-tree property, "linux,elfcorehdr", instead of traditional "elfcorehdr=" kernel parameter
o limit memory regions based on DT property, "usable-memory", instead of "mem=" kernel parameter
o kdump: fix a build error when !CONFIG_KEXEC_CORE
o kvm: use generic kvm_call_hyp() interface instead of kvm_cpu_reset()
o kvm: initialize only a primary cpu at init_hyp_mode()
Changes for v13 (Jan 15, 2016, 20m):
o Rebase to Linux-4.4.
o Remove align directive from cpu_reset.c.
o Use inline C wrapper for cpu_soft_restart.
o Revert the new image d-cache flush changes of v10.
o Add SCTLR cleanup patch.
o Change pr_devel to pr_debug.
o Call flush_icache_range() for reboot_code_buffer.
o Add .ltorg directive to arm64_relocate_new_kernel.
o Make new asm macro copy_page.
o Change cache maintenence from inner-shareable to non-shareable.
o Rename KEXEC_ARCH_ARM64 to KEXEC_ARCH_AARCH64.
o arm64: kvm: allows kvm cpu hotplug
- remove some garbage code from kvm_host.h
o arm64: kdump: reserve memory for crash dump kernel
- change CONFIG_KEXEC to CONFIG_KEXEC_CORE
- don't panic on crash kernel alloc failure
(thanks to Mark Salter, RH)
o arm64: kdump: implement machine_crash_shutdown()
- change "boot/non-boot cpu" to "crashing/non-crashing cpu"
- introduce is_in_crash_kexec() for readability
- re-introduce machine_kexec_mask_interrupts(), as arch/arm has, to discard unexpected interrupts
- call crash_save_cpu() before making cpus offline to avoid a possible race (thanks to Pratyush Anand/Mark Salter, RH)
o arm64: kdump: update a kernel doc
- clarify that we support "Image" format as well as vmlinux in kdump.txt
o arm64: kdump: relax BUG_ON() if more than one cpus are still active
- change a warning message at the failure of shooting down non-crahsing cpus
Changes for v12 (Nov 24, 2015, 18m):
o No changes, rebase to Linux-4.4-rc2.
Changes for v11 (Nov 6, 2015, 18m):
o Rebase to Linux-4.3.
o Move the new image d-cache flush from arm64_relocate_new_kernel to machine_kexec.
o Pass values to arm64_relocate_new_kernel in registers, not in global variables.
o Fixups to setting the sctlr_el1 and sctlr_el2 flags.
Changes for v10 (Oct 18, 2015, 17m):
o Rebase to Linux-4.3-rc6.
o Move tcr_set_idmap_t0sz to assembler.h.
o Add back simplified cpu_reset routines.
o Combine kexec + kdump patches.
Changes for v9 (Apr 7, 2015, 11m):
o Use new upstream flag IND_FLAGS.
Changes for v8 (Mar 19, 2015, 10m):
o Rebase to Linux-4.0-rc4.
o Re-boot using purgatory only.
Changes for v7 (Jan 16, 2015, 8m):
o Rebase to Linux-3.19-rc4.
o Change from ESR_EL2_ to ESR_ELx_.
o Remove work-arounds for EFI systems.
Changes for v6 (Dec 2, 2014, 7m):
o Rebase to Linux-3.18-rc2
Changes for v5 (Nov 16, 2014, 6m):
Changes for v4 (Oct 3, 2014, 5m):
Changes for v3 (Sept 23, 2014, 4m):
Changes for v2 (Sep 9, 2014, 4m):
o Rebase to Linux-3.17-rc4.
o Move macros from proc-macros.S to assembler.h.
o Convert hcalls to use ISS field.
o Add new hcall HVC_CALL_FUNC.
o Add EL2 switch to soft_restart.
First submission v1 (May 13, 2014):
o Based on Linux-3.15-rc4.
-Geoff
The following changes since commit bf16200689118d19de1b8d2a3c314fc21f5dc7bb:
Linux 4.6-rc3 (2016-04-10 17:58:30 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/geoff/linux-kexec.git kexec-v16
for you to fetch changes up to e13a046f0d7c011e3665fadf5cd68754d3efcb5e:
arm64: kdump: update a kernel doc (2016-04-14 14:10:45 -0700)
----------------------------------------------------------------
AKASHI Takahiro (7):
arm64: kvm: allows kvm cpu hotplug
arm64: kdump: reserve memory for crash dump kernel
arm64: limit memory regions based on DT property, usable-memory
arm64: kdump: implement machine_crash_shutdown()
arm64: kdump: add kdump support
arm64: kdump: enable kdump in the arm64 defconfig
arm64: kdump: update a kernel doc
Geoff Levand (8):
arm64: Fold proc-macros.S into assembler.h
arm64: Cleanup SCTLR flags
arm64: hyp/kvm: Extend hyp-stub API to allow function calls at EL2
arm64: Add new asm macro copy_page
arm64: Add back cpu_reset routines
arm64/kexec: Add core kexec support
arm64/kexec: Enable kexec in the arm64 defconfig arm64/kexec: Add pr_debug output
James Morse (5):
arm64: kvm: Move the do_el2_call macro to a header file
arm64: kvm: Move lr save/restore from do_el2_call into EL1
arm64: kernel: Include _AC definition in page.h
arm64: Promote KERNEL_START/KERNEL_END definitions to a header file
arm64: head.S: el2_setup() to accept sctlr_el1 as an argument
Documentation/kdump/kdump.txt | 15 +- arch/arm/include/asm/kvm_host.h | 10 +- arch/arm/include/asm/kvm_mmu.h | 1 + arch/arm/kvm/arm.c | 128 ++++++++++------- arch/arm/kvm/mmu.c | 5 + arch/arm64/Kconfig | 21 +++ arch/arm64/configs/defconfig | 2 + arch/arm64/include/asm/assembler.h | 111 ++++++++++++++- arch/arm64/include/asm/hardirq.h | 2 +- arch/arm64/include/asm/kexec.h | 78 +++++++++++ arch/arm64/include/asm/kvm_arm.h | 11 -- arch/arm64/include/asm/kvm_asm.h | 1 + arch/arm64/include/asm/kvm_host.h | 13 +- arch/arm64/include/asm/kvm_mmu.h | 1 + arch/arm64/include/asm/memory.h | 3 + arch/arm64/include/asm/page.h | 2 + arch/arm64/include/asm/smp.h | 4 + arch/arm64/include/asm/sysreg.h | 19 ++- arch/arm64/include/asm/virt.h | 30 +++- arch/arm64/kernel/Makefile | 3 + arch/arm64/kernel/cpu-reset.S | 57 ++++++++ arch/arm64/kernel/cpu-reset.h | 30 ++++ arch/arm64/kernel/crash_dump.c | 71 ++++++++++ arch/arm64/kernel/head.S | 22 +-- arch/arm64/kernel/hyp-stub.S | 43 ++++-- arch/arm64/kernel/machine_kexec.c | 272 ++++++++++++++++++++++++++++++++++++ arch/arm64/kernel/relocate_kernel.S | 131 +++++++++++++++++ arch/arm64/kernel/setup.c | 7 +- arch/arm64/kernel/sleep.S | 1 + arch/arm64/kernel/smp.c | 63 +++++++++ arch/arm64/kvm/hyp-init.S | 43 +++++- arch/arm64/kvm/hyp.S | 11 +- arch/arm64/kvm/hyp/hyp-entry.S | 23 +-- arch/arm64/kvm/reset.c | 14 ++ arch/arm64/mm/cache.S | 2 - arch/arm64/mm/init.c | 152 ++++++++++++++++++++ arch/arm64/mm/proc-macros.S | 98 ------------- arch/arm64/mm/proc.S | 3 - include/uapi/linux/kexec.h | 1 + 39 files changed, 1283 insertions(+), 221 deletions(-) create mode 100644 arch/arm64/include/asm/kexec.h create mode 100644 arch/arm64/kernel/cpu-reset.S create mode 100644 arch/arm64/kernel/cpu-reset.h create mode 100644 arch/arm64/kernel/crash_dump.c create mode 100644 arch/arm64/kernel/machine_kexec.c create mode 100644 arch/arm64/kernel/relocate_kernel.S delete mode 100644 arch/arm64/mm/proc-macros.S
Signature · 7 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 1/20 arm64: Fold proc-macros.S into assembler.h
To allow the assembler macros defined in arch/arm64/mm/proc-macros.S to be used outside the mm code move the contents of proc-macros.S to asm/assembler.h. Also, delete proc-macros.S, and fix up all references to proc-macros.S.
--- arch/arm64/include/asm/assembler.h | 82 ++++++++++++++++++++++++++++++- arch/arm64/mm/cache.S | 2 - arch/arm64/mm/proc-macros.S | 98 -------------------------------------- arch/arm64/mm/proc.S | 3 -- 4 files changed, 81 insertions(+), 104 deletions(-) delete mode 100644 arch/arm64/mm/proc-macros.S
arch/arm64/include/asm/assembler.h +81 -1
@@ -1,5 +1,5 @@/* -* Based on arch/arm/include/asm/assembler.h +* Based on arch/arm/include/asm/assembler.h, arch/arm/mm/proc-macros.S * * Copyright (C) 1996-2000 Russell King * Copyright (C) 2012 ARM Ltd.
@@ -23,6 +23,8 @@#ifndef __ASM_ASSEMBLER_H#define __ASM_ASSEMBLER_H +#include <asm/asm-offsets.h> +#include <asm/pgtable-hwdef.h> #include <asm/ptrace.h> #include <asm/thread_info.h>
@@ -212,6 +214,84 @@ lr .req x30 // link register .endm /* + * vma_vm_mm - get mm pointer from vma pointer (vma->vm_mm) + */ + .macro vma_vm_mm, rd, rn + ldr \rd, [\rn, #VMA_VM_MM] + .endm + +/* +* mmid - get context id from mm pointer (mm->context.id) +*/ + .macro mmid, rd, rn + ldr \rd, [\rn, #MM_CONTEXT_ID] + .endm + +/* +* dcache_line_size - get the minimum D-cache line size from the CTR register. +*/ + .macro dcache_line_size, reg, tmp + mrs \tmp, ctr_el0 // read CTR + ubfm \tmp, \tmp, #16, #19 // cache line size encoding + mov \reg, #4 // bytes per word + lsl \reg, \reg, \tmp // actual cache line size + .endm + +/* + * icache_line_size - get the minimum I-cache line size from the CTR register. + */ + .macro icache_line_size, reg, tmp + mrs \tmp, ctr_el0 // read CTR + and \tmp, \tmp, #0xf // cache line size encoding + mov \reg, #4 // bytes per word + lsl \reg, \reg, \tmp // actual cache line size + .endm + +/* + * tcr_set_idmap_t0sz - update TCR.T0SZ so that we can load the ID map + */ + .macro tcr_set_idmap_t0sz, valreg, tmpreg +#ifndef CONFIG_ARM64_VA_BITS_48 + ldr_l \tmpreg, idmap_t0sz + bfi \valreg, \tmpreg, #TCR_T0SZ_OFFSET, #TCR_TxSZ_WIDTH +#endif + .endm + +/* + * Macro to perform a data cache maintenance for the interval + * [kaddr, kaddr + size) + * + * op: operation passed to dc instruction + * domain: domain used in dsb instruciton + * kaddr: starting virtual address of the region + * size: size of the region + * Corrupts: kaddr, size, tmp1, tmp2 + */ + .macro dcache_by_line_op op, domain, kaddr, size, tmp1, tmp2 + dcache_line_size \tmp1, \tmp2 + add \size, \kaddr, \size + sub \tmp2, \tmp1, #1 + bic \kaddr, \kaddr, \tmp2 +9998: dc \op, \kaddr + add \kaddr, \kaddr, \tmp1 + cmp \kaddr, \size + b.lo 9998b + dsb \domain + .endm + +/* + * reset_pmuserenr_el0 - reset PMUSERENR_EL0 if PMUv3 present + */ + .macro reset_pmuserenr_el0, tmpreg + mrs \tmpreg, id_aa64dfr0_el1 // Check ID_AA64DFR0_EL1 PMUVer + sbfx \tmpreg, \tmpreg, #8, #4 + cmp \tmpreg, #1 // Skip if no PMU present + b.lt 9000f + msr pmuserenr_el0, xzr // Disable PMU access from EL0 +9000: + .endm + +/* * Annotate a function as position independent, i.e., safe to be called before * the kernel virtual mapping is activated. */
arch/arm64/mm/cache.S +0 -2
@@ -24,8 +24,6 @@ #include <asm/cpufeature.h> #include <asm/alternative.h> -#include "proc-macros.S" - /* * flush_icache_range(start,end) *
arch/arm64/mm/proc-macros.S deleted +0 -98
98 lines not on this page · raw message
arch/arm64/mm/proc.S +0 -3
@@ -23,13 +23,10 @@ #include <asm/assembler.h> #include <asm/asm-offsets.h> #include <asm/hwcap.h> -#include <asm/pgtable-hwdef.h> #include <asm/pgtable.h> #include <asm/cpufeature.h> #include <asm/alternative.h> -#include "proc-macros.S" - #ifdef CONFIG_ARM64_64K_PAGES #define TCR_TG_FLAGS TCR_TG0_64K | TCR_TG1_64K #elif defined(CONFIG_ARM64_16K_PAGES)
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 2/20 arm64: Cleanup SCTLR flags
In reply to Geoff LevandWe currently have macros defining flags for the arm64 sctlr registers in both kvm_arm.h and sysreg.h. To clean things up and simplify move the definitions of the SCTLR_EL2 flags from kvm_arm.h to sysreg.h, rename any SCTLR_EL1 or SCTLR_EL2 flags that are common to both registers to be SCTLR_ELx, with 'x' indicating a common flag, and fixup all files to include the proper header or to use the new macro names.
--- arch/arm64/include/asm/kvm_arm.h | 11 ----------- arch/arm64/include/asm/sysreg.h | 19 +++++++++++++++---- arch/arm64/kvm/hyp-init.S | 5 +++-- 3 files changed, 18 insertions(+), 17 deletions(-)
arch/arm64/include/asm/kvm_arm.h +0 -11
@@ -84,17 +84,6 @@#define HCR_INT_OVERRIDE (HCR_FMO | HCR_IMO)#define HCR_HOST_VHE_FLAGS (HCR_RW | HCR_TGE | HCR_E2H) -/* Hyp System Control Register (SCTLR_EL2) bits */ -#define SCTLR_EL2_EE (1 << 25) -#define SCTLR_EL2_WXN (1 << 19) -#define SCTLR_EL2_I (1 << 12) -#define SCTLR_EL2_SA (1 << 3) -#define SCTLR_EL2_C (1 << 2) -#define SCTLR_EL2_A (1 << 1) -#define SCTLR_EL2_M 1 -#define SCTLR_EL2_FLAGS (SCTLR_EL2_M | SCTLR_EL2_A | SCTLR_EL2_C | \ - SCTLR_EL2_SA | SCTLR_EL2_I) -/* TCR_EL2 Registers bits */ #define TCR_EL2_RES1 ((1 << 31) | (1 << 23))#define TCR_EL2_TBI (1 << 20)
arch/arm64/include/asm/sysreg.h +15 -4
@@ -86,10 +86,21 @@#define SET_PSTATE_UAO (x) __inst_arm(0xd5000000 | REG_PSTATE_UAO_IMM |\ (!!x)<<8 | 0x1f) -/* SCTLR_EL1 */ -#define SCTLR_EL1_CP15BEN (0x1 << 5) -#define SCTLR_EL1_SED (0x1 << 8) -#define SCTLR_EL1_SPAN (0x1 << 23) +/* Common SCTLR_ELx flags. */ +#define SCTLR_ELx_EE (1 << 25) +#define SCTLR_ELx_I (1 << 12) +#define SCTLR_ELx_SA (1 << 3) +#define SCTLR_ELx_C (1 << 2) +#define SCTLR_ELx_A (1 << 1) +#define SCTLR_ELx_M 1 + +#define SCTLR_ELx_FLAGS (SCTLR_ELx_M | SCTLR_ELx_A | SCTLR_ELx_C | \ + SCTLR_ELx_SA | SCTLR_ELx_I) + +/* SCTLR_EL1 specific flags. */ +#define SCTLR_EL1_SPAN (1 << 23) +#define SCTLR_EL1_SED (1 << 8) +#define SCTLR_EL1_CP15BEN (1 << 5)/* id_aa64isar0 */
arch/arm64/kvm/hyp-init.S +3 -2
@@ -21,6 +21,7 @@ #include <asm/kvm_arm.h> #include <asm/kvm_mmu.h> #include <asm/pgtable-hwdef.h> +#include <asm/sysreg.h> .text .pushsection .hyp.idmap.text, "ax"
@@ -103,8 +104,8 @@ __do_hyp_init: dsb sy mrs x4, sctlr_el2 - and x4, x4, #SCTLR_EL2_EE // preserve endianness of EL2 - ldr x5, =SCTLR_EL2_FLAGS + and x4, x4, #SCTLR_ELx_EE // preserve endianness of EL2 + ldr x5, =SCTLR_ELx_FLAGS orr x4, x4, x5 msr sctlr_el2, x4 isb
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 3/20 arm64: kvm: Move the do_el2_call macro to a header file
In reply to Geoff LevandFrom: James Morse <[email protected]>
The hyp-stub could make use of the do_el2_call(), move it to a header file.
--- arch/arm64/include/asm/virt.h | 18 +++++++++++++++++- arch/arm64/kvm/hyp/hyp-entry.S | 17 +---------------- 2 files changed, 18 insertions(+), 17 deletions(-)
arch/arm64/include/asm/virt.h +17 -1
@@ -21,7 +21,23 @@#define BOOT_CPU_MODE_EL1 (0xe11)#define BOOT_CPU_MODE_EL2 (0xe12) -#ifndef __ASSEMBLY__ +#ifdef __ASSEMBLY__ +.macro do_el2_call +/* +* Shuffle the parameters before calling the function +* pointed to in x0. Assumes parameters in x[1,2,3]. + */ + sub sp, sp, #16 + str lr, [sp] + mov lr, x0 + mov x0, x1 + mov x1, x2 + mov x2, x3 + blr lr + ldr lr, [sp] + add sp, sp, #16 +.endm +#else #include <asm/ptrace.h>
arch/arm64/kvm/hyp/hyp-entry.S +1 -16
@@ -23,6 +23,7 @@ #include <asm/kvm_arm.h> #include <asm/kvm_asm.h> #include <asm/kvm_mmu.h> +#include <asm/virt.h> .text .pushsection .hyp.text, "ax"
@@ -37,22 +38,6 @@ ldp x0, x1, [sp], #16 .endm -.macro do_el2_call - /* - * Shuffle the parameters before calling the function - * pointed to in x0. Assumes parameters in x[1,2,3]. - */ - sub sp, sp, #16 - str lr, [sp] - mov lr, x0 - mov x0, x1 - mov x1, x2 - mov x2, x3 - blr lr - ldr lr, [sp] - add sp, sp, #16 -.endm - ENTRY(__vhe_hyp_call) do_el2_call /*
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 4/20 arm64: kvm: Move lr save/restore from do_el2_call into EL1
In reply to Geoff LevandFrom: James Morse <[email protected]>
Today the 'hvc' calling kvm or the hyp-stub is expected to preserve all registers. Kvm saves/restores the registers it needs on the EL2 stack using do_el2_call. The hyp-stub has no stack, later patches need at least one register they can use.
Allow theses calls to clobber the link register, and add code to save/restore this register at the call sites.
--- arch/arm64/include/asm/virt.h | 4 ---- arch/arm64/kernel/hyp-stub.S | 10 ++++++++-- arch/arm64/kvm/hyp.S | 7 ++++++- arch/arm64/kvm/hyp/hyp-entry.S | 2 ++ 4 files changed, 16 insertions(+), 7 deletions(-)
arch/arm64/include/asm/virt.h +0 -4
@@ -27,15 +27,11 @@* Shuffle the parameters before calling the function * pointed to in x0. Assumes parameters in x[1,2,3]. */ - sub sp, sp, #16 - str lr, [sp]mov lr, x0 mov x0, x1 mov x1, x2 mov x2, x3 blr lr - ldr lr, [sp] - add sp, sp, #16 .endm #else
arch/arm64/kernel/hyp-stub.S +8 -2
@@ -101,10 +101,16 @@ ENDPROC(\label) */ ENTRY(__hyp_get_vectors) + str lr, [sp, #-16]! mov x0, xzr - // fall through -ENTRY(__hyp_set_vectors) hvc #0 + ldr lr, [sp], #16 ret ENDPROC(__hyp_get_vectors) + +ENTRY(__hyp_set_vectors) + str lr, [sp, #-16]! + hvc #0 + ldr lr, [sp], #16 + ret ENDPROC(__hyp_set_vectors)
arch/arm64/kvm/hyp.S +6 -1
@@ -38,13 +38,18 @@ * A function pointer with a value of 0 has a special meaning, and is * used to implement __hyp_get_vectors in the same way as in * arch/arm64/kernel/hyp_stub.S. + * HVC behaves as a 'bl' call and will clobber lr. */ ENTRY(__kvm_call_hyp) -alternative_if_not ARM64_HAS_VIRT_HOST_EXTN +alternative_if_not ARM64_HAS_VIRT_HOST_EXTN + str lr, [sp, #-16]! hvc #0 + ldr lr, [sp], #16 ret alternative_else b __vhe_hyp_call nop + nop + nop alternative_endif ENDPROC(__kvm_call_hyp)
arch/arm64/kvm/hyp/hyp-entry.S +2 -0
@@ -39,7 +39,9 @@ .endm ENTRY(__vhe_hyp_call) + str lr, [sp, #-16]! do_el2_call + ldr lr, [sp], #16 /* * We used to rely on having an exception return to get * an implicit isb. In the E2H case, we don't have it anymore.
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 5/20 arm64: hyp/kvm: Extend hyp-stub API to allow function calls at EL2
In reply to Geoff LevandThe existing arm64 hcall implementations are limited in that they only allow for two distinct hcalls; with the x0 register either zero or not zero. Also, the API of the hyp-stub exception vector routines and the KVM exception vector routines differ; hyp-stub uses a non-zero value in x0 to implement __hyp_set_vectors, whereas KVM uses it to implement kvm_call_hyp.
To allow for additional hcalls to be defined and to make the arm64 hcall API more consistent across exception vector routines, change the hcall implementations to reserve all x0 values below PAGE_SIZE for hcalls such as {s,g}et_vectors().
Define two new preprocessor macros HVC_GET_VECTORS, and HVC_SET_VECTORS to be used as hcall type specifiers and convert the existing __hyp_get_vectors() and __hyp_set_vectors() routines to use these new macros when executing an HVC call. Also, change the corresponding hyp-stub and KVM el1_sync exception vector routines to use these new macros.
[Merged two hcall patches, moved immediate value from esr to x0, use lr
as a scratch register]
--- arch/arm64/include/asm/virt.h | 16 ++++++++++++++++ arch/arm64/kernel/hyp-stub.S | 33 +++++++++++++++++++++++---------- arch/arm64/kvm/hyp.S | 4 ++-- arch/arm64/kvm/hyp/hyp-entry.S | 4 ++-- 4 files changed, 43 insertions(+), 14 deletions(-)
arch/arm64/include/asm/virt.h +16 -0
@@ -18,6 +18,22 @@#ifndef __ASM__VIRT_H#define __ASM__VIRT_H +/* +* The arm64 hcall implementation uses x0 to specify the hcall type. A value +* less than PAGE_SIZE indicates a special hcall, such as get/set vector. +* Any other value is used as a pointer to the function to call. +*/ + +/* HVC_GET_VECTORS - Return the value of the vbar_el2 register. */ +#define HVC_GET_VECTORS 0 + +/* +* HVC_SET_VECTORS - Set the value of the vbar_el2 register. +* +* @x0: Physical address of the new vector table. +*/ +#define HVC_SET_VECTORS 1 +#define BOOT_CPU_MODE_EL1 (0xe11)#define BOOT_CPU_MODE_EL2 (0xe12)
arch/arm64/kernel/hyp-stub.S +23 -10
@@ -22,6 +22,7 @@ #include <linux/irqchip/arm-gic-v3.h> #include <asm/assembler.h> +#include <asm/kvm_arm.h> #include <asm/ptrace.h> #include <asm/virt.h>
@@ -53,15 +54,25 @@ ENDPROC(__hyp_stub_vectors) .align 11 el1_sync: - mrs x1, esr_el2 - lsr x1, x1, #26 - cmp x1, #0x16 - b.ne 2f // Not an HVC trap - cbz x0, 1f - msr vbar_el2, x0 // Set vbar_el2 - b 2f -1: mrs x0, vbar_el2 // Return vbar_el2 -2: eret + mrs x30, esr_el2 + lsr x30, x30, #ESR_ELx_EC_SHIFT + + cmp x30, #ESR_ELx_EC_HVC64 + b.ne 9f // Not an HVC trap + + cmp x0, #HVC_GET_VECTORS + b.ne 1f + mrs x0, vbar_el2 + b 9f + +1: cmp x0, #HVC_SET_VECTORS + b.ne 2f + msr vbar_el2, x1 + b 9f + +2: do_el2_call + +9: eret ENDPROC(el1_sync) .macro invalid_vector label
@@ -102,7 +113,7 @@ ENDPROC(\label) ENTRY(__hyp_get_vectors) str lr, [sp, #-16]! - mov x0, xzr + mov x0, #HVC_GET_VECTORS hvc #0 ldr lr, [sp], #16 ret
@@ -110,6 +121,8 @@ ENDPROC(__hyp_get_vectors) ENTRY(__hyp_set_vectors) str lr, [sp, #-16]! + mov x1, x0 + mov x0, #HVC_SET_VECTORS hvc #0 ldr lr, [sp], #16 ret
arch/arm64/kvm/hyp.S +2 -2
@@ -35,8 +35,8 @@ * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c). Return values are * passed in x0. * - * A function pointer with a value of 0 has a special meaning, and is - * used to implement __hyp_get_vectors in the same way as in + * A function pointer with a value less than PAGE_SIZE has a special meaning, + * and is used to implement __hyp_get_vectors in the same way as in * arch/arm64/kernel/hyp_stub.S. * HVC behaves as a 'bl' call and will clobber lr. */
arch/arm64/kvm/hyp/hyp-entry.S +2 -2
@@ -71,8 +71,8 @@ alternative_endif /* Here, we're pretty sure the host called HVC. */ restore_x0_to_x3 - /* Check for __hyp_get_vectors */ - cbnz x0, 1f + cmp x0, #HVC_GET_VECTORS + b.ne 1f mrs x0, vbar_el2 b 2f
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 6/20 arm64: kvm: allows kvm cpu hotplug
In reply to Geoff LevandFrom: AKASHI Takahiro <[email protected]>
The current kvm implementation on arm64 does cpu-specific initialization at system boot, and has no way to gracefully shutdown a core in terms of kvm. This prevents kexec from rebooting the system at EL2.
This patch adds a cpu tear-down function and also puts an existing cpu-init code into a separate function, kvm_arch_hardware_disable() and kvm_arch_hardware_enable() respectively.
We don't need the arm64 specific cpu hotplug hook any more.
Since this patch modifies common code between arm and arm64, one stub definition, __cpu_reset_hyp_mode(), is added on arm side to avoid compilation errors.
[Rebase, added separate VHE init/exit path, changed resets use of
kvm_call_hyp() to the __version, en/disabled hardware in init_subsystems(), added icache maintenance to __kvm_hyp_reset() and removed lr restore]
--- arch/arm/include/asm/kvm_host.h | 10 ++- arch/arm/include/asm/kvm_mmu.h | 1 + arch/arm/kvm/arm.c | 128 +++++++++++++++++++++++--------------- arch/arm/kvm/mmu.c | 5 ++ arch/arm64/include/asm/kvm_asm.h | 1 + arch/arm64/include/asm/kvm_host.h | 13 +++- arch/arm64/include/asm/kvm_mmu.h | 1 + arch/arm64/kvm/hyp-init.S | 38 +++++++++++ arch/arm64/kvm/reset.c | 14 +++++ 9 files changed, 158 insertions(+), 53 deletions(-)
arch/arm/include/asm/kvm_host.h +9 -1
@@ -265,6 +265,15 @@ static inline void __cpu_init_stage2(void)kvm_call_hyp (__init_stage2_translation); } +static inline void __cpu_reset_hyp_mode (phys_addr_t boot_pgd_ptr, +phys_addr_t phys_idmap_start) +{ +/* +* TODO +* kvm_call_reset(boot_pgd_ptr, phys_idmap_start); +*/ +} +static inline int kvm_arch_dev_ioctl_check_extension (long ext) {return 0 ;
@@ -277,7 +286,6 @@ void kvm_mmu_wp_memory_region(struct kvm *kvm, int slot);struct kvm_vcpu *kvm_mpidr_to_vcpu (struct kvm *kvm,unsigned long mpidr); -static inline void kvm_arch_hardware_disable (void ) {}static inline void kvm_arch_hardware_unsetup (void ) {}static inline void kvm_arch_sync_events (struct kvm *kvm) {}static inline void kvm_arch_vcpu_uninit (struct kvm_vcpu *vcpu) {}
arch/arm/include/asm/kvm_mmu.h +1 -0
@@ -66,6 +66,7 @@ void kvm_mmu_free_memory_caches(struct kvm_vcpu *vcpu);phys_addr_t kvm_mmu_get_httbr (void );phys_addr_t kvm_mmu_get_boot_httbr (void );phys_addr_t kvm_get_idmap_vector (void ); +phys_addr_t kvm_get_idmap_start (void );int kvm_mmu_init (void );void kvm_clear_hyp_idmap (void );
arch/arm/kvm/arm.c +77 -51
223 lines not on this page · raw message
arch/arm/kvm/mmu.c +5 -0
@@ -1666,6 +1666,11 @@ phys_addr_t kvm_get_idmap_vector(void)return hyp_idmap_vector; } +phys_addr_t kvm_get_idmap_start (void ) +{ +return hyp_idmap_start; +} +int kvm_mmu_init (void ) {int err;
arch/arm64/include/asm/kvm_asm.h +1 -0
@@ -40,6 +40,7 @@ struct kvm_vcpu;extern char __kvm_hyp_init[];extern char __kvm_hyp_init_end[]; +extern char __kvm_hyp_reset[];extern char __kvm_hyp_vector[];
arch/arm64/include/asm/kvm_host.h +12 -1
@@ -46,6 +46,7 @@ int __attribute_const__ kvm_target_cpu(void);int kvm_reset_vcpu (struct kvm_vcpu *vcpu);int kvm_arch_dev_ioctl_check_extension (long ext); +phys_addr_t kvm_hyp_reset_entry (void );struct kvm_arch {/* The VMID generation used for the virt. memory system */
@@ -352,7 +353,17 @@ static inline void __cpu_init_hyp_mode(phys_addr_t boot_pgd_ptr, hyp_stack_ptr, vector_ptr); } -static inline void kvm_arch_hardware_disable (void ) {} +static inline void __cpu_reset_hyp_mode (phys_addr_t boot_pgd_ptr, +phys_addr_t phys_idmap_start) +{ +/* +* Call reset code, and switch back to stub hyp vectors. +* Uses __kvm_call_hyp() to avoid kaslr's kvm_ksym_ref() translation. +*/ +__kvm_call_hyp ((void *)kvm_hyp_reset_entry (), + boot_pgd_ptr, phys_idmap_start); +} +static inline void kvm_arch_hardware_unsetup (void ) {}static inline void kvm_arch_sync_events (struct kvm *kvm) {}static inline void kvm_arch_vcpu_uninit (struct kvm_vcpu *vcpu) {}
arch/arm64/include/asm/kvm_mmu.h +1 -0
@@ -109,6 +109,7 @@ void kvm_mmu_free_memory_caches(struct kvm_vcpu *vcpu);phys_addr_t kvm_mmu_get_httbr (void );phys_addr_t kvm_mmu_get_boot_httbr (void );phys_addr_t kvm_get_idmap_vector (void ); +phys_addr_t kvm_get_idmap_start (void );int kvm_mmu_init (void );void kvm_clear_hyp_idmap (void );
arch/arm64/kvm/hyp-init.S +38 -0
@@ -139,6 +139,44 @@ merged: eret ENDPROC(__kvm_hyp_init) + /* + * x0: HYP boot pgd + * x1: HYP phys_idmap_start + */ +ENTRY(__kvm_hyp_reset) + /* We're in trampoline code in VA, switch back to boot page tables */ + msr ttbr0_el2, x0 + isb + + /* Ensure the PA branch doesn't find a stale tlb entry or stale code. */ + ic iallu + tlbi alle2 + dsb sy + isb + + /* Branch into PA space */ + adr x0, 1f + bfi x1, x0, #0, #PAGE_SHIFT + br x1 + + /* We're now in idmap, disable MMU */ +1: mrs x0, sctlr_el2 + ldr x1, =SCTLR_ELx_FLAGS + bic x0, x0, x1 // Clear SCTL_M and etc + msr sctlr_el2, x0 + isb + + /* Invalidate the old TLBs */ + tlbi alle2 + dsb sy + + /* Install stub vectors */ + adr_l x0, __hyp_stub_vectors + msr vbar_el2, x0 + + eret +ENDPROC(__kvm_hyp_reset) + .ltorg .popsection
arch/arm64/kvm/reset.c +14 -0
@@ -29,7 +29,9 @@#include <asm/cputype.h> #include <asm/ptrace.h> #include <asm/kvm_arm.h> +#include <asm/kvm_asm.h> #include <asm/kvm_coproc.h> +#include <asm/kvm_mmu.h> /* * ARMv8 Reset Values
@@ -130,3 +132,15 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)/* Reset timer */ return kvm_timer_vcpu_reset (vcpu, cpu_vtimer_irq); } + +extern char __hyp_idmap_text_start[]; + +phys_addr_t kvm_hyp_reset_entry (void ) +{ +unsigned long offset; + + offset = (unsigned long )__kvm_hyp_reset + - ((unsigned long )__hyp_idmap_text_start &PAGE_MASK ); + +return TRAMPOLINE_VA + offset; +}
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 7/20 arm64: kernel: Include _AC definition in page.h
In reply to Geoff LevandFrom: James Morse <[email protected]>
page.h uses '_AC' in the definition of PAGE_SIZE, but doesn't include linux/const.h where this is defined. This produces build warnings when only asm/page.h is included by asm code.
--- arch/arm64/include/asm/page.h | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/include/asm/page.h +2 -0
@@ -19,6 +19,8 @@#ifndef __ASM_PAGE_H#define __ASM_PAGE_H +#include <linux/const.h> +/* PAGE_SHIFT determines the page size */ /* CONT_SHIFT determines the number of pages which can be tracked together */ #ifdef CONFIG_ARM64_64K_PAGES
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 8/20 arm64: Promote KERNEL_START/KERNEL_END definitions to a header file
In reply to Geoff LevandFrom: James Morse <[email protected]>
KERNEL_START and KERNEL_END are useful outside head.S, move them to a header file.
--- arch/arm64/include/asm/memory.h | 3 +++ arch/arm64/kernel/head.S | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm64/include/asm/memory.h +3 -0
@@ -71,6 +71,9 @@#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 4)) +#define KERNEL_START _text +#define KERNEL_END _end +/* * The size of the KASAN shadow region. This should be 1/8th of the * size of the entire kernel virtual address space.
arch/arm64/kernel/head.S +0 -3
@@ -51,9 +51,6 @@ #error TEXT_OFFSET must be less than 2MB #endif -#define KERNEL_START _text -#define KERNEL_END _end - /* * Kernel startup entry point. * ---------------------------
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 9/20 arm64: Add new asm macro copy_page
In reply to Geoff LevandKexec and hibernate need to copy pages of memory, but may not have all of the kernel mapped, and are unable to call copy_page().
Add a simplistic copy_page() macro, that can be inlined in these situations. lib/copy_page.S provides a bigger better version, but uses more registers.
--- arch/arm64/include/asm/assembler.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
arch/arm64/include/asm/assembler.h +19 -0
@@ -24,6 +24,7 @@#define __ASM_ASSEMBLER_H#include <asm/asm-offsets.h> +#include <asm/page.h> #include <asm/pgtable-hwdef.h> #include <asm/ptrace.h> #include <asm/thread_info.h>
@@ -292,6 +293,24 @@ lr .req x30 // link register .endm /* + * copy_page - copy src to dest using temp registers t1-t8 + */ + .macro copy_page dest:req src:req t1:req t2:req t3:req t4:req t5:req t6:req t7:req t8:req +9998: ldp \t1, \t2, [\src] + ldp \t3, \t4, [\src, #16] + ldp \t5, \t6, [\src, #32] + ldp \t7, \t8, [\src, #48] + add \src, \src, #64 + stnp \t1, \t2, [\dest] + stnp \t3, \t4, [\dest, #16] + stnp \t5, \t6, [\dest, #32] + stnp \t7, \t8, [\dest, #48] + add \dest, \dest, #64 + tst \src, #(PAGE_SIZE - 1) + b.ne 9998b + .endm + +/* * Annotate a function as position independent, i.e., safe to be called before * the kernel virtual mapping is activated. */
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 10/20 arm64: head.S: el2_setup() to accept sctlr_el1 as an argument
In reply to Geoff LevandFrom: James Morse <[email protected]>
el2_setup() doesn't just configure el2, it configures el1 too. This means we can't use it to re-configure el2 after resume from hibernate, as we will be returned to el1 with the MMU turned off.
Split the sctlr_el1 setting code up, so that el2_setup() accepts an initial value as an argument. This value will be ignored if el2_setup() is called at el1: the running value will be preserved with endian correction.
Hibernate can now call el2_setup() to re-configure el2, passing the current sctlr_el1 as an argument.
--- arch/arm64/include/asm/assembler.h | 10 ++++++++++ arch/arm64/kernel/head.S | 19 ++++++++++++------- arch/arm64/kernel/sleep.S | 1 + 3 files changed, 23 insertions(+), 7 deletions(-)
arch/arm64/include/asm/assembler.h +10 -0
@@ -311,6 +311,16 @@ lr .req x30 // link register .endm /* + * Generate the initial sctlr_el1 value for el2_setup to set if we boot at EL2. + */ + .macro init_sctlr_el1 reg + mov \reg, #0x0800 // Set/clear RES{1,0} bits +CPU_BE( movk \reg, #0x33d0, lsl #16) // Set EE and E0E on BE systems +CPU_LE( movk \reg, #0x30d0, lsl #16) // Clear EE and E0E on LE systems + .endm + +/* +* Annotate a function as position independent, i.e., safe to be called before * the kernel virtual mapping is activated. */
arch/arm64/kernel/head.S +12 -7
@@ -208,6 +208,7 @@ section_table: ENTRY(stext) bl preserve_boot_args + init_sctlr_el1 x0 bl el2_setup // Drop to EL1, w20=cpu_boot_mode mov x23, xzr // KASLR offset, defaults to 0 adrp x24, __PHYS_OFFSET
@@ -514,8 +515,12 @@ ENTRY(kimage_vaddr) * * Returns either BOOT_CPU_MODE_EL1 or BOOT_CPU_MODE_EL2 in x20 if * booted in EL1 or EL2 respectively. + * + * If booted in EL2, SCTLR_EL1 will be initialised with the value in x0 + * (otherwise the existing value will be preserved, with endian correction). */ ENTRY(el2_setup) + mov x1, x0 // preserve passed-in sctlr_el1 mrs x0, CurrentEL cmp x0, #CurrentEL_EL2 b.ne 1f
@@ -524,7 +529,7 @@ CPU_BE( orr x0, x0, #(1 << 25) ) // Set the EE bit for EL2 CPU_LE( bic x0, x0, #(1 << 25) ) // Clear the EE bit for EL2 msr sctlr_el2, x0 b 2f -1: mrs x0, sctlr_el1 +1: mrs x0, sctlr_el1 // ignore passed-in sctlr_el1 CPU_BE( orr x0, x0, #(3 << 24) ) // Set the EE and E0E bits for EL1 CPU_LE( bic x0, x0, #(3 << 24) ) // Clear the EE and E0E bits for EL1 msr sctlr_el1, x0
@@ -578,6 +583,10 @@ set_hcr: 3: #endif + /* use sctlr_el1 value we were provided with */ +CPU_BE( orr x1, x1, #(3 << 24) ) // Set the EE and E0E bits for EL1 +CPU_LE( bic x1, x1, #(3 << 24) ) // Clear the EE and E0E bits for EL1 + msr sctlr_el1, x1 /* Populate ID registers. */ mrs x0, midr_el1
@@ -585,12 +594,6 @@ set_hcr: msr vpidr_el2, x0 msr vmpidr_el2, x1 - /* sctlr_el1 */ - mov x0, #0x0800 // Set/clear RES{1,0} bits -CPU_BE( movk x0, #0x33d0, lsl #16 ) // Set EE and E0E on BE systems -CPU_LE( movk x0, #0x30d0, lsl #16 ) // Clear EE and E0E on LE systems - msr sctlr_el1, x0 - /* Coprocessor traps. */ mov x0, #0x33ff msr cptr_el2, x0 // Disable copro. traps to EL2
@@ -667,6 +670,7 @@ ENTRY(__boot_cpu_mode) * cores are held until we're ready for them to initialise. */ ENTRY(secondary_holding_pen) + init_sctlr_el1 x0 bl el2_setup // Drop to EL1, w20=cpu_boot_mode bl set_cpu_boot_mode_flag mrs x0, mpidr_el1
@@ -685,6 +689,7 @@ ENDPROC(secondary_holding_pen) * be used where CPUs are brought online dynamically by the kernel. */ ENTRY(secondary_entry) + init_sctlr_el1 x0 bl el2_setup // Drop to EL1 bl set_cpu_boot_mode_flag b secondary_startup
arch/arm64/kernel/sleep.S +1 -0
@@ -160,6 +160,7 @@ cpu_resume_after_mmu: ENDPROC(cpu_resume_after_mmu) ENTRY(cpu_resume) + init_sctlr_el1 x0 bl el2_setup // if in EL2 drop to EL1 cleanly mrs x1, mpidr_el1 adrp x8, mpidr_hash
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 11/20 arm64: Add back cpu_reset routines
In reply to Geoff LevandCommit 68234df4ea7939f98431aa81113fbdce ("arm64: kill flush_cache_all()") removed the global arm64 routines cpu_reset() and cpu_soft_restart() needed by the arm64 kexec and kdump support. Add simplified versions of those two routines back with some changes needed for kexec in the new files cpu_reset.S, and cpu_reset.h.
When a CPU is reset it needs to be put into the exception level it had when it entered the kernel. Update cpu_reset() to accept an argument which signals if the reset address needs to be entered at EL1 or EL2.
--- arch/arm64/kernel/cpu-reset.S | 57 +++++++++++++++++++++++++++++++++++++++++++ arch/arm64/kernel/cpu-reset.h | 30 +++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 arch/arm64/kernel/cpu-reset.S create mode 100644 arch/arm64/kernel/cpu-reset.h
arch/arm64/kernel/cpu-reset.S new file +57 -0
@@ -0,0 +1,57 @@ +/* + * CPU reset routines + * + * Copyright (C) 2001 Deep Blue Solutions Ltd. + * Copyright (C) 2012 ARM Ltd. + * Copyright (C) 2015 Huawei Futurewei Technologies. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <linux/linkage.h> +#include <asm/assembler.h> +#include <asm/sysreg.h> +#include <asm/virt.h> + +.text +.pushsection .idmap.text, "ax" + +/* + * __cpu_soft_restart(el2_switch, entry, arg0, arg1, arg2) - Helper for + * cpu_soft_restart. + * + * @el2_switch: Flag to indicate a swich to EL2 is needed. + * @entry: Location to jump to for soft reset. + * arg0: First argument passed to @entry. + * arg1: Second argument passed to @entry. + * arg2: Third argument passed to @entry. + * + * Put the CPU into the same state as it would be if it had been reset, and + * branch to what would be the reset vector. It must be executed with the + * flat identity mapping. + */ +ENTRY(__cpu_soft_restart) + /* Clear sctlr_el1 flags. */ + mrs x12, sctlr_el1 + ldr x13, =SCTLR_ELx_FLAGS + bic x12, x12, x13 + msr sctlr_el1, x12 + isb + + cbz x0, 1f // el2_switch? + mov x0, x1 // entry + mov x1, x2 // arg0 + mov x2, x3 // arg1 + mov x3, x4 // arg2 + hvc #0 // no return + +1: mov x18, x1 // entry + mov x0, x2 // arg0 + mov x1, x3 // arg1 + mov x2, x4 // arg2 + ret x18 +ENDPROC(__cpu_soft_restart) + +.popsection
arch/arm64/kernel/cpu-reset.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* CPU reset routines +* +* Copyright (C) 2015 Huawei Futurewei Technologies. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef _ARM64_CPU_RESET_H +#define _ARM64_CPU_RESET_H + +#include <asm/virt.h> + +void __cpu_soft_restart (unsigned long el2_switch,unsigned long entry, +unsigned long arg0,unsigned long arg1,unsigned long arg2); + +static inline void __noreturn cpu_soft_restart (unsigned long el2_switch, +unsigned long entry,unsigned long arg0,unsigned long arg1, +unsigned long arg2) +{ +typeof (__cpu_soft_restart) *restart; + + restart = (void *)virt_to_phys (__cpu_soft_restart); +restart (el2_switch, entry, arg0, arg1, arg2); +unreachable (); +} + +#endif
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 12/20 arm64/kexec: Add core kexec support
In reply to Geoff LevandAdd three new files, kexec.h, machine_kexec.c and relocate_kernel.S to the arm64 architecture that add support for the kexec re-boot mechanism (CONFIG_KEXEC) on arm64 platforms.
--- arch/arm64/Kconfig | 10 +++ arch/arm64/include/asm/kexec.h | 48 +++++++++++ arch/arm64/kernel/Makefile | 2 + arch/arm64/kernel/machine_kexec.c | 159 ++++++++++++++++++++++++++++++++++++ arch/arm64/kernel/relocate_kernel.S | 131 +++++++++++++++++++++++++++++ include/uapi/linux/kexec.h | 1 + 6 files changed, 351 insertions(+) create mode 100644 arch/arm64/include/asm/kexec.h create mode 100644 arch/arm64/kernel/machine_kexec.c create mode 100644 arch/arm64/kernel/relocate_kernel.S
arch/arm64/Kconfig +10 -0
@@ -618,6 +618,16 @@ config PARAVIRT_TIME_ACCOUNTING If in doubt, say N here. +config KEXEC + depends on PM_SLEEP_SMP + select KEXEC_CORE + bool "kexec system call" + ---help--- + kexec is a system call that implements the ability to shutdown your + current kernel, and to start another kernel. It is like a reboot + but it is independent of the system firmware. And like a reboot + you can start any kernel with it, not just Linux. + config XEN_DOM0 def_bool y depends on XEN
arch/arm64/include/asm/kexec.h new file +48 -0
48 lines not on this page · raw message
arch/arm64/kernel/Makefile +2 -0
@@ -45,6 +45,8 @@ arm64-obj-$(CONFIG_ACPI) += acpi.o arm64-obj-$(CONFIG_ARM64_ACPI_PARKING_PROTOCOL) += acpi_parking_protocol.o arm64-obj-$(CONFIG_PARAVIRT) += paravirt.o arm64-obj-$(CONFIG_RANDOMIZE_BASE) += kaslr.o +arm64-obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o \ + cpu-reset.o obj-y += $(arm64-obj-y) vdso/ obj-m += $(arm64-obj-m)
arch/arm64/kernel/machine_kexec.c new file +159 -0
159 lines not on this page · raw message
arch/arm64/kernel/relocate_kernel.S new file +131 -0
131 lines not on this page · raw message
include/uapi/linux/kexec.h +1 -0
@@ -39,6 +39,7 @@#define KEXEC_ARCH_SH (42 << 16)#define KEXEC_ARCH_MIPS_LE (10 << 16)#define KEXEC_ARCH_MIPS ( 8 << 16) +#define KEXEC_ARCH_AARCH64 (183 << 16)/* The artificial cap on the number of segments passed to kexec_load. */ #define KEXEC_SEGMENT_MAX 16
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 13/20 arm64/kexec: Enable kexec in the arm64 defconfig
In reply to Geoff Levand--- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
@@ -68,6 +68,7 @@ CONFIG_KSM=y CONFIG_TRANSPARENT_HUGEPAGE=y CONFIG_CMA=y CONFIG_XEN=y +CONFIG_KEXEC=y # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set CONFIG_COMPAT=y CONFIG_CPU_IDLE=y
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 14/20 arm64/kexec: Add pr_debug output
In reply to Geoff LevandTo aid in debugging kexec problems or when adding new functionality to kexec add a new routine kexec_image_info() and several inline pr_debug statements.
--- arch/arm64/kernel/machine_kexec.c | 67 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 2 deletions(-)
arch/arm64/kernel/machine_kexec.c +65 -2
@@ -11,6 +11,7 @@#include <linux/highmem.h> #include <linux/kexec.h> +#include <linux/libfdt_env.h> #include <linux/of_fdt.h> #include <linux/slab.h> #include <linux/uaccess.h>
@@ -27,6 +28,47 @@ extern const unsigned long arm64_relocate_new_kernel_size;static unsigned long kimage_start; +/** +* kexec_is_dtb - Helper routine to check the device tree header signature. +*/ +static bool kexec_is_dtb (const void *dtb) +{ +__be32 magic; + +if (get_user (magic, (__be32 *)dtb)) +return false; + +return fdt32_to_cpu (magic) ==OF_DT_HEADER ; +} + +/** +* kexec_image_info - For debugging output. +*/ +#define kexec_image_info (_i) _kexec_image_info(__func__, __LINE__, _i) +static void _kexec_image_info (const char *func,int line, +const struct kimage *kimage) +{ +unsigned long i; + +pr_debug ("%s:%d:\n" , func, line); +pr_debug (" kexec kimage info:\n" ); +pr_debug (" type: %d\n" , kimage->type); +pr_debug (" start: %lx\n" , kimage->start); +pr_debug (" head: %lx\n" , kimage->head); +pr_debug (" nr_segments: %lu\n" , kimage->nr_segments); + +for (i =0 ; i < kimage->nr_segments; i++) { +pr_debug (" segment[%lu]: %016lx - %016lx, 0x%lx bytes, %lu pages%s\n" , + i, + kimage->segment[i].mem, + kimage->segment[i].mem + kimage->segment[i].memsz, + kimage->segment[i].memsz, + kimage->segment[i].memsz /PAGE_SIZE , + (kexec_is_dtb (kimage->segment[i].buf) ? +", dtb segment" :"" )); + } +} +void machine_kexec_cleanup (struct kimage *kimage) {/* Empty routine needed to avoid build errors. */
@@ -40,6 +82,8 @@ void machine_kexec_cleanup(struct kimage *kimage)int machine_kexec_prepare (struct kimage *kimage) { kimage_start = kimage->start; +kexec_image_info (kimage); +return 0 ; }
@@ -82,10 +126,10 @@ static void kexec_segment_flush(const struct kimage *kimage) {unsigned long i; -pr_devel ("%s:\n" , __func__); +pr_debug ("%s:\n" , __func__);for (i =0 ; i < kimage->nr_segments; i++) { - pr_devel(" segment[%lu]: %016lx - %016lx, %lx bytes, %lu pages\n", + pr_debug(" segment[%lu]: %016lx - %016lx, 0x%lx bytes, %lu pages\n", i, kimage->segment[i].mem, kimage->segment[i].mem + kimage->segment[i].memsz,
@@ -112,6 +156,25 @@ void machine_kexec(struct kimage *kimage) reboot_code_buffer_phys =page_to_phys (kimage->control_code_page); reboot_code_buffer =kmap (kimage->control_code_page); +kexec_image_info (kimage); + +pr_debug ("%s:%d: control_code_page: %p\n" , __func__, __LINE__, + kimage->control_code_page); +pr_debug ("%s:%d: reboot_code_buffer_phys: %pa\n" , __func__, __LINE__, + &reboot_code_buffer_phys); +pr_debug ("%s:%d: reboot_code_buffer: %p\n" , __func__, __LINE__, + reboot_code_buffer); +pr_debug ("%s:%d: relocate_new_kernel: %p\n" , __func__, __LINE__, + arm64_relocate_new_kernel); +pr_debug ("%s:%d: relocate_new_kernel_size: 0x%lx(%lu) bytes\n" , + __func__, __LINE__, arm64_relocate_new_kernel_size, + arm64_relocate_new_kernel_size); + +pr_debug ("%s:%d: kimage_head: %lx\n" , __func__, __LINE__, + kimage->head); +pr_debug ("%s:%d: kimage_start: %lx\n" , __func__, __LINE__, + kimage_start); +/* * Copy arm64_relocate_new_kernel to the reboot_code_buffer for use * after the kernel is shut down.
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 15/20 arm64: kdump: reserve memory for crash dump kernel
In reply to Geoff LevandFrom: AKASHI Takahiro <[email protected]>
On the startup of primary kernel, the memory region used by crash dump kernel must be specified by "crashkernel=" kernel parameter. reserve_crashkernel() will allocate and reserve the region for later use.
User space tools, like kexec-tools, will be able to find that region marked as "Crash kernel" in /proc/iomem.
--- arch/arm64/kernel/setup.c | 7 +++++- arch/arm64/mm/init.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-)
arch/arm64/kernel/setup.c +6 -1
@@ -31,7 +31,6 @@#include <linux/screen_info.h> #include <linux/init.h> #include <linux/kexec.h> -#include <linux/crash_dump.h> #include <linux/root_dev.h> #include <linux/cpu.h> #include <linux/interrupt.h>
@@ -222,6 +221,12 @@ static void __init request_standard_resources(void) kernel_data.end <= res->end)request_resource (res, &kernel_data); } + +#ifdef CONFIG_KEXEC_CORE +/* User space tools will find "Crash kernel" region in /proc/iomem. */ +if (crashk_res.end) +insert_resource (&iomem_resource, &crashk_res); +#endif }#ifdef CONFIG_BLK_DEV_INITRD
arch/arm64/mm/init.c +60 -0
78 lines not on this page · raw message
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 16/20 arm64: limit memory regions based on DT property, usable-memory
In reply to Geoff LevandFrom: AKASHI Takahiro <[email protected]>
Crash dump kernel will be run with a limited range of memory as System RAM.
On arm64, we will use a device-tree property under /chosen,
linux,usable-memory = <BASE SIZE>
in order for primary kernel either on uefi or non-uefi (device tree only) system to hand over the information about usable memory region to crash dump kernel. This property will supercede entries in uefi memory map table and "memory" nodes in a device tree.
--- arch/arm64/mm/init.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
arch/arm64/mm/init.c +38 -0
@@ -224,10 +224,48 @@ static int __init early_mem(char *p) }early_param ("mem" , early_mem); +static int __init early_init_dt_scan_usablemem (unsigned long node, +const char *uname,int depth,void *data) +{ +struct memblock_region *usablemem = (struct memblock_region *)data; +const __be32 *reg; +int len; + + usablemem->size =0 ; + +if (depth !=1 ||strcmp (uname,"chosen" ) !=0 ) +return 0 ; + + reg =of_get_flat_dt_prop (node,"linux,usable-memory" , &len); +if (!reg || (len < (dt_root_addr_cells + dt_root_size_cells))) +return 1 ; + + usablemem->base =dt_mem_next_cell (dt_root_addr_cells, ®); + usablemem->size =dt_mem_next_cell (dt_root_size_cells, ®); + +return 1 ; +} + +static void __init fdt_enforce_memory_region (void ) +{ +struct memblock_region reg; + +of_scan_flat_dt (early_init_dt_scan_usablemem, ®); + +if (reg.size) { +memblock_remove (0 ,PAGE_ALIGN (reg.base)); +memblock_remove (round_down (reg.base + reg.size,PAGE_SIZE ), +ULLONG_MAX ); + } +} +void __init arm64_memblock_init (void ) {const s64 linear_region_size = -(s64 )PAGE_OFFSET ; +/* Handle linux,usable-memory property */ +fdt_enforce_memory_region (); +/* * Ensure that the linear region takes up exactly half of the kernel * virtual address space. This way, we can distinguish a linear address
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 17/20 arm64: kdump: implement machine_crash_shutdown()
In reply to Geoff LevandFrom: AKASHI Takahiro <[email protected]>
Primary kernel calls machine_crash_shutdown() to shut down non-boot cpus and save registers' status in per-cpu ELF notes before starting crash dump kernel. See kernel_kexec().
Even if not all secondary cpus have shut down, we do kdump anyway.
As we don't have to make non-boot(crashed) cpus offline (to preserve correct status of cpus at crash dump) before shutting down, this patch also adds a variant of smp_send_stop().
--- arch/arm64/include/asm/hardirq.h | 2 +- arch/arm64/include/asm/kexec.h | 32 +++++++++++++++++++- arch/arm64/include/asm/smp.h | 4 +++ arch/arm64/kernel/machine_kexec.c | 56 ++++++++++++++++++++++++++++++++-- arch/arm64/kernel/smp.c | 63 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 152 insertions(+), 5 deletions(-)
arch/arm64/include/asm/hardirq.h +1 -1
@@ -20,7 +20,7 @@#include <linux/threads.h> #include <asm/irq.h> -#define NR_IPI 6 +#define NR_IPI 7 typedef struct { unsigned int __softirq_pending;
arch/arm64/include/asm/kexec.h +31 -1
@@ -40,7 +40,37 @@static inline void crash_setup_regs (struct pt_regs *newregs,struct pt_regs *oldregs) { -/* Empty routine needed to avoid build errors. */ +if (oldregs) { +memcpy (newregs, oldregs,sizeof (*newregs)); + }else { + __asm__ __volatile__ ( +"stp x0, x1, [%3, #16 * 0]\n" +"stp x2, x3, [%3, #16 * 1]\n" +"stp x4, x5, [%3, #16 * 2]\n" +"stp x6, x7, [%3, #16 * 3]\n" +"stp x8, x9, [%3, #16 * 4]\n" +"stp x10, x11, [%3, #16 * 5]\n" +"stp x12, x13, [%3, #16 * 6]\n" +"stp x14, x15, [%3, #16 * 7]\n" +"stp x16, x17, [%3, #16 * 8]\n" +"stp x18, x19, [%3, #16 * 9]\n" +"stp x20, x21, [%3, #16 * 10]\n" +"stp x22, x23, [%3, #16 * 11]\n" +"stp x24, x25, [%3, #16 * 12]\n" +"stp x26, x27, [%3, #16 * 13]\n" +"stp x28, x29, [%3, #16 * 14]\n" +"str x30, [%3, #16 * 15]\n" +"mov %0, sp\n" +"adr %1, 1f\n" +"mrs %2, spsr_el1\n" +"1:" + :"=r" (newregs->sp), +"=r" (newregs->pc), +"=r" (newregs->pstate) + :"r" (&newregs->regs) + :"memory" + ); + } }#endif /* __ASSEMBLY__ */
arch/arm64/include/asm/smp.h +4 -0
@@ -113,6 +113,10 @@ static inline void update_cpu_boot_status(int val)dsb (ishst); } +#ifdef CONFIG_KEXEC_CORE +extern void smp_send_crash_stop (void ); +#endif +#endif /* ifndef __ASSEMBLY__ */ #endif /* ifndef __ASM_SMP_H */
arch/arm64/kernel/machine_kexec.c +53 -3
85 lines not on this page · raw message
arch/arm64/kernel/smp.c +63 -0
99 lines not on this page · raw message
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 18/20 arm64: kdump: add kdump support
In reply to Geoff LevandFrom: AKASHI Takahiro <[email protected]>
On crash dump kernel, all the information about primary kernel's system memory (core image) is available in elf core header.
The primary kernel will set aside this header with reserve_elfcorehdr() at boot time and inform crash dump kernel of its location via a new device-tree property, "linux,elfcorehdr".
Please note that all other architectures use traditional "elfcorehdr=" kernel parameter for this purpose.
Then crash dump kernel will access the primary kernel's memory with copy_oldmem_page(), which reads one page by ioremap'ing it since it does not reside in linear mapping on crash dump kernel.
We also need our own elfcorehdr_read() here since the header is placed within crash dump kernel's usable memory.
--- arch/arm64/Kconfig | 11 +++++++ arch/arm64/kernel/Makefile | 1 + arch/arm64/kernel/crash_dump.c | 71 ++++++++++++++++++++++++++++++++++++++++++ arch/arm64/mm/init.c | 54 ++++++++++++++++++++++++++++++++ 4 files changed, 137 insertions(+) create mode 100644 arch/arm64/kernel/crash_dump.c
arch/arm64/Kconfig +11 -0
@@ -628,6 +628,17 @@ config KEXEC but it is independent of the system firmware. And like a reboot you can start any kernel with it, not just Linux. +config CRASH_DUMP + bool "Build kdump crash kernel" + help + Generate crash dump after being started by kexec. This should + be normally only set in special crash dump kernels which are + loaded in the main kernel with kexec-tools into a specially + reserved region and then later executed after a crash by + kdump/kexec. + + For more details see Documentation/kdump/kdump.txt + config XEN_DOM0 def_bool y depends on XEN
arch/arm64/kernel/Makefile +1 -0
@@ -47,6 +47,7 @@ arm64-obj-$(CONFIG_PARAVIRT) += paravirt.o arm64-obj-$(CONFIG_RANDOMIZE_BASE) += kaslr.o arm64-obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o \ cpu-reset.o +arm64-obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-y += $(arm64-obj-y) vdso/ obj-m += $(arm64-obj-m)
arch/arm64/kernel/crash_dump.c new file +71 -0
71 lines not on this page · raw message
arch/arm64/mm/init.c +54 -0
72 lines not on this page · raw message
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 19/20 arm64: kdump: enable kdump in the arm64 defconfig
In reply to Geoff LevandFrom: AKASHI Takahiro <[email protected]>
--- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
@@ -69,6 +69,7 @@ CONFIG_TRANSPARENT_HUGEPAGE=y CONFIG_CMA=y CONFIG_XEN=y CONFIG_KEXEC=y +CONFIG_CRASH_DUMP=y # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set CONFIG_COMPAT=y CONFIG_CPU_IDLE=y
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v16 20/20 arm64: kdump: update a kernel doc
In reply to Geoff LevandFrom: AKASHI Takahiro <[email protected]>
This patch adds arch specific descriptions about kdump usage on arm64 to kdump.txt.
--- Documentation/kdump/kdump.txt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
Documentation/kdump/kdump.txt +14 -1
@@ -18,7 +18,7 @@ memory image to a dump file on the local disk, or across the network to a remote system. Kdump and kexec are currently supported on the x86, x86_64, ppc64, ia64, -s390x and arm architectures. +s390x, arm and arm64 architectures. When the system kernel boots, it reserves a small section of memory for the dump-capture kernel. This ensures that ongoing Direct Memory Access
@@ -249,6 +249,12 @@ Dump-capture kernel config options (Arch Dependent, arm) AUTO_ZRELADDR=y +Dump-capture kernel config options (Arch Dependent, arm64) +---------------------------------------------------------- + +1) Currently, kvm will not be enabled on the dump-capture kernel even + if it is configured. + Extended crashkernel syntax ===========================
@@ -312,6 +318,8 @@ Boot into System Kernel any space below the alignment point may be overwritten by the dump-capture kernel, which means it is possible that the vmcore is not that precise as expected. + On arm64, use "crashkernel=Y[@X]". Note that the start address of + the kernel, X if explicitly specified, must be aligned to 2MiB (0x200000). Load the Dump-capture Kernel ============================
@@ -334,6 +342,8 @@ For s390x: - Use image or bzImage For arm: - Use zImage +For arm64: + - Use vmlinux or Image If you are using a uncompressed vmlinux image then use following command to load dump-capture kernel.
@@ -377,6 +387,9 @@ For s390x: For arm: "1 maxcpus=1 reset_devices" +For arm64: + "1 maxcpus=1 reset_devices" + Notes on loading the dump-capture kernel: * By default, the ELF headers are stored in ELF64 format to support
Signature · 7 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Hello Geoff,
Quoted 4 lines · Geoff Levand
This series adds the core support for kexec re-boot and kdump on ARM64. This version of the series combines Takahiro's kdump patches with my kexec patches. Please consider all patches for inclusion.
Quoted 8 lines
To load a second stage kernel and execute a kexec re-boot or to work with kdump on ARM64 systems a series of patches to kexec-tools [2], which have not yet been merged upstream, are needed. Please update to the latest if you have been using an older version.
To examine vmcore (
/proc/vmcore), you should use
- gdb v7.7 or later
- crash v7.1.1 or later
I have been trying to use crash dump with your branch without much success on juno-r2:
WARNING: could not find MAGIC_START!
crash: cannot determine base kernel version
crash: /root/vmlinux and /root/coredump.kernel do not match!
Looking at the debug log (-p 5), the translation va -> pa computed by crash is wrong.
The physical address expected is 0x80a76b28, but crash return 0x88a76b28.
I am using crash built from [1] and the panic has been created using /proc/sysrq-trigger.
Also, crash dump seems to always report that Xen is running even when KVM was in used (see logs [2]) below.
Lastly, crash fails with an error after a couple of minutes (see logs [2]).
How you seen such errors during your testing?
Regards,
[1] https://github.com/crash-utility/crash
[2] http://pastebin.com/wC8w44SN
Signature · 6 lines
Julien Grall _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
[+Ard]
Hi Julien,
Thank you for reporting this issue.
Quoted 19 lines · Julien Grall
Hello Geoff,
Quoted 4 lines · Geoff Levand
This series adds the core support for kexec re-boot and kdump on ARM64. This version of the series combines Takahiro's kdump patches with my kexec patches. Please consider all patches for inclusion.
Quoted 8 lines
To load a second stage kernel and execute a kexec re-boot or to work with kdump on ARM64 systems a series of patches to kexec-tools [2], which have not yet been merged upstream, are needed. Please update to the latest if you have been using an older version.
To examine vmcore (
/proc/vmcore), you should use
- gdb v7.7 or later
- crash v7.1.1 or laterI have been trying to use crash dump with your branch without much success on juno-r2:
Quoted 8 lines
WARNING: could not find
MAGIC_START!
crash: cannot determine base kernel version
crash:/root/vmlinuxand/root/coredump.kerneldo not match!Looking at the debug log (-p 5), the translation va -> pa computed by crash is wrong.
The physical address expected is
0x80a76b28, but crash return0x88a76b28.
Yeah, this is due to Ard's KASLR patches (especially, f9040773b7bb: "arm64:
move kernel image to base of vmalloc area").
Now that the kernel image (and so all the kernel symbols) is located in the vmalloc area, which is below PAGE_OFFSET, we can't use liner mapping conversion for va -> pa in order to access kernel data in the core image.
I'm sure that the image (/proc/vmcore) is still sane, and we will have to fix a user-space tool, i.e. crash.
The good news is that I've already confirmed that we could read the core image successfully by adding a bit nasty hack to the tool.
I'll let you know once a refined patch gets ready.
Thanks for your patience,
-Takahiro AKASHI
Quoted 6 lines
I am using crash built from [1] and the panic has been created using
/proc/sysrq-trigger.Also, crash dump seems to always report that Xen is running even when KVM was in used (see logs [2]) below.
Quoted 11 lines
Lastly, crash fails with an error after a couple of minutes (see logs [2]).
How you seen such errors during your testing?
Regards,
[1] https://github.com/crash-utility/crash
[2] http://pastebin.com/wC8w44SNSignature · 1 line
Julien Grall
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec