diff --git a/core/session_manager.c b/core/session_manager.c index f218fef27d890f9ac4b4ad31d4589396b78e8892..12a6c107651a90436e3935c32c8de2795279fdc4 100644 --- a/core/session_manager.c +++ b/core/session_manager.c @@ -56,6 +56,7 @@ #include "internal_functions.h" #include "ko_adapt.h" #include "shared_mem.h" +#include "tee_compat_check.h" static DEFINE_MUTEX(g_load_app_lock); #define MAX_REF_COUNT (255) @@ -1276,17 +1277,25 @@ void close_unclosed_session_in_kthread(struct tc_ns_dev_file *dev) close_session_thread_fn(dev); (void)close_thread; #else - close_thread = kthread_create(close_session_thread_fn, - dev, "close_fn_%6d", dev->dev_file_id); - if (unlikely(IS_ERR_OR_NULL(close_thread))) { - tloge("fail to create close session thread\n"); - return; - } + if (is_ccos()) { + /** + * In CCOS, TA's affinity can be set just in TEE, and CA affinity does not influence TA affiity, + * so no need to go to tzdriver to set affinity. + */ + close_session_thread_fn(dev); + } else { + close_thread = kthread_create(close_session_thread_fn, + dev, "close_fn_%6d", dev->dev_file_id); + if (unlikely(IS_ERR_OR_NULL(close_thread))) { + tloge("fail to create close session thread\n"); + return; + } - tz_kthread_bind_mask(close_thread); - wake_up_process(close_thread); - wait_for_completion(&dev->close_comp); - tlogd("wait for completion success\n"); + tz_kthread_bind_mask(close_thread); + wake_up_process(close_thread); + wait_for_completion(&dev->close_comp); + tlogd("wait for completion success\n"); + } #endif } diff --git a/core/smc_smp.c b/core/smc_smp.c index 1e338aac35253143f4cebbe52e0c2cd3efd377b0..cbe2c8984df3fb6195ec2ad31eeddcd68546c7f7 100644 --- a/core/smc_smp.c +++ b/core/smc_smp.c @@ -513,8 +513,10 @@ static struct pending_entry *init_pending_entry(void) pe->task = current; #ifdef CONFIG_TA_AFFINITY - cpumask_copy(&pe->ca_mask, CURRENT_CPUS_ALLOWED); - cpumask_copy(&pe->ta_mask, CURRENT_CPUS_ALLOWED); + if (!is_ccos()) { + cpumask_copy(&pe->ca_mask, CURRENT_CPUS_ALLOWED); + cpumask_copy(&pe->ta_mask, CURRENT_CPUS_ALLOWED); + } #endif init_waitqueue_head(&pe->wq); @@ -582,7 +584,8 @@ static void restore_cpu_mask(struct pending_entry *pe) static void release_pending_entry(struct pending_entry *pe) { #ifdef CONFIG_TA_AFFINITY - restore_cpu_mask(pe); + if (!is_ccos()) + restore_cpu_mask(pe); #endif spin_lock(&g_pend_lock); list_del(&pe->list); @@ -604,6 +607,9 @@ static inline bool is_shadow_exit(uint64_t target) #ifdef CONFIG_TA_AFFINITY static bool match_ta_affinity(struct pending_entry *pe) { + if (is_ccos()) + return false; + if (!cpumask_equal(CURRENT_CPUS_ALLOWED, &pe->ta_mask)) { if (set_cpus_allowed_ptr(current, &pe->ta_mask)) { tlogw("set %s affinity failed\n", current->comm); diff --git a/core/tz_spi_notify.c b/core/tz_spi_notify.c index 1d4a264817fc16dda56342ce49e8e39763b6d63a..31a6955728023ce777dd27adbac214420f6a972e 100644 --- a/core/tz_spi_notify.c +++ b/core/tz_spi_notify.c @@ -45,6 +45,7 @@ #include "session_manager.h" #include "internal_functions.h" #include "shared_mem.h" +#include "tee_compat_check.h" #define DEFAULT_SPI_NUM 111 @@ -325,7 +326,8 @@ static noinline int get_notify_data_entry(struct notify_data_entry *copy) break; #ifdef CONFIG_TA_AFFINITY case NOTIFY_DATA_ENTRY_SET_AFFINITY: - g_notify_data->meta.context.meta.recv_af++; + if (!is_ccos()) + g_notify_data->meta.context.meta.recv_af++; break; #endif default: @@ -393,6 +395,9 @@ static void tc_notify_set_affinity(struct notify_data_entry *entry) struct notify_context_set_affinity *af_data = NULL; struct pending_entry *pe = NULL; + if (is_ccos()) + return; + af_data = &(entry->context.affinity); pe = find_pending_entry(af_data->ca_thread_id); if (pe != NULL) {