linux-arm-kernel.lists.infradead.org archive mirror
 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

* Re: [PATCH] arm64: clean up has_vhe()
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Marc Zyngier @ 2019-04-03 10:51 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Catalin Marinas, Will Deacon, Christoffer Dall, linux-arm-kernel

On Wed, 03 Apr 2019 09:41:25 +0100,
Mark Rutland <mark.rutland@arm.com> wrote:
> 
> 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__ */

Acked-by: Marc Zyngier <marc.zyngier@arm.com>

	M.

-- 
Jazz is not dead, it just smell funny.

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

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

* Re: [PATCH] arm64: clean up has_vhe()
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Christoffer Dall @ 2019-04-03 11:43 UTC (permalink / raw)
  To: Mark Rutland; +Cc: Marc Zyngier, Catalin Marinas, Will Deacon, linux-arm-kernel

On Wed, Apr 03, 2019 at 09:41:25AM +0100, Mark Rutland wrote:
> 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__ */


Acked-by: Christoffer Dall <christoffer.dall@arm.com>

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

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

* Re: [PATCH] arm64: clean up has_vhe()
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2019-04-03 11:47 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Marc Zyngier, Catalin Marinas, Christoffer Dall, linux-arm-kernel

On Wed, Apr 03, 2019 at 09:41:25AM +0100, Mark Rutland wrote:
> 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(-)

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

Will

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

^ permalink raw reply	[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;
as well as URLs for NNTP newsgroup(s).