2022-06-18 13:26:10 +02:00
|
|
|
|
README.txt
|
|
|
|
|
==========
|
|
|
|
|
|
2022-10-13 15:32:59 +02:00
|
|
|
|
This board configuration will use QEMU to emulate generic ARM64 v8-A series
|
2022-06-18 13:26:10 +02:00
|
|
|
|
hardware platform and provides support for these devices:
|
|
|
|
|
|
arch/arm64: Add support for Generic Interrupt Controller Version 2
Currently NuttX on Arm64 supports Generic Interrupt Controller (GIC) Versions 3 and 4: [`arm64_gicv3.c`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm64/src/common/arm64_gicv3.c), [`arm64_gic.h`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm64/src/common/arm64_gic.h). This PR adds support for GIC Version 2, which is needed by [Pine64 PinePhone](https://lupyuen.github.io/articles/interrupt) based on Allwinner A64 SoC.
This 64-bit implementation of GIC v2 is mostly identical to the existing GIC v2 for 32-bit Armv7-A ([`armv7-a/arm_gicv2.c`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/arm_gicv2.c), [`armv7-a/gic.h`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/gic.h)), with minor modifications to support 64-bit Registers (Interrupt Context).
- `arch/arm64/Kconfig`: Under "ARM64 Options", we added an integer option `ARM_GIC_VERSION` ("GIC version") that selects the GIC Version. Valid values are 2, 3 and 4, default is 3.
- `arch/arm64/src/common/arm64_gicv2.c`: Implements 64-bit GIC v2 based on 32-bit [`armv7-a/arm_gicv2.c`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/arm_gicv2.c) and [`armv7-a/gic.h`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/gic.h), modified to support 64-bit Registers (Interrupt Context).
Function and Macro Names have not been changed, for easier cross-referencing between the 32-bit and 64-bit implementations of GIC v2.
- `arch/arm64/src/common/arm64_gicv3.c`: Added Conditional Compilation for GIC v3. This file will not be compiled if `ARM_GIC_VERSION` is 2.
- `arch/arm64/src/common/arm64_gic.h`: Added the Version Identifier for GIC v2. At startup we read the GIC Version from hardware and verify that it matches `ARM_GIC_VERSION`.
- `arch/arm64/include/qemu/chip.h`: Added the QEMU Base Addresses for GIC v2.
- `arch/arm64/src/common/Make.defs`: Added the source file that implements GIC v2.
- `boards/arm64/qemu/qemu-armv8a/README.txt`: Added the documentation for testing GIC v2 with QEMU.
- `boards/arm64/qemu/qemu-armv8a/configs/nsh_gicv2/defconfig`: Added the Board Configuration `qemu-armv8a:nsh_gicv2` for testing GIC v2 with QEMU. Identical to `qemu-armv8a:nsh`, except that `ARM_GIC_VERSION` is 2.
2022-11-16 08:29:43 +01:00
|
|
|
|
- GICv2 and GICv3 interrupt controllers
|
2022-06-18 13:26:10 +02:00
|
|
|
|
- ARM Generic Timer
|
|
|
|
|
- PL011 UART controller
|
|
|
|
|
|
|
|
|
|
Contents
|
|
|
|
|
========
|
|
|
|
|
- Getting Started
|
|
|
|
|
- Status
|
|
|
|
|
- Platform Features
|
|
|
|
|
- Debugging with QEMU
|
|
|
|
|
- FPU Support and Performance
|
|
|
|
|
- SMP Support
|
|
|
|
|
- References
|
|
|
|
|
|
|
|
|
|
Getting Started
|
|
|
|
|
===============
|
|
|
|
|
|
|
|
|
|
1. Compile Toolchain
|
|
|
|
|
1.1 Host environment
|
|
|
|
|
GNU/Linux: Ubuntu 18.04 or greater
|
|
|
|
|
1.2 Download and Install
|
|
|
|
|
$ wget https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf.tar.xz
|
|
|
|
|
$ xz -d gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf.tar.xz
|
|
|
|
|
$ tar xf gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf.tar
|
|
|
|
|
|
|
|
|
|
Put gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf/bin/ to your host PATH environment variable, like:
|
|
|
|
|
$ export PATH=$PATH:/opt/software/arm/linaro-toolchain/gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf/bin
|
|
|
|
|
check the toolchain:
|
|
|
|
|
$ aarch64-none-elf-gcc -v
|
|
|
|
|
|
|
|
|
|
2. Install QEMU
|
|
|
|
|
In Ubuntu 18.04(or greater), install qemu:
|
|
|
|
|
$ sudo apt-get install qemu-system-arm qemu-efi-aarch64 qemu-utils
|
|
|
|
|
And make sure install is properly:
|
|
|
|
|
$ qemu-system-aarch64 --help
|
|
|
|
|
|
|
|
|
|
3. Configuring and running
|
arch/arm64: Add support for Generic Interrupt Controller Version 2
Currently NuttX on Arm64 supports Generic Interrupt Controller (GIC) Versions 3 and 4: [`arm64_gicv3.c`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm64/src/common/arm64_gicv3.c), [`arm64_gic.h`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm64/src/common/arm64_gic.h). This PR adds support for GIC Version 2, which is needed by [Pine64 PinePhone](https://lupyuen.github.io/articles/interrupt) based on Allwinner A64 SoC.
This 64-bit implementation of GIC v2 is mostly identical to the existing GIC v2 for 32-bit Armv7-A ([`armv7-a/arm_gicv2.c`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/arm_gicv2.c), [`armv7-a/gic.h`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/gic.h)), with minor modifications to support 64-bit Registers (Interrupt Context).
- `arch/arm64/Kconfig`: Under "ARM64 Options", we added an integer option `ARM_GIC_VERSION` ("GIC version") that selects the GIC Version. Valid values are 2, 3 and 4, default is 3.
- `arch/arm64/src/common/arm64_gicv2.c`: Implements 64-bit GIC v2 based on 32-bit [`armv7-a/arm_gicv2.c`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/arm_gicv2.c) and [`armv7-a/gic.h`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/gic.h), modified to support 64-bit Registers (Interrupt Context).
Function and Macro Names have not been changed, for easier cross-referencing between the 32-bit and 64-bit implementations of GIC v2.
- `arch/arm64/src/common/arm64_gicv3.c`: Added Conditional Compilation for GIC v3. This file will not be compiled if `ARM_GIC_VERSION` is 2.
- `arch/arm64/src/common/arm64_gic.h`: Added the Version Identifier for GIC v2. At startup we read the GIC Version from hardware and verify that it matches `ARM_GIC_VERSION`.
- `arch/arm64/include/qemu/chip.h`: Added the QEMU Base Addresses for GIC v2.
- `arch/arm64/src/common/Make.defs`: Added the source file that implements GIC v2.
- `boards/arm64/qemu/qemu-armv8a/README.txt`: Added the documentation for testing GIC v2 with QEMU.
- `boards/arm64/qemu/qemu-armv8a/configs/nsh_gicv2/defconfig`: Added the Board Configuration `qemu-armv8a:nsh_gicv2` for testing GIC v2 with QEMU. Identical to `qemu-armv8a:nsh`, except that `ARM_GIC_VERSION` is 2.
2022-11-16 08:29:43 +01:00
|
|
|
|
3.1 Single Core (GICv3)
|
2022-06-18 13:26:10 +02:00
|
|
|
|
Configuring NuttX and compile:
|
2022-10-13 15:32:59 +02:00
|
|
|
|
$ ./tools/configure.sh -l qemu-armv8a:nsh
|
2022-06-18 13:26:10 +02:00
|
|
|
|
$ make
|
|
|
|
|
Running with qemu
|
|
|
|
|
$ qemu-system-aarch64 -cpu cortex-a53 -nographic \
|
|
|
|
|
-machine virt,virtualization=on,gic-version=3 \
|
|
|
|
|
-net none -chardev stdio,id=con,mux=on -serial chardev:con \
|
|
|
|
|
-mon chardev=con,mode=readline -kernel ./nuttx
|
|
|
|
|
|
2023-05-12 04:24:20 +02:00
|
|
|
|
3.1.1 Single Core with virtio network and block driver (GICv3)
|
2022-11-23 13:21:46 +01:00
|
|
|
|
Configuring NuttX and compile:
|
|
|
|
|
$ ./tools/configure.sh -l qemu-armv8a:netnsh
|
|
|
|
|
$ make
|
2023-05-12 04:24:20 +02:00
|
|
|
|
$ dd if=/dev/zero of=./mydisk-1gb.img bs=1M count=1024
|
2022-11-23 13:21:46 +01:00
|
|
|
|
Running with qemu
|
|
|
|
|
$ qemu-system-aarch64 -cpu cortex-a53 -nographic \
|
|
|
|
|
-machine virt,virtualization=on,gic-version=3 \
|
|
|
|
|
-chardev stdio,id=con,mux=on -serial chardev:con \
|
|
|
|
|
-global virtio-mmio.force-legacy=false \
|
2023-05-12 04:24:20 +02:00
|
|
|
|
-drive file=./mydisk-1gb.img,if=none,format=raw,id=hd -device virtio-blk-device,drive=hd \
|
2022-11-23 13:21:46 +01:00
|
|
|
|
-netdev user,id=u1,hostfwd=tcp:127.0.0.1:10023-10.0.2.15:23,hostfwd=tcp:127.0.0.1:15001-10.0.2.15:5001 \
|
|
|
|
|
-device virtio-net-device,netdev=u1,bus=virtio-mmio-bus.0 \
|
|
|
|
|
-mon chardev=con,mode=readline -kernel ./nuttx
|
|
|
|
|
|
arch/arm64: Add support for Generic Interrupt Controller Version 2
Currently NuttX on Arm64 supports Generic Interrupt Controller (GIC) Versions 3 and 4: [`arm64_gicv3.c`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm64/src/common/arm64_gicv3.c), [`arm64_gic.h`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm64/src/common/arm64_gic.h). This PR adds support for GIC Version 2, which is needed by [Pine64 PinePhone](https://lupyuen.github.io/articles/interrupt) based on Allwinner A64 SoC.
This 64-bit implementation of GIC v2 is mostly identical to the existing GIC v2 for 32-bit Armv7-A ([`armv7-a/arm_gicv2.c`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/arm_gicv2.c), [`armv7-a/gic.h`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/gic.h)), with minor modifications to support 64-bit Registers (Interrupt Context).
- `arch/arm64/Kconfig`: Under "ARM64 Options", we added an integer option `ARM_GIC_VERSION` ("GIC version") that selects the GIC Version. Valid values are 2, 3 and 4, default is 3.
- `arch/arm64/src/common/arm64_gicv2.c`: Implements 64-bit GIC v2 based on 32-bit [`armv7-a/arm_gicv2.c`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/arm_gicv2.c) and [`armv7-a/gic.h`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/gic.h), modified to support 64-bit Registers (Interrupt Context).
Function and Macro Names have not been changed, for easier cross-referencing between the 32-bit and 64-bit implementations of GIC v2.
- `arch/arm64/src/common/arm64_gicv3.c`: Added Conditional Compilation for GIC v3. This file will not be compiled if `ARM_GIC_VERSION` is 2.
- `arch/arm64/src/common/arm64_gic.h`: Added the Version Identifier for GIC v2. At startup we read the GIC Version from hardware and verify that it matches `ARM_GIC_VERSION`.
- `arch/arm64/include/qemu/chip.h`: Added the QEMU Base Addresses for GIC v2.
- `arch/arm64/src/common/Make.defs`: Added the source file that implements GIC v2.
- `boards/arm64/qemu/qemu-armv8a/README.txt`: Added the documentation for testing GIC v2 with QEMU.
- `boards/arm64/qemu/qemu-armv8a/configs/nsh_gicv2/defconfig`: Added the Board Configuration `qemu-armv8a:nsh_gicv2` for testing GIC v2 with QEMU. Identical to `qemu-armv8a:nsh`, except that `ARM_GIC_VERSION` is 2.
2022-11-16 08:29:43 +01:00
|
|
|
|
3.2 SMP (GICv3)
|
2022-06-18 13:26:10 +02:00
|
|
|
|
Configuring NuttX and compile:
|
2022-10-13 15:32:59 +02:00
|
|
|
|
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
|
2022-06-18 13:26:10 +02:00
|
|
|
|
$ make
|
2022-08-07 15:20:07 +02:00
|
|
|
|
Running with qemu
|
2022-06-18 13:26:10 +02:00
|
|
|
|
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
|
|
|
|
|
-machine virt,virtualization=on,gic-version=3 \
|
|
|
|
|
-net none -chardev stdio,id=con,mux=on -serial chardev:con \
|
|
|
|
|
-mon chardev=con,mode=readline -kernel ./nuttx
|
|
|
|
|
|
2022-11-23 13:21:46 +01:00
|
|
|
|
3.2.1 SMP (GICv3)
|
|
|
|
|
Configuring NuttX and compile:
|
|
|
|
|
$ ./tools/configure.sh -l qemu-armv8a:netnsh_smp
|
|
|
|
|
$ make
|
|
|
|
|
Running with qemu
|
|
|
|
|
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
|
|
|
|
|
-machine virt,virtualization=on,gic-version=3 \
|
|
|
|
|
-chardev stdio,id=con,mux=on -serial chardev:con \
|
|
|
|
|
-global virtio-mmio.force-legacy=false \
|
|
|
|
|
-netdev user,id=u1,hostfwd=tcp:127.0.0.1:10023-10.0.2.15:23,hostfwd=tcp:127.0.0.1:15001-10.0.2.15:5001 \
|
|
|
|
|
-device virtio-net-device,netdev=u1,bus=virtio-mmio-bus.0 \
|
|
|
|
|
-mon chardev=con,mode=readline -kernel ./nuttx
|
|
|
|
|
|
arch/arm64: Add support for Generic Interrupt Controller Version 2
Currently NuttX on Arm64 supports Generic Interrupt Controller (GIC) Versions 3 and 4: [`arm64_gicv3.c`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm64/src/common/arm64_gicv3.c), [`arm64_gic.h`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm64/src/common/arm64_gic.h). This PR adds support for GIC Version 2, which is needed by [Pine64 PinePhone](https://lupyuen.github.io/articles/interrupt) based on Allwinner A64 SoC.
This 64-bit implementation of GIC v2 is mostly identical to the existing GIC v2 for 32-bit Armv7-A ([`armv7-a/arm_gicv2.c`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/arm_gicv2.c), [`armv7-a/gic.h`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/gic.h)), with minor modifications to support 64-bit Registers (Interrupt Context).
- `arch/arm64/Kconfig`: Under "ARM64 Options", we added an integer option `ARM_GIC_VERSION` ("GIC version") that selects the GIC Version. Valid values are 2, 3 and 4, default is 3.
- `arch/arm64/src/common/arm64_gicv2.c`: Implements 64-bit GIC v2 based on 32-bit [`armv7-a/arm_gicv2.c`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/arm_gicv2.c) and [`armv7-a/gic.h`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/gic.h), modified to support 64-bit Registers (Interrupt Context).
Function and Macro Names have not been changed, for easier cross-referencing between the 32-bit and 64-bit implementations of GIC v2.
- `arch/arm64/src/common/arm64_gicv3.c`: Added Conditional Compilation for GIC v3. This file will not be compiled if `ARM_GIC_VERSION` is 2.
- `arch/arm64/src/common/arm64_gic.h`: Added the Version Identifier for GIC v2. At startup we read the GIC Version from hardware and verify that it matches `ARM_GIC_VERSION`.
- `arch/arm64/include/qemu/chip.h`: Added the QEMU Base Addresses for GIC v2.
- `arch/arm64/src/common/Make.defs`: Added the source file that implements GIC v2.
- `boards/arm64/qemu/qemu-armv8a/README.txt`: Added the documentation for testing GIC v2 with QEMU.
- `boards/arm64/qemu/qemu-armv8a/configs/nsh_gicv2/defconfig`: Added the Board Configuration `qemu-armv8a:nsh_gicv2` for testing GIC v2 with QEMU. Identical to `qemu-armv8a:nsh`, except that `ARM_GIC_VERSION` is 2.
2022-11-16 08:29:43 +01:00
|
|
|
|
3.3 Single Core (GICv2)
|
|
|
|
|
Configuring NuttX and compile:
|
|
|
|
|
$ ./tools/configure.sh -l qemu-armv8a:nsh_gicv2
|
|
|
|
|
$ make
|
|
|
|
|
Running with qemu
|
|
|
|
|
$ qemu-system-aarch64 -cpu cortex-a53 -nographic \
|
|
|
|
|
-machine virt,virtualization=on,gic-version=2 \
|
|
|
|
|
-net none -chardev stdio,id=con,mux=on -serial chardev:con \
|
|
|
|
|
-mon chardev=con,mode=readline -kernel ./nuttx
|
|
|
|
|
|
2022-06-18 13:26:10 +02:00
|
|
|
|
Note:
|
|
|
|
|
1. Make sure the aarch64-none-elf toolchain install PATH has been added to environment variable
|
|
|
|
|
2. To quit QEMU, type Ctrl + X
|
|
|
|
|
3. Nuttx default core number is 4, and Changing CONFIG_SMP_NCPUS > 4 and setting qemu command
|
|
|
|
|
option -smp will boot more core. For qemu, core limit is 32.
|
|
|
|
|
|
|
|
|
|
Status
|
|
|
|
|
======
|
|
|
|
|
|
arch/arm64: Add support for Generic Interrupt Controller Version 2
Currently NuttX on Arm64 supports Generic Interrupt Controller (GIC) Versions 3 and 4: [`arm64_gicv3.c`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm64/src/common/arm64_gicv3.c), [`arm64_gic.h`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm64/src/common/arm64_gic.h). This PR adds support for GIC Version 2, which is needed by [Pine64 PinePhone](https://lupyuen.github.io/articles/interrupt) based on Allwinner A64 SoC.
This 64-bit implementation of GIC v2 is mostly identical to the existing GIC v2 for 32-bit Armv7-A ([`armv7-a/arm_gicv2.c`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/arm_gicv2.c), [`armv7-a/gic.h`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/gic.h)), with minor modifications to support 64-bit Registers (Interrupt Context).
- `arch/arm64/Kconfig`: Under "ARM64 Options", we added an integer option `ARM_GIC_VERSION` ("GIC version") that selects the GIC Version. Valid values are 2, 3 and 4, default is 3.
- `arch/arm64/src/common/arm64_gicv2.c`: Implements 64-bit GIC v2 based on 32-bit [`armv7-a/arm_gicv2.c`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/arm_gicv2.c) and [`armv7-a/gic.h`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/gic.h), modified to support 64-bit Registers (Interrupt Context).
Function and Macro Names have not been changed, for easier cross-referencing between the 32-bit and 64-bit implementations of GIC v2.
- `arch/arm64/src/common/arm64_gicv3.c`: Added Conditional Compilation for GIC v3. This file will not be compiled if `ARM_GIC_VERSION` is 2.
- `arch/arm64/src/common/arm64_gic.h`: Added the Version Identifier for GIC v2. At startup we read the GIC Version from hardware and verify that it matches `ARM_GIC_VERSION`.
- `arch/arm64/include/qemu/chip.h`: Added the QEMU Base Addresses for GIC v2.
- `arch/arm64/src/common/Make.defs`: Added the source file that implements GIC v2.
- `boards/arm64/qemu/qemu-armv8a/README.txt`: Added the documentation for testing GIC v2 with QEMU.
- `boards/arm64/qemu/qemu-armv8a/configs/nsh_gicv2/defconfig`: Added the Board Configuration `qemu-armv8a:nsh_gicv2` for testing GIC v2 with QEMU. Identical to `qemu-armv8a:nsh`, except that `ARM_GIC_VERSION` is 2.
2022-11-16 08:29:43 +01:00
|
|
|
|
2022-11-18:
|
|
|
|
|
1. Added support for GICv2.
|
|
|
|
|
|
|
|
|
|
2. Added board configuration for nsh_gicv2.
|
|
|
|
|
|
2022-10-13 15:32:59 +02:00
|
|
|
|
2022-10-13:
|
|
|
|
|
1. Renamed the board configuration name from qemu-a53 to qemu-v8a.
|
|
|
|
|
|
|
|
|
|
2. Added the configurations for Cortex-A57 and Cortex-A72.
|
|
|
|
|
|
2022-06-18 13:26:10 +02:00
|
|
|
|
2022-07-01:
|
|
|
|
|
|
|
|
|
|
1. It's very stranger to see that signal testing of ostest is PASSED at Physical Ubuntu PC
|
|
|
|
|
rather than an Ubuntu at VMWare. For Physical Ubuntu PC, I have run the ostest
|
|
|
|
|
for 10 times at least but never see the crash again, but it's almost crashed every time
|
|
|
|
|
running the ostest at Virtual Ubuntu in VMWare
|
|
|
|
|
I check the fail point. It's seem at signal routine to access another CPU's task context reg
|
|
|
|
|
will get a NULL pointer, but I watch the task context with GDB, everything is OK.
|
|
|
|
|
So maybe this is a SMP cache synchronize issue? But I have done cache synchronize
|
|
|
|
|
operation at thread switch and how to explain why the crash not happening at
|
|
|
|
|
Physical Ubuntu PC?
|
|
|
|
|
So maybe this is a qemu issue at VMWare. I am planning to run
|
|
|
|
|
the arm64 to real hardware platform like IMX8 and will check the issue again
|
|
|
|
|
|
|
|
|
|
2022-06-12:
|
|
|
|
|
|
|
|
|
|
1. SMP is support at QEMU. Add psci interface, armv8 cache operation(data cache)
|
|
|
|
|
and smccc support. The system can run into nsh shell, SMP test is PASSED, but
|
|
|
|
|
ostest crash at signal testing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-22:
|
|
|
|
|
Arm64 support version for NuttX is Ready, These Features supported:
|
|
|
|
|
1.Cotex-a53 single core support: With the supporting of GICv3,
|
|
|
|
|
Arch timer, PL101 UART, The system can run into nsh shell.
|
|
|
|
|
Running ostest seem PASSED.
|
|
|
|
|
|
|
|
|
|
2.qemu-a53 board configuration support: qemu-a53 board can configuring
|
2022-08-07 15:20:07 +02:00
|
|
|
|
and compiling, And running with qemu-system-aarch64
|
2022-06-18 13:26:10 +02:00
|
|
|
|
at Ubuntu 18.04.
|
|
|
|
|
3.FPU support for armv8-a: FPU context switching in NEON/floating-point
|
|
|
|
|
TRAP was supported. FPU registers saving at vfork and independent
|
|
|
|
|
FPU context for signal routine was considered but more testing
|
|
|
|
|
needs to be do.
|
|
|
|
|
|
|
|
|
|
Platform Features
|
|
|
|
|
=================
|
|
|
|
|
|
|
|
|
|
The following hardware features are supported:
|
|
|
|
|
+--------------+------------+----------------------+
|
|
|
|
|
| Interface | Controller | Driver/Component |
|
|
|
|
|
+==============+============+======================+
|
|
|
|
|
| GIC | on-chip | interrupt controller |
|
|
|
|
|
+--------------+------------+----------------------+
|
|
|
|
|
| PL011 UART | on-chip | serial port |
|
|
|
|
|
+--------------+------------+----------------------+
|
|
|
|
|
| ARM TIMER | on-chip | system clock |
|
|
|
|
|
+--------------+------------+----------------------+
|
|
|
|
|
|
|
|
|
|
The kernel currently does not support other hardware features on this
|
|
|
|
|
qemu platform.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Debugging with QEMU
|
|
|
|
|
===================
|
|
|
|
|
|
|
|
|
|
The nuttx ELF image can be debugged with QEMU.
|
|
|
|
|
|
|
|
|
|
1. To debug the nuttx (ELF) with symbols, make sure the following change have
|
|
|
|
|
applied to defconfig.
|
|
|
|
|
|
|
|
|
|
+CONFIG_DEBUG_SYMBOLS=y
|
|
|
|
|
|
|
|
|
|
2. Run QEMU(at shell terminal 1)
|
|
|
|
|
|
|
|
|
|
Single Core
|
|
|
|
|
$ qemu-system-aarch64 -cpu cortex-a53 -nographic -machine virt,virtualization=on,gic-version=3 \
|
|
|
|
|
-net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline \
|
|
|
|
|
-kernel ./nuttx -S -s
|
|
|
|
|
SMP
|
|
|
|
|
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic -machine virt,virtualization=on,gic-version=3 \
|
|
|
|
|
-net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline \
|
|
|
|
|
-kernel ./nuttx -S -s
|
|
|
|
|
|
|
|
|
|
3. Run gdb with TUI, connect to QEMU, load nuttx and continue (at shell terminal 2)
|
|
|
|
|
|
|
|
|
|
$ aarch64-none-elf-gdb -tui --eval-command='target remote localhost:1234' nuttx
|
|
|
|
|
(gdb) set debug aarch64
|
|
|
|
|
(gdb) c
|
|
|
|
|
Continuing.
|
|
|
|
|
^C
|
|
|
|
|
Program received signal SIGINT, Interrupt.
|
|
|
|
|
arch_cpu_idle () at common/arm64_cpu_idle.S:37
|
|
|
|
|
(gdb)
|
|
|
|
|
(gdb) where
|
|
|
|
|
#0 arch_cpu_idle () at common/arm64_cpu_idle.S:37
|
|
|
|
|
#1 0x00000000402823ec in nx_start () at init/nx_start.c:742
|
|
|
|
|
#2 0x0000000040280148 in arm64_boot_primary_c_routine () at common/arm64_boot.c:184
|
|
|
|
|
#3 0x00000000402a5bf8 in switch_el () at common/arm64_head.S:201
|
|
|
|
|
(gdb)
|
|
|
|
|
|
|
|
|
|
SMP Case
|
|
|
|
|
Thread 1 received signal SIGINT, Interrupt.
|
|
|
|
|
arch_cpu_idle () at common/arm64_cpu_idle.S:37
|
|
|
|
|
(gdb) info threads
|
|
|
|
|
Id Target Id Frame
|
|
|
|
|
* 1 Thread 1 (CPU#0 [halted ]) arch_cpu_idle () at common/arm64_cpu_idle.S:37
|
|
|
|
|
2 Thread 2 (CPU#1 [halted ]) arch_cpu_idle () at common/arm64_cpu_idle.S:37
|
|
|
|
|
3 Thread 3 (CPU#2 [halted ]) arch_cpu_idle () at common/arm64_cpu_idle.S:37
|
|
|
|
|
4 Thread 4 (CPU#3 [halted ]) arch_cpu_idle () at common/arm64_cpu_idle.S:37
|
|
|
|
|
(gdb)
|
|
|
|
|
|
|
|
|
|
Note:
|
2023-02-25 19:14:11 +01:00
|
|
|
|
1. it will make your debugging more easier in source level if you setting
|
|
|
|
|
CONFIG_DEBUG_FULLOPT=n. but there is a risk of stack overflow when the
|
|
|
|
|
option is disabled. Just enlarging your stack size will avoid the
|
2022-06-18 13:26:10 +02:00
|
|
|
|
issue (eg. enlarging CONFIG_DEFAULT_TASK_STACKSIZE)
|
|
|
|
|
2. TODO: ARMv8-A Supporting for tools/nuttx-gdbinit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FPU Support and Performance
|
|
|
|
|
===========================
|
|
|
|
|
I was using FPU trap to handle FPU context switch. For threads accessing
|
|
|
|
|
the FPU (FPU instructions or registers), a trap will happen at this thread,
|
|
|
|
|
the FPU context will be saved/restore for the thread at the trap handler.
|
|
|
|
|
It will improve performance for thread switch since it's not to save/restore
|
|
|
|
|
the FPU context (almost 512 bytes) at the thread switch anymore. But some issue
|
|
|
|
|
need to be considered:
|
|
|
|
|
|
|
|
|
|
1. Floating point argument passing issue
|
|
|
|
|
In many cases, the FPU trap is triggered by va_start() that copies
|
|
|
|
|
the content of FP registers used for floating point argument passing
|
|
|
|
|
into the va_list object in case there were actual float arguments from
|
2023-03-13 04:10:40 +01:00
|
|
|
|
the caller.
|
2022-06-18 13:26:10 +02:00
|
|
|
|
adding -mgeneral-regs-only option will make compiler not use the FPU
|
|
|
|
|
register, we can use the following patch to syslog:
|
|
|
|
|
|
|
|
|
|
diff --git a/libs/libc/syslog/Make.defs b/libs/libc/syslog/Make.defs
|
|
|
|
|
index c58fb45512..acac6febaa
|
|
|
|
|
--- a/libs/libc/syslog/Make.defs
|
|
|
|
|
+++ b/libs/libc/syslog/Make.defs
|
|
|
|
|
@@ -26,3 +26,4 @@ CSRCS += lib_syslog.c lib_setlogmask.c
|
|
|
|
|
|
|
|
|
|
DEPPATH += --dep-path syslog
|
|
|
|
|
VPATH += :syslog
|
|
|
|
|
+syslog/lib_syslog.c_CFLAGS += -mgeneral-regs-only
|
2023-03-13 04:10:40 +01:00
|
|
|
|
I cannot commit the patch for NuttX mainline because it's very special case
|
2023-02-25 19:14:11 +01:00
|
|
|
|
since ostest is using syslog for lots of information printing. but this is
|
2022-06-18 13:26:10 +02:00
|
|
|
|
a clue for FPU performance analysis. va_list object is using for many C code to
|
|
|
|
|
handle argument passing, but if it's not passing floating point argument indeed.
|
|
|
|
|
Add the option to your code maybe increase FPU performance
|
|
|
|
|
|
2023-03-13 04:10:40 +01:00
|
|
|
|
2. memset/memcpy issue
|
|
|
|
|
For improve performance, the memset/memcpy implement for libc will
|
|
|
|
|
use the neon/fpu instruction/register. The FPU trap is also triggered
|
|
|
|
|
in this case.
|
|
|
|
|
|
|
|
|
|
we can trace this issue with Procfs:
|
|
|
|
|
|
|
|
|
|
nsh> cat /proc/arm64fpu
|
|
|
|
|
CPU0: save: 7 restore: 8 switch: 62 exedepth: 0
|
|
|
|
|
nsh>
|
|
|
|
|
|
|
|
|
|
after ostest
|
|
|
|
|
nsh> cat /proc/arm64fpu
|
|
|
|
|
CPU0: save: 1329 restore: 2262 switch: 4613 exedepth: 0
|
|
|
|
|
nsh>
|
|
|
|
|
|
|
|
|
|
Note:
|
|
|
|
|
save: the counts of save for task FPU context
|
|
|
|
|
restore: the counts of restore for task FPU context
|
|
|
|
|
switch: the counts of task switch
|
|
|
|
|
|
2022-06-18 13:26:10 +02:00
|
|
|
|
2. FPU trap at IRQ handler
|
|
|
|
|
it's probably need to handle FPU trap at IRQ routine. Exception_depth is
|
|
|
|
|
handling for this case, it will inc/dec at enter/leave exception. If the
|
|
|
|
|
exception_depth > 1, that means an exception occurring when another exception
|
|
|
|
|
is executing, the present implement is to switch FPU context to idle thread,
|
2022-08-07 15:20:07 +02:00
|
|
|
|
it will handle most case for calling printf-like routine at IRQ routine.
|
2022-06-18 13:26:10 +02:00
|
|
|
|
But in fact, this case will make uncertainty interrupt processing time sine
|
|
|
|
|
it's uncertainty for trap exception handling. It would be best to add
|
|
|
|
|
"-mgeneral-regs-only" option to compile the IRQ code avoiding accessing FP
|
|
|
|
|
register.
|
|
|
|
|
if it's necessarily for the exception routine to use FPU, calling function to
|
|
|
|
|
save/restore FPU context directly maybe become a solution. Linux kernel introduce
|
|
|
|
|
kernel_neon_begin/kernel_neon_end function for this case. Similar function will
|
|
|
|
|
be add to NuttX if this issue need to be handle.
|
|
|
|
|
|
2023-03-13 04:10:40 +01:00
|
|
|
|
3. More reading
|
|
|
|
|
for Linux kernel, please reference:
|
|
|
|
|
- https://www.kernel.org/doc/html/latest/arm/kernel_mode_neon.html
|
|
|
|
|
|
2022-06-18 13:26:10 +02:00
|
|
|
|
SMP Support
|
|
|
|
|
===========
|
|
|
|
|
1. Booting
|
|
|
|
|
Primary core call sequence
|
|
|
|
|
arm64_start
|
|
|
|
|
->arm64_boot_primary_c_routine
|
|
|
|
|
->arm64_chip_boot
|
|
|
|
|
->set init TBBR and Enable MMU
|
|
|
|
|
->nx_start
|
|
|
|
|
->OS component initialize
|
|
|
|
|
->Initialize GIC: GICD and Primary core GICR
|
|
|
|
|
->nx_smp_start
|
|
|
|
|
for every CPU core
|
|
|
|
|
->up_cpu_start
|
|
|
|
|
->arm64_start_cpu(call PCSI to boot CPU)
|
2023-02-25 19:14:11 +01:00
|
|
|
|
->waiting for every core to boot
|
2022-06-18 13:26:10 +02:00
|
|
|
|
->nx_bringup
|
|
|
|
|
|
|
|
|
|
Secondary Core call sequence
|
|
|
|
|
arm64_start
|
|
|
|
|
->arm64_boot_secondary_c_routine
|
|
|
|
|
->Enable MMU
|
|
|
|
|
->Initialize GIC: Secondary core GICR
|
|
|
|
|
->Notify Primary core booting is Ready
|
|
|
|
|
->nx_idle_trampoline
|
2023-02-25 19:14:11 +01:00
|
|
|
|
|
2022-06-18 13:26:10 +02:00
|
|
|
|
2. interrupt
|
|
|
|
|
|
|
|
|
|
SGI
|
|
|
|
|
SGI_CPU_PAUSE: for core pause request, for every core
|
|
|
|
|
|
|
|
|
|
PPI
|
|
|
|
|
ARM_ARCH_TIMER_IRQ: timer interrupt, handle by primary Core
|
|
|
|
|
|
|
|
|
|
SPI
|
|
|
|
|
CONFIG_QEMU_UART_IRQ: serial driver interrupt, handle by primary Core
|
|
|
|
|
|
|
|
|
|
3. Timer
|
|
|
|
|
The origin design for ARMv8-A timer is assigned private timer to
|
|
|
|
|
every PE(CPU core), the ARM_ARCH_TIMER_IRQ is a PPI so it's
|
|
|
|
|
should be enabled at every core.
|
|
|
|
|
|
|
|
|
|
But for NuttX, it's design only for primary core to handle timer
|
2023-02-25 19:14:11 +01:00
|
|
|
|
interrupt and call nxsched_process_timer at timer tick mode.
|
2022-06-18 13:26:10 +02:00
|
|
|
|
So we need only enable timer for primary core
|
|
|
|
|
|
|
|
|
|
IMX6 use GPT which is a SPI rather than generic timer to handle
|
|
|
|
|
timer interrupt
|
|
|
|
|
|
|
|
|
|
References
|
|
|
|
|
===========
|
|
|
|
|
|
|
|
|
|
1. (ID050815) ARM® Cortex®-A Series - Programmer’s Guide for ARMv8-A
|
|
|
|
|
2. (ID020222) Arm® Architecture Reference Manual - for A profile architecture
|
|
|
|
|
3. (ARM062-948681440-3280) Armv8-A Instruction Set Architecture
|
|
|
|
|
4. AArch64 Exception and Interrupt Handling
|
|
|
|
|
5. AArch64 Programmer's Guides Generic Timer
|
|
|
|
|
6. Arm Generic Interrupt Controller v3 and v4 Overview
|
|
|
|
|
7. Arm® Generic Interrupt Controller Architecture Specification GIC architecture version 3 and version 4
|
|
|
|
|
8. (DEN0022D.b) Arm Power State Coordination Interface Platform Design Document
|