[PATCH 05/12] arm64: cpufeature: Detect E2H0 not being implemented

Marc Zyngier maz at kernel.org
Fri Nov 17 04:21:30 PST 2023


On Fri, 17 Nov 2023 00:56:36 +0000,
Oliver Upton <oliver.upton at linux.dev> wrote:
> 
> On Mon, Nov 13, 2023 at 05:42:37PM +0000, Marc Zyngier wrote:
> > FEAT_E2H0 is a new feature that indicates whether or not HCR_EL2.E2H
> > can be set to 0. Amusingly, this feature is set to 0 when implemented,
> > and otherwise negative.
> > 
> > Add a new capability and detection infrastructure to detect the
> > absence of FEAT_E2H0.
> > 
> > Signed-off-by: Marc Zyngier <maz at kernel.org>
> 
> Reviewed-by: Oliver Upton <oliver.upton at linux.dev>
> 
> > ---
> >  arch/arm64/kernel/cpufeature.c | 7 +++++++
> >  arch/arm64/tools/cpucaps       | 1 +
> >  2 files changed, 8 insertions(+)
> > 
> > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> > index 41db7f993eef..e0d64e8b4851 100644
> > --- a/arch/arm64/kernel/cpufeature.c
> > +++ b/arch/arm64/kernel/cpufeature.c
> > @@ -2787,6 +2787,13 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
> >  		.matches = has_cpuid_feature,
> >  		ARM64_CPUID_FIELDS(ID_AA64MMFR2_EL1, EVT, IMP)
> >  	},
> > +	{
> > +		.desc = "FEAT_E2H0 not implemented",
> > +		.capability = ARM64_HCR_E2H_RES1,
> 
> I did read this a couple times before the neurons that interpret "0 not
> implemented" and "RES1" fired together, heh.

Yeah, the whole thing is upside down, in order to preserve backward
compatibility. I guess that as the architecture deprecates old cruft,
we may see more of this sort of constructs.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list