Skip to contentSkip to conversation

arm64: clean up has_vhe()

PATCH In review Mark Rutland 4 participants 4 messages Apr 3, 2019 arm64

lore
Share & tools
lore

Mark Rutland

author reviewer
#0 lore raw

PATCH 1/1 arm64: clean up has_vhe()

Currently, has_vhe() has a redundant if statement, and unlike other cpucap helpers, it doesn't check whether the relevant config option (CONFIG_ARM64_VHE) is enabled, leading to redundant code in some minimal kernel configurations.

This patches fixes both of these issues.

Cc Catalin Marinas <[email protected]>
Cc Christoffer Dall <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/include/asm/virt.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm64/include/asm/virt.h +2 -4
index 9d1e24e030b3..57d500abdf4f 100644
@@ -96,10 +96,8 @@ static inline bool is_kernel_in_hyp_mode(void)
 
 static inline bool has_vhe(void)
 {
-	if (cpus_have_const_cap(ARM64_HAS_VIRT_HOST_EXTN))
-		return true;
-
-	return false;
+	return IS_ENABLED(CONFIG_ARM64_VHE) &&
+	       cpus_have_const_cap(ARM64_HAS_VIRT_HOST_EXTN);
 }
 
 #endif /* __ASSEMBLY__ */
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Acked-by on v1 1/1
#1 lore raw
Quoted 23 lines · Mark Rutland

Currently, has_vhe() has a redundant if statement, and unlike other cpucap helpers, it doesn't check whether the relevant config option (CONFIG_ARM64_VHE) is enabled, leading to redundant code in some minimal kernel configurations.

This patches fixes both of these issues.

Cc Catalin Marinas <[email protected]>
Cc Christoffer Dall <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/include/asm/virt.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm64/include/asm/virt.h +0 -0
index 9d1e24e030b3..57d500abdf4f 100644
@@ -96,10 +96,8 @@ static inline bool is_kernel_in_hyp_mode(void)
 
 static inline bool has_vhe(void)

arch/arm64/include/asm/virt.h static inline bool is_kernel_in_hyp_mode(void) · line 103

Quoted 10 lines
arch/arm64/include/asm/virt.h +2 -4
 {
-	if (cpus_have_const_cap(ARM64_HAS_VIRT_HOST_EXTN))
-		return true;
-
-	return false;
+	return IS_ENABLED(CONFIG_ARM64_VHE) &&
+	       cpus_have_const_cap(ARM64_HAS_VIRT_HOST_EXTN);
 }
 
 #endif /* __ASSEMBLY__ */
	M.
Signature · 6 lines
Jazz is not dead, it just smell funny.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Acked-by on v1 1/1
#2 lore raw
In reply to Mark Rutland
Quoted 22 lines · Mark Rutland

Currently, has_vhe() has a redundant if statement, and unlike other cpucap helpers, it doesn't check whether the relevant config option (CONFIG_ARM64_VHE) is enabled, leading to redundant code in some minimal kernel configurations.

This patches fixes both of these issues.

Cc Catalin Marinas <[email protected]>
Cc Christoffer Dall <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/include/asm/virt.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm64/include/asm/virt.h +0 -0
index 9d1e24e030b3..57d500abdf4f 100644
@@ -96,10 +96,8 @@ static inline bool is_kernel_in_hyp_mode(void)
 
 static inline bool has_vhe(void)

arch/arm64/include/asm/virt.h static inline bool is_kernel_in_hyp_mode(void) · line 103

Quoted 10 lines
arch/arm64/include/asm/virt.h +2 -4
 {
-	if (cpus_have_const_cap(ARM64_HAS_VIRT_HOST_EXTN))
-		return true;
-
-	return false;
+	return IS_ENABLED(CONFIG_ARM64_VHE) &&
+	       cpus_have_const_cap(ARM64_HAS_VIRT_HOST_EXTN);
 }
 
 #endif /* __ASSEMBLY__ */

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw
In reply to Mark Rutland
Quoted 6 lines · Mark Rutland

Currently, has_vhe() has a redundant if statement, and unlike other cpucap helpers, it doesn't check whether the relevant config option (CONFIG_ARM64_VHE) is enabled, leading to redundant code in some minimal kernel configurations.

This patches fixes both of these issues.

Quoted 8 lines
Cc Catalin Marinas <[email protected]>
Cc Christoffer Dall <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/include/asm/virt.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Thanks, I'll queue this up with Marc and Christoffer's acks.

Will

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel