[PATCH v2 15/16] efi: LoongArch: Define LoongArch bits everywhere

Simon Glass sjg at chromium.org
Thu Jul 2 12:27:36 CEST 2026


Hi Yao,

On 2026-07-01T11:17:53, Yao Zi <me at ziyao.cc> wrote:
> efi: LoongArch: Define LoongArch bits everywhere
>
> They are all coming from UEFI specification, PE-COFF specification,
> or IANA websites.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang at flygoat.com>
> Signed-off-by: Yao Zi <me at ziyao.cc>
>
> include/asm-generic/pe.h                          | 2 ++
>  include/config_distro_bootcmd.h                   | 5 +++++
>  include/pe.h                                      | 1 +
>  lib/efi_loader/efi_helper.c                       | 4 ++++
>  lib/efi_loader/efi_image_loader.c                 | 7 +++++++
>  lib/efi_loader/efi_runtime.c                      | 4 ++++
>  lib/efi_selftest/efi_selftest_miniapp_exception.c | 3 +++
>  7 files changed, 26 insertions(+)

> They are all coming from UEFI specification, PE-COFF specification,
> or IANA websites.

Please expand this to say what is actually added (PE machine types,
relocation type, PXE arch number, BOOTEFI filename, R_LARCH_RELATIVE
runtime reloc, selftest trap instruction) - 'bits everywhere' is
hard to grep for later.

> diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
> @@ -371,6 +373,9 @@
> +#elif defined(CONFIG_ARCH_LA64) || (defined(__loongarch__) && __loongarch_grlen == 64))

Unbalanced parentheses - one extra ')' at the end.

> diff --git a/lib/efi_selftest/efi_selftest_miniapp_exception.c b/lib/efi_selftest/efi_selftest_miniapp_exception.c
> @@ -35,6 +35,9 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
> +#elif defined(CONFIG_LOONGARCH)
> +     /* ud 31 */
> +     asm volatile (".word 0x386007ff\n");

The rest of the series keys off CONFIG_ARCH_LA64. Please pick one
and use it consistently - otherwise a future LA32 build will
trigger this ud but be missing all the other bits. Given Tom's
suggestion on patch 6 to move to CONFIG_LOONGARCH, that is probably
the way to unify it.

> diff --git a/include/pe.h b/include/pe.h
> @@ -194,6 +194,7 @@ typedef struct _IMAGE_RELOCATION
> +#define IMAGE_REL_BASED_LOONGARCH64_MARK_LA  8 /* yes, 8 too */

The PE-COFF spec also defines IMAGE_REL_BASED_LOONGARCH32_MARK_LA
(=8). Since __loongarch_grlen == 32 is handled in efi_image_loader.c
below, it would be tidier to add both here even if only the 64-bit
one is wired up today.

Regards,
Simon


More information about the U-Boot mailing list