Skip to content

LoongArch initial support

Yao Zi u-boot 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest20 patches 3 repliesIn review
  2. v620 patches 12 repliesSuperseded
  3. v520 patches 15 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v419 patches0 repliesSuperseded
v319 patches10 repliesSuperseded
v216 patches47 repliesSuperseded

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/20lib: fdtdec: Handle multiple memory nodesinclude/asm-generic/global_data.h lib/fdtdec.c+74 -550 replies
2/20linux/io.h: Use map_physmem to implement ioremapinclude/linux/io.h+2 -10 replies
3/20image: Take entry point as an output of booti_setuparch/arm/lib/image.c arch/riscv/lib/image.c arch/sandbox/lib/bootm.c +4 more+21 -140 replies
4/20elf: Define LoongArch bitsinclude/elf.h+8 -10 replies
5/20image: Define IH_ARCH_LOONGARCHboot/image.c include/image.h+2 -00 replies
6/20LoongArch: skeleton and headersMakefile arch/Kconfig arch/loongarch/Kconfig +37 more+3341 -00 replies
7/20LoongArch: lib: General routinesarch/loongarch/include/asm/cache.h arch/loongarch/include/asm/global_data.h arch/loongarch/lib/Makefile +5 more+407 -10 replies
8/20LoongArch: CPU assembly routinesarch/loongarch/cpu/Makefile arch/loongarch/cpu/cpu.c arch/loongarch/cpu/smp_secondary.S +1 more+244 -00 replies
9/20LoongArch: Exception handlingarch/loongarch/Kconfig arch/loongarch/cpu/Makefile arch/loongarch/cpu/genex.S +2 more+400 -10 replies
10/20LoongArch: Boot Image bitsarch/loongarch/lib/Makefile arch/loongarch/lib/bootm.c arch/loongarch/lib/image.c +2 more+210 -10 replies
11/20LoongArch: Generic platform typearch/loongarch/Kconfig arch/loongarch/cpu/generic/Kconfig arch/loongarch/cpu/generic/Makefile +2 more+60 -00 replies
12/20board_f: Add LoongArch path of mon_len calculationcommon/board_f.c+1 -11 reply
13/20cpu: Add loongarch_cpu driverdrivers/cpu/Kconfig drivers/cpu/Makefile drivers/cpu/loongarch_cpu.c+152 -00 replies
14/20timer: Add loongarch_timer driverdrivers/timer/Kconfig drivers/timer/Makefile drivers/timer/loongarch_timer.c+141 -00 replies
15/20board: emulation: Add qemu-loongarcharch/loongarch/Kconfig board/emulation/qemu-loongarch/Kconfig board/emulation/qemu-loongarch/MAINTAINERS +7 more+251 -00 replies
16/20efi: LoongArch: Define LoongArch bits everywhereinclude/asm-generic/pe.h include/config_distro_bootcmd.h include/pe.h +4 more+27 -01 reply
17/20efi: LoongArch: Implement everythingarch/loongarch/config.mk arch/loongarch/lib/Makefile arch/loongarch/lib/crt0_loongarch_efi.S +5 more+408 -11 reply
18/20doc: arch: Add documentation for LoongArchdoc/arch/index.rst doc/arch/loongarch.rst+32 -00 replies
19/20MAINTAINERS: Add entry for LoongArchMAINTAINERS+11 -00 replies
20/20CI: Wire up qemu-loongarch64.azure-pipelines.yml .gitlab-ci.yml+13 -40 replies

Reviews trailers per patch

All 20 patches have a Reviewed-by or Acked-by.

PatchSimon GlassHeinrich SchuchardtTom RiniIlias Apalodimas
1/20R-b
2/20R-b
3/20R-b R-b
4/20R-b R-b
5/20R-b R-b
6/20R-b
7/20R-b
8/20R-b
9/20R-b
10/20R-b
11/20R-b
12/20R-b A-b
13/20R-b
14/20R-b
15/20R-b
16/20R-b A-b
17/20R-b A-b
18/20R-b
19/20R-b
20/20R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v7 thread

Cover letter [PATCH v7 00/20] LoongArch initial support

Hi all,

So far this series has implemented general support for initializing CPU, exceptions, kernel booting, CPU and timer drivers, QEMU LoongArch virt machine support and UEFI standard compliant EFI booting support.

LoongArch had defined 3 ISA variants, LA64, LA32 and LA32R (Reduced, intended for MCUs and education purpose). This is a little-endian only architecture. Only LA64 is implemented in this series since the hardware is more widely available, and I'll work on 32bit support later.

This series had passed checkpatch with exceptions on some false alarms and headers imported elsewhere. I've tested virtio devices, direct kernel booting, efistub kernel booting, grub, and hello/selftests EFI app.

LoongArch CI depends on some already-merged dockerfile[1] and buildman[2] changes to run. With the docker image replaced with one built by myself, this series passes the Azure CI[3].

Toolchain can be found at [4] or using upstream one, to build

make qemu-loongarch64_defconfig
make

To run in QEMU:

qemu-system-loongarch64 -nographic -machine virt -bios u-boot.bin

TODOs on the architecture & board:
- loongson,ls7a-rtc driver
- The only device on QEMU board haven't been supported yet
- LoongArch sandbox host support
- TLB enablement
- This is required for real CPU to utilize caches
- Possibly EFI-APP support for real machine

Thanks for your time and review!

Link to v5: https://lore.kernel.org/u-boot/[email protected]/
Link to v4: https://lore.kernel.org/u-boot/[email protected]/
Link to v3: https://lore.kernel.org/u-boot/[email protected]/
Link to v2: https://lore.kernel.org/u-boot/[email protected]/
Link to v1: https://lore.kernel.org/u-boot/[email protected]/

[1]: https://lore.kernel.org/u-boot/[email protected]/
[2]: https://lore.kernel.org/u-boot/[email protected]/
[3]: https://github.com/u-boot/u-boot/pull/1073
[4]: https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/14.2.0/x86_64-gcc-14.2.0-nolibc-loongarch64-linux.tar.gz

Jiaxun Yang (16):
lib: fdtdec: Handle multiple memory nodes linux/io.h: Use map_physmem to implement ioremap
image: Take entry point as an output of booti_setup
elf: Define LoongArch bits
image: Define IH_ARCH_LOONGARCH
LoongArch: skeleton and headers
LoongArch: lib: General routines
LoongArch: CPU assembly routines
LoongArch: Exception handling
LoongArch: Boot Image bits
LoongArch: Generic platform type
cpu: Add loongarch_cpu driver
timer: Add loongarch_timer driver
board: emulation: Add qemu-loongarch
efi: LoongArch: Define LoongArch bits everywhere
efi: LoongArch: Implement everything

Yao Zi (4):
board_f: Add LoongArch path of mon_len calculation
doc: arch: Add documentation for LoongArch
MAINTAINERS: Add entry for LoongArch
CI: Wire up qemu-loongarch64

 .azure-pipelines.yml                          |   11 +-
 .gitlab-ci.yml                                |    6 +
 MAINTAINERS                                   |   11 +
 Makefile                                      |    2 +
 arch/Kconfig                                  |   17 +
 arch/arm/lib/image.c                          |    3 +-
 arch/loongarch/Kconfig                        |   64 +
 arch/loongarch/Makefile                       |   21 +
 arch/loongarch/config.mk                      |   27 +
 arch/loongarch/cpu/Makefile                   |    9 +
 arch/loongarch/cpu/cpu.c                      |   17 +
 arch/loongarch/cpu/generic/Kconfig            |   13 +
 arch/loongarch/cpu/generic/Makefile           |    7 +
 arch/loongarch/cpu/generic/cpu.c              |   23 +
 arch/loongarch/cpu/generic/dram.c             |   16 +
 arch/loongarch/cpu/genex.S                    |   21 +
 arch/loongarch/cpu/smp_secondary.S            |   55 +
 arch/loongarch/cpu/start.S                    |  168 ++
 arch/loongarch/cpu/u-boot.lds                 |   85 +
 arch/loongarch/dts/Makefile                   |    6 +
 arch/loongarch/include/asm/acpi_table.h       |    8 +
 arch/loongarch/include/asm/addrspace.h        |   86 +
 .../include/asm/arch-generic/entry-init.h     |   15 +
 arch/loongarch/include/asm/asm.h              |  186 +++
 arch/loongarch/include/asm/atomic.h           |   12 +
 arch/loongarch/include/asm/barrier.h          |  138 ++
 arch/loongarch/include/asm/bitops.h           |  156 ++
 arch/loongarch/include/asm/byteorder.h        |   22 +
 arch/loongarch/include/asm/cache.h            |   35 +
 arch/loongarch/include/asm/config.h           |   11 +
 arch/loongarch/include/asm/cpu.h              |  123 ++
 arch/loongarch/include/asm/dma-mapping.h      |   27 +
 arch/loongarch/include/asm/global_data.h      |   50 +
 arch/loongarch/include/asm/gpio.h             |   11 +
 arch/loongarch/include/asm/io.h               |  399 +++++
 arch/loongarch/include/asm/linkage.h          |   11 +
 arch/loongarch/include/asm/loongarch.h        | 1467 +++++++++++++++++
 arch/loongarch/include/asm/posix_types.h      |   87 +
 arch/loongarch/include/asm/processor.h        |   11 +
 arch/loongarch/include/asm/ptrace.h           |   33 +
 arch/loongarch/include/asm/regdef.h           |   42 +
 arch/loongarch/include/asm/sections.h         |    8 +
 arch/loongarch/include/asm/setjmp.h           |   20 +
 arch/loongarch/include/asm/spl.h              |   11 +
 arch/loongarch/include/asm/stackframe.h       |  175 ++
 arch/loongarch/include/asm/string.h           |   11 +
 arch/loongarch/include/asm/system.h           |   72 +
 arch/loongarch/include/asm/types.h            |   37 +
 arch/loongarch/include/asm/u-boot-loongarch.h |   23 +
 arch/loongarch/include/asm/u-boot.h           |   30 +
 arch/loongarch/include/asm/unaligned.h        |   11 +
 arch/loongarch/lib/Makefile                   |   22 +
 arch/loongarch/lib/asm-offsets.c              |   66 +
 arch/loongarch/lib/boot.c                     |   14 +
 arch/loongarch/lib/bootm.c                    |  129 ++
 arch/loongarch/lib/cache.c                    |  235 +++
 arch/loongarch/lib/crt0_loongarch_efi.S       |  182 ++
 arch/loongarch/lib/elf_loongarch_efi.lds      |   76 +
 arch/loongarch/lib/image.c                    |   77 +
 arch/loongarch/lib/interrupts.c               |  184 +++
 arch/loongarch/lib/reloc_loongarch_efi.c      |  101 ++
 arch/loongarch/lib/reset.c                    |   14 +
 arch/loongarch/lib/setjmp.S                   |   52 +
 arch/riscv/lib/image.c                        |    4 +-
 arch/sandbox/lib/bootm.c                      |    2 +-
 board/emulation/qemu-loongarch/Kconfig        |   68 +
 board/emulation/qemu-loongarch/MAINTAINERS    |    9 +
 board/emulation/qemu-loongarch/Makefile       |    6 +
 .../emulation/qemu-loongarch/qemu-loongarch.c |   67 +
 .../qemu-loongarch/qemu-loongarch.env         |    5 +
 boot/Kconfig                                  |    1 +
 boot/bootm.c                                  |    5 +-
 boot/image.c                                  |    1 +
 cmd/Kconfig                                   |    2 +-
 cmd/booti.c                                   |    5 +-
 common/board_f.c                              |    2 +-
 common/spl/spl.c                              |    9 +-
 configs/qemu-loongarch64_defconfig            |   35 +
 doc/arch/index.rst                            |    1 +
 doc/arch/loongarch.rst                        |   31 +
 doc/board/emulation/index.rst                 |    1 +
 doc/board/emulation/qemu-loongarch.rst        |   39 +
 drivers/cpu/Kconfig                           |    6 +
 drivers/cpu/Makefile                          |    1 +
 drivers/cpu/loongarch_cpu.c                   |  145 ++
 drivers/timer/Kconfig                         |    8 +
 drivers/timer/Makefile                        |    1 +
 drivers/timer/loongarch_timer.c               |  132 ++
 include/asm-generic/global_data.h             |    2 +-
 include/asm-generic/pe.h                      |    2 +
 include/config_distro_bootcmd.h               |    5 +
 include/configs/qemu-loongarch.h              |   17 +
 include/elf.h                                 |    9 +-
 include/host_arch.h                           |    2 +
 include/image.h                               |    8 +-
 include/linux/io.h                            |    3 +-
 include/pe.h                                  |    2 +
 lib/efi_loader/Kconfig                        |    2 +-
 lib/efi_loader/efi_helper.c                   |    7 +
 lib/efi_loader/efi_image_loader.c             |   40 +
 lib/efi_loader/efi_runtime.c                  |    4 +
 .../efi_selftest_miniapp_exception.c          |    3 +
 lib/fdtdec.c                                  |  127 +-
 103 files changed, 5803 insertions(+), 78 deletions(-)
 create mode 100644 arch/loongarch/Kconfig
 create mode 100644 arch/loongarch/Makefile
 create mode 100644 arch/loongarch/config.mk
 create mode 100644 arch/loongarch/cpu/Makefile
 create mode 100644 arch/loongarch/cpu/cpu.c
 create mode 100644 arch/loongarch/cpu/generic/Kconfig
 create mode 100644 arch/loongarch/cpu/generic/Makefile
 create mode 100644 arch/loongarch/cpu/generic/cpu.c
 create mode 100644 arch/loongarch/cpu/generic/dram.c
 create mode 100644 arch/loongarch/cpu/genex.S
 create mode 100644 arch/loongarch/cpu/smp_secondary.S
 create mode 100644 arch/loongarch/cpu/start.S
 create mode 100644 arch/loongarch/cpu/u-boot.lds
 create mode 100644 arch/loongarch/dts/Makefile
 create mode 100644 arch/loongarch/include/asm/acpi_table.h
 create mode 100644 arch/loongarch/include/asm/addrspace.h
 create mode 100644 arch/loongarch/include/asm/arch-generic/entry-init.h
 create mode 100644 arch/loongarch/include/asm/asm.h
 create mode 100644 arch/loongarch/include/asm/atomic.h
 create mode 100644 arch/loongarch/include/asm/barrier.h
 create mode 100644 arch/loongarch/include/asm/bitops.h
 create mode 100644 arch/loongarch/include/asm/byteorder.h
 create mode 100644 arch/loongarch/include/asm/cache.h
 create mode 100644 arch/loongarch/include/asm/config.h
 create mode 100644 arch/loongarch/include/asm/cpu.h
 create mode 100644 arch/loongarch/include/asm/dma-mapping.h
 create mode 100644 arch/loongarch/include/asm/global_data.h
 create mode 100644 arch/loongarch/include/asm/gpio.h
 create mode 100644 arch/loongarch/include/asm/io.h
 create mode 100644 arch/loongarch/include/asm/linkage.h
 create mode 100644 arch/loongarch/include/asm/loongarch.h
 create mode 100644 arch/loongarch/include/asm/posix_types.h
 create mode 100644 arch/loongarch/include/asm/processor.h
 create mode 100644 arch/loongarch/include/asm/ptrace.h
 create mode 100644 arch/loongarch/include/asm/regdef.h
 create mode 100644 arch/loongarch/include/asm/sections.h
 create mode 100644 arch/loongarch/include/asm/setjmp.h
 create mode 100644 arch/loongarch/include/asm/spl.h
 create mode 100644 arch/loongarch/include/asm/stackframe.h
 create mode 100644 arch/loongarch/include/asm/string.h
 create mode 100644 arch/loongarch/include/asm/system.h
 create mode 100644 arch/loongarch/include/asm/types.h
 create mode 100644 arch/loongarch/include/asm/u-boot-loongarch.h
 create mode 100644 arch/loongarch/include/asm/u-boot.h
 create mode 100644 arch/loongarch/include/asm/unaligned.h
 create mode 100644 arch/loongarch/lib/Makefile
 create mode 100644 arch/loongarch/lib/asm-offsets.c
 create mode 100644 arch/loongarch/lib/boot.c
 create mode 100644 arch/loongarch/lib/bootm.c
 create mode 100644 arch/loongarch/lib/cache.c
 create mode 100644 arch/loongarch/lib/crt0_loongarch_efi.S
 create mode 100644 arch/loongarch/lib/elf_loongarch_efi.lds
 create mode 100644 arch/loongarch/lib/image.c
 create mode 100644 arch/loongarch/lib/interrupts.c
 create mode 100644 arch/loongarch/lib/reloc_loongarch_efi.c
 create mode 100644 arch/loongarch/lib/reset.c
 create mode 100644 arch/loongarch/lib/setjmp.S
 create mode 100644 board/emulation/qemu-loongarch/Kconfig
 create mode 100644 board/emulation/qemu-loongarch/MAINTAINERS
 create mode 100644 board/emulation/qemu-loongarch/Makefile
 create mode 100644 board/emulation/qemu-loongarch/qemu-loongarch.c
 create mode 100644 board/emulation/qemu-loongarch/qemu-loongarch.env
 create mode 100644 configs/qemu-loongarch64_defconfig
 create mode 100644 doc/arch/loongarch.rst
 create mode 100644 doc/board/emulation/qemu-loongarch.rst
 create mode 100644 drivers/cpu/loongarch_cpu.c
 create mode 100644 drivers/timer/loongarch_timer.c
 create mode 100644 include/configs/qemu-loongarch.h
Signature · 1 line
2.56.0