[3/3] ARM: domain: move {set,get}_domain under config guard
diff mbox

Message ID 1461325416-29570-4-git-send-email-vladimir.murzin@arm.com
State New, archived
Headers show

Commit Message

Vladimir Murzin April 22, 2016, 11:43 a.m. UTC
Domains is not available on !MMU cores, like R/M class. However,
currently guarding manages M-class only, for the R-class, in case
of fault we get in recursive "undefined instruction" faulting because
__show_regs() tries to get domain information.

Fix it by extending CONFIG_CPU_USE_DOMAINS on {set,get}_domain
functions and providing stubs for the case where Domains is not
supported.

Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
 arch/arm/include/asm/domain.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Russell King - ARM Linux April 27, 2016, 10:49 a.m. UTC | #1
On Fri, Apr 22, 2016 at 12:43:36PM +0100, Vladimir Murzin wrote:
> Domains is not available on !MMU cores, like R/M class. However,
> currently guarding manages M-class only, for the R-class, in case
> of fault we get in recursive "undefined instruction" faulting because
> __show_regs() tries to get domain information.
> 
> Fix it by extending CONFIG_CPU_USE_DOMAINS on {set,get}_domain
> functions and providing stubs for the case where Domains is not
> supported.

Huge big bloody NAK.

I think it would be useful if you read the history of the file,
particularly looking at commit a5e090acbf545c0a3b04080f8a488b17ec41fe02.

It really amazes me how people propose patches which undo bits of
previous patches without making comments about it.

No way is this patch going in, which has the effect of completely
disabling SW PAN, sorry.

Patch
diff mbox

diff --git a/arch/arm/include/asm/domain.h b/arch/arm/include/asm/domain.h
index fc8ba16..a031bb9 100644
--- a/arch/arm/include/asm/domain.h
+++ b/arch/arm/include/asm/domain.h
@@ -84,6 +84,8 @@ 
 
 #ifndef __ASSEMBLY__
 
+#ifdef CONFIG_CPU_USE_DOMAINS
+
 static inline unsigned int get_domain(void)
 {
 	unsigned int domain;
@@ -104,7 +106,6 @@  static inline void set_domain(unsigned val)
 	isb();
 }
 
-#ifdef CONFIG_CPU_USE_DOMAINS
 #define modify_domain(dom,type)					\
 	do {							\
 		unsigned int domain = get_domain();		\
@@ -114,6 +115,8 @@  static inline void set_domain(unsigned val)
 	} while (0)
 
 #else
+static inline unsigned int get_domain(void) { return 0;}
+static inline void set_domain(unsigned val) { }
 static inline void modify_domain(unsigned dom, unsigned type)	{ }
 #endif