diff mbox series

[v1,1/4] KVM: arm64: Use macro to replace hard number

Message ID 20190222082327.3312-2-leo.yan@linaro.org
State New
Headers show
Series ARM64/KVM: Minor cleanup and refactoring | expand

Commit Message

Leo Yan Feb. 22, 2019, 8:23 a.m. UTC
Use macro for ID_AA64MMFR1_EL1.VH bits shift instead of 8 directly.

Signed-off-by: Leo Yan <leo.yan@linaro.org>

---
 arch/arm64/kernel/head.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.17.1

Comments

Mark Rutland Feb. 22, 2019, 11:40 a.m. UTC | #1
On Fri, Feb 22, 2019 at 04:23:23PM +0800, Leo Yan wrote:
> Use macro for ID_AA64MMFR1_EL1.VH bits shift instead of 8 directly.

> 

> Signed-off-by: Leo Yan <leo.yan@linaro.org>


It's always nice to get rid of magic numbers, and this is correct
AFAICT. FWIW:

Reviewed-by: Mark Rutland <mark.rutland@arm.com>


Mark.

> ---

>  arch/arm64/kernel/head.S | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S

> index 4471f570a295..3ac377e9fd28 100644

> --- a/arch/arm64/kernel/head.S

> +++ b/arch/arm64/kernel/head.S

> @@ -490,7 +490,7 @@ ENTRY(el2_setup)

>  	 * kernel is intended to run at EL2.

>  	 */

>  	mrs	x2, id_aa64mmfr1_el1

> -	ubfx	x2, x2, #8, #4

> +	ubfx	x2, x2, #ID_AA64MMFR1_VHE_SHIFT, #4

>  #else

>  	mov	x2, xzr

>  #endif

> -- 

> 2.17.1

>
diff mbox series

Patch

diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 4471f570a295..3ac377e9fd28 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -490,7 +490,7 @@  ENTRY(el2_setup)
 	 * kernel is intended to run at EL2.
 	 */
 	mrs	x2, id_aa64mmfr1_el1
-	ubfx	x2, x2, #8, #4
+	ubfx	x2, x2, #ID_AA64MMFR1_VHE_SHIFT, #4
 #else
 	mov	x2, xzr
 #endif