From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
michael.roth@amd.com, aik@amd.com, isaku.yamahata@intel.com
Subject: Re: [PATCH 00/10] KVM: SEV: allow customizing VMSA features
Date: Fri, 16 Feb 2024 17:40:51 -0800 [thread overview]
Message-ID: <ZdAOo2AAm_NrTdOe@google.com> (raw)
In-Reply-To: <CABgObfY=aGJNMk4CYb7nvauBWLJVbwVaA69bOK4bLteH7YyBNA@mail.gmail.com>
On Tue, Feb 13, 2024, Paolo Bonzini wrote:
> On Tue, Feb 13, 2024 at 3:46 AM Sean Christopherson <seanjc@google.com> wrote:
> > __u32 flags;
> > __u32 vm_type;
> > union {
> > struct tdx;
> > struct sev;
> > struct sev_es;
> > struct sev_snp;
> > __u8 pad[<big size>]
> > };
> >
> > Rinse and repeat for APIs that have a common purpose, but different payloads.
> >
> > Similar to KVM_{SET,GET}_NESTED_STATE, where the data is wildly different, and
> > there's very little overlap between {svm,vmx}_set_nested_state(), I find it quite
> > valuable to have a single set of APIs. E.g. I don't have to translate between
> > VMX and SVM terminology when thinking about the APIs, when discussing them, etc.
> >
> > That's especially true for all this CoCo goo, where the names are ridiculously
> > divergent, and often not exactly intuitive. E.g. LAUNCH_MEASURE reads like
> > "measure the launch", but surprise, it's "get the measurement".
>
> I agree, but then you'd have to do things like "CPUID data is passed
> via UPDATE_DATA for SEV and INIT_VM for TDX (and probably not at all
> for pKVM)". And in one case the firmware may prefer to encrypt in
> place, in the other you cannot do that at all.
>
> There was a reason why SVM support was not added from the beginning.
> Before adding nested get/set support for SVM, the whole nested
> virtualization was made as similar as possible in design and
> functionality to VMX. Of course it cannot be entirely the same, but
> for example they share the overall idea that pending events and L2
> state are taken from vCPU state; kvm_nested_state only stores global
> processor state (VMXON/VMCS pointers on VMX, and GIF on SVM) and,
> while in guest mode, L1 state and control bits. This ensures that the
> same userspace flow can work for both VMX and SVM. However, in this
> case we can't really control what is done in firmware.
>
> > The effort doesn't seem huge, so long as we don't try to make the parameters
> > common across vendor code. The list of APIs doesn't seem insurmountable (note,
> > I'm not entirely sure these are correct mappings):
>
> While the effort isn't huge, the benefit is also pretty small, which
> comes to a second big difference with GET/SET_NESTED_STATE: because
> there is a GET ioctl, we have the possibility of retrieving the "black
> box" and passing it back. With CoCo it's anyway userspace's task to
> fill in the parameter structs. I just don't see the possibility of
> sharing any code except the final ioctl, which to be honest is not
> much to show. And the higher price might be in re-reviewing code that
> has already been reviewed, both in KVM and in userspace.
Yeah, I realize I'm probably grasping at straws. *sigh*
prev parent reply other threads:[~2024-02-17 1:40 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 18:37 [PATCH 00/10] KVM: SEV: allow customizing VMSA features Paolo Bonzini
2024-02-09 18:37 ` [PATCH 01/10] KVM: SEV: fix compat ABI for KVM_MEMORY_ENCRYPT_OP Paolo Bonzini
2024-02-14 22:50 ` Michael Roth
2024-02-09 18:37 ` [PATCH 02/10] KVM: introduce new vendor op for KVM_GET_DEVICE_ATTR Paolo Bonzini
2024-02-14 22:57 ` Michael Roth
2024-02-09 18:37 ` [PATCH 03/10] Documentation: kvm/sev: separate description of firmware Paolo Bonzini
2024-02-14 23:23 ` Michael Roth
2024-02-09 18:37 ` [PATCH 04/10] KVM: SEV: publish supported VMSA features Paolo Bonzini
2024-02-14 23:49 ` Michael Roth
2024-02-09 18:37 ` [PATCH 05/10] KVM: SEV: store VMSA features in kvm_sev_info Paolo Bonzini
2024-02-15 0:03 ` Michael Roth
2024-02-09 18:37 ` [PATCH 06/10] KVM: x86: define standard behavior for bits 0/1 of VM type Paolo Bonzini
2024-02-09 18:37 ` [PATCH 07/10] KVM: x86: Add is_vm_type_supported callback Paolo Bonzini
2024-02-15 0:33 ` Michael Roth
2024-02-15 13:35 ` Paolo Bonzini
2024-02-09 18:37 ` [PATCH 08/10] KVM: SEV: define VM types for SEV and SEV-ES Paolo Bonzini
2024-02-15 1:19 ` Michael Roth
2024-02-15 13:40 ` Paolo Bonzini
2024-02-09 18:37 ` [PATCH 09/10] KVM: SEV: introduce KVM_SEV_INIT2 operation Paolo Bonzini
2024-02-15 1:34 ` Michael Roth
2024-02-15 13:44 ` Paolo Bonzini
2024-02-15 14:44 ` Michael Roth
2024-02-15 17:28 ` Paolo Bonzini
2024-02-15 17:54 ` Michael Roth
2024-02-15 18:08 ` Paolo Bonzini
2024-02-15 20:44 ` Michael Roth
2024-02-15 11:07 ` Alexey Kardashevskiy
2024-02-15 21:14 ` Tom Lendacky
2024-02-09 18:37 ` [PATCH 10/10] selftests: kvm: add tests for KVM_SEV_INIT2 Paolo Bonzini
2024-02-09 18:37 ` [PATCH 11/10] selftests: kvm: switch sev_migrate_tests to KVM_SEV_INIT2 Paolo Bonzini
2024-02-09 19:40 ` [PATCH 00/10] KVM: SEV: allow customizing VMSA features Sean Christopherson
2024-02-09 22:40 ` Paolo Bonzini
2024-02-13 2:46 ` Sean Christopherson
2024-02-13 14:44 ` Paolo Bonzini
2024-02-17 1:40 ` 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=ZdAOo2AAm_NrTdOe@google.com \
--to=seanjc@google.com \
--cc=aik@amd.com \
--cc=isaku.yamahata@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=pbonzini@redhat.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