From ed938d18b1b6fc48648dc68f46f9a7533a393940 Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Tue, 25 Aug 2020 16:31:59 -0700 Subject: [PATCH] arc: fix arch_ API implementations on current CPU All of these should be no-ops for the following reasons: 1. User threads cannot configure memory domains, only supervisor threads. 2. The scope of memory domains is user thread memory access, supervisor threads can access the entire memory map. Hence it's never required to reprogram the MPU on the current CPU when a memory domain API is called. This does not address the issue #27785 if a user thread in the domain is running on some other CPU. Signed-off-by: Andrew Boie --- arch/arc/core/mpu/arc_core_mpu.c | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/arch/arc/core/mpu/arc_core_mpu.c b/arch/arc/core/mpu/arc_core_mpu.c index f8c0977167e..6a756388504 100644 --- a/arch/arc/core/mpu/arc_core_mpu.c +++ b/arch/arc/core/mpu/arc_core_mpu.c @@ -38,13 +38,7 @@ int arch_mem_domain_max_partitions_get(void) void arch_mem_domain_partition_remove(struct k_mem_domain *domain, uint32_t partition_id) { - if (_current->mem_domain_info.mem_domain != domain) { - return; - } - - arc_core_mpu_disable(); - arc_core_mpu_remove_mem_partition(domain, partition_id); - arc_core_mpu_enable(); + /* No-op on this architecture */ } /* @@ -52,13 +46,7 @@ void arch_mem_domain_partition_remove(struct k_mem_domain *domain, */ void arch_mem_domain_thread_add(struct k_thread *thread) { - if (_current != thread) { - return; - } - - arc_core_mpu_disable(); - arc_core_mpu_configure_mem_domain(thread); - arc_core_mpu_enable(); + /* No-op on this architecture */ } /* @@ -66,13 +54,7 @@ void arch_mem_domain_thread_add(struct k_thread *thread) */ void arch_mem_domain_destroy(struct k_mem_domain *domain) { - if (_current->mem_domain_info.mem_domain != domain) { - return; - } - - arc_core_mpu_disable(); - arc_core_mpu_remove_mem_domain(domain); - arc_core_mpu_enable(); + /* No-op on this architecture */ } void arch_mem_domain_partition_add(struct k_mem_domain *domain, @@ -83,11 +65,7 @@ void arch_mem_domain_partition_add(struct k_mem_domain *domain, void arch_mem_domain_thread_remove(struct k_thread *thread) { - if (_current != thread) { - return; - } - - arch_mem_domain_destroy(thread->mem_domain_info.mem_domain); + /* No-op on this architecture */ } /*