[PATCH v2 06/10] efi/libstub: loongarch: Use struct efi_image_info to access image properties
Ard Biesheuvel
ardb+git at google.com
Tue Nov 10 04:17:38 PST 2026
From: Ard Biesheuvel <ardb at kernel.org>
Instead of exposing individual symbols to the EFI stub explicitly via
the linker script, use the generic struct efi_image_info, which accesses
the original symbols via PC-relative references from the stub itself.
This improves code reuse across architectures, and makes it easier to
add new references in a generic manner.
Signed-off-by: Ard Biesheuvel <ardb at kernel.org>
---
arch/loongarch/kernel/image-vars.h | 1 -
drivers/firmware/efi/libstub/loongarch-stub.c | 4 +---
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/loongarch/kernel/image-vars.h b/arch/loongarch/kernel/image-vars.h
index e557ebd46c2b..d8676cea754a 100644
--- a/arch/loongarch/kernel/image-vars.h
+++ b/arch/loongarch/kernel/image-vars.h
@@ -8,7 +8,6 @@
#ifdef CONFIG_EFI_STUB
__efistub_strcmp = strcmp;
-__efistub_kernel_entry = kernel_entry;
__efistub_kernel_asize = kernel_asize;
__efistub_kernel_fsize = kernel_fsize;
#if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB)
diff --git a/drivers/firmware/efi/libstub/loongarch-stub.c b/drivers/firmware/efi/libstub/loongarch-stub.c
index c87ac7025107..ab7e73e38334 100644
--- a/drivers/firmware/efi/libstub/loongarch-stub.c
+++ b/drivers/firmware/efi/libstub/loongarch-stub.c
@@ -118,7 +118,5 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
unsigned long kernel_entry_address(unsigned long kernel_addr,
efi_loaded_image_t *image)
{
- unsigned long base = (unsigned long)image->image_base;
-
- return (unsigned long)&kernel_entry - base + kernel_addr;
+ return kernel_addr + efistub_kernel_entry_offset(efistub_get_image_info());
}
--
2.56.0.542.g3ef89b7020-goog
More information about the linux-riscv
mailing list