summaryrefslogtreecommitdiff
path: root/arch/arm/include/asm/domain.h
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2015-08-19 21:23:48 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2015-08-21 13:55:49 +0100
commit1eef5d2f1b461c120bcd82077edee5ec706ac53b (patch)
treeb95a7132189a44d9a826e7b44fbbe5cae74d75fb /arch/arm/include/asm/domain.h
parentd770e558e21961ad6cfdf0ff7df0eb5d7d4f0754 (diff)
ARM: domains: switch to keeping domain value in register
Rather than modifying both the domain access control register and our per-thread copy, modify only the domain access control register, and use the per-thread copy to save and restore the register over context switches. We can also avoid the explicit initialisation of the init thread_info structure. This allows us to avoid needing to gain access to the thread information at the uaccess control sites. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/include/asm/domain.h')
-rw-r--r--arch/arm/include/asm/domain.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/arch/arm/include/asm/domain.h b/arch/arm/include/asm/domain.h
index 6ddbe446425e..7f2941905714 100644
--- a/arch/arm/include/asm/domain.h
+++ b/arch/arm/include/asm/domain.h
@@ -59,6 +59,17 @@
#ifndef __ASSEMBLY__
+static inline unsigned int get_domain(void)
+{
+ unsigned int domain;
+
+ asm(
+ "mrc p15, 0, %0, c3, c0 @ get domain"
+ : "=r" (domain));
+
+ return domain;
+}
+
#ifdef CONFIG_CPU_USE_DOMAINS
static inline void set_domain(unsigned val)
{
@@ -70,11 +81,10 @@ static inline void set_domain(unsigned val)
#define modify_domain(dom,type) \
do { \
- struct thread_info *thread = current_thread_info(); \
- unsigned int domain = thread->cpu_domain; \
- domain &= ~domain_val(dom, DOMAIN_MANAGER); \
- thread->cpu_domain = domain | domain_val(dom, type); \
- set_domain(thread->cpu_domain); \
+ unsigned int domain = get_domain(); \
+ domain &= ~domain_val(dom, DOMAIN_MANAGER); \
+ domain = domain | domain_val(dom, type); \
+ set_domain(domain); \
} while (0)
#else