Re: [PATCH] kexec/crash: no crash update when kexec in progress

2024-08-19 Thread Sourabh Jain
Hello Baoquan, On 19/08/24 11:45, Baoquan He wrote: On 08/19/24 at 09:45am, Sourabh Jain wrote: Hello Michael and Boaquan On 01/08/24 12:21, Sourabh Jain wrote: Hello Michael, On 01/08/24 08:04, Michael Ellerman wrote: Sourabh Jain writes: The following errors are observed when kexec is d

Re: [RFCv2 1/9] efi/libstub: Ask efi_random_alloc() to skip unusable memory

2024-08-19 Thread Pingfan Liu
On Tue, Aug 20, 2024 at 2:00 AM Jarkko Sakkinen wrote: > > On Mon Aug 19, 2024 at 5:53 PM EEST, Pingfan Liu wrote: > > efi_random_alloc() demands EFI_ALLOCATE_ADDRESS when allocate_pages(), > > but the current implement can not ensure the selected target locates > > inside free area, that is to ex

Re: [RFCv2 1/9] efi/libstub: Ask efi_random_alloc() to skip unusable memory

2024-08-19 Thread Jarkko Sakkinen
On Mon Aug 19, 2024 at 5:53 PM EEST, Pingfan Liu wrote: > efi_random_alloc() demands EFI_ALLOCATE_ADDRESS when allocate_pages(), > but the current implement can not ensure the selected target locates > inside free area, that is to exclude EFI_BOOT_SERVICES_*, > EFI_RUNTIME_SERVICES_* etc. > > Fix t

Re: [PATCH v9 06/19] x86: Add early SHA-1 support for Secure Launch early measurements

2024-08-19 Thread Matthew Garrett
On Mon, Aug 19, 2024 at 09:05:47PM +0300, Jarkko Sakkinen wrote: > On Fri Aug 16, 2024 at 9:41 PM EEST, Matthew Garrett wrote: > > On Fri, Aug 16, 2024 at 02:22:04PM +0300, Jarkko Sakkinen wrote: > > > > > For (any) non-legacy features we can choose, which choices we choose to > > > support, and wh

Re: [PATCH v9 06/19] x86: Add early SHA-1 support for Secure Launch early measurements

2024-08-19 Thread Jarkko Sakkinen
On Fri Aug 16, 2024 at 9:41 PM EEST, Matthew Garrett wrote: > On Fri, Aug 16, 2024 at 02:22:04PM +0300, Jarkko Sakkinen wrote: > > > For (any) non-legacy features we can choose, which choices we choose to > > support, and which we do not. This is not an oppositive view just saying > > how it is, an

[RFCv2 9/9] arm64: kexec: Enable kexec_pe_image

2024-08-19 Thread Pingfan Liu
Now, anything is ready, enable PE image loading on arm64 Signed-off-by: Pingfan Liu Cc: Ard Biesheuvel Cc: Mark Rutland Cc: Will Deacon Cc: Catalin Marinas To: linux-arm-ker...@lists.infradead.org --- arch/arm64/Kconfig | 4 arch/arm64/kernel/machine_kexec_file.c | 3

[RFCv2 8/9] arm64: kexec: Prepare page table for emulator

2024-08-19 Thread Pingfan Liu
The emulator will run in identity mapping, and the first kernel prepares for it. The special allocator resorts to kimage_alloc_control_pages(), which can avoid the allocation on the spot of the destination and overwritten during copying the kernel. The identity mapping covers only all of the kexec

[RFCv2 7/9] arm64: mm: Change to prototype of

2024-08-19 Thread Pingfan Liu
The current allocator of __create_pgd_mapping_locked() takes only one parameter, which reflects the current level of page table. But kexec_page_alloc() should extra control information from the parameter kimage. In order to make kexec_page_alloc() as an allocator, re-shape the prototype of the all

[RFCv2 6/9] arm64: kexec: Introduce a new member param_mem to kimage_arch

2024-08-19 Thread Pingfan Liu
relocate_kernel will be used either to boot vmlinux directly or PE image. In the latter case, the efi emulator needs efi_emulator_param instead of dtb as input parameter. On the other hand, dtb is still required to pass down through efi_emulator_param to the second kernel, so keep kimage_arch->dtb

[RFCv2 4/9] efi/emulator: Turn on mmu for arm64

2024-08-19 Thread Pingfan Liu
On arm64, when kexec switches to the new kernel, the mmu is off. So the efi emulator should turn on the mmu to enable the identity mapping at the first stage. In fact, the kexec switching can run with mmu-on if it enters emulator, but that requires the re-arrangement of the relocate_kernel.S [1].

[RFCv2 5/9] kexec: Introduce kexec_pe_image to parse and load PE file

2024-08-19 Thread Pingfan Liu
As UEFI becomes popular, a few architectures support to boot a PE format kernel image directly. And the internal of PE format may be different. This introduces a new kexec_file_ops implementation, named pe_image_ops, which prepares UEFI environment for the trampoline code 'efi emulator'. The pe_im

[RFCv2 1/9] efi/libstub: Ask efi_random_alloc() to skip unusable memory

2024-08-19 Thread Pingfan Liu
efi_random_alloc() demands EFI_ALLOCATE_ADDRESS when allocate_pages(), but the current implement can not ensure the selected target locates inside free area, that is to exclude EFI_BOOT_SERVICES_*, EFI_RUNTIME_SERVICES_* etc. Fix the issue by checking md->type. Signed-off-by: Pingfan Liu Cc: Ard

[RFCv2 2/9] efi/libstub: Complete efi_simple_text_output_protocol

2024-08-19 Thread Pingfan Liu
Some uefi applications e.g systemd-stub uses more members in efi_simple_text_output_protocol, hence extending its members as UEFI specification. Signed-off-by: Pingfan Liu Cc: Ard Biesheuvel To: linux-...@vger.kernel.org --- drivers/firmware/efi/libstub/efistub.h | 7 +++ 1 file changed, 7

[RFCv2 0/9] UEFI emulator for kexec

2024-08-19 Thread Pingfan Liu
*** Background *** As more PE format kernel images are introduced, it post challenge to kexec to cope with the new format. In my attempt to add support for arm64 zboot image in the kernel [1], Ard suggested using an emulator to tackle this issue. Last year, when Jan tried to introduce UKI suppor

Re: [PATCH v2] Document/kexec: Generalize crash hotplug description

2024-08-19 Thread Baoquan He
Add Jonathan and Andew. On 08/12/24 at 09:46am, Sourabh Jain wrote: > Commit 79365026f869 ("crash: add a new kexec flag for hotplug support") > generalizes the crash hotplug support to allow architectures to update > multiple kexec segments on CPU/Memory hotplug and not just elfcorehdr. > Therefor