[PATCH v15 00/10] Add LoongArch support

2023-04-18 Thread Xiaotian Wu
LoongArch is a new Loongson 3A5000 CPU instruction set, you can read documents [1] or visit the development community [2] to get more information. [1]: https://loongson.github.io/LoongArch-Documentation/README-EN.html [2]: https://github.com/loongson This patch series adds support for the Loongar

[PATCH v15 03/10] LoongArch: Add setjmp implementation

2023-04-18 Thread Xiaotian Wu
This patch adds a setjmp implementation for LoongArch. Signed-off-by: Zhou Yang Signed-off-by: Sun Haiyong Signed-off-by: Xiaotian Wu --- grub-core/lib/loongarch64/setjmp.S | 69 ++ grub-core/lib/setjmp.S | 2 + include/grub/loongarch64/setjmp.h | 27 +

[PATCH v15 02/10] ELF: Add LoongArch definitions

2023-04-18 Thread Xiaotian Wu
Add ELF e_machine ID [1] and relocations types [2] for LoongArch to the current in-repo definitions. [1]: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_e_machine_identifies_the_machine [2]: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.ht

[PATCH v15 04/10] LoongArch: Add early startup code

2023-04-18 Thread Xiaotian Wu
On entry, we need to save the system table pointer as well as our image handle. Add an early startup file that saves them and then brings us into our main function. Signed-off-by: Zhou Yang Signed-off-by: Xiaotian Wu --- grub-core/kern/loongarch64/efi/startup.S | 34 1

[PATCH v15 06/10] LoongArch: Add support for ELF psABI v2.00 relocations

2023-04-18 Thread Xiaotian Wu
A new set of relocation types was added in the LoongArch ELF psABI v2.00 spec [1][2] to replace the stack-based scheme in v1.00. Toolchain support is available from binutils 2.40 and gcc 13 onwards. This patch adds support for the new relocation types, that are simpler to handle (in particular, st

[PATCH v15 01/10] PE: Add LoongArch definitions

2023-04-18 Thread Xiaotian Wu
Add PE machine types [1] and relocation types [2] for LoongArch to the current in-repo definitions. [1]: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#machine-types [2]: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#base-relocation-types Signed-off-by: Zhou Y

[PATCH v15 05/10] LoongArch: Add support for ELF psABI v1.00 relocations

2023-04-18 Thread Xiaotian Wu
This patch adds support of the stack-based LoongArch relocations throughout grub, including tools, dynamic linkage, and support for conversion of ELF relocations into PE ones. A stack machine is required to handle these per the spec [1] (see the R_LARCH_SOP types), of which a simple implementation

[PATCH v15 09/10] tests: Fix timezone inconsistency in squashfs_test

2023-04-18 Thread Xiaotian Wu
The image timestamp was not returned in UTC, but the following logic expected and used UTC. This patch fixes the test failure like described below: unsquashfs -s /tmp/grub-fs-tester.20230407111703613257436.squash4_gzip.9R4/squash4_gzip_512_4096_1_0.img grep '^Creation' awk '{print $6 " " $

[PATCH v15 08/10] LoongArch: Add to build system

2023-04-18 Thread Xiaotian Wu
This patch adds LoongArch to the grub build system and various tools, so grub can be built on LoongArch as a UEFI application. Signed-off-by: Zhou Yang Signed-off-by: Xiaotian Wu --- Makefile.util.def | 1 + configure.ac| 8 +- gentpl.py | 27 ++

[PATCH v15 10/10] tests: Add LoongArch to various test cases

2023-04-18 Thread Xiaotian Wu
The test results of running "make check" with qemu 7.2 are as follows: = GRUB 2.11: ./test-suite.log = # TOTAL: 85 # PASS: 73 # SKIP: 8 # XFAIL: 0 # FAIL: 2 # XPASS: 0 # ERROR: 2 .. contents:: :depth: 2 ERROR: f2

[PATCH v15 07/10] LoongArch: Add auxiliary files

2023-04-18 Thread Xiaotian Wu
Add support for manipulating architectural cache and timers, and EFI memory maps. Signed-off-by: Zhou Yang Signed-off-by: Xiaotian Wu --- grub-core/kern/efi/mm.c | 3 +- grub-core/kern/loongarch64/cache.c | 39 grub-core/kern/loongarch64/cache_flush.S | 33 +