efi/loongarch: Add efistub booting support
authorHuacai Chen <chenhuacai@loongson.cn>
Fri, 19 Aug 2022 10:20:37 +0000 (18:20 +0800)
committerArd Biesheuvel <ardb@kernel.org>
Tue, 6 Sep 2022 09:19:34 +0000 (11:19 +0200)
commitead384d956345681e1ddf97890d5e15ded015f07
treeaa03bbe0c8e154a3743f28b7eccb281912c20dec
parent568035b01cfb107af8d2e4bd2fb9aea22cf5b868
efi/loongarch: Add efistub booting support

This patch adds efistub booting support, which is the standard UEFI boot
protocol for LoongArch to use.

We use generic efistub, which means we can pass boot information (i.e.,
system table, memory map, kernel command line, initrd) via a light FDT
and drop a lot of non-standard code.

We use a flat mapping to map the efi runtime in the kernel's address
space. In efi, VA = PA; in kernel, VA = PA + PAGE_OFFSET. As a result,
flat mapping is not identity mapping, SetVirtualAddressMap() is still
needed for the efi runtime.

Tested-by: Xi Ruoyao <xry111@xry111.site>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
[ardb: change fpic to fpie as suggested by Xi Ruoyao]
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
15 files changed:
arch/loongarch/Kconfig
arch/loongarch/Makefile
arch/loongarch/boot/Makefile
arch/loongarch/include/asm/efi.h
arch/loongarch/kernel/efi-header.S [new file with mode: 0644]
arch/loongarch/kernel/efi.c
arch/loongarch/kernel/head.S
arch/loongarch/kernel/image-vars.h [new file with mode: 0644]
arch/loongarch/kernel/setup.c
arch/loongarch/kernel/vmlinux.lds.S
drivers/firmware/efi/Kconfig
drivers/firmware/efi/libstub/Makefile
drivers/firmware/efi/libstub/efi-stub.c
drivers/firmware/efi/libstub/loongarch-stub.c [new file with mode: 0644]
include/linux/pe.h