public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/5] Documentation: kvm: cleanup and introduce "VM planes"
@ 2024-10-23 12:45 Paolo Bonzini
  2024-10-23 12:45 ` [RFC PATCH 1/5] KVM: powerpc: remove remaining traces of KVM_CAP_PPC_RMA Paolo Bonzini
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Paolo Bonzini @ 2024-10-23 12:45 UTC (permalink / raw)
  To: linux-kernel, kvm
  Cc: roy.hopkins, seanjc, michael.roth, ashish.kalra, jroedel,
	thomas.lendacky, nsaenz, anelkz, oliver.upton, isaku.yamahata,
	maz, steven.price, kai.huang, rick.p.edgecombe, James.Bottomley

As discussed at KVM Forum, this series introduces documentation for the
"VM planes" concept that can be used to implement at least AMD VMPLs
and Microsoft VTLs.

I didn't include Intel TDX and Arm CCA, because people expressed doubts
on whether KVM could deal with {firm,hard}ware that magically enters the
vCPU in one privilege level and leave at another.  This however may not
be a blocker, especially considering that we decided to have only one
mutex for all planes.

Compared to the notes from the KVM Forum BoF, the main change is in the
kvm_run fields.  The design at the BoF had fields masked_planes and
runnable_planes, and a userspace exit would happen if the value of
runnable_planes & ~masked_planes became nonzero.

Here instead I have:

- req_exit_planes which is similar to ~masked_planes.  The difference comes
  from the Hyper-V VINA feature ("Virtual Interrupt Notification Assist"),
  which requires userspace to know about _all_ interrupts, even those for
  lower VTLs

- suspended_planes, which is not used yet but needs to be there for future
  in-kernel accelerations, because interrupts can "skip" VTLs/VMPLs and need
  to return to the last suspended level.

  I am not sure that this needs to be in kvm_run though.  It definitely has
  to be migrated once KVM supports in-kernel switch, but I am not sure that
  userspace needs it "enough" to put it in kvm_run.  It could be accessed
  with KVM_GET_ONE_REG/KVM_SET_ONE_REG or similar, perhaps.

- pending_event_planes (same as runnable_planes) is in the KVM_EXIT_PLANE_EVENT
  data, kvm_run->exit.plane.  It seems that it is not used in any other case
  by userspace (KVM probably needs to keep it up to date at all time; but
  it cannot trust anyway what is in kvm_run and needs to have its own copy).


Another difference is in whether FPU is shared.  We had it as shared,
but for SEV-ES the contents of the x87 and AVX registers are stored in
the VMSA and therefore each VMPL has its own copy.  The solution I have
(KVM_CAP_PLANE_FPU) is a bit of a cop out though.

In order to add the relevant text, there are a few cleanups that can be applied
separately.


Paolo Bonzini (5):
  KVM: powerpc: remove remaining traces of KVM_CAP_PPC_RMA
  Documentation: kvm: fix a few mistakes
  Documentation: kvm: replace section numbers with links
  Documentation: kvm: reorganize introduction
  Documentation: kvm: introduce "VM plane" concept

 Documentation/virt/kvm/api.rst           | 357 ++++++++++++++++-------
 Documentation/virt/kvm/vcpu-requests.rst |   7 +
 arch/powerpc/kvm/powerpc.c               |   3 -
 3 files changed, 266 insertions(+), 101 deletions(-)

-- 
2.46.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-01-21 18:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-23 12:45 [RFC PATCH 0/5] Documentation: kvm: cleanup and introduce "VM planes" Paolo Bonzini
2024-10-23 12:45 ` [RFC PATCH 1/5] KVM: powerpc: remove remaining traces of KVM_CAP_PPC_RMA Paolo Bonzini
2024-10-23 12:45 ` [RFC PATCH 2/5] Documentation: kvm: fix a few mistakes Paolo Bonzini
2024-10-23 12:45 ` [RFC PATCH 3/5] Documentation: kvm: replace section numbers with links Paolo Bonzini
2024-10-23 12:45 ` [RFC PATCH 4/5] Documentation: kvm: reorganize introduction Paolo Bonzini
2024-10-23 12:45 ` [PATCH 5/5] Documentation: kvm: introduce "VM plane" concept Paolo Bonzini
2025-01-17 21:48   ` Sean Christopherson
2025-01-21 10:50     ` Nicolas Saenz Julienne
2025-01-21 17:20       ` Sean Christopherson
2025-01-21 18:34         ` Nicolas Saenz Julienne
2024-11-08  9:07 ` [RFC PATCH 0/5] Documentation: kvm: cleanup and introduce "VM planes" Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox