[PATCH v5 00/17] Add boot LoongArch elf kernel with FDT

Song Gao posted 17 patches 8 months, 4 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240301093839.663947-1-gaosong@loongson.cn
Maintainers: Song Gao <gaosong@loongson.cn>
There is a newer version of this series
include/hw/intc/loongarch_extioi.h |   1 +
include/hw/loongarch/boot.h        | 109 +++++++++
include/hw/loongarch/virt.h        |  14 ++
include/hw/pci-host/ls7a.h         |   2 +
target/loongarch/cpu.h             |   2 +
hw/loongarch/boot.c                | 330 ++++++++++++++++++++++++++
hw/loongarch/virt.c                | 364 ++++++++++++++++-------------
hw/loongarch/meson.build           |   1 +
8 files changed, 661 insertions(+), 162 deletions(-)
create mode 100644 include/hw/loongarch/boot.h
create mode 100644 hw/loongarch/boot.c
[PATCH v5 00/17] Add boot LoongArch elf kernel with FDT
Posted by Song Gao 8 months, 4 weeks ago
Hi, All

We already support boot efi kernel with bios, but not support boot elf kernel.
This series adds boot elf kernel with FDT.

'LoongArch supports ACPI and FDT. The information that needs to be passed
 to the kernel includes the memmap, the initrd, the command line, optionally
 the ACPI/FDT tables, and so on'  see [1].

Patch 2-8 : Create efi system table, and three efi configuration table
            boot_memmap, initd, FDT.
Patch 9-17 : Fixes FDT problems.

Test:
  - Start kernel
    See [2] start_kernel.sh
  - Start qcow2
    See [2] start_qcow2.sh

V5:
  - Rebase;

V4:
  - patch 3 change slave_boot_code[] to const, and 'static void *p ' to
    'void *p';
  - patch 4 fixes build error;
  - patch 10-13, add project and commit link.

V3:
  - Load initrd at  kernel_high + 4 * kernel_size;
  - Load 'boot_rom' at [0 - 1M], the 'boot_rom' includes
    slave_boot_code, cmdline_buf and systab_tables;
  - R-b and rebase.

V2:
  - FDT pcie node adds cells 'msi-map';


[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/arch/loongarch/booting.rst?h=v6.7-rc4

[2]: https://github.com/gaosong-loongson/loongarch-binary/releases

Please review!

Thanks.
Song Gao

Song Gao (17):
  hw/loongarch: Move boot fucntions to boot.c
  hw/loongarch: Add load initrd
  hw/loongarch: Add slave cpu boot_code
  hw/loongarch: Add init_cmdline
  hw/loongarch: Init efi_system_table
  hw/loongarch: Init efi_boot_memmap table
  hw/loongarch: Init efi_initrd table
  hw/loongarch: Init efi_fdt table
  hw/loongarch: Fix fdt memory node wrong 'reg'
  hw/loongarch: fdt adds cpu interrupt controller node
  hw/loongarch: fdt adds Extend I/O Interrupt Controller
  hw/loongarch: fdt adds pch_pic Controller
  hw/loongarch: fdt adds pch_msi Controller
  hw/loongarch: fdt adds pcie irq_map node
  hw/loongarch: fdt remove unused irqchip node
  hw/loongarch: Add cells missing from uart node
  hw/loongarch: Add cells missing from rtc node

 include/hw/intc/loongarch_extioi.h |   1 +
 include/hw/loongarch/boot.h        | 109 +++++++++
 include/hw/loongarch/virt.h        |  14 ++
 include/hw/pci-host/ls7a.h         |   2 +
 target/loongarch/cpu.h             |   2 +
 hw/loongarch/boot.c                | 330 ++++++++++++++++++++++++++
 hw/loongarch/virt.c                | 364 ++++++++++++++++-------------
 hw/loongarch/meson.build           |   1 +
 8 files changed, 661 insertions(+), 162 deletions(-)
 create mode 100644 include/hw/loongarch/boot.h
 create mode 100644 hw/loongarch/boot.c

-- 
2.25.1
Re: [PATCH v5 00/17] Add boot LoongArch elf kernel with FDT
Posted by gaosong 8 months, 4 weeks ago
Hi,

If there are no new comments, I'll add this series to the loongarch-next 
branch next week.

Thanks.
Song Gao

在 2024/3/1 下午5:38, Song Gao 写道:
> Hi, All
>
> We already support boot efi kernel with bios, but not support boot elf kernel.
> This series adds boot elf kernel with FDT.
>
> 'LoongArch supports ACPI and FDT. The information that needs to be passed
>   to the kernel includes the memmap, the initrd, the command line, optionally
>   the ACPI/FDT tables, and so on'  see [1].
>
> Patch 2-8 : Create efi system table, and three efi configuration table
>              boot_memmap, initd, FDT.
> Patch 9-17 : Fixes FDT problems.
>
> Test:
>    - Start kernel
>      See [2] start_kernel.sh
>    - Start qcow2
>      See [2] start_qcow2.sh
>
> V5:
>    - Rebase;
>
> V4:
>    - patch 3 change slave_boot_code[] to const, and 'static void *p ' to
>      'void *p';
>    - patch 4 fixes build error;
>    - patch 10-13, add project and commit link.
>
> V3:
>    - Load initrd at  kernel_high + 4 * kernel_size;
>    - Load 'boot_rom' at [0 - 1M], the 'boot_rom' includes
>      slave_boot_code, cmdline_buf and systab_tables;
>    - R-b and rebase.
>
> V2:
>    - FDT pcie node adds cells 'msi-map';
>
>
> [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/arch/loongarch/booting.rst?h=v6.7-rc4
>
> [2]: https://github.com/gaosong-loongson/loongarch-binary/releases
>
> Please review!
>
> Thanks.
> Song Gao
>
> Song Gao (17):
>    hw/loongarch: Move boot fucntions to boot.c
>    hw/loongarch: Add load initrd
>    hw/loongarch: Add slave cpu boot_code
>    hw/loongarch: Add init_cmdline
>    hw/loongarch: Init efi_system_table
>    hw/loongarch: Init efi_boot_memmap table
>    hw/loongarch: Init efi_initrd table
>    hw/loongarch: Init efi_fdt table
>    hw/loongarch: Fix fdt memory node wrong 'reg'
>    hw/loongarch: fdt adds cpu interrupt controller node
>    hw/loongarch: fdt adds Extend I/O Interrupt Controller
>    hw/loongarch: fdt adds pch_pic Controller
>    hw/loongarch: fdt adds pch_msi Controller
>    hw/loongarch: fdt adds pcie irq_map node
>    hw/loongarch: fdt remove unused irqchip node
>    hw/loongarch: Add cells missing from uart node
>    hw/loongarch: Add cells missing from rtc node
>
>   include/hw/intc/loongarch_extioi.h |   1 +
>   include/hw/loongarch/boot.h        | 109 +++++++++
>   include/hw/loongarch/virt.h        |  14 ++
>   include/hw/pci-host/ls7a.h         |   2 +
>   target/loongarch/cpu.h             |   2 +
>   hw/loongarch/boot.c                | 330 ++++++++++++++++++++++++++
>   hw/loongarch/virt.c                | 364 ++++++++++++++++-------------
>   hw/loongarch/meson.build           |   1 +
>   8 files changed, 661 insertions(+), 162 deletions(-)
>   create mode 100644 include/hw/loongarch/boot.h
>   create mode 100644 hw/loongarch/boot.c
>