Re: [PATCH v2 11/19] KVM: arm64: Move vcpu ON_UNSUPPORTED_CPU flag to the state flag set

Marc Zyngier
2022-06-15T13:23:57Z

On Wed, 15 Jun 2022 14:14:19 +0100,
Alexandru Elisei <alexandru.elisei@arm.com> wrote:
>
> Hi,
>
> On Fri, Jun 10, 2022 at 10:28:30AM +0100, Marc Zyngier wrote:
> > The ON_UNSUPPORTED_CPU flag is only there to track the sad fact
> > that we have ended-up on a CPU where we cannot really run.
> >
> > Since this is only for the host kernel's use, move it to the state
> > set.
> >
> > Reviewed-by: Fuad Tabba <tabba@google.com>
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > ---
> > arch/arm64/include/asm/kvm_host.h | 9 +++++----
> > 1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
> > index 4f147bdc5ce9..0c22514cb7c7 100644
> > --- a/arch/arm64/include/asm/kvm_host.h
> > +++ b/arch/arm64/include/asm/kvm_host.h
> > @@ -519,6 +519,8 @@ struct kvm_vcpu_arch {
> > #define HOST_SVE_ENABLED __vcpu_single_flag(sflags, BIT(0))
> > /* SME enabled for EL0 */
> > #define HOST_SME_ENABLED __vcpu_single_flag(sflags, BIT(1))
> > +/* Physical CPU not in supported_cpus */
> > +#define ON_UNSUPPORTED_CPU __vcpu_single_flag(sflags, BIT(2))
>
> I'm a bit confused here. The ON_UNSUPPORTED_CPU flag ends up in sflags. The
> comment for sflags says:
>
> + /* State flags for kernel bookkeeping, unused by the hypervisor code */
> + u64 sflags;
>
> The ON_UNSUPPORT_CPU flag is used exclusively by KVM (it's only used by the
> file arch/arm64/kvm/arm.c), so why is it part of a set of flags which are
> supposed to be unused by the hypervisor code?

Are we going to have the same terminology discussion we had when you
reviewed the NV patches?

These flags are only used by code that isn't involved in any sort of
world switching. If you are running nVHE, these flags are not used by
the EL2 code.

That's what 'hypervisor code' means in this context.

M.

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