aboutsummaryrefslogtreecommitdiff
path: root/drivers/firmware/efi/libstub/riscv-stub.c
AgeCommit message (Collapse)AuthorFilesLines
2024-10-02move asm/unaligned.h to linux/unaligned.hAl Viro1-1/+1
asm/unaligned.h is always an include of asm-generic/unaligned.h; might as well move that thing to linux/unaligned.h and include that - there's nothing arch-specific in that header. auto-generated by the following: for i in `git grep -l -w asm/unaligned.h`; do sed -i -e "s/asm\/unaligned.h/linux\/unaligned.h/" $i done for i in `git grep -l -w asm-generic/unaligned.h`; do sed -i -e "s/asm-generic\/unaligned.h/linux\/unaligned.h/" $i done git mv include/asm-generic/unaligned.h include/linux/unaligned.h git mv tools/include/asm-generic/unaligned.h tools/include/linux/unaligned.h sed -i -e "/unaligned.h/d" include/asm-generic/Kbuild sed -i -e "s/__ASM_GENERIC/__LINUX/" include/linux/unaligned.h tools/include/linux/unaligned.h
2023-09-05riscv: libstub: Implement KASLR by using generic functionsAlexandre Ghiti1-18/+15
We can now use arm64 functions to handle the move of the kernel physical mapping: if KASLR is enabled, we will try to get a random seed from the firmware, if not possible, the kernel will be moved to a location that suits its alignment constraints. Signed-off-by: Alexandre Ghiti <[email protected]> Tested-by: Conor Dooley <[email protected]> Tested-by: Song Shuai <[email protected]> Reviewed-by: Sami Tolvanen <[email protected]> Tested-by: Sami Tolvanen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
2022-11-09efi/riscv: libstub: Split off kernel image relocation for builtin stubArd Biesheuvel1-74/+7
The RISC-V build of the EFI stub is part of the core kernel image, and therefore accesses section markers directly when it needs to figure out the size of the various section. The zboot decompressor does not have access to those symbols, but doesn't really need that either. So let's move handle_kernel_image() into a separate file (or rather, move everything else into a separate file) so that the zboot build does not pull in unused code that links to symbols that it does not define. Signed-off-by: Ard Biesheuvel <[email protected]>
2022-11-09efi: libstub: Factor out min alignment and preferred kernel load addressArd Biesheuvel1-12/+3
Factor out the expressions that describe the preferred placement of the loaded image as well as the minimum alignment so we can reuse them in the decompressor. Signed-off-by: Ard Biesheuvel <[email protected]>
2022-07-19riscv/efi_stub: Add 64bit boot-hartid support on RV64Sunil V L1-3/+10
The boot-hartid can be a 64bit value on RV64 platforms but the "boot-hartid" in DT is assumed to be 32bit only. Detect the size of the "boot-hartid" in DT and use 32bit or 64bit read appropriately. Signed-off-by: Sunil V L <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
2022-05-19riscv/efi_stub: Add support for RISCV_EFI_BOOT_PROTOCOLSunil V L1-6/+23
Add support for getting the boot hart ID from the Linux EFI stub using RISCV_EFI_BOOT_PROTOCOL. This method is preferred over the existing DT based approach since it works irrespective of DT or ACPI. The specification of the protocol is hosted at: https://github.com/riscv-non-isa/riscv-uefi Signed-off-by: Sunil V L <[email protected]> Acked-by: Palmer Dabbelt <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ardb: minor tweaks for coding style and whitespace] Signed-off-by: Ard Biesheuvel <[email protected]>
2022-05-03efi: libstub: pass image handle to handle_kernel_image()Ard Biesheuvel1-1/+2
In a future patch, arm64's implementation of handle_kernel_image() will omit randomizing the placement of the kernel if the load address was chosen randomly by the loader. In order to do this, it needs to locate a protocol on the image handle, so pass it to handle_kernel_image(). Signed-off-by: Ard Biesheuvel <[email protected]>
2022-02-28riscv/efi_stub: Fix get_boot_hartid_from_fdt() return valueSunil V L1-7/+10
The get_boot_hartid_from_fdt() function currently returns U32_MAX for failure case which is not correct because U32_MAX is a valid hartid value. This patch fixes the issue by returning error code. Cc: <[email protected]> Fixes: d7071743db31 ("RISC-V: Add EFI stub support.") Signed-off-by: Sunil V L <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]>
2020-10-02RISC-V: Add EFI stub support.Atish Patra1-0/+109
Add a RISC-V architecture specific stub code that actually copies the actual kernel image to a valid address and jump to it after boot services are terminated. Enable UEFI related kernel configs as well for RISC-V. Signed-off-by: Atish Patra <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ardb: - move hartid fetch into check_platform_features() - use image_size not reserve_size - select ISA_C - do not use dram_base] Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>