public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Oliver Upton <oliver.upton@linux.dev>
Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org,
	James Morse <james.morse@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>
Subject: Re: [PATCH 1/8] KVM: arm64: Add generic check for system-supported vCPU features
Date: Thu, 21 Sep 2023 09:30:27 +0100	[thread overview]
Message-ID: <87wmwk2ajg.wl-maz@kernel.org> (raw)
In-Reply-To: <20230920195036.1169791-2-oliver.upton@linux.dev>

On Wed, 20 Sep 2023 20:50:29 +0100,
Oliver Upton <oliver.upton@linux.dev> wrote:
> 
> To date KVM has relied on kvm_reset_vcpu() failing when the vCPU feature
> flags are unsupported by the system. This is a bit messy since
> kvm_reset_vcpu() is called at runtime outside of the KVM_ARM_VCPU_INIT
> ioctl when it is expected to succeed. Further complicating the matter is
> that kvm_reset_vcpu() must tolerate be idemptotent to the config_lock,
> as it isn't consistently called with the lock held.
> 
> Prepare to move feature compatibility checks out of kvm_reset_vcpu() with
> a 'generic' check that compares the user-provided flags with a computed
> maximum feature set for the system.
> 
> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> ---
>  arch/arm64/kvm/arm.c | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> index 4866b3f7b4ea..66f3720cdd3a 100644
> --- a/arch/arm64/kvm/arm.c
> +++ b/arch/arm64/kvm/arm.c
> @@ -1190,6 +1190,16 @@ int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level,
>  	return -EINVAL;
>  }
>  
> +static unsigned long system_supported_vcpu_features(void)
> +{
> +	unsigned long features = KVM_VCPU_VALID_FEATURES;
> +
> +	if (!cpus_have_const_cap(ARM64_HAS_32BIT_EL1))

I think we can now convert this to a cpus_have_final_cap(), as Mark is
getting rid of the helper altogether, see [1].

Thanks,

	M.
	
[1] https://lore.kernel.org/r/20230919092850.1940729-1-mark.rutland@arm.com


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

  reply	other threads:[~2023-09-21 22:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-20 19:50 [PATCH 0/8] KVM: arm64: Cleanup + fix to vCPU reset, feature flags Oliver Upton
2023-09-20 19:50 ` [PATCH 1/8] KVM: arm64: Add generic check for system-supported vCPU features Oliver Upton
2023-09-21  8:30   ` Marc Zyngier [this message]
2023-09-21 12:47   ` Philippe Mathieu-Daudé
2023-09-20 19:50 ` [PATCH 2/8] KVM: arm64: Hoist PMUv3 check into KVM_ARM_VCPU_INIT ioctl handler Oliver Upton
2023-09-21 12:48   ` Philippe Mathieu-Daudé
2023-09-20 19:50 ` [PATCH 3/8] KVM: arm64: Hoist SVE " Oliver Upton
2023-09-20 19:50 ` [PATCH 4/8] KVM: arm64: Hoist PAuth checks into KVM_ARM_VCPU_INIT ioctl Oliver Upton
2023-09-20 19:50 ` [PATCH 5/8] KVM: arm64: Prevent NV feature flag on systems w/o nested virt Oliver Upton
2023-09-21  8:25   ` Marc Zyngier
2023-09-20 19:50 ` [PATCH 6/8] KVM: arm64: Hoist NV+SVE check into KVM_ARM_VCPU_INIT ioctl handler Oliver Upton
2023-09-20 19:50 ` [PATCH 7/8] KVM: arm64: Remove unused return value from kvm_reset_vcpu() Oliver Upton
2023-09-20 19:50 ` [PATCH 8/8] KVM: arm64: Get rid of vCPU-scoped feature bitmap Oliver Upton
2023-09-21  8:49 ` [PATCH 0/8] KVM: arm64: Cleanup + fix to vCPU reset, feature flags Marc Zyngier
2023-09-21 18:18 ` Oliver Upton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wmwk2ajg.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=james.morse@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=oliver.upton@linux.dev \
    --cc=suzuki.poulose@arm.com \
    --cc=yuzenghui@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox