public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] arm64: clean up has_vhe()
@ 2019-04-03  8:41 Mark Rutland
  2019-04-03 10:51 ` Marc Zyngier
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mark Rutland @ 2019-04-03  8:41 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Mark Rutland, Catalin Marinas, Will Deacon, Christoffer Dall,
	Marc Zyngier

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.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoffer Dall <christoffer.dall@arm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
---
 arch/arm64/include/asm/virt.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/include/asm/virt.h b/arch/arm64/include/asm/virt.h
index 9d1e24e030b3..57d500abdf4f 100644
--- a/arch/arm64/include/asm/virt.h
+++ b/arch/arm64/include/asm/virt.h
@@ -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__ */
-- 
2.11.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-03 11:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-03  8:41 [PATCH] arm64: clean up has_vhe() Mark Rutland
2019-04-03 10:51 ` Marc Zyngier
2019-04-03 11:43 ` Christoffer Dall
2019-04-03 11:47 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox