foc: add support for Raspberry Pi 3

Ref #3260
This commit is contained in:
Stefan Kalkowski 2019-03-29 11:08:06 +01:00 committed by Christian Helmuth
parent 71a48c0a26
commit f0d28eeca7
15 changed files with 282 additions and 13 deletions

View File

@ -0,0 +1,107 @@
#
# Automatically generated file; DO NOT EDIT.
# Fiasco configuration
#
CONFIG_HAS_FPU_OPTION=y
CONFIG_HAS_VIRT_OBJ_SPACE_OPTION=y
CONFIG_HAS_SERIAL_OPTION=y
CONFIG_HAS_JDB_GZIP_OPTION=y
CONFIG_HAS_MP_OPTION=y
CONFIG_HAS_CPU_VIRT=y
#
# Target configuration
#
# CONFIG_IA32 is not set
# CONFIG_AMD64 is not set
CONFIG_ARM=y
# CONFIG_MIPS is not set
# CONFIG_PF_INTEGRATOR is not set
# CONFIG_PF_REALVIEW is not set
# CONFIG_PF_SUNXI is not set
CONFIG_PF_BCM283X=y
# CONFIG_PF_SA1100 is not set
# CONFIG_PF_XSCALE is not set
# CONFIG_PF_ARMADA38X is not set
# CONFIG_PF_KIRKWOOD is not set
# CONFIG_PF_TEGRA is not set
# CONFIG_PF_LAYERSCAPE is not set
# CONFIG_PF_IMX is not set
# CONFIG_PF_ARM_VIRT is not set
# CONFIG_PF_RCAR3 is not set
# CONFIG_PF_EXYNOS is not set
# CONFIG_PF_S3C2410 is not set
# CONFIG_PF_OMAP is not set
# CONFIG_PF_ZYNQ is not set
# CONFIG_PF_ZYNQMP is not set
CONFIG_BSP_NAME="bcm283x"
CONFIG_HAS_64BIT=y
CONFIG_CAN_ARM_CPU_CORTEX_A53=y
CONFIG_ARM_V6PLUS=y
CONFIG_ARM_V7PLUS=y
CONFIG_ARM_V8=y
# CONFIG_PF_BCM283X_RPI1 is not set
# CONFIG_PF_BCM283X_RPI2 is not set
CONFIG_PF_BCM283X_RPI3=y
CONFIG_ABI_VF=y
CONFIG_ARM_CORTEX_A53=y
# CONFIG_CPU_VIRT is not set
CONFIG_FPU=y
# CONFIG_ARM_ALIGNMENT_CHECK is not set
CONFIG_ARM_EM_STD=y
# CONFIG_ARM_SMC_USER is not set
CONFIG_BIT64_CHOICE=y
CONFIG_ARM_LPAE=y
# CONFIG_ARM_CPU_ERRATA is not set
#
# Kernel options
#
CONFIG_MP=y
CONFIG_MP_MAX_CPUS=4
CONFIG_CONTEXT_8K=y
# CONFIG_FINE_GRAINED_CPUTIME is not set
CONFIG_SCHED_FIXED_PRIO=y
# CONFIG_SCHED_WFQ is not set
# CONFIG_SCHED_FP_WFQ is not set
# CONFIG_DISABLE_VIRT_OBJ_SPACE is not set
CONFIG_VIRT_OBJ_SPACE=y
#
# Debugging
#
CONFIG_INLINE=y
# CONFIG_NDEBUG is not set
# CONFIG_NO_FRAME_PTR is not set
# CONFIG_STACK_DEPTH is not set
# CONFIG_LIST_ALLOC_SANITY is not set
CONFIG_SERIAL=y
CONFIG_JDB=y
CONFIG_JDB_LOGGING=y
CONFIG_JDB_GZIP=y
# CONFIG_JDB_ACCOUNTING is not set
# CONFIG_WARN_NONE is not set
CONFIG_WARN_WARNING=y
# CONFIG_WARN_ANY is not set
#
# ARM debugging options
#
# CONFIG_VMEM_ALLOC_TEST is not set
# CONFIG_DEBUG_KERNEL_PAGE_FAULTS is not set
#
# Compiling
#
CONFIG_CC="gcc"
CONFIG_CXX="g++"
CONFIG_HOST_CC="gcc"
CONFIG_HOST_CXX="g++"
# CONFIG_MAINTAINER_MODE is not set
CONFIG_LABEL=""
CONFIG_EXPERIMENTAL=y
CONFIG_PERF_CNT=y
CONFIG_BIT64=y
CONFIG_WARN_LEVEL=1
CONFIG_XARCH="arm"
CONFIG_ABI="vf"

View File

@ -0,0 +1,49 @@
#
# Automatically generated file; DO NOT EDIT.
# L4Re Configuration
#
CONFIG_ARCH_ENABLE_STACK_PROTECTOR=y
# CONFIG_BUILD_ARCH_amd64 is not set
# CONFIG_BUILD_ARCH_arm is not set
CONFIG_BUILD_ARCH_arm64=y
# CONFIG_BUILD_ARCH_mips is not set
# CONFIG_BUILD_ARCH_ppc32 is not set
# CONFIG_BUILD_ARCH_sparc is not set
# CONFIG_BUILD_ARCH_x86 is not set
CONFIG_BUILD_ARCH="arm64"
CONFIG_BUILD_ABI_l4f=y
CONFIG_BUILD_ABI="l4f"
CONFIG_CPU="armv8a"
CONFIG_CPU_ARM_ARMV8A=y
# CONFIG_PLATFORM_TYPE_ls1012afrdm is not set
# CONFIG_PLATFORM_TYPE_arm_virt is not set
# CONFIG_PLATFORM_TYPE_rv_vexpress_a15 is not set
CONFIG_PLATFORM_TYPE_rpi_b=y
# CONFIG_PLATFORM_TYPE_rcar3_m3 is not set
# CONFIG_PLATFORM_TYPE_zynqmp is not set
# CONFIG_PLATFORM_TYPE_custom is not set
CONFIG_PLATFORM_TYPE="rpi_b"
# CONFIG_USE_DROPS_STDDIR is not set
# CONFIG_USE_DICE is not set
CONFIG_DROPS_STDDIR="/path/to/l4re"
CONFIG_DROPS_INSTDIR="/path/to/l4re"
CONFIG_BID_COLORED_PHASES=y
#
# Building
#
CONFIG_YACC="yacc"
CONFIG_LEX="flex"
CONFIG_CTAGS="ctags"
CONFIG_ETAGS="etags"
CONFIG_HAVE_LDSO=y
CONFIG_INT_CPP_NAME_SWITCH=y
CONFIG_INT_LD_NAME_SWITCH=y
# CONFIG_BID_STRIP_PROGS is not set
CONFIG_BID_GCC_OMIT_FP=y
CONFIG_BID_GCC_ENABLE_STACK_PROTECTOR=y
# CONFIG_BID_GCC_STACK_PROTECTOR_ALL is not set
CONFIG_BID_GCC_STACK_PROTECTOR=y
# CONFIG_BID_BUILD_DOC is not set
# CONFIG_RELEASE_MODE is not set
CONFIG_MAKECONFS_ADD=""

View File

@ -13,6 +13,12 @@ ifeq ($(filter-out $(SPECS),arm),)
CC_OPT += -DARCH_arm
endif # ARM
ifeq ($(filter-out $(SPECS),arm_64),)
INC_DIR += $(L4_INCLUDE_DIR)/arm64/l4f $(L4_INCLUDE_DIR)/arm64
CC_OPT += -DARCH_arm64
endif # ARM
INC_DIR += $(L4_INCLUDE_DIR)/l4f $(L4_INCLUDE_DIR)
CC_OPT += -DCONFIG_L4_CALL_SYSCALLS

View File

@ -24,6 +24,11 @@ ifeq ($(filter-out $(SPECS),arm_v6),)
L4_BUILD_ARCH := arm_armv6
endif
ifeq ($(filter-out $(SPECS),arm_v8),)
L4_BUILD_ARCH := arm_armv8a
endif
ifeq ($(L4_BUILD_ARCH),)
$(error L4_BUILD_ARCH undefined, architecture not supported)
endif

View File

@ -1,6 +1,3 @@
# override default stack-area location
INC_DIR += $(REP_DIR)/src/include/spec/arm
LIBS += timeout-arm
include $(REP_DIR)/lib/mk/base-foc.inc

View File

@ -0,0 +1,3 @@
LIBS += timeout
include $(REP_DIR)/lib/mk/base-foc.inc

View File

@ -0,0 +1,8 @@
REQUIRES += arm_64
SRC_CC += spec/arm/platform_arm.cc \
spec/arm_64/ipc_pager.cc \
platform_services.cc
include $(REP_DIR)/lib/mk/core-foc.inc
vpath platform_services.cc $(GEN_CORE_DIR)

View File

@ -0,0 +1,3 @@
BASE_LIBS += base-foc-common base-foc
include $(BASE_DIR)/lib/mk/spec/arm_64/ld-platform.inc

View File

@ -0,0 +1,5 @@
LIBS += syscall-foc
include $(BASE_DIR)/lib/mk/startup.inc
vpath crt0.s $(BASE_DIR)/src/lib/startup/spec/arm_64

View File

@ -0,0 +1,3 @@
KERNEL_CONFIG := $(REP_DIR)/config/rpi3.kernel
include $(REP_DIR)/lib/mk/kernel-foc.inc

View File

@ -0,0 +1,18 @@
L4_CONFIG := $(call select_from_repositories,config/rpi3.user)
L4_BIN_DIR := $(LIB_CACHE_DIR)/syscall-foc/rpi3-build/bin/arm_armv8
L4_INC_TARGETS = arm64/l4/sys \
arm64/l4f/l4/sys \
arm64/l4/vcpu
CC_OPT += -Iinclude/arm64
include $(REP_DIR)/lib/mk/syscall-foc.inc
SRC_C += utcb.c
utcb.c:
$(VERBOSE)ln -sf $(L4_BUILD_DIR)/source/pkg/l4re-core/l4sys/lib/src/utcb.c
utcb.c: $(PKG_TAGS)

View File

@ -0,0 +1,51 @@
/*
* \brief Fiasco.OC pager framework
* \author Stefan Kalkowski
* \date 2011-09-08
*
* ARM 64-bit specific parts, when handling cpu-exceptions.
*/
/*
* Copyright (C) 2011-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
/* core includes */
#include <ipc_pager.h>
namespace Fiasco {
#include <l4/sys/utcb.h>
}
enum Exceptions { EX_REGS = 0x500000 };
void Genode::Ipc_pager::_parse_exception()
{
if (Fiasco::l4_utcb_exc()->err == EX_REGS)
_type = PAUSE;
else
_type = EXCEPTION;
}
void Genode::Ipc_pager::get_regs(Foc_thread_state &state) const
{
state.ip = _regs.pc;
state.sp = _regs.sp;
}
void Genode::Ipc_pager::set_regs(Foc_thread_state const &state)
{
_regs.pc = state.ip;
_regs.sp = state.sp;
}
bool Genode::Ipc_pager::exec_fault() const
{
return (_pf_addr & 4) && !(_pf_addr & 1);
}

View File

@ -12,6 +12,7 @@ proc core_link_address { } {
if {[have_spec x86 ]} { return "0x01100000" }
if {[have_spec arndale ]} { return "0x80100000" }
if {[have_spec rpi ]} { return "0x00800000" }
if {[have_spec rpi3 ]} { return "0x00800000" }
if {[have_spec panda ]} { return "0xa0000000" }
if {[have_spec pbxa9 ]} { return "0x76000000" }
if {[have_spec odroid_x2]} { return "0x80100000" }
@ -51,6 +52,7 @@ proc l4_bin_dir { } {
if {[have_spec x86_64]} { return "[l4_build_dir]/bin/amd64_K8" }
if {[have_spec arm_v7a]} { return "[l4_build_dir]/bin/arm_armv7a" }
if {[have_spec arm_v6]} { return "[l4_build_dir]/bin/arm_armv6" }
if {[have_spec arm_v8]} { return "[l4_build_dir]/bin/arm64_armv8a" }
puts stderr "Error: Cannot determine bin directory"
exit 1
@ -211,8 +213,9 @@ proc run_boot_dir_arm { binaries } {
#
proc run_boot_dir {binaries} {
if {[have_spec x86]} { return [run_boot_dir_x86 $binaries] }
if {[have_spec arm]} { return [run_boot_dir_arm $binaries] }
if {[have_spec x86]} { return [run_boot_dir_x86 $binaries] }
if {[have_spec arm]} { return [run_boot_dir_arm $binaries] }
if {[have_spec arm_64]} { return [run_boot_dir_arm $binaries] }
}

View File

@ -39,9 +39,12 @@ proc run_image {elf_img} {
set compress_type gzip
}
set arch "arm"
if {[have_spec arm_64]} { set arch "arm64" }
# create uImage
set uboot_img [run_dir]/uImage
exec mkimage -A arm -O linux -T kernel -C $compress_type -a $load_addr \
exec mkimage -A $arch -O linux -T kernel -C $compress_type -a $load_addr \
-e $entrypoint -d $bin_img$bin_ext $uboot_img
exec rm -rf $bin_img$bin_ext
}

View File

@ -53,6 +53,7 @@ proc run_power_on { } {
if {[have_spec x86_32]} { set qemu "qemu-system-i386" }
if {[have_spec x86_64]} { set qemu "qemu-system-x86_64" }
if {[have_spec arm]} { set qemu "qemu-system-arm" }
if {[have_spec arm_64]} { set qemu "qemu-system-aarch64" }
#
# Only the x86_64 variant of Qemu provides the emulation of hardware
@ -62,13 +63,19 @@ proc run_power_on { } {
if {[have_spec nova]} { set qemu "qemu-system-x86_64" }
#
# Redirect serial output to stdio, but only in graphics mode and no
# explicit configuration of serial interfaces is specified in the run
# script. The 'mon' prefix enables the access to the qemu console.
# Redirect serial output to stdio, but only when no explicit configuration
# of serial interfaces is specified in the run script.
# The 'mon' prefix enables the access to the qemu console.
#
if {![regexp -- {-nographic} $qemu_args dummy] &&
![regexp -- {-serial} $qemu_args dummy]} {
append qemu_args " -serial mon:stdio " }
if {![regexp -- {-serial} $qemu_args dummy]} {
#
# In the raspi3 model the first UART is never used as
# log output, but the second
#
if {[have_spec rpi3]} { append qemu_args " -serial null " }
append qemu_args " -serial mon:stdio "
}
# SVM virtualization is broken after $qemu_good_old and until before $qemu_good_new
# We use "-cpu phenom" when using VMs in Qemu
@ -100,6 +107,7 @@ proc run_power_on { } {
}
if {[have_spec vpb926]} { append qemu_args " -M versatilepb -m 128 " }
if {[have_spec zynq_qemu]} { append qemu_args " -M xilinx-zynq-a9 -cpu cortex-a9 -m 256 " }
if {[have_spec rpi3]} { append qemu_args " -M raspi3 -m 512 " }
# on x86, we support booting via pxe or iso/disk image
if {[have_spec x86]} {
@ -131,7 +139,7 @@ proc run_power_on { } {
}
# on ARM, we supply the boot image as kernel
if {[have_spec arm]} { append qemu_args " -kernel [run_dir]/boot/image.elf " }
if {[have_spec arm] || [have_spec arm_v8]} { append qemu_args " -kernel [run_dir]/boot/image.elf " }
eval spawn $qemu $qemu_args
set qemu_spawn_id $spawn_id