diff options
| author | Kamlesh Gurudasani <kamlesh@ti.com> | 2024-05-23 14:39:48 +0530 |
|---|---|---|
| committer | Ryan Eatmon <reatmon@ti.com> | 2024-06-15 08:05:34 -0500 |
| commit | 6fc988cbbd45295991e273d5e6991543062e4faf (patch) | |
| tree | a701904710f8f58143bb79033f2f9b9da48822f8 /meta-ti-bsp/recipes-security/optee | |
| parent | 07e39d4ce33c1cfaf2e91acd4701a1c9a955a21e (diff) | |
| download | meta-ti-6fc988cbbd45295991e273d5e6991543062e4faf.tar.gz | |
optee: Update to upstream 4.2.0
Update all of the optee components to the upstream 4.2.0 version.
While at it, remove the patches and fixups which are not needed anymore.
Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
Signed-off-by: Ryan Eatmon <reatmon@ti.com>
Diffstat (limited to 'meta-ti-bsp/recipes-security/optee')
5 files changed, 7 insertions, 265 deletions
diff --git a/meta-ti-bsp/recipes-security/optee/optee-client-ti-version.inc b/meta-ti-bsp/recipes-security/optee/optee-client-ti-version.inc index 16fbd6c5..22a363f4 100644 --- a/meta-ti-bsp/recipes-security/optee/optee-client-ti-version.inc +++ b/meta-ti-bsp/recipes-security/optee/optee-client-ti-version.inc | |||
| @@ -1,2 +1,2 @@ | |||
| 1 | PV = "4.1.0+git" | 1 | PV = "4.2.0+git" |
| 2 | SRCREV = "f7e4ced15d1fefd073bbfc484fe0e1f74afe96c2" | 2 | SRCREV = "3eac340a781c00ccd61b151b0e9c22a8c6e9f9f0" |
diff --git a/meta-ti-bsp/recipes-security/optee/optee-examples-ti-version.inc b/meta-ti-bsp/recipes-security/optee/optee-examples-ti-version.inc index 23cd7580..2d7a95bd 100644 --- a/meta-ti-bsp/recipes-security/optee/optee-examples-ti-version.inc +++ b/meta-ti-bsp/recipes-security/optee/optee-examples-ti-version.inc | |||
| @@ -1,2 +1,2 @@ | |||
| 1 | PV = "4.0.0+git" | 1 | PV = "4.2.0+git" |
| 2 | SRCREV = "378dc0db2d5dd279f58a3b6cb3f78ffd6b165035" | 2 | SRCREV = "378dc0db2d5dd279f58a3b6cb3f78ffd6b165035" |
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 deleted file mode 100644 index 06a8ff60..00000000 --- a/meta-ti-bsp/recipes-security/optee/optee-os-4.0.0/0002ti-core-Define-section-attributes-for-clang.patch +++ /dev/null | |||
| @@ -1,249 +0,0 @@ | |||
| 1 | |||
| 2 | This is a fixup of the patch in meta-arm. The file: | ||
| 3 | core/arch/arm/mm/pgt_cache.c | ||
| 4 | was moved to: | ||
| 5 | core/mm/pgt_cache.c | ||
| 6 | |||
| 7 | Ryan Eatmon <reatmon@ti.com> | ||
| 8 | |||
| 9 | |||
| 10 | From 6f588813a170a671ebf1d6b51cebc7bc761295dc Mon Sep 17 00:00:00 2001 | ||
| 11 | From: Emekcan Aras <emekcan.aras@arm.com> | ||
| 12 | Date: Wed, 21 Dec 2022 10:55:58 +0000 | ||
| 13 | Subject: [PATCH] core: Define section attributes for clang | ||
| 14 | |||
| 15 | Clang's attribute section is not same as gcc, here we need to add flags | ||
| 16 | to sections so they can be eventually collected by linker into final | ||
| 17 | output segments. Only way to do so with clang is to use | ||
| 18 | |||
| 19 | pragma clang section ... | ||
| 20 | |||
| 21 | The behavious is described here [1], this allows us to define names bss | ||
| 22 | sections. This was not an issue until clang-15 where LLD linker starts | ||
| 23 | to detect the section flags before merging them and throws the following | ||
| 24 | errors | ||
| 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 | |||
| 34 | These sections should be carrying SHT_NOBITS but so far it was not | ||
| 35 | possible to do so, this patch tries to use clangs pragma to get this | ||
| 36 | going 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 | |||
| 40 | Upstream-Status: Pending | ||
| 41 | Signed-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 | |||
| 50 | diff --git a/core/arch/arm/kernel/thread.c b/core/arch/arm/kernel/thread.c | ||
| 51 | index 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 | ||
| 87 | diff --git a/core/arch/arm/mm/core_mmu_lpae.c b/core/arch/arm/mm/core_mmu_lpae.c | ||
| 88 | index 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 | * | ||
| 142 | diff --git a/core/arch/arm/mm/core_mmu_v7.c b/core/arch/arm/mm/core_mmu_v7.c | ||
| 143 | index 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; | ||
| 196 | diff --git a/core/mm/pgt_cache.c b/core/mm/pgt_cache.c | ||
| 197 | index 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++) { | ||
| 220 | diff --git a/core/kernel/thread.c b/core/kernel/thread.c | ||
| 221 | index 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-ti-version.inc b/meta-ti-bsp/recipes-security/optee/optee-os-ti-version.inc index 9db67567..790f5f5f 100644 --- a/meta-ti-bsp/recipes-security/optee/optee-os-ti-version.inc +++ b/meta-ti-bsp/recipes-security/optee/optee-os-ti-version.inc | |||
| @@ -1,7 +1,2 @@ | |||
| 1 | PV = "4.1.0+git" | 1 | PV = "4.2.0+git" |
| 2 | SRCREV = "012cdca49db398693903e05c42a254a3a0c0d8f2" | 2 | SRCREV = "12d7c4ee4642d2d761e39fbcf21a06fb77141dea" |
| 3 | |||
| 4 | # Fixes for pointing to 4.0.0 before upstream meta-arm | ||
| 5 | FILESEXTRAPATHS:prepend := "${THISDIR}/optee-os-4.0.0:" | ||
| 6 | SRC_URI:remove = "file://0002-core-Define-section-attributes-for-clang.patch" | ||
| 7 | SRC_URI:append = " file://0002ti-core-Define-section-attributes-for-clang.patch" | ||
diff --git a/meta-ti-bsp/recipes-security/optee/optee-test-ti-version.inc b/meta-ti-bsp/recipes-security/optee/optee-test-ti-version.inc index 16b2dfc3..fdfa420c 100644 --- a/meta-ti-bsp/recipes-security/optee/optee-test-ti-version.inc +++ b/meta-ti-bsp/recipes-security/optee/optee-test-ti-version.inc | |||
| @@ -1,6 +1,2 @@ | |||
| 1 | PV = "4.1.0+git" | 1 | PV = "4.2.0+git" |
| 2 | SRCREV = "2e1e7a9c9d659585566a75fc8802f4758c42bcb2" | 2 | SRCREV = "526d5bac1b65f907f67c05cd07beca72fbab88dd" |
| 3 | |||
| 4 | # Fixes for pointing to 4.0.0 before upstream meta-arm | ||
| 5 | SRC_URI:remove = "file://0001-xtest-regression_1000-remove-unneeded-stat.h-include.patch" | ||
| 6 | |||
