Initial commit
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
|
||||
From cf84c933bb7b8a95742d1e723950cb2cde2d5320 Mon Sep 17 00:00:00 2001
|
||||
From: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Date: Wed, 20 Jul 2022 16:37:10 +0100
|
||||
Subject: [PATCH] core: arm: add MPIDR affinity shift and mask for 32-bit
|
||||
|
||||
This change is to add MPIDR affinity shift and mask for
|
||||
32-bit
|
||||
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
|
||||
diff --git a/core/arch/arm/include/arm.h b/core/arch/arm/include/arm.h
|
||||
index f59478af..2f6f82e7 100644
|
||||
--- a/core/arch/arm/include/arm.h
|
||||
+++ b/core/arch/arm/include/arm.h
|
||||
@@ -63,6 +63,8 @@
|
||||
#define MPIDR_AFF1_MASK (MPIDR_AFFLVL_MASK << MPIDR_AFF1_SHIFT)
|
||||
#define MPIDR_AFF2_SHIFT U(16)
|
||||
#define MPIDR_AFF2_MASK (MPIDR_AFFLVL_MASK << MPIDR_AFF2_SHIFT)
|
||||
+#define MPIDR_AFF3_SHIFT U(32)
|
||||
+#define MPIDR_AFF3_MASK (MPIDR_AFFLVL_MASK << MPIDR_AFF3_SHIFT)
|
||||
|
||||
#define MPIDR_MT_SHIFT U(24)
|
||||
#define MPIDR_MT_MASK BIT(MPIDR_MT_SHIFT)
|
||||
--
|
||||
2.17.1
|
||||
|
||||
+233
@@ -0,0 +1,233 @@
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
|
||||
From 22ba7c7789082dbc179921962cdcadece4499c89 Mon Sep 17 00:00:00 2001
|
||||
From: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Date: Thu, 30 Jun 2022 18:36:26 +0100
|
||||
Subject: [PATCH] plat-n1sdp: add N1SDP platform support
|
||||
|
||||
These changes are to add N1SDP platform to optee-os
|
||||
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
|
||||
diff --git a/core/arch/arm/plat-n1sdp/conf.mk b/core/arch/arm/plat-n1sdp/conf.mk
|
||||
new file mode 100644
|
||||
index 00000000..06b4975a
|
||||
--- /dev/null
|
||||
+++ b/core/arch/arm/plat-n1sdp/conf.mk
|
||||
@@ -0,0 +1,41 @@
|
||||
+include core/arch/arm/cpu/cortex-armv8-0.mk
|
||||
+
|
||||
+CFG_DEBUG_INFO = y
|
||||
+CFG_TEE_CORE_LOG_LEVEL = 4
|
||||
+
|
||||
+# Workaround 808870: Unconditional VLDM instructions might cause an
|
||||
+# alignment fault even though the address is aligned
|
||||
+# Either hard float must be disabled for AArch32 or strict alignment checks
|
||||
+# must be disabled
|
||||
+ifeq ($(CFG_SCTLR_ALIGNMENT_CHECK),y)
|
||||
+$(call force,CFG_TA_ARM32_NO_HARD_FLOAT_SUPPORT,y)
|
||||
+else
|
||||
+$(call force,CFG_SCTLR_ALIGNMENT_CHECK,n)
|
||||
+endif
|
||||
+
|
||||
+CFG_ARM64_core ?= y
|
||||
+
|
||||
+CFG_ARM_GICV3 = y
|
||||
+
|
||||
+# ARM debugger needs this
|
||||
+platform-cflags-debug-info = -gdwarf-4
|
||||
+platform-aflags-debug-info = -gdwarf-4
|
||||
+
|
||||
+CFG_CORE_SEL1_SPMC = y
|
||||
+CFG_WITH_ARM_TRUSTED_FW = y
|
||||
+
|
||||
+$(call force,CFG_GIC,y)
|
||||
+$(call force,CFG_PL011,y)
|
||||
+$(call force,CFG_SECURE_TIME_SOURCE_CNTPCT,y)
|
||||
+
|
||||
+CFG_CORE_HEAP_SIZE = 0x32000 # 200kb
|
||||
+
|
||||
+CFG_TEE_CORE_NB_CORE = 4
|
||||
+CFG_TZDRAM_START ?= 0x08000000
|
||||
+CFG_TZDRAM_SIZE ?= 0x02008000
|
||||
+
|
||||
+CFG_SHMEM_START ?= 0x83000000
|
||||
+CFG_SHMEM_SIZE ?= 0x00210000
|
||||
+# DRAM1 is defined above 4G
|
||||
+$(call force,CFG_CORE_LARGE_PHYS_ADDR,y)
|
||||
+$(call force,CFG_CORE_ARM64_PA_BITS,36)
|
||||
diff --git a/core/arch/arm/plat-n1sdp/main.c b/core/arch/arm/plat-n1sdp/main.c
|
||||
new file mode 100644
|
||||
index 00000000..cfb7f19b
|
||||
--- /dev/null
|
||||
+++ b/core/arch/arm/plat-n1sdp/main.c
|
||||
@@ -0,0 +1,63 @@
|
||||
+// SPDX-License-Identifier: BSD-2-Clause
|
||||
+/*
|
||||
+ * Copyright (c) 2022, Arm Limited.
|
||||
+ */
|
||||
+
|
||||
+#include <arm.h>
|
||||
+#include <console.h>
|
||||
+#include <drivers/gic.h>
|
||||
+#include <drivers/pl011.h>
|
||||
+#include <drivers/tpm2_mmio.h>
|
||||
+#include <drivers/tpm2_ptp_fifo.h>
|
||||
+#include <drivers/tzc400.h>
|
||||
+#include <initcall.h>
|
||||
+#include <keep.h>
|
||||
+#include <kernel/boot.h>
|
||||
+#include <kernel/interrupt.h>
|
||||
+#include <kernel/misc.h>
|
||||
+#include <kernel/notif.h>
|
||||
+#include <kernel/panic.h>
|
||||
+#include <kernel/spinlock.h>
|
||||
+#include <kernel/tee_time.h>
|
||||
+#include <mm/core_memprot.h>
|
||||
+#include <mm/core_mmu.h>
|
||||
+#include <platform_config.h>
|
||||
+#include <sm/psci.h>
|
||||
+#include <stdint.h>
|
||||
+#include <string.h>
|
||||
+#include <trace.h>
|
||||
+
|
||||
+static struct gic_data gic_data __nex_bss;
|
||||
+static struct pl011_data console_data __nex_bss;
|
||||
+
|
||||
+register_phys_mem_pgdir(MEM_AREA_IO_SEC, CONSOLE_UART_BASE, PL011_REG_SIZE);
|
||||
+
|
||||
+register_ddr(DRAM0_BASE, DRAM0_SIZE);
|
||||
+
|
||||
+register_phys_mem_pgdir(MEM_AREA_IO_SEC, GICD_BASE, GIC_DIST_REG_SIZE);
|
||||
+register_phys_mem_pgdir(MEM_AREA_IO_SEC, GICC_BASE, GIC_DIST_REG_SIZE);
|
||||
+register_phys_mem_pgdir(MEM_AREA_IO_SEC, GICR_BASE, GIC_DIST_REG_SIZE);
|
||||
+
|
||||
+void main_init_gic(void)
|
||||
+{
|
||||
+ gic_init_base_addr(&gic_data, GICC_BASE,
|
||||
+ GICD_BASE);
|
||||
+ itr_init(&gic_data.chip);
|
||||
+}
|
||||
+
|
||||
+void main_secondary_init_gic(void)
|
||||
+{
|
||||
+ gic_cpu_init(&gic_data);
|
||||
+}
|
||||
+
|
||||
+void itr_core_handler(void)
|
||||
+{
|
||||
+ gic_it_handle(&gic_data);
|
||||
+}
|
||||
+
|
||||
+void console_init(void)
|
||||
+{
|
||||
+ pl011_init(&console_data, CONSOLE_UART_BASE, CONSOLE_UART_CLK_IN_HZ,
|
||||
+ CONSOLE_BAUDRATE);
|
||||
+ register_serial_console(&console_data.chip);
|
||||
+}
|
||||
diff --git a/core/arch/arm/plat-n1sdp/n1sdp_core_pos.S b/core/arch/arm/plat-n1sdp/n1sdp_core_pos.S
|
||||
new file mode 100644
|
||||
index 00000000..439d4e67
|
||||
--- /dev/null
|
||||
+++ b/core/arch/arm/plat-n1sdp/n1sdp_core_pos.S
|
||||
@@ -0,0 +1,32 @@
|
||||
+/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
+/*
|
||||
+ * Copyright (c) 2022, Arm Limited
|
||||
+ */
|
||||
+
|
||||
+#include <asm.S>
|
||||
+#include <arm.h>
|
||||
+#include "platform_config.h"
|
||||
+
|
||||
+FUNC get_core_pos_mpidr , :
|
||||
+ mov x4, x0
|
||||
+
|
||||
+ /*
|
||||
+ * The MT bit in MPIDR is always set for n1sdp and the
|
||||
+ * affinity level 0 corresponds to thread affinity level.
|
||||
+ */
|
||||
+
|
||||
+ /* Extract individual affinity fields from MPIDR */
|
||||
+ ubfx x0, x4, #MPIDR_AFF0_SHIFT, #MPIDR_AFFINITY_BITS
|
||||
+ ubfx x1, x4, #MPIDR_AFF1_SHIFT, #MPIDR_AFFINITY_BITS
|
||||
+ ubfx x2, x4, #MPIDR_AFF2_SHIFT, #MPIDR_AFFINITY_BITS
|
||||
+ ubfx x3, x4, #MPIDR_AFF3_SHIFT, #MPIDR_AFFINITY_BITS
|
||||
+
|
||||
+ /* Compute linear position */
|
||||
+ mov x4, #N1SDP_MAX_CLUSTERS_PER_CHIP
|
||||
+ madd x2, x3, x4, x2
|
||||
+ mov x4, #N1SDP_MAX_CPUS_PER_CLUSTER
|
||||
+ madd x1, x2, x4, x1
|
||||
+ mov x4, #N1SDP_MAX_PE_PER_CPU
|
||||
+ madd x0, x1, x4, x0
|
||||
+ ret
|
||||
+END_FUNC get_core_pos_mpidr
|
||||
diff --git a/core/arch/arm/plat-n1sdp/platform_config.h b/core/arch/arm/plat-n1sdp/platform_config.h
|
||||
new file mode 100644
|
||||
index 00000000..81b99409
|
||||
--- /dev/null
|
||||
+++ b/core/arch/arm/plat-n1sdp/platform_config.h
|
||||
@@ -0,0 +1,49 @@
|
||||
+/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
+/*
|
||||
+ * Copyright (c) 2022, Arm Limited
|
||||
+ */
|
||||
+
|
||||
+#ifndef PLATFORM_CONFIG_H
|
||||
+#define PLATFORM_CONFIG_H
|
||||
+
|
||||
+#include <mm/generic_ram_layout.h>
|
||||
+#include <stdint.h>
|
||||
+
|
||||
+/* Make stacks aligned to data cache line length */
|
||||
+#define STACK_ALIGNMENT 64
|
||||
+
|
||||
+ /* N1SDP topology related constants */
|
||||
+#define N1SDP_MAX_CPUS_PER_CLUSTER U(2)
|
||||
+#define PLAT_ARM_CLUSTER_COUNT U(2)
|
||||
+#define PLAT_N1SDP_CHIP_COUNT U(2)
|
||||
+#define N1SDP_MAX_CLUSTERS_PER_CHIP U(2)
|
||||
+#define N1SDP_MAX_PE_PER_CPU U(1)
|
||||
+
|
||||
+#define PLATFORM_CORE_COUNT (PLAT_N1SDP_CHIP_COUNT * \
|
||||
+ PLAT_ARM_CLUSTER_COUNT * \
|
||||
+ N1SDP_MAX_CPUS_PER_CLUSTER * \
|
||||
+ N1SDP_MAX_PE_PER_CPU)
|
||||
+
|
||||
+#define GIC_BASE 0x2c010000
|
||||
+
|
||||
+#define UART1_BASE 0x1C0A0000
|
||||
+#define UART1_CLK_IN_HZ 24000000 /*24MHz*/
|
||||
+
|
||||
+#define CONSOLE_UART_BASE UART1_BASE
|
||||
+#define CONSOLE_UART_CLK_IN_HZ UART1_CLK_IN_HZ
|
||||
+
|
||||
+#define DRAM0_BASE 0x80000000
|
||||
+#define DRAM0_SIZE 0x80000000
|
||||
+
|
||||
+#define GICD_BASE 0x30000000
|
||||
+#define GICC_BASE 0x2C000000
|
||||
+#define GICR_BASE 0x300C0000
|
||||
+
|
||||
+#ifndef UART_BAUDRATE
|
||||
+#define UART_BAUDRATE 115200
|
||||
+#endif
|
||||
+#ifndef CONSOLE_BAUDRATE
|
||||
+#define CONSOLE_BAUDRATE UART_BAUDRATE
|
||||
+#endif
|
||||
+
|
||||
+#endif /*PLATFORM_CONFIG_H*/
|
||||
diff --git a/core/arch/arm/plat-n1sdp/sub.mk b/core/arch/arm/plat-n1sdp/sub.mk
|
||||
new file mode 100644
|
||||
index 00000000..a0b49da1
|
||||
--- /dev/null
|
||||
+++ b/core/arch/arm/plat-n1sdp/sub.mk
|
||||
@@ -0,0 +1,3 @@
|
||||
+global-incdirs-y += .
|
||||
+srcs-y += main.c
|
||||
+srcs-y += n1sdp_core_pos.S
|
||||
--
|
||||
2.17.1
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
|
||||
From 0c3ce4c09cd7d2ff4cd2e62acab899dd88dc9514 Mon Sep 17 00:00:00 2001
|
||||
From: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Date: Wed, 20 Jul 2022 16:45:59 +0100
|
||||
Subject: [PATCH] HACK: disable instruction cache and data cache.
|
||||
|
||||
For some reason, n1sdp fails to boot with instruction cache and
|
||||
data cache enabled. This is a temporary change to disable I cache
|
||||
and D cache until a proper fix is found.
|
||||
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
|
||||
%% original patch: 0003-HACK-disable-instruction-cache-and-data-cache.patch
|
||||
|
||||
diff --git a/core/arch/arm/kernel/entry_a64.S b/core/arch/arm/kernel/entry_a64.S
|
||||
index 875b6e69..594d6928 100644
|
||||
--- a/core/arch/arm/kernel/entry_a64.S
|
||||
+++ b/core/arch/arm/kernel/entry_a64.S
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
.macro set_sctlr_el1
|
||||
mrs x0, sctlr_el1
|
||||
- orr x0, x0, #SCTLR_I
|
||||
+ bic x0, x0, #SCTLR_I
|
||||
orr x0, x0, #SCTLR_SA
|
||||
orr x0, x0, #SCTLR_SPAN
|
||||
#if defined(CFG_CORE_RWDATA_NOEXEC)
|
||||
@@ -490,11 +490,11 @@ LOCAL_FUNC enable_mmu , : , .identity_map
|
||||
isb
|
||||
|
||||
/* Enable I and D cache */
|
||||
- mrs x1, sctlr_el1
|
||||
+ /* mrs x1, sctlr_el1
|
||||
orr x1, x1, #SCTLR_I
|
||||
orr x1, x1, #SCTLR_C
|
||||
msr sctlr_el1, x1
|
||||
- isb
|
||||
+ isb */
|
||||
|
||||
/* Adjust stack pointers and return address */
|
||||
msr spsel, #1
|
||||
--
|
||||
2.17.1
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
|
||||
From b3fde6c2e1a950214f760ab9f194f3a6572292a8 Mon Sep 17 00:00:00 2001
|
||||
From: Balint Dobszay <balint.dobszay@arm.com>
|
||||
Date: Fri, 15 Jul 2022 13:45:54 +0200
|
||||
Subject: [PATCH] Handle logging syscall
|
||||
|
||||
Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
|
||||
Change-Id: Ib8151cc9c66aea8bcc8fe8b1ecdc3f9f9c5f14e4
|
||||
|
||||
%% original patch: 0004-Handle-logging-syscall.patch
|
||||
|
||||
diff --git a/core/arch/arm/kernel/spmc_sp_handler.c b/core/arch/arm/kernel/spmc_sp_handler.c
|
||||
index e0fa0aa6..c7a45387 100644
|
||||
--- a/core/arch/arm/kernel/spmc_sp_handler.c
|
||||
+++ b/core/arch/arm/kernel/spmc_sp_handler.c
|
||||
@@ -1132,6 +1132,12 @@ void spmc_sp_msg_handler(struct thread_smc_args *args,
|
||||
handle_mem_perm_set(args, caller_sp);
|
||||
sp_enter(args, caller_sp);
|
||||
break;
|
||||
+ case 0xdeadbeef:
|
||||
+ ts_push_current_session(&caller_sp->ts_sess);
|
||||
+ IMSG("%s", (char *)args->a1);
|
||||
+ ts_pop_current_session();
|
||||
+ sp_enter(args, caller_sp);
|
||||
+ break;
|
||||
default:
|
||||
EMSG("Unhandled FFA function ID %#"PRIx32,
|
||||
(uint32_t)args->a0);
|
||||
--
|
||||
2.17.1
|
||||
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
|
||||
From 2eb1da30564428551ca687d456d848129105abac Mon Sep 17 00:00:00 2001
|
||||
From: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Date: Tue, 25 Oct 2022 19:08:49 +0100
|
||||
Subject: [PATCH] plat-n1sdp: register DRAM1 to optee-os
|
||||
|
||||
N1SDP supports two DRAM's. This change is to add 2nd DRAM
|
||||
starting at 0x8080000000 address.
|
||||
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
|
||||
diff --git a/core/arch/arm/plat-n1sdp/conf.mk b/core/arch/arm/plat-n1sdp/conf.mk
|
||||
index 06b4975a..5374e406 100644
|
||||
--- a/core/arch/arm/plat-n1sdp/conf.mk
|
||||
+++ b/core/arch/arm/plat-n1sdp/conf.mk
|
||||
@@ -38,4 +38,4 @@ CFG_SHMEM_START ?= 0x83000000
|
||||
CFG_SHMEM_SIZE ?= 0x00210000
|
||||
# DRAM1 is defined above 4G
|
||||
$(call force,CFG_CORE_LARGE_PHYS_ADDR,y)
|
||||
-$(call force,CFG_CORE_ARM64_PA_BITS,36)
|
||||
+$(call force,CFG_CORE_ARM64_PA_BITS,42)
|
||||
diff --git a/core/arch/arm/plat-n1sdp/main.c b/core/arch/arm/plat-n1sdp/main.c
|
||||
index cfb7f19b..bb951ce6 100644
|
||||
--- a/core/arch/arm/plat-n1sdp/main.c
|
||||
+++ b/core/arch/arm/plat-n1sdp/main.c
|
||||
@@ -33,6 +33,7 @@ static struct pl011_data console_data __nex_bss;
|
||||
register_phys_mem_pgdir(MEM_AREA_IO_SEC, CONSOLE_UART_BASE, PL011_REG_SIZE);
|
||||
|
||||
register_ddr(DRAM0_BASE, DRAM0_SIZE);
|
||||
+register_ddr(DRAM1_BASE, DRAM1_SIZE);
|
||||
|
||||
register_phys_mem_pgdir(MEM_AREA_IO_SEC, GICD_BASE, GIC_DIST_REG_SIZE);
|
||||
register_phys_mem_pgdir(MEM_AREA_IO_SEC, GICC_BASE, GIC_DIST_REG_SIZE);
|
||||
diff --git a/core/arch/arm/plat-n1sdp/platform_config.h b/core/arch/arm/plat-n1sdp/platform_config.h
|
||||
index 81b99409..bf0a3c83 100644
|
||||
--- a/core/arch/arm/plat-n1sdp/platform_config.h
|
||||
+++ b/core/arch/arm/plat-n1sdp/platform_config.h
|
||||
@@ -35,6 +35,9 @@
|
||||
#define DRAM0_BASE 0x80000000
|
||||
#define DRAM0_SIZE 0x80000000
|
||||
|
||||
+#define DRAM1_BASE 0x8080000000ULL
|
||||
+#define DRAM1_SIZE 0x80000000ULL
|
||||
+
|
||||
#define GICD_BASE 0x30000000
|
||||
#define GICC_BASE 0x2C000000
|
||||
#define GICR_BASE 0x300C0000
|
||||
--
|
||||
2.17.1
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
|
||||
|
||||
From 1a9aeedda58228893add545e49d2d6cd4c316b4f Mon Sep 17 00:00:00 2001
|
||||
From: Emekcan <emekcan.aras@arm.com>
|
||||
Date: Tue, 13 Dec 2022 13:45:06 +0000
|
||||
Subject: [PATCH] plat-n1sdp: add external device tree base and size
|
||||
|
||||
Adds external device tree address and size. It also
|
||||
register this physical memory so optee can read the device tree.
|
||||
---
|
||||
core/arch/arm/plat-n1sdp/main.c | 1 +
|
||||
core/arch/arm/plat-n1sdp/platform_config.h | 3 +++
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/core/arch/arm/plat-n1sdp/main.c b/core/arch/arm/plat-n1sdp/main.c
|
||||
index bb951ce6b..ab76f60c6 100644
|
||||
--- a/core/arch/arm/plat-n1sdp/main.c
|
||||
+++ b/core/arch/arm/plat-n1sdp/main.c
|
||||
@@ -31,6 +31,7 @@ static struct gic_data gic_data __nex_bss;
|
||||
static struct pl011_data console_data __nex_bss;
|
||||
|
||||
register_phys_mem_pgdir(MEM_AREA_IO_SEC, CONSOLE_UART_BASE, PL011_REG_SIZE);
|
||||
+register_phys_mem_pgdir(MEM_AREA_EXT_DT, EXT_DT_BASE, EXT_DT_SIZE);
|
||||
|
||||
register_ddr(DRAM0_BASE, DRAM0_SIZE);
|
||||
register_ddr(DRAM1_BASE, DRAM1_SIZE);
|
||||
diff --git a/core/arch/arm/plat-n1sdp/platform_config.h b/core/arch/arm/plat-n1sdp/platform_config.h
|
||||
index bf0a3c834..8741a2503 100644
|
||||
--- a/core/arch/arm/plat-n1sdp/platform_config.h
|
||||
+++ b/core/arch/arm/plat-n1sdp/platform_config.h
|
||||
@@ -42,6 +42,9 @@
|
||||
#define GICC_BASE 0x2C000000
|
||||
#define GICR_BASE 0x300C0000
|
||||
|
||||
+#define EXT_DT_BASE 0x04001600
|
||||
+#define EXT_DT_SIZE 0x200
|
||||
+
|
||||
#ifndef UART_BAUDRATE
|
||||
#define UART_BAUDRATE 115200
|
||||
#endif
|
||||
--
|
||||
2.17.1
|
||||
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
From 34db1357ab3192f18629ceadf4ea33b948513fec Mon Sep 17 00:00:00 2001
|
||||
From: Olivier Deprez <olivier.deprez@arm.com>
|
||||
Date: Mon, 16 Nov 2020 10:14:02 +0100
|
||||
Subject: [PATCH 1/2] WIP: Enable managed exit
|
||||
|
||||
This change declares OP-TEE SP as supporting managed exit in response to
|
||||
a NS interrupt triggering while the SWd runs.
|
||||
|
||||
At init OP-TEE enables (HF_INTERRUPT_ENABLE) the managed exit virtual
|
||||
interrupt through the Hafnium para-virtualized interface.
|
||||
|
||||
Physical interrupts are trapped to the SPMC which injects a managed exit
|
||||
interrupt to OP-TEE. The managed exit interrupt is acknowledged by
|
||||
OP-TEE by HF_INTERUPT_GET hvc call.
|
||||
|
||||
Note: this code change is meant with in mind the SPMC runs at SEL2. It
|
||||
needs slight refactoring such that it does not break the SEL1 SPMC
|
||||
configuration.
|
||||
|
||||
Change-Id: I9a95f36cf517c11048ff04680007f40259c4f636
|
||||
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
|
||||
Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
|
||||
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
|
||||
---
|
||||
core/arch/arm/kernel/boot.c | 12 ++++++++++++
|
||||
core/arch/arm/kernel/thread_a64.S | 11 ++++++++++-
|
||||
core/arch/arm/kernel/thread_spmc.c | 11 +++++++++++
|
||||
.../arm/plat-totalcompute/fdts/optee_sp_manifest.dts | 1 +
|
||||
4 files changed, 34 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/core/arch/arm/kernel/boot.c b/core/arch/arm/kernel/boot.c
|
||||
index f173384d..466c042e 100644
|
||||
--- a/core/arch/arm/kernel/boot.c
|
||||
+++ b/core/arch/arm/kernel/boot.c
|
||||
@@ -1350,6 +1350,18 @@ static void init_secondary_helper(unsigned long nsec_entry)
|
||||
init_vfp_sec();
|
||||
init_vfp_nsec();
|
||||
|
||||
+ /* Enable managed exit interrupt for secondary core. */
|
||||
+ __asm__ volatile (
|
||||
+ "mov x0, %0;"
|
||||
+ "mov x1, %1;"
|
||||
+ "mov x2, %2;"
|
||||
+ "mov x3, %3;"
|
||||
+ "hvc #0"
|
||||
+ : : "i" (0xff03), "i" (4), "i" (1), "i" (1));
|
||||
+
|
||||
+ IMSG("%s core %lu: enabled managed exit interrupt.",
|
||||
+ __func__, get_core_pos());
|
||||
+
|
||||
IMSG("Secondary CPU %zu switching to normal world boot", get_core_pos());
|
||||
}
|
||||
|
||||
diff --git a/core/arch/arm/kernel/thread_a64.S b/core/arch/arm/kernel/thread_a64.S
|
||||
index d6baee4d..1b0c8f37 100644
|
||||
--- a/core/arch/arm/kernel/thread_a64.S
|
||||
+++ b/core/arch/arm/kernel/thread_a64.S
|
||||
@@ -1087,6 +1087,14 @@ END_FUNC el0_sync_abort
|
||||
bl dcache_op_louis
|
||||
ic iallu
|
||||
#endif
|
||||
+
|
||||
+ /* HF_INTERRUPT_GET */
|
||||
+ mov x0, #0xff04
|
||||
+ hvc #0
|
||||
+ /* Expect managed exit interrupt */
|
||||
+ cmp x0, #4
|
||||
+ bne .
|
||||
+
|
||||
/*
|
||||
* Mark current thread as suspended
|
||||
*/
|
||||
@@ -1204,8 +1212,9 @@ LOCAL_FUNC elx_irq , :
|
||||
#endif
|
||||
END_FUNC elx_irq
|
||||
|
||||
+#define HF_MANAGED_EXIT 1
|
||||
LOCAL_FUNC elx_fiq , :
|
||||
-#if defined(CFG_ARM_GICV3)
|
||||
+#if defined(CFG_ARM_GICV3) || defined (HF_MANAGED_EXIT)
|
||||
foreign_intr_handler fiq
|
||||
#else
|
||||
native_intr_handler fiq
|
||||
diff --git a/core/arch/arm/kernel/thread_spmc.c b/core/arch/arm/kernel/thread_spmc.c
|
||||
index ea9e8f03..15577e7e 100644
|
||||
--- a/core/arch/arm/kernel/thread_spmc.c
|
||||
+++ b/core/arch/arm/kernel/thread_spmc.c
|
||||
@@ -1518,6 +1518,17 @@ static TEE_Result spmc_init(void)
|
||||
my_endpoint_id = spmc_get_id();
|
||||
DMSG("My endpoint ID %#x", my_endpoint_id);
|
||||
|
||||
+ /* Enable managed exit interrupt for boot core. */
|
||||
+ __asm__ volatile (
|
||||
+ "mov x0, %0;"
|
||||
+ "mov x1, %1;"
|
||||
+ "mov x2, %2;"
|
||||
+ "mov x3, %3;"
|
||||
+ "hvc #0"
|
||||
+ : : "i" (0xff03), "i" (4), "i" (1), "i" (1));
|
||||
+
|
||||
+ IMSG("%s enabled managed exit interrupt.", __func__);
|
||||
+
|
||||
return TEE_SUCCESS;
|
||||
}
|
||||
#endif /* !defined(CFG_CORE_SEL1_SPMC) */
|
||||
diff --git a/core/arch/arm/plat-totalcompute/fdts/optee_sp_manifest.dts b/core/arch/arm/plat-totalcompute/fdts/optee_sp_manifest.dts
|
||||
index 0bfe33f3..00cfa5b2 100644
|
||||
--- a/core/arch/arm/plat-totalcompute/fdts/optee_sp_manifest.dts
|
||||
+++ b/core/arch/arm/plat-totalcompute/fdts/optee_sp_manifest.dts
|
||||
@@ -24,6 +24,7 @@
|
||||
xlat-granule = <0>; /* 4KiB */
|
||||
boot-order = <0>;
|
||||
messaging-method = <0x3>; /* Direct request/response supported */
|
||||
+ managed-exit; /* Managed exit supported */
|
||||
|
||||
device-regions {
|
||||
compatible = "arm,ffa-manifest-device-regions";
|
||||
--
|
||||
2.34.1
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
From 35dba075593cb32c62b881e7763fcf0ea37908f7 Mon Sep 17 00:00:00 2001
|
||||
From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
|
||||
Date: Mon, 23 May 2022 11:32:41 +0100
|
||||
Subject: [PATCH 2/2] plat-totalcompute: fix TZDRAM start and size
|
||||
|
||||
- Fix TZDRAM_SIZE in TC platform
|
||||
- For CFG_CORE_SEL2_SPMC, manifest size is increased from 0x1000 to
|
||||
0x4000 for boot protocol support.
|
||||
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
|
||||
Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
|
||||
Change-Id: Iff19c498e9edae961f469604d69419c1a32145f5
|
||||
---
|
||||
core/arch/arm/plat-totalcompute/conf.mk | 5 +++--
|
||||
core/arch/arm/plat-totalcompute/fdts/optee_sp_manifest.dts | 2 +-
|
||||
2 files changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/core/arch/arm/plat-totalcompute/conf.mk b/core/arch/arm/plat-totalcompute/conf.mk
|
||||
index b39ac0f0..2f6c0ee1 100644
|
||||
--- a/core/arch/arm/plat-totalcompute/conf.mk
|
||||
+++ b/core/arch/arm/plat-totalcompute/conf.mk
|
||||
@@ -32,8 +32,9 @@ ifeq ($(CFG_CORE_SEL1_SPMC),y)
|
||||
CFG_TZDRAM_START ?= 0xfd000000
|
||||
CFG_TZDRAM_SIZE ?= 0x02000000
|
||||
else ifeq ($(CFG_CORE_SEL2_SPMC),y)
|
||||
-CFG_TZDRAM_START ?= 0xfd281000
|
||||
-CFG_TZDRAM_SIZE ?= 0x01d7f000
|
||||
+CFG_TZDRAM_START ?= 0xfd284000
|
||||
+# TZDRAM size 0x1980000 - 0x4000 manifest size
|
||||
+CFG_TZDRAM_SIZE ?= 0x0197c000
|
||||
else
|
||||
CFG_TZDRAM_START ?= 0xff000000
|
||||
CFG_TZDRAM_SIZE ?= 0x01000000
|
||||
diff --git a/core/arch/arm/plat-totalcompute/fdts/optee_sp_manifest.dts b/core/arch/arm/plat-totalcompute/fdts/optee_sp_manifest.dts
|
||||
index 00cfa5b2..56e69f37 100644
|
||||
--- a/core/arch/arm/plat-totalcompute/fdts/optee_sp_manifest.dts
|
||||
+++ b/core/arch/arm/plat-totalcompute/fdts/optee_sp_manifest.dts
|
||||
@@ -20,7 +20,7 @@
|
||||
exception-level = <2>; /* S-EL1 */
|
||||
execution-state = <0>; /* AARCH64 */
|
||||
load-address = <0xfd280000>;
|
||||
- entrypoint-offset = <0x1000>;
|
||||
+ entrypoint-offset = <0x4000>;
|
||||
xlat-granule = <0>; /* 4KiB */
|
||||
boot-order = <0>;
|
||||
messaging-method = <0x3>; /* Direct request/response supported */
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"op-tee" : {
|
||||
"image": "tee-pager_v2.bin",
|
||||
"pm": "optee_sp_manifest.dts"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user