Re: [PATCH v15 06/16] of/fdt: add helper functions for handling properties

2018-09-28 Thread Frank Rowand
On 09/28/18 06:44, Rob Herring wrote: > +David Gibson > > On Fri, Sep 28, 2018 at 1:48 AM AKASHI Takahiro > wrote: >> >> These functions will be used later to handle kexec-specific properties >> in arm64's kexec_file implementation. As I requested in version 14: The intent of the helper

Re: [PATCH 3/3] resource: Fix find_next_iomem_res() iteration issue

2018-09-28 Thread Borislav Petkov
On Thu, Sep 27, 2018 at 09:22:09AM -0500, Bjorn Helgaas wrote: > From: Bjorn Helgaas > > Previously find_next_iomem_res() used "*res" as both an input parameter for > the range to search and the type of resource to search for, and an output > parameter for the resource we found, which makes the

Re: [PATCH 2/3] resource: Include resource end in walk_*() interfaces

2018-09-28 Thread Borislav Petkov
On Thu, Sep 27, 2018 at 09:22:02AM -0500, Bjorn Helgaas wrote: > From: Bjorn Helgaas > > find_next_iomem_res() finds an iomem resource that covers part of a range > described by "start, end". All callers expect that range to be inclusive, > i.e., both start and end are included, but

Re: [PATCH v15 06/16] of/fdt: add helper functions for handling properties

2018-09-28 Thread Rob Herring
+David Gibson On Fri, Sep 28, 2018 at 1:48 AM AKASHI Takahiro wrote: > > These functions will be used later to handle kexec-specific properties > in arm64's kexec_file implementation. > > Signed-off-by: AKASHI Takahiro > Cc: Rob Herring > Cc: Frank Rowand > Cc: devicet...@vger.kernel.org >

Re: [PATCH 1/3] x86/kexec: Correct KEXEC_BACKUP_SRC_END off-by-one error

2018-09-28 Thread Borislav Petkov
On Thu, Sep 27, 2018 at 09:21:55AM -0500, Bjorn Helgaas wrote: > From: Bjorn Helgaas > > The only use of KEXEC_BACKUP_SRC_END is as an argument to > walk_system_ram_res(): > > int crash_load_segments(struct kimage *image) > { > ... > walk_system_ram_res(KEXEC_BACKUP_SRC_START,

Re: [PATCH 3/3] resource: Fix find_next_iomem_res() iteration issue

2018-09-28 Thread Borislav Petkov
On Thu, Sep 27, 2018 at 09:03:51AM -0500, Bjorn Helgaas wrote: > Since I think the current interface (using *res as both input and > output parameters that have very different meanings) is confusing, FTR, I too, think that this whole machinery in resource.c with passing in a function and a struct

Re: [PATCH v7 RESEND 2/4] kexec: allocate unencrypted control pages for kdump in case SME is enabled

2018-09-28 Thread lijiang
在 2018年09月28日 15:57, Borislav Petkov 写道: > On Fri, Sep 28, 2018 at 11:52:21AM +0800, lijiang wrote: >> There are two functions that are usually called in pairs, they are: >> arch_kexec_post_alloc_pages() and arch_kexec_pre_free_pages(). >> >> One marks the pages as decrypted, another one marks the

Re: [PATCH v7 RESEND 4/4] kdump/vmcore: support encrypted old memory with SME enabled

2018-09-28 Thread Borislav Petkov
On Thu, Sep 27, 2018 at 03:19:54PM +0800, Lianbo Jiang wrote: > In kdump kernel, we need to dump the old memory into vmcore file,if SME > is enabled in the first kernel, we have to remap the old memory with the > memory encryption mask, which will be automatically decrypted when we > read from

Re: [PATCH v7 RESEND 2/4] kexec: allocate unencrypted control pages for kdump in case SME is enabled

2018-09-28 Thread Borislav Petkov
On Fri, Sep 28, 2018 at 11:52:21AM +0800, lijiang wrote: > There are two functions that are usually called in pairs, they are: > arch_kexec_post_alloc_pages() and arch_kexec_pre_free_pages(). > > One marks the pages as decrypted, another one marks the pages as encrypted. > > But for the crash

[PATCH v15 15/16] arm64: kexec_file: add kernel signature verification support

2018-09-28 Thread AKASHI Takahiro
With this patch, kernel verification can be done without IMA security subsystem enabled. Turn on CONFIG_KEXEC_VERIFY_SIG instead. On x86, a signature is embedded into a PE file (Microsoft's format) header of binary. Since arm64's "Image" can also be seen as a PE file as far as CONFIG_EFI is

[PATCH v15 14/16] include: pe.h: remove message[] from mz header definition

2018-09-28 Thread AKASHI Takahiro
message[] field won't be part of the definition of mz header. This change is crucial for enabling kexec_file_load on arm64 because arm64's "Image" binary, as in PE format, doesn't have any data for it and accordingly the following check in pefile_parse_binary() will fail: chkaddr(cursor,

[PATCH v15 16/16] arm64: kexec_file: add kaslr support

2018-09-28 Thread AKASHI Takahiro
Adding "kaslr-seed" to dtb enables triggering kaslr, or kernel virtual address randomization, at secondary kernel boot. We always do this as it will have no harm on kaslr-incapable kernel. We don't have any "switch" to turn off this feature directly, but still can suppress it by passing "nokaslr"

[PATCH v15 12/16] arm64: kexec_file: add crash dump support

2018-09-28 Thread AKASHI Takahiro
Enabling crash dump (kdump) includes * prepare contents of ELF header of a core dump file, /proc/vmcore, using crash_prepare_elf64_headers(), and * add two device tree properties, "linux,usable-memory-range" and "linux,elfcorehdr", which represent respectively a memory range to be used by

[PATCH v15 13/16] arm64: kexec_file: invoke the kernel without purgatory

2018-09-28 Thread AKASHI Takahiro
On arm64, purgatory would do almost nothing. So just invoke secondary kernel directly by jumping into its entry code. While, in this case, cpu_soft_restart() must be called with dtb address in the fifth argument, the behavior still stays compatible with kexec_load case as long as the argument is

[PATCH v15 10/16] arm64: kexec_file: load initrd and device-tree

2018-09-28 Thread AKASHI Takahiro
load_other_segments() is expected to allocate and place all the necessary memory segments other than kernel, including initrd and device-tree blob (and elf core header for crash). While most of the code was borrowed from kexec-tools' counterpart, users may not be allowed to specify dtb explicitly,

[PATCH v15 11/16] arm64: kexec_file: allow for loading Image-format kernel

2018-09-28 Thread AKASHI Takahiro
This patch provides kexec_file_ops for "Image"-format kernel. In this implementation, a binary is always loaded with a fixed offset identified in text_offset field of its header. Regarding signature verification for trusted boot, this patch doesn't contains CONFIG_KEXEC_VERIFY_SIG support, which

[PATCH v15 09/16] arm64: enable KEXEC_FILE config

2018-09-28 Thread AKASHI Takahiro
Modify arm64/Kconfig to enable kexec_file_load support. Signed-off-by: AKASHI Takahiro Cc: Catalin Marinas Cc: Will Deacon Acked-by: James Morse --- arch/arm64/Kconfig | 9 + arch/arm64/kernel/Makefile | 3 ++- arch/arm64/kernel/machine_kexec_file.c

[PATCH v15 08/16] arm64: cpufeature: add MMFR0 helper functions

2018-09-28 Thread AKASHI Takahiro
Those helper functions for MMFR0 register will be used later by kexec_file loader. Signed-off-by: AKASHI Takahiro Cc: Catalin Marinas Cc: Will Deacon Reviewed-by: James Morse --- arch/arm64/include/asm/cpufeature.h | 48 + 1 file changed, 48 insertions(+) diff

[PATCH v15 05/16] kexec_file: kexec_walk_memblock() only walks a dedicated region at kdump

2018-09-28 Thread AKASHI Takahiro
In kdump case, there exists only one dedicated memblock region as usable memory (crashk_res). With this patch, kexec_walk_memblock() runs a given callback function on this region. Cosmetic change: 0 to MEMBLOCK_NONE at for_each_free_mem_range*() Signed-off-by: AKASHI Takahiro Cc: Dave Young

[PATCH v15 07/16] arm64: add image head flag definitions

2018-09-28 Thread AKASHI Takahiro
Those image head's flags will be used later by kexec_file loader. Signed-off-by: AKASHI Takahiro Cc: Catalin Marinas Cc: Will Deacon Acked-by: James Morse --- arch/arm64/include/asm/boot.h | 15 +++ arch/arm64/kernel/head.S | 2 +- 2 files changed, 16 insertions(+), 1

[PATCH v15 06/16] of/fdt: add helper functions for handling properties

2018-09-28 Thread AKASHI Takahiro
These functions will be used later to handle kexec-specific properties in arm64's kexec_file implementation. Signed-off-by: AKASHI Takahiro Cc: Rob Herring Cc: Frank Rowand Cc: devicet...@vger.kernel.org --- drivers/of/fdt.c | 56 ++

[PATCH v15 03/16] s390, kexec_file: drop arch_kexec_mem_walk()

2018-09-28 Thread AKASHI Takahiro
Since s390 already knows where to locate buffers, calling arch_kexec_mem_walk() has no sense. So we can just drop it as kbuf->mem indicates this while all other architectures sets it to 0 initially. This change is a preparatory work for the next patch, where all the variant memory walks, either

[PATCH v15 02/16] kexec_file: make kexec_image_post_load_cleanup_default() global

2018-09-28 Thread AKASHI Takahiro
Change this function from static to global so that arm64 can implement its own arch_kimage_file_post_load_cleanup() later using kexec_image_post_load_cleanup_default(). Signed-off-by: AKASHI Takahiro Acked-by: Dave Young Cc: Vivek Goyal Cc: Baoquan He --- include/linux/kexec.h | 1 +

[PATCH v15 04/16] powerpc, kexec_file: factor out memblock-based arch_kexec_walk_mem()

2018-09-28 Thread AKASHI Takahiro
Memblock list is another source for usable system memory layout. So move powerpc's arch_kexec_walk_mem() to common code so that other memblock-based architectures, particularly arm64, can also utilise it. A moved function is now renamed to kexec_walk_memblock() and integrated into

[PATCH v15 00/16] arm64: kexec: add kexec_file_load() support

2018-09-28 Thread AKASHI Takahiro
This is the fifteenth round of implementing kexec_file_load() support on arm64.[1] (See "Changes" below) Most of the code is based on kexec-tools. # Since v15, we need a few prerequisite patches; See "Changes." # You will find them in [1], too. This patch series enables us to * load the

[PATCH v15 01/16] asm-generic: add kexec_file_load system call to unistd.h

2018-09-28 Thread AKASHI Takahiro
The initial user of this system call number is arm64. Signed-off-by: AKASHI Takahiro Acked-by: Arnd Bergmann --- include/uapi/asm-generic/unistd.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index