public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Tom Dohrmann <erbse.13@gmx.de>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Paolo Bonzini <pbonzini@redhat.com>,
	Michael Roth <michael.roth@amd.com>
Subject: Re: [PATCH] KVM: x86: Only advertise KVM_CAP_READONLY_MEM when supported by VM
Date: Fri, 6 Sep 2024 14:15:57 -0700	[thread overview]
Message-ID: <ZttxDQ6v-1OAVja9@google.com> (raw)
In-Reply-To: <y2vqv2k6b3ytwgvxkhl3jlxx2lpfcla6zigccuo426zp63lqgl@zvdztkpwuxed>

On Fri, Sep 06, 2024, Shakeel Butt wrote:
> On Mon, Sep 02, 2024 at 02:42:19PM GMT, Tom Dohrmann wrote:
> > Until recently, KVM_CAP_READONLY_MEM was unconditionally supported on
> > x86, but this is no longer the case for SEV-ES and SEV-SNP VMs.
> > 
> > When KVM_CHECK_EXTENSION is invoked on a VM, only advertise
> > KVM_CAP_READONLY_MEM when it's actually supported.
> > 
> > Fixes: 66155de93bcf ("KVM: x86: Disallow read-only memslots for SEV-ES and SEV-SNP (and TDX)")
> > Cc: Sean Christopherson <seanjc@google.com>
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Cc: Michael Roth <michael.roth@amd.com>
> > Signed-off-by: Tom Dohrmann <erbse.13@gmx.de>
> > ---
> >  arch/x86/kvm/x86.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > index 70219e406987..9ad7fe279e72 100644
> > --- a/arch/x86/kvm/x86.c
> > +++ b/arch/x86/kvm/x86.c
> > @@ -4656,7 +4656,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> >  	case KVM_CAP_ASYNC_PF_INT:
> >  	case KVM_CAP_GET_TSC_KHZ:
> >  	case KVM_CAP_KVMCLOCK_CTRL:
> > -	case KVM_CAP_READONLY_MEM:
> >  	case KVM_CAP_IOAPIC_POLARITY_IGNORED:
> >  	case KVM_CAP_TSC_DEADLINE_TIMER:
> >  	case KVM_CAP_DISABLE_QUIRKS:
> > @@ -4815,6 +4814,8 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> >  	case KVM_CAP_VM_TYPES:
> >  		r = kvm_caps.supported_vm_types;
> >  		break;
> > +	case KVM_CAP_READONLY_MEM:
> > +		r = kvm ? kvm_arch_has_readonly_mem(kvm) : 1;
> 
> Need a break here otherwise -Wimplicit-fallthrough option will warn.

Heh, Nathan beat you to it:

https://lore.kernel.org/all/20240905-kvm-x86-avoid-clang-implicit-fallthrough-v1-1-f2e785f1aa45@kernel.org

      reply	other threads:[~2024-09-06 21:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-02 14:42 [PATCH] KVM: x86: Only advertise KVM_CAP_READONLY_MEM when supported by VM Tom Dohrmann
2024-09-02 14:56 ` Paolo Bonzini
2024-09-06 19:11 ` Shakeel Butt
2024-09-06 21:15   ` Sean Christopherson [this message]

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=ZttxDQ6v-1OAVja9@google.com \
    --to=seanjc@google.com \
    --cc=erbse.13@gmx.de \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.roth@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=shakeel.butt@linux.dev \
    /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