Skip to content

Commit f8e3503

Browse files
committed
Revert "optee: Clear stale cache entries during initialization"
This reverts commit b5c10dd which breaks OP-TEE virtualization support [1]. The bug is in fact in the Xen mediator [2] so the proper fix is to upgrade Xen when a new maintenance release is available, at which point this revert should be discarded. Link: [1] OP-TEE/build#523 Link: [2] https://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=1c3ed9c908732d19660fbe83580674d585464d4c Signed-off-by: Jerome Forissier <[email protected]>
1 parent 0a74b86 commit f8e3503

File tree

3 files changed

+3
-43
lines changed

3 files changed

+3
-43
lines changed

drivers/tee/optee/call.c

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -421,13 +421,11 @@ void optee_enable_shm_cache(struct optee *optee)
421421
}
422422

423423
/**
424-
* __optee_disable_shm_cache() - Disables caching of some shared memory
425-
* allocation in OP-TEE
424+
* optee_disable_shm_cache() - Disables caching of some shared memory allocation
425+
* in OP-TEE
426426
* @optee: main service struct
427-
* @is_mapped: true if the cached shared memory addresses were mapped by this
428-
* kernel, are safe to dereference, and should be freed
429427
*/
430-
static void __optee_disable_shm_cache(struct optee *optee, bool is_mapped)
428+
void optee_disable_shm_cache(struct optee *optee)
431429
{
432430
struct optee_call_waiter w;
433431

@@ -446,13 +444,6 @@ static void __optee_disable_shm_cache(struct optee *optee, bool is_mapped)
446444
if (res.result.status == OPTEE_SMC_RETURN_OK) {
447445
struct tee_shm *shm;
448446

449-
/*
450-
* Shared memory references that were not mapped by
451-
* this kernel must be ignored to prevent a crash.
452-
*/
453-
if (!is_mapped)
454-
continue;
455-
456447
shm = reg_pair_to_ptr(res.result.shm_upper32,
457448
res.result.shm_lower32);
458449
tee_shm_free(shm);
@@ -463,27 +454,6 @@ static void __optee_disable_shm_cache(struct optee *optee, bool is_mapped)
463454
optee_cq_wait_final(&optee->call_queue, &w);
464455
}
465456

466-
/**
467-
* optee_disable_shm_cache() - Disables caching of mapped shared memory
468-
* allocations in OP-TEE
469-
* @optee: main service struct
470-
*/
471-
void optee_disable_shm_cache(struct optee *optee)
472-
{
473-
return __optee_disable_shm_cache(optee, true);
474-
}
475-
476-
/**
477-
* optee_disable_unmapped_shm_cache() - Disables caching of shared memory
478-
* allocations in OP-TEE which are not
479-
* currently mapped
480-
* @optee: main service struct
481-
*/
482-
void optee_disable_unmapped_shm_cache(struct optee *optee)
483-
{
484-
return __optee_disable_shm_cache(optee, false);
485-
}
486-
487457
#define PAGELIST_ENTRIES_PER_PAGE \
488458
((OPTEE_MSG_NONCONTIG_PAGE_SIZE / sizeof(u64)) - 1)
489459

drivers/tee/optee/core.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -719,15 +719,6 @@ static int optee_probe(struct platform_device *pdev)
719719
optee->memremaped_shm = memremaped_shm;
720720
optee->pool = pool;
721721

722-
/*
723-
* Ensure that there are no pre-existing shm objects before enabling
724-
* the shm cache so that there's no chance of receiving an invalid
725-
* address during shutdown. This could occur, for example, if we're
726-
* kexec booting from an older kernel that did not properly cleanup the
727-
* shm cache.
728-
*/
729-
optee_disable_unmapped_shm_cache(optee);
730-
731722
optee_enable_shm_cache(optee);
732723

733724
if (optee->sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM)

drivers/tee/optee/optee_private.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ int optee_cancel_req(struct tee_context *ctx, u32 cancel_id, u32 session);
159159

160160
void optee_enable_shm_cache(struct optee *optee);
161161
void optee_disable_shm_cache(struct optee *optee);
162-
void optee_disable_unmapped_shm_cache(struct optee *optee);
163162

164163
int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm,
165164
struct page **pages, size_t num_pages,

0 commit comments

Comments
 (0)