Re: [PATCH v1 10/24] kvm: arm64: Extract parts of el2_setup into a macro

From: David Brazdil
Date: Mon Nov 16 2020 - 12:57:01 EST


Hi Marc,

> > + * Check for VHE being present. x2 being non-zero indicates that we
> > + * do have VHE, and that the kernel is intended to run at EL2.
> > */
> > mrs x2, id_aa64mmfr1_el1
> > ubfx x2, x2, #ID_AA64MMFR1_VHE_SHIFT, #4
> > -#else
> > - mov x2, xzr
> > -#endif
> > + cbz x2, el2_setup_nvhe
>
> What initialises x2 to zero when CONFIG_VHE is disabled?

There is no need for x2 anymore, the nVHE code just falls through. Basically:

el2_setup:
< check CurrentEL >
b.eq 1f
ret
1:
#ifdef CONFIG_VHE
< check has VHE >
cbz el2_setup_nvhe
< VHE setup >
ret
#endif
el2_setup_nvhe:
< nVHE setup >
eret

-David