summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Eatmon <reatmon@ti.com>2023-10-26 08:27:24 -0500
committerRyan Eatmon <reatmon@ti.com>2023-10-27 13:43:48 -0500
commit26729b38d3890e2cf850e30ef1171f2fc2534043 (patch)
tree5b925faa28c705bacc16e4b1a09bc54f2dc4c44b
parent9e3727d4b2fcbe771b0a3567d17e914d3fd1a66b (diff)
downloadmeta-ti-26729b38d3890e2cf850e30ef1171f2fc2534043.tar.gz
optee: Update to upstream 4.0.0cicd.master.202310300100
Update all of the optee components to the upstream 4.0.0 version. Signed-off-by: Ryan Eatmon <reatmon@ti.com>
-rw-r--r--meta-ti-bsp/recipes-security/optee/optee-client-ti.inc7
-rw-r--r--meta-ti-bsp/recipes-security/optee/optee-client_%.bbappend4
-rw-r--r--meta-ti-bsp/recipes-security/optee/optee-examples-ti.inc2
-rw-r--r--meta-ti-bsp/recipes-security/optee/optee-examples_%.bbappend4
-rw-r--r--meta-ti-bsp/recipes-security/optee/optee-os-4.0.0/0002ti-core-Define-section-attributes-for-clang.patch249
-rw-r--r--meta-ti-bsp/recipes-security/optee/optee-os-tadevkit-ti.inc8
-rw-r--r--meta-ti-bsp/recipes-security/optee/optee-os-ti.inc8
-rw-r--r--meta-ti-bsp/recipes-security/optee/optee-test-ti.inc6
-rw-r--r--meta-ti-bsp/recipes-security/optee/optee-test_%.bbappend4
9 files changed, 292 insertions, 0 deletions
diff --git a/meta-ti-bsp/recipes-security/optee/optee-client-ti.inc b/meta-ti-bsp/recipes-security/optee/optee-client-ti.inc
new file mode 100644
index 00000000..f64a90c3
--- /dev/null
+++ b/meta-ti-bsp/recipes-security/optee/optee-client-ti.inc
@@ -0,0 +1,7 @@
1PV = "4.0.0+git${SRCPV}"
2SRCREV = "acb0885c117e73cb6c5c9b1dd9054cb3f93507ee"
3
4inherit pkgconfig
5DEPENDS += "util-linux"
6
7EXTRA_OEMAKE += "PKG_CONFIG=pkg-config"
diff --git a/meta-ti-bsp/recipes-security/optee/optee-client_%.bbappend b/meta-ti-bsp/recipes-security/optee/optee-client_%.bbappend
new file mode 100644
index 00000000..08c5256b
--- /dev/null
+++ b/meta-ti-bsp/recipes-security/optee/optee-client_%.bbappend
@@ -0,0 +1,4 @@
1OPTEE_TI = ""
2OPTEE_TI:ti-soc = "${BPN}-ti.inc"
3
4require ${OPTEE_TI}
diff --git a/meta-ti-bsp/recipes-security/optee/optee-examples-ti.inc b/meta-ti-bsp/recipes-security/optee/optee-examples-ti.inc
new file mode 100644
index 00000000..d6ddc907
--- /dev/null
+++ b/meta-ti-bsp/recipes-security/optee/optee-examples-ti.inc
@@ -0,0 +1,2 @@
1PV = "4.0.0+git${SRCPV}"
2SRCREV = "378dc0db2d5dd279f58a3b6cb3f78ffd6b165035"
diff --git a/meta-ti-bsp/recipes-security/optee/optee-examples_%.bbappend b/meta-ti-bsp/recipes-security/optee/optee-examples_%.bbappend
new file mode 100644
index 00000000..08c5256b
--- /dev/null
+++ b/meta-ti-bsp/recipes-security/optee/optee-examples_%.bbappend
@@ -0,0 +1,4 @@
1OPTEE_TI = ""
2OPTEE_TI:ti-soc = "${BPN}-ti.inc"
3
4require ${OPTEE_TI}
diff --git a/meta-ti-bsp/recipes-security/optee/optee-os-4.0.0/0002ti-core-Define-section-attributes-for-clang.patch b/meta-ti-bsp/recipes-security/optee/optee-os-4.0.0/0002ti-core-Define-section-attributes-for-clang.patch
new file mode 100644
index 00000000..06a8ff60
--- /dev/null
+++ b/meta-ti-bsp/recipes-security/optee/optee-os-4.0.0/0002ti-core-Define-section-attributes-for-clang.patch
@@ -0,0 +1,249 @@
1
2This is a fixup of the patch in meta-arm. The file:
3 core/arch/arm/mm/pgt_cache.c
4was moved to:
5 core/mm/pgt_cache.c
6
7Ryan Eatmon <reatmon@ti.com>
8
9
10From 6f588813a170a671ebf1d6b51cebc7bc761295dc Mon Sep 17 00:00:00 2001
11From: Emekcan Aras <emekcan.aras@arm.com>
12Date: Wed, 21 Dec 2022 10:55:58 +0000
13Subject: [PATCH] core: Define section attributes for clang
14
15Clang's attribute section is not same as gcc, here we need to add flags
16to sections so they can be eventually collected by linker into final
17output segments. Only way to do so with clang is to use
18
19pragma clang section ...
20
21The behavious is described here [1], this allows us to define names bss
22sections. This was not an issue until clang-15 where LLD linker starts
23to detect the section flags before merging them and throws the following
24errors
25
26| ld.lld: error: section type mismatch for .nozi.kdata_page
27| >>> /mnt/b/yoe/master/build/tmp/work/qemuarm64-yoe-linux/optee-os-tadevkit/3.17.0-r0/build/core/arch/arm/kernel/thread.o:(.nozi.kdata_page): SHT_PROGBITS
28| >>> output section .nozi: SHT_NOBITS
29|
30| ld.lld: error: section type mismatch for .nozi.mmu.l2
31| >>> /mnt/b/yoe/master/build/tmp/work/qemuarm64-yoe-linux/optee-os-tadevkit/3.17.0-r0/build/core/arch/arm/mm/core_mmu_lpae.o:(.nozi.mmu.l2): SHT_PROGBITS
32| >>> output section .nozi: SHT_NOBITS
33
34These sections should be carrying SHT_NOBITS but so far it was not
35possible to do so, this patch tries to use clangs pragma to get this
36going and match the functionality with gcc.
37
38[1] https://intel.github.io/llvm-docs/clang/LanguageExtensions.html#specifying-section-names-for-global-objects-pragma-clang-section
39
40Upstream-Status: Pending
41Signed-off-by: Khem Raj <raj.khem@gmail.com>
42---
43 core/arch/arm/kernel/thread.c | 19 +++++++++++++++--
44 core/arch/arm/mm/core_mmu_lpae.c | 35 +++++++++++++++++++++++++++----
45 core/arch/arm/mm/core_mmu_v7.c | 36 +++++++++++++++++++++++++++++---
46 core/arch/arm/mm/pgt_cache.c | 12 ++++++++++-
47 core/kernel/thread.c | 13 +++++++++++-
48 5 files changed, 104 insertions(+), 11 deletions(-)
49
50diff --git a/core/arch/arm/kernel/thread.c b/core/arch/arm/kernel/thread.c
51index 4487ef026df9..f3624389611b 100644
52--- a/core/arch/arm/kernel/thread.c
53+++ b/core/arch/arm/kernel/thread.c
54@@ -44,15 +44,30 @@ static size_t thread_user_kcode_size __nex_bss;
55 #if defined(CFG_CORE_UNMAP_CORE_AT_EL0) && \
56 defined(CFG_CORE_WORKAROUND_SPECTRE_BP_SEC) && defined(ARM64)
57 long thread_user_kdata_sp_offset __nex_bss;
58+#ifdef __clang__
59+#ifndef CFG_VIRTUALIZATION
60+#pragma clang section bss=".nozi.kdata_page"
61+#else
62+#pragma clang section bss=".nex_nozi.kdata_page"
63+#endif
64+#endif
65 static uint8_t thread_user_kdata_page[
66 ROUNDUP(sizeof(struct thread_core_local) * CFG_TEE_CORE_NB_CORE,
67 SMALL_PAGE_SIZE)]
68 __aligned(SMALL_PAGE_SIZE)
69+#ifndef __clang__
70 #ifndef CFG_NS_VIRTUALIZATION
71- __section(".nozi.kdata_page");
72+ __section(".nozi.kdata_page")
73 #else
74- __section(".nex_nozi.kdata_page");
75+ __section(".nex_nozi.kdata_page")
76 #endif
77+#endif
78+ ;
79+#endif
80+
81+/* reset BSS section to default ( .bss ) */
82+#ifdef __clang__
83+#pragma clang section bss=""
84 #endif
85
86 #ifdef ARM32
87diff --git a/core/arch/arm/mm/core_mmu_lpae.c b/core/arch/arm/mm/core_mmu_lpae.c
88index 7e79f780ad28..ec4db9dc98c5 100644
89--- a/core/arch/arm/mm/core_mmu_lpae.c
90+++ b/core/arch/arm/mm/core_mmu_lpae.c
91@@ -233,19 +233,46 @@ typedef uint16_t l1_idx_t;
92 typedef uint64_t base_xlat_tbls_t[CFG_TEE_CORE_NB_CORE][NUM_BASE_LEVEL_ENTRIES];
93 typedef uint64_t xlat_tbl_t[XLAT_TABLE_ENTRIES];
94
95+#ifdef __clang__
96+#pragma clang section bss=".nozi.mmu.base_table"
97+#endif
98 static base_xlat_tbls_t base_xlation_table[NUM_BASE_TABLES]
99 __aligned(NUM_BASE_LEVEL_ENTRIES * XLAT_ENTRY_SIZE)
100- __section(".nozi.mmu.base_table");
101+#ifndef __clang__
102+ __section(".nozi.mmu.base_table")
103+#endif
104+;
105+#ifdef __clang__
106+#pragma clang section bss=""
107+#endif
108
109+#ifdef __clang__
110+#pragma clang section bss=".nozi.mmu.l2"
111+#endif
112 static xlat_tbl_t xlat_tables[MAX_XLAT_TABLES]
113- __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2");
114+ __aligned(XLAT_TABLE_SIZE)
115+#ifndef __clang__
116+ __section(".nozi.mmu.l2")
117+#endif
118+;
119+#ifdef __clang__
120+#pragma clang section bss=""
121+#endif
122
123 #define XLAT_TABLES_SIZE (sizeof(xlat_tbl_t) * MAX_XLAT_TABLES)
124
125+#ifdef __clang__
126+#pragma clang section bss=".nozi.mmu.l2"
127+#endif
128 /* MMU L2 table for TAs, one for each thread */
129 static xlat_tbl_t xlat_tables_ul1[CFG_NUM_THREADS]
130- __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2");
131-
132+#ifndef __clang__
133+ __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2")
134+#endif
135+;
136+#ifdef __clang__
137+#pragma clang section bss=""
138+#endif
139 /*
140 * TAs page table entry inside a level 1 page table.
141 *
142diff --git a/core/arch/arm/mm/core_mmu_v7.c b/core/arch/arm/mm/core_mmu_v7.c
143index 61e703da89c8..1960c08ca688 100644
144--- a/core/arch/arm/mm/core_mmu_v7.c
145+++ b/core/arch/arm/mm/core_mmu_v7.c
146@@ -204,16 +204,46 @@ typedef uint32_t l1_xlat_tbl_t[NUM_L1_ENTRIES];
147 typedef uint32_t l2_xlat_tbl_t[NUM_L2_ENTRIES];
148 typedef uint32_t ul1_xlat_tbl_t[NUM_UL1_ENTRIES];
149
150+#ifdef __clang__
151+#pragma clang section bss=".nozi.mmu.l1"
152+#endif
153 static l1_xlat_tbl_t main_mmu_l1_ttb
154- __aligned(L1_ALIGNMENT) __section(".nozi.mmu.l1");
155+ __aligned(L1_ALIGNMENT)
156+#ifndef __clang__
157+ __section(".nozi.mmu.l1")
158+#endif
159+;
160+#ifdef __clang__
161+#pragma clang section bss=""
162+#endif
163
164 /* L2 MMU tables */
165+#ifdef __clang__
166+#pragma clang section bss=".nozi.mmu.l2"
167+#endif
168 static l2_xlat_tbl_t main_mmu_l2_ttb[MAX_XLAT_TABLES]
169- __aligned(L2_ALIGNMENT) __section(".nozi.mmu.l2");
170+ __aligned(L2_ALIGNMENT)
171+#ifndef __clang__
172+ __section(".nozi.mmu.l2")
173+#endif
174+;
175+#ifdef __clang__
176+#pragma clang section bss=""
177+#endif
178
179 /* MMU L1 table for TAs, one for each thread */
180+#ifdef __clang__
181+#pragma clang section bss=".nozi.mmu.ul1"
182+#endif
183 static ul1_xlat_tbl_t main_mmu_ul1_ttb[CFG_NUM_THREADS]
184- __aligned(UL1_ALIGNMENT) __section(".nozi.mmu.ul1");
185+ __aligned(UL1_ALIGNMENT)
186+#ifndef __clang__
187+ __section(".nozi.mmu.ul1")
188+#endif
189+;
190+#ifdef __clang__
191+#pragma clang section bss=""
192+#endif
193
194 struct mmu_partition {
195 l1_xlat_tbl_t *l1_table;
196diff --git a/core/mm/pgt_cache.c b/core/mm/pgt_cache.c
197index 79553c6d2183..b9efdf42780b 100644
198--- a/core/mm/pgt_cache.c
199+++ b/core/mm/pgt_cache.c
200@@ -410,8 +410,18 @@ void pgt_init(void)
201 * has a large alignment, while .bss has a small alignment. The current
202 * link script is optimized for small alignment in .bss
203 */
204+#ifdef __clang__
205+#pragma clang section bss=".nozi.mmu.l2"
206+#endif
207 static uint8_t pgt_tables[PGT_CACHE_SIZE][PGT_SIZE]
208- __aligned(PGT_SIZE) __section(".nozi.pgt_cache");
209+ __aligned(PGT_SIZE)
210+#ifndef __clang__
211+ __section(".nozi.pgt_cache")
212+#endif
213+ ;
214+#ifdef __clang__
215+#pragma clang section bss=""
216+#endif
217 size_t n;
218
219 for (n = 0; n < ARRAY_SIZE(pgt_tables); n++) {
220diff --git a/core/kernel/thread.c b/core/kernel/thread.c
221index 2a1f22dce635..5516b677141a 100644
222--- a/core/kernel/thread.c
223+++ b/core/kernel/thread.c
224@@ -39,13 +39,24 @@ static uint32_t end_canary_value = 0xababab00;
225 name[stack_num][sizeof(name[stack_num]) / sizeof(uint32_t) - 1]
226 #endif
227
228+#define DO_PRAGMA(x) _Pragma (#x)
229+
230+#ifdef __clang__
231+#define DECLARE_STACK(name, num_stacks, stack_size, linkage) \
232+DO_PRAGMA (clang section bss=".nozi_stack." #name) \
233+linkage uint32_t name[num_stacks] \
234+ [ROUNDUP(stack_size + STACK_CANARY_SIZE + STACK_CHECK_EXTRA, \
235+ STACK_ALIGNMENT) / sizeof(uint32_t)] \
236+ __attribute__((aligned(STACK_ALIGNMENT))); \
237+DO_PRAGMA(clang section bss="")
238+#else
239 #define DECLARE_STACK(name, num_stacks, stack_size, linkage) \
240 linkage uint32_t name[num_stacks] \
241 [ROUNDUP(stack_size + STACK_CANARY_SIZE + STACK_CHECK_EXTRA, \
242 STACK_ALIGNMENT) / sizeof(uint32_t)] \
243 __attribute__((section(".nozi_stack." # name), \
244 aligned(STACK_ALIGNMENT)))
245-
246+#endif
247 #define GET_STACK(stack) ((vaddr_t)(stack) + STACK_SIZE(stack))
248
249 DECLARE_STACK(stack_tmp, CFG_TEE_CORE_NB_CORE, STACK_TMP_SIZE,
diff --git a/meta-ti-bsp/recipes-security/optee/optee-os-tadevkit-ti.inc b/meta-ti-bsp/recipes-security/optee/optee-os-tadevkit-ti.inc
index df46e243..55453366 100644
--- a/meta-ti-bsp/recipes-security/optee/optee-os-tadevkit-ti.inc
+++ b/meta-ti-bsp/recipes-security/optee/optee-os-tadevkit-ti.inc
@@ -1 +1,9 @@
1PV = "4.0.0+git${SRCPV}"
2SRCREV = "2a5b1d1232f582056184367fb58a425ac7478ec6"
3
4# Fixes for pointing to 4.0.0 before upstream meta-arm
5FILESEXTRAPATHS:prepend := "${THISDIR}/optee-os-4.0.0:"
6SRC_URI:remove = "file://0002-core-Define-section-attributes-for-clang.patch"
7SRC_URI:append = " file://0002ti-core-Define-section-attributes-for-clang.patch"
8
1EXTRA_OEMAKE:remove = "CFG_MAP_EXT_DT_SECURE=y" 9EXTRA_OEMAKE:remove = "CFG_MAP_EXT_DT_SECURE=y"
diff --git a/meta-ti-bsp/recipes-security/optee/optee-os-ti.inc b/meta-ti-bsp/recipes-security/optee/optee-os-ti.inc
index de13d282..6d192bbe 100644
--- a/meta-ti-bsp/recipes-security/optee/optee-os-ti.inc
+++ b/meta-ti-bsp/recipes-security/optee/optee-os-ti.inc
@@ -1,3 +1,11 @@
1PV = "4.0.0+git${SRCPV}"
2SRCREV = "2a5b1d1232f582056184367fb58a425ac7478ec6"
3
4# Fixes for pointing to 4.0.0 before upstream meta-arm
5FILESEXTRAPATHS:prepend := "${THISDIR}/optee-os-4.0.0:"
6SRC_URI:remove = "file://0002-core-Define-section-attributes-for-clang.patch"
7SRC_URI:append = " file://0002ti-core-Define-section-attributes-for-clang.patch"
8
1# Use TI SECDEV for signing 9# Use TI SECDEV for signing
2inherit ti-secdev 10inherit ti-secdev
3 11
diff --git a/meta-ti-bsp/recipes-security/optee/optee-test-ti.inc b/meta-ti-bsp/recipes-security/optee/optee-test-ti.inc
new file mode 100644
index 00000000..1dea1fbd
--- /dev/null
+++ b/meta-ti-bsp/recipes-security/optee/optee-test-ti.inc
@@ -0,0 +1,6 @@
1PV = "4.0.0+git${SRCPV}"
2SRCREV = "1c3d6be5eaa6174e3dbabf60928d15628e39b994"
3
4# Fixes for pointing to 4.0.0 before upstream meta-arm
5SRC_URI:remove = "file://0001-xtest-regression_1000-remove-unneeded-stat.h-include.patch"
6
diff --git a/meta-ti-bsp/recipes-security/optee/optee-test_%.bbappend b/meta-ti-bsp/recipes-security/optee/optee-test_%.bbappend
new file mode 100644
index 00000000..08c5256b
--- /dev/null
+++ b/meta-ti-bsp/recipes-security/optee/optee-test_%.bbappend
@@ -0,0 +1,4 @@
1OPTEE_TI = ""
2OPTEE_TI:ti-soc = "${BPN}-ti.inc"
3
4require ${OPTEE_TI}