Compare commits

...

10 Commits
aos ... rk3288

Author SHA1 Message Date
Siwei Zhuang
2d4f3b6db6 arm: move ASID PD slot
Move the location of ASID PD slot to avoid clash with hardware device
memeory

Signed-off-by: Siwei Zhuang <siwei.zhuang@data61.csiro.au>
2021-09-08 19:32:40 +10:00
Siwei Zhuang
ef7dbbfacb hyp: remove check for kernel window conflict
In hyper mode, the VM access resources via stage 2 translation. The VM
should have access to the entire 4GB space. The check for the kernel
window should only apply to stage 1. Removing the check in hyp mode to
enable the VM's access to the extra space.

Signed-off-by: Siwei Zhuang <siwei.zhuang@data61.csiro.au>
2021-09-08 19:32:04 +10:00
Siwei Zhuang
91bd40d388 rk3288: Enable hypervisor build
Enable seL4 hypervisor mode build for rk3288.

Signed-off-by: Siwei Zhuang <siwei.zhuang@data61.csiro.au>
2021-09-08 19:30:31 +10:00
Siwei Zhuang
ce873d266c rk3288: Reserve memory for trust zone firmware
ATF resides in the first 2MB of the physical memory, so tell the kernel
not to touch that.

Signed-off-by: Siwei Zhuang <siwei.zhuang@data61.csiro.au>
2021-09-08 19:30:31 +10:00
Peter Chubb
0d2331bebb Clean up cmake config for rk3288
Try to simplify as suggested by review comments.

Signed-off-by: Peter Chubb <peter.chubb@data61.csiro.au>
2021-09-08 19:30:20 +10:00
Peter Chubb
400744394b Attempt to unify cache clean instruction sequence
Rather than #ifdef on individual platforms, use the same sequence for
all armV7e platforms.

Signed-off-by: Peter Chubb <peter.chubb@data61.csiro.au>
2021-09-08 19:29:37 +10:00
Peter Chubb
a09406adb0 Fix GitHub CI errors rk3288
CMake errors in the rk3288 config.cmake were preventing other platforms
from building.

Signed-off-by: Peter Chubb <peter.chubb@data61.csiro.au>
2021-09-08 19:29:37 +10:00
Peter Chubb
a18c6bc5b6 RK3288: fix github style issues
mostly whitespace rearrangement.

Signed-off-by: Peter Chubb <peter.chubb@data61.csiro.au>
2021-09-08 19:29:37 +10:00
Peter Chubb
ab6e39082d Add SPDX licence rk3288
The timer.c file is copied from Linux and is GPL2.0

Signed-off-by: Peter Chubb <peter.chubb@data61.csiro.au>
2021-09-08 19:29:37 +10:00
Peter Chubb
7d7ce2cb2b Inital support for RK3288
Using the Yeacreate NTablet as the platform, this patch series adds
support for the Rockchip RK3288.

Signed-off-by: Peter Chubb <peter.chubb@data61.csiro.au>
2021-09-08 19:29:37 +10:00
10 changed files with 4119 additions and 9 deletions

View File

@@ -12,7 +12,7 @@
#include <object/structures.h>
/* PD slot reserved for storing the PD's allocated hardware ASID */
#define PD_ASID_SLOT (0xff000000 >> (PT_INDEX_BITS + PAGE_BITS))
#define PD_ASID_SLOT (0xfe000000 >> (PT_INDEX_BITS + PAGE_BITS))
enum pde_pte_tag {
ME_PDE,

View File

@@ -385,13 +385,9 @@ static inline void cleanByVA_PoU(vptr_t vaddr, paddr_t paddr)
#elif defined(CONFIG_ARCH_ARM_V6)
/* V6 doesn't distinguish PoU and PoC, so use the basic flush. */
asm volatile("mcr p15, 0, %0, c7, c10, 1" : : "r"(vaddr));
#elif defined(CONFIG_PLAT_EXYNOS5)
#elif defined(CONFIG_ARCH_ARM_V7VE)
/* Flush to coherency for table walks... Why? */
asm volatile("mcr p15, 0, %0, c7, c10, 1" : : "r"(vaddr));
#elif defined(CONFIG_PLAT_IMX7)
asm volatile("mcr p15, 0, %0, c7, c10, 1" : : "r"(vaddr));
#elif defined(CONFIG_PLAT_TK1)
asm volatile("mcr p15, 0, %0, c7, c10, 1" : : "r"(vaddr));
#elif defined(CONFIG_ARM_CORTEX_A53)
asm volatile("mcr p15, 0, %0, c7, c10, 1" : : "r"(vaddr));
#else

View File

@@ -0,0 +1,22 @@
/*
* Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#ifdef HAVE_AUTOCONF
#include <autoconf.h>
#endif
/* Cortex a17 manual, section 9.2.2 */
#define seL4_NumHWBreakpoints (10)
#define seL4_NumExclusiveBreakpoints (6)
#define seL4_NumExclusiveWatchpoints (4)
#ifdef CONFIG_HARDWARE_DEBUG_API
#define seL4_FirstWatchpoint (6)
#define seL4_NumDualFunctionMonitors (0)
#endif
/* First address in the virtual address space that is not accessible to user level */
#define seL4_UserTop 0xe0000000

View File

@@ -2214,6 +2214,7 @@ static exception_t decodeARMPageTableInvocation(word_t invLabel, word_t length,
pd = PDE_PTR(cap_page_directory_cap_get_capPDBasePtr(pdCap));
asid = cap_page_directory_cap_get_capPDMappedASID(pdCap);
#ifndef CONFIG_ARM_HYPERVISOR_SUPPORT
if (unlikely(vaddr >= USER_TOP)) {
userError("ARMPageTableMap: Virtual address cannot be in kernel window. vaddr: 0x%08lx, USER_TOP: 0x%08x", vaddr,
USER_TOP);
@@ -2222,6 +2223,7 @@ static exception_t decodeARMPageTableInvocation(word_t invLabel, word_t length,
return EXCEPTION_SYSCALL_ERROR;
}
#endif
{
findPDForASID_ret_t find_ret;
@@ -2279,7 +2281,7 @@ static exception_t decodeARMFrameInvocation(word_t invLabel, word_t length,
{
switch (invLabel) {
case ARMPageMap: {
word_t vaddr, vtop, w_rightsMask;
word_t vaddr, w_rightsMask;
paddr_t capFBasePtr;
cap_t pdCap;
pde_t *pd;
@@ -2333,6 +2335,8 @@ static exception_t decodeARMFrameInvocation(word_t invLabel, word_t length,
return EXCEPTION_SYSCALL_ERROR;
}
} else {
#ifndef CONFIG_ARM_HYPERVISOR_SUPPORT
word_t vtop;
vtop = vaddr + BIT(pageBitsForSize(frameSize)) - 1;
if (unlikely(vtop >= USER_TOP)) {
@@ -2343,6 +2347,7 @@ static exception_t decodeARMFrameInvocation(word_t invLabel, word_t length,
return EXCEPTION_SYSCALL_ERROR;
}
#endif
}
{

View File

@@ -33,14 +33,14 @@ BOOT_CODE void initGenericTimer(void)
}
/*
* The exynos5 platforms require custom hardware initialisation before the
* The exynos5 and rk3288 platforms require custom hardware initialisation before the
* generic timer is usable. They need to overwrite initTimer before calling
* initGenericTimer because of this. We cannot use a `weak` symbol definition
* in this case because the kernel is built as a single file and multiple
* symbol definitions with the same name are not allowed. We therefore resort
* to ifdef'ing out this initTimer definition for exynos5 platforms.
*/
#ifndef CONFIG_PLAT_EXYNOS5
#if !defined(CONFIG_PLAT_EXYNOS5) && !defined(CONFIG_PLAT_RK3288)
BOOT_CODE void initTimer(void)
{
initGenericTimer();

View File

@@ -0,0 +1,47 @@
#
# Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
#
# SPDX-License-Identifier: GPL-2.0-only
#
cmake_minimum_required(VERSION 3.7.2)
declare_platform(rk3288 KernelPlatRK3288 PLAT_RK3288 "KernelSel4ArchAarch32 OR KernelSel4ArchArmHyp")
if(KernelPlatRK3288)
if("${KernelSel4Arch}" STREQUAL aarch32)
declare_seL4_arch(aarch32)
elseif("${KernelSel4Arch}" STREQUAL arm_hyp)
declare_seL4_arch(arm_hyp)
else()
fallback_declare_seL4_arch_default(aarch32)
endif()
set(KernelArmCortexA15 ON) #almost the same as A17
set(KernelArchArmV7ve ON)
# v7ve is a superset of v7a, so we enable that as well
set(KernelArchArmV7a ON)
config_set(KernelARMPlatform ARM_PLAT rk3288)
config_set(KernelArmMach "rk3288" CACHE INTERNAL "")
list(APPEND KernelDTSList "tools/dts/${KernelARMPlatform}-ntablet.dts")
list(APPEND KernelDTSList "src/plat/rk3288/overlay-${KernelARMPlatform}-ntablet.dts")
declare_default_headers(
TIMER_FREQUENCY 24000000llu
MAX_IRQ 187
NUM_PPI 32
TIMER drivers/timer/arm_generic.h
INTERRUPT_CONTROLLER arch/machine/gic_v2.h
CLK_MAGIC 2863311531llu
CLK_SHIFT 36u
KERNEL_WCET 10u
)
endif()
add_sources(
DEP "KernelPlatRK3288"
CFILES
# I consider the next line to be too long,
# but the github style checker insists on having it all on one line.
src/arch/arm/machine/gic_v2.c src/arch/arm/machine/l2c_nop.c src/plat/rk3288/machine/timer.c
)

View File

@@ -0,0 +1,28 @@
/*
* Copyright 2020 Data61, CSIRO (ABN 41 687 119 230)
*
* SPDX-License-Identifier: GPL-2.0-only
*/
/*
* This code was taken from the Linux kernel, file arch/arm/mach-rockchip/rockchip.c
*/
#define RK3288_TIMER6_7_PHYS 0xff810000
#define writel(v, a) (*(uint32_t *)(a) = (v))
BOOT_CODE void initTimer(void)
{
/*
* Most/all uboot versions for rk3288 don't enable timer7
* which is needed for the architected timer to work.
* So make sure it is running during early boot.
*/
writel(0, RK3288_TIMER6_7_PHYS + 0x30);
writel(0xffffffff, RK3288_TIMER6_7_PHYS + 0x20);
writel(0xffffffff, RK3288_TIMER6_7_PHYS + 0x24);
writel(1, RK3288_TIMER6_7_PHYS + 0x30);
dsb();
initGenericTimer();
}

View File

@@ -0,0 +1,24 @@
/*
* Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
*
* SPDX-License-Identifier: GPL-2.0-only
*/
/ {
chosen {
seL4,elfloader-devices =
"serial2";
seL4,kernel-devices =
"serial2",
&{/interrupt-controller@ffc01000},
&{/timer};
};
// Trustzone carves out some RAM for its secure zone.
// Ideally we'd use the memory node passed in from U-Boot,
// but for now we need this at compile time.
memory {
reg = <0x0 0x200000 0x0 0x7fe00000>;
};
};

3987
tools/dts/rk3288-ntablet.dts Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -49,6 +49,7 @@ imx6q-wandboard-revd1=wandq
imx7d-sdb=imx7sabre
omap3-beagle=omap3
qcom-apq8064-ifc6410=apq8064
rk3288-ntablet=rk3288-ntablet-870a-5648
sun7i-a20-cubietruck=allwinnera20
tegra124-jetson-tk1=tk1
zynq-zc706=zynq7000