ARM: Extend qemu_arm to support ARM64
Subsystems (2)
v2 cover ARM: Extend qemu_arm to support ARM64
Changes in v2:
- Remove references to setting ARCH from the documentation
- Add Reviewed-by to the other 3 batches
Hi,
This series extends qemu_arm to have support for ARM64 as well. Adding test.py support for it gets us the first test.py job for an ARM64 board on Travis-CI.
The corresponding changes in the uboot-test-hook repository have already been merged but for reference they were in:
https://github.com/swarren/uboot-test-hooks/pull/15
Tuomas Tynkkynen (4):
ARM: qemu-arm: Add support for AArch64
ARM: Document AArch64 version of qemu-arm
Travis-CI: Download ARM64 version of GRUB as well
Travis-CI: Add job for running test.py on qemu_arm64
.travis.yml | 8 +++++
arch/arm/Kconfig | 2 --
arch/arm/mach-qemu/Kconfig | 11 +++++++
board/emulation/qemu-arm/MAINTAINERS | 1 +
board/emulation/qemu-arm/qemu-arm.c | 35 ++++++++++++++++++++++
.../{qemu_arm_defconfig => qemu_arm64_defconfig} | 1 +
configs/qemu_arm_defconfig | 1 +
doc/README.qemu-arm | 21 +++++++++----
8 files changed, 73 insertions(+), 7 deletions(-)
copy configs/{qemu_arm_defconfig => qemu_arm64_defconfig} (94%)Signature · 1 line
2.15.0
PATCH v2 1/4 ARM: qemu-arm: Add support for AArch64
This adds support for '-machine virt' on AArch64. This is rather simple:
we just add TARGET_QEMU_ARM_xxBIT to select a few different Kconfig symbols, provide the ARMv8 memory map from the board file and add a new defconfig based on the 32-bit defconfig.
---
v2: No change (except added Reviewed-by)
---
arch/arm/Kconfig | 2 --
arch/arm/mach-qemu/Kconfig | 11 +++++++
board/emulation/qemu-arm/MAINTAINERS | 1 +
board/emulation/qemu-arm/qemu-arm.c | 35 ++++++++++++++++++++++
.../{qemu_arm_defconfig => qemu_arm64_defconfig} | 1 +
configs/qemu_arm_defconfig | 1 +
6 files changed, 49 insertions(+), 2 deletions(-)
copy configs/{qemu_arm_defconfig => qemu_arm64_defconfig} (94%)arch/arm/Kconfig +0 -2
@@ -642,8 +642,6 @@ config ARCH_MX5 config ARCH_QEMU bool "QEMU Virtual Platform" - select CPU_V7 - select ARCH_SUPPORT_PSCI select DM select DM_SERIAL select OF_CONTROL
arch/arm/mach-qemu/Kconfig +11 -0
@@ -10,3 +10,14 @@ config SYS_CONFIG_NAME default "qemu-arm" endif + +config TARGET_QEMU_ARM_32BIT + bool "Support qemu_arm" + depends on ARCH_QEMU + select CPU_V7 + select ARCH_SUPPORT_PSCI + +config TARGET_QEMU_ARM_64BIT + bool "Support qemu_arm64" + depends on ARCH_QEMU + select ARM64
board/emulation/qemu-arm/MAINTAINERS +1 -0
@@ -4,3 +4,4 @@ S: Maintained F: board/emulation/qemu-arm/ F: include/configs/qemu-arm.h F: configs/qemu_arm_defconfig +F: configs/qemu_arm64_defconfig
board/emulation/qemu-arm/qemu-arm.c +35 -0
@@ -6,6 +6,41 @@#include <common.h> #include <fdtdec.h> +#ifdef CONFIG_ARM64 +#include <asm/armv8/mmu.h> + +static struct mm_region qemu_arm64_mem_map[] = { + { +/* Flash */ + .virt =0x00000000UL , + .phys =0x00000000UL , + .size =0x08000000UL , + .attrs =PTE_BLOCK_MEMTYPE (MT_NORMAL ) | +PTE_BLOCK_INNER_SHARE + }, { +/* Peripherals */ + .virt =0x08000000UL , + .phys =0x08000000UL , + .size =0x38000000 , + .attrs =PTE_BLOCK_MEMTYPE (MT_DEVICE_NGNRNE ) | +PTE_BLOCK_NON_SHARE | +PTE_BLOCK_PXN |PTE_BLOCK_UXN + }, { +/* RAM */ + .virt =0x40000000UL , + .phys =0x40000000UL , + .size =0xc0000000UL , + .attrs =PTE_BLOCK_MEMTYPE (MT_NORMAL ) | +PTE_BLOCK_INNER_SHARE + }, { +/* List terminator */ +0 , + } +}; + +struct mm_region *mem_map = qemu_arm64_mem_map; +#endif +int board_init (void ) {return 0 ;
configs/qemu_arm64_defconfig renamed from configs/qemu_arm_defconfig +1 -0
@@ -1,6 +1,7 @@ CONFIG_ARM=y CONFIG_ARM_SMCCC=y CONFIG_ARCH_QEMU=y +CONFIG_TARGET_QEMU_ARM_64BIT=y CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y # CONFIG_DISPLAY_CPUINFO is not set
configs/qemu_arm_defconfig +1 -0
@@ -1,6 +1,7 @@ CONFIG_ARM=y CONFIG_ARM_SMCCC=y CONFIG_ARCH_QEMU=y +CONFIG_TARGET_QEMU_ARM_32BIT=y CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y # CONFIG_DISPLAY_CPUINFO is not set
Signature · 1 line
2.15.0
PATCH v2 1/4 ARM: qemu-arm: Add support for AArch64
Quoted 4 lines · Tuomas Tynkkynen
This adds support for '-machine virt' on AArch64. This is rather simple:
we just addTARGET_QEMU_ARM_xxBITto select a few differentKconfigsymbols, provide the ARMv8 memory map from the board file and add a new defconfig based on the 32-bit defconfig.
While nvme is in the defconfig it seems only ahci works with distroboot automatically.
Booting off nvme requires manually running
=> nvme scan
=> setenv devtype nvme
=> run scan_dev_for_boot_part
Having it work automatically requires something like the below
include/config_distro_bootcmd.h +27 -0
@@ -195,6 +195,31 @@ BOOT_TARGET_DEVICES_references_SCSI_without_CONFIG_SCSI#endif +#ifdef CONFIG_NVME +#define BOOTENV_RUN_NVME_INIT "run nvme_init; " +#define BOOTENV_SET_NVME_NEED_INIT "setenv nvme_need_init; " +#define BOOTENV_SHARED_NVME \ + "nvme_init=" \ + "if ${nvme_need_init}; then " \ + "setenv nvme_need_init false; " \ + "nvme scan; " \ + "fi\0" \ + \ + "nvme_boot=" \ + BOOTENV_RUN_NVME_INIT \ + BOOTENV_SHARED_BLKDEV_BODY(nvme) +#define BOOTENV_DEV_NVME BOOTENV_DEV_BLKDEV +#define BOOTENV_DEV_NAME_NVME BOOTENV_DEV_NAME_BLKDEV +#else +#define BOOTENV_RUN_NVME_INIT +#define BOOTENV_SET_NVME_NEED_INIT +#define BOOTENV_SHARED_NVME +#define BOOTENV_DEV_NVME \ + BOOT_TARGET_DEVICES_references_NVME_without_CONFIG_NVME +#define BOOTENV_DEV_NAME_NVME \ + BOOT_TARGET_DEVICES_references_NVME_without_CONFIG_NVME +#endif +#ifdef CONFIG_IDE #define BOOTENV_SHARED_IDE BOOTENV_SHARED_BLKDEV(ide)#define BOOTENV_DEV_IDE BOOTENV_DEV_BLKDEV
@@ -324,6 +349,7 @@#define BOOTENV \ BOOTENV_SHARED_HOST \ BOOTENV_SHARED_MMC \ + BOOTENV_SHARED_NVME \ BOOTENV_SHARED_PCI \ BOOTENV_SHARED_USB \ BOOTENV_SHARED_SATA \
@@ -390,6 +416,7 @@ BOOT_TARGET_DEVICES(BOOTENV_DEV) \ \"distro_bootcmd=" BOOTENV_SET_SCSI_NEED_INIT \ +BOOTENV_SET_NVME_NEED_INIT \"for target in ${boot_targets}; do " \"run bootcmd_${target}; " \"done\0"
include/configs/qemu-arm.h +2 -1
@@ -38,7 +38,8 @@#include <config_distro_defaults.h> #define BOOT_TARGET_DEVICES (func) \ - func(SCSI, scsi, 0) + func(SCSI, scsi, 0) \ + func(NVME, nvme, 0)#include <config_distro_bootcmd.h>
PATCH v2 1/4 ARM: qemu-arm: Add support for AArch64
Hi Jonathan,
Quoted 9 lines · Jonathan Gray
Quoted 4 lines · Tuomas Tynkkynen
This adds support for '-machine virt' on AArch64. This is rather simple:
we just addTARGET_QEMU_ARM_xxBITto select a few differentKconfigsymbols, provide the ARMv8 memory map from the board file and add a new defconfig based on the 32-bit defconfig.While nvme is in the defconfig it seems only ahci works with distroboot automatically.
Quoted 8 lines
Booting off nvme requires manually running
=> nvme scan
=> setenv devtype nvme
=> runscan_dev_for_boot_partHaving it work automatically requires something like the below
Yeah. You should probably send that as a formal patch (or two I guess; one for config_distro_bootcmd.h; one for qemu-arm.h).
FWIW, I have a mostly-working virtio stack for U-Boot which probably would be the best disk interface for booting Linux. Still needs a lot of cleanup, hopefully one day it will be ready...
PATCH v2 1/4 ARM: qemu-arm: Add support for AArch64
Quoted 21 lines · Tuomas Tynkkynen
Hi Jonathan,
Quoted 9 lines · Jonathan Gray
Quoted 4 lines · Tuomas Tynkkynen
This adds support for '-machine virt' on AArch64. This is rather simple:
we just addTARGET_QEMU_ARM_xxBITto select a few differentKconfigsymbols, provide the ARMv8 memory map from the board file and add a new defconfig based on the 32-bit defconfig.While nvme is in the defconfig it seems only ahci works with distroboot automatically.
Quoted 8 lines
Booting off nvme requires manually running
=> nvme scan
=> setenv devtype nvme
=> runscan_dev_for_boot_partHaving it work automatically requires something like the below
Quoted 6 lines
Yeah. You should probably send that as a formal patch (or two I guess; one for
config_distro_bootcmd.h; one forqemu-arm.h).FWIW, I have a mostly-working virtio stack for U-Boot which probably would be the best disk interface for booting Linux. Still needs a lot of cleanup, hopefully one day it will be ready...
That would be great. I'm interested in running OpenBSD not Linux and ahci cant't map the interrupt with qemu (does on pci ecam + ahci on an overdrive 1000), and nvme turns out to hang when mounting the root filesystem.
Would be nice to be able to replace using edk2 ovmf for booting off virtio storage.
PATCH v2 1/4 ARM: qemu-arm: Add support for AArch64
In reply to Tuomas TynkkynenQuoted 7 lines · Tuomas Tynkkynen
This adds support for '-machine virt' on AArch64. This is rather simple:
we just addTARGET_QEMU_ARM_xxBITto select a few differentKconfigsymbols, provide the ARMv8 memory map from the board file and add a new defconfig based on the 32-bit defconfig.Signed-off-by Tuomas Tynkkynen <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180119/e3b01ba5/attachment.sig>
PATCH v2 2/4 ARM: Document AArch64 version of qemu-arm
In reply to Tuomas TynkkynenIt's mostly obvious, except that QEMU is annoying and requires an explicit '-cpu cortex-a57' (or some other 64-bit core) to actually run in 64-bit mode.
While at it, remove the references to setting the ARCH environment variable; that is not used in U-Boot.
---
v2: Drop ARCH=arm as it turns out not to be needed in U-Boot.
--- doc/README.qemu-arm | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
doc/README.qemu-arm +16 -5
@@ -4,11 +4,12 @@ # SPDX-License-Identifier: GPL-2.0+ # -U-Boot on QEMU's 'virt' machine on ARM -====================================== +U-Boot on QEMU's 'virt' machine on ARM & AArch64 +================================================ QEMU for ARM supports a special 'virt' machine designed for emulation and virtualization purposes. This document describes how to run U-Boot under it. +Both 32-bit ARM and AArch64 are supported. The 'virt' platform provides the following as the basic functionality:
@@ -17,7 +18,7 @@ The 'virt' platform provides the following as the basic functionality: - A generated device tree blob placed at the start of RAM - A freely configurable amount of RAM, described by the DTB - A PL011 serial port, discoverable via the DTB - - An ARMv7 architected timer + - An ARMv7/ARMv8 architected timer - PSCI for rebooting the system - A generic ECAM-based PCI host controller, discoverable via the DTB
@@ -25,19 +26,29 @@ Additionally, a number of optional peripherals can be added to the PCI bus. Building U-Boot --------------- -Set the CROSS_COMPILE and ARCH=arm environment variables as usual, and run: +Set the CROSS_COMPILE environment variable as usual, and run: +- For ARM: make qemu_arm_defconfig make +- For AArch64: + make qemu_arm64_defconfig + make + Running U-Boot -------------- The minimal QEMU command line to get U-Boot up and running is: +- For ARM: qemu-system-arm -machine virt,highmem=off -bios u-boot.bin +- For AArch64: + qemu-system-aarch64 -machine virt,highmem=off -cpu cortex-a57 -bios u-boot.bin + The 'highmem=off' parameter to the 'virt' machine is required for PCI to work -in U-Boot. +in U-Boot. Also, for some odd reason qemu-system-aarch64 needs to be explicitly +told to use a 64-bit CPU or it will boot in 32-bit mode. Additional peripherals that have been tested to work in both U-Boot and Linux can be enabled with the following command line parameters:
Signature · 1 line
2.15.0
PATCH v2 2/4 ARM: Document AArch64 version of qemu-arm
Quoted 8 lines · Tuomas Tynkkynen
It's mostly obvious, except that QEMU is annoying and requires an explicit '-cpu cortex-a57' (or some other 64-bit core) to actually run in 64-bit mode.
While at it, remove the references to setting the ARCH environment variable; that is not used in U-Boot.
Signed-off-by Tuomas Tynkkynen <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180111/df55c0d3/attachment.sig>
PATCH v2 2/4 ARM: Document AArch64 version of qemu-arm
In reply to Tuomas TynkkynenQuoted 9 lines · Tuomas Tynkkynen
It's mostly obvious, except that QEMU is annoying and requires an explicit '-cpu cortex-a57' (or some other 64-bit core) to actually run in 64-bit mode.
While at it, remove the references to setting the ARCH environment variable; that is not used in U-Boot.
Signed-off-by Tuomas Tynkkynen <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180119/9c33b37e/attachment.sig>
PATCH v2 3/4 Travis-CI: Download ARM64 version of GRUB as well
In reply to Tuomas TynkkynenFor preparation of adding AArch64 test.py jobs.
---
v2: No change (except added Reviewed-by)
--- .travis.yml | 3 +++ 1 file changed, 3 insertions(+)
.travis.yml +3 -0
@@ -46,6 +46,8 @@ install: - grub-mkimage -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd - mkdir ~/grub2-arm - ( cd ~/grub2-arm; wget -O - http://download.opensuse.org/ports/armv7hl/distribution/leap/42.2/repo/oss/suse/armv7hl/grub2-arm-efi-2.02~beta2-87.1.armv7hl.rpm | rpm2cpio | cpio -di ) + - mkdir ~/grub2-arm64 + - ( cd ~/grub2-arm64; wget -O - http://download.opensuse.org/ports/aarch64/distribution/leap/42.2/repo/oss/suse/aarch64/grub2-arm64-efi-2.02~beta2-87.1.aarch64.rpm | rpm2cpio | cpio -di ) env: global:
@@ -109,6 +111,7 @@ script: - export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/.bm-work/${TEST_PY_BD}; cp ~/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/; cp ~/grub2-arm/usr/lib/grub2/arm-efi/grub.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi; + cp ~/grub2-arm64/usr/lib/grub2/arm64-efi/grub.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi; if [[ "${TEST_PY_BD}" != "" ]]; then ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID} -k "${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}"
Signature · 1 line
2.15.0
PATCH v2 3/4 Travis-CI: Download ARM64 version of GRUB as well
Quoted 4 lines · Tuomas Tynkkynen
For preparation of adding AArch64
test.pyjobs.Signed-off-by Tuomas Tynkkynen <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180119/c8dedc15/attachment.sig>
PATCH v2 4/4 Travis-CI: Add job for running test.py on qemu_arm64
In reply to Tuomas TynkkynenThe corresponding changes in the uboot-test-hooks repo are:
https://github.com/swarren/uboot-test-hooks/pull/15
---
v2: No change (except added Reviewed-by)
--- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+)
.travis.yml +5 -0
@@ -315,6 +315,11 @@ matrix: TEST_PY_TEST_SPEC="not sleep" QEMU_TARGET="arm-softmmu" BUILDMAN="^qemu_arm$" + - env: + - TEST_PY_BD="qemu_arm64" + TEST_PY_TEST_SPEC="not sleep" + QEMU_TARGET="aarch64-softmmu" + BUILDMAN="^qemu_arm64$" - env: - TEST_PY_BD="qemu_mips" TEST_PY_TEST_SPEC="not sleep"
Signature · 1 line
2.15.0
PATCH v2 4/4 Travis-CI: Add job for running test.py on qemu_arm64
Quoted 6 lines · Tuomas Tynkkynen
The corresponding changes in the uboot-test-hooks repo are:
https://github.com/swarren/uboot-test-hooks/pull/15
Signed-off-by Tuomas Tynkkynen <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180119/74adcd02/attachment.sig>