From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <seanjc@google.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
srutherford@google.com, joro@8bytes.org, brijesh.singh@amd.com,
thomas.lendacky@amd.com, venu.busireddy@oracle.com,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Borislav Petkov <bp@suse.de>,
x86@kernel.org, Ashish Kalra <ashish.kalra@amd.com>
Subject: Re: [PATCH 0/3] KVM: x86: guest interface for SEV live migration
Date: Wed, 21 Apr 2021 14:03:37 +0200 [thread overview]
Message-ID: <478030b2-7521-4080-c3de-46533c2cc3cf@redhat.com> (raw)
In-Reply-To: <YH9hyid+zyQN1GUw@google.com>
On 21/04/21 01:20, Sean Christopherson wrote:
> If userspace blindly copies CPUID, but doesn't
> enable the capability, the guest will think the hypercall is supported. The
> guest hopefully won't freak out too much on the resulting -KVM_ENOSYS, but it
> does make the CPUID flag rather useless.
Yes that's why the CPUID bit must *not* be in KVM_GET_SUPPORTED_CPUID.
> The
> guest hopefully won't freak out too much on the resulting -KVM_ENOSYS, but it
> does make the CPUID flag rather useless.
>
> We can make it work with:
>
> u64 gpa = a0, npages = a1, enc = a2;
>
> if (!guest_pv_has(vcpu, KVM_FEATURE_HC_PAGE_ENC_STATUS))
> break;
>
> if (!PAGE_ALIGNED(gpa) || !npages ||
> gpa_to_gfn(gpa) + npages <= gpa_to_gfn(gpa)) {
> ret = -EINVAL;
> break;
> }
>
> if (!vcpu->kvm->arch.hypercall_exit_enabled) {
> ret = 0;
> break;
> }
>
> [...]
The interaction with KVM_CAP_ENFORCE_PV_FEATURE_CPUID scares me. But
I'll take it into account when posting v2.
>>>> (BTW, it's better to return a bitmask of hypercalls that will exit to
>>>> userspace from KVM_CHECK_EXTENSION. Userspace can still reject with -ENOSYS
>>>> those that it doesn't know, but it's important that it knows in general how
>>>> to handle KVM_EXIT_HYPERCALL).
>
> Speaking of bitmasks, what about also accepting a bitmask for enabling the
> capability? (not sure if the above implies that). E.g.
Yes, makes sense.
Paolo
prev parent reply other threads:[~2021-04-21 12:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-20 11:20 Paolo Bonzini
2021-04-20 15:15 ` Sean Christopherson
2021-04-20 18:27 ` Paolo Bonzini
2021-04-20 17:31 ` Sean Christopherson
2021-04-20 18:11 ` Ashish Kalra
2021-04-20 18:40 ` Sean Christopherson
2021-04-20 18:58 ` Sean Christopherson
2021-04-20 18:39 ` Paolo Bonzini
2021-04-20 19:02 ` Sean Christopherson
2021-04-20 20:16 ` Sean Christopherson
2021-04-20 20:58 ` Paolo Bonzini
2021-04-20 22:49 ` Sean Christopherson
2021-04-20 23:20 ` Sean Christopherson
2021-04-21 12:03 ` Paolo Bonzini [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=478030b2-7521-4080-c3de-46533c2cc3cf@redhat.com \
--to=pbonzini@redhat.com \
--cc=ashish.kalra@amd.com \
--cc=bp@suse.de \
--cc=brijesh.singh@amd.com \
--cc=hpa@zytor.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=seanjc@google.com \
--cc=srutherford@google.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=venu.busireddy@oracle.com \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®