All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/5] Qemu SEV-ES guest support
@ 2020-09-15 21:29 ` Tom Lendacky
  0 siblings, 0 replies; 49+ messages in thread
From: Tom Lendacky @ 2020-09-15 21:29 UTC (permalink / raw)
  To: qemu-devel, kvm
  Cc: Marcel Apfelbaum, Paolo Bonzini, Dr. David Alan Gilbert,
	Eduardo Habkost, Richard Henderson, Connor Kuehl, Brijesh Singh,
	Jiri Slaby, Marcelo Tosatti, Michael S. Tsirkin

From: Tom Lendacky <thomas.lendacky@amd.com>

This patch series provides support for launching an SEV-ES guest.

Secure Encrypted Virtualization - Encrypted State (SEV-ES) expands on the
SEV support to protect the guest register state from the hypervisor. See
"AMD64 Architecture Programmer's Manual Volume 2: System Programming",
section "15.35 Encrypted State (SEV-ES)" [1].

In order to allow a hypervisor to perform functions on behalf of a guest,
there is architectural support for notifying a guest's operating system
when certain types of VMEXITs are about to occur. This allows the guest to
selectively share information with the hypervisor to satisfy the requested
function. The notification is performed using a new exception, the VMM
Communication exception (#VC). The information is shared through the
Guest-Hypervisor Communication Block (GHCB) using the VMGEXIT instruction.
The GHCB format and the protocol for using it is documented in "SEV-ES
Guest-Hypervisor Communication Block Standardization" [2].

The main areas of the Qemu code that are updated to support SEV-ES are
around the SEV guest launch process and AP booting in order to support
booting multiple vCPUs.

There are no new command line switches required. Instead, the desire for
SEV-ES is presented using the SEV policy object. Bit 2 of the SEV policy
object indicates that SEV-ES is required.

The SEV launch process is updated in two ways. The first is that a the
KVM_SEV_ES_INIT ioctl is used to initialize the guest instead of the
standard KVM_SEV_INIT ioctl. The second is that before the SEV launch
measurement is calculated, the LAUNCH_UPDATE_VMSA SEV API is invoked for
each vCPU that Qemu has created. Once the LAUNCH_UPDATE_VMSA API has been
invoked, no direct changes to the guest register state can be made.

AP booting poses some interesting challenges. The INIT-SIPI-SIPI sequence
is typically used to boot the APs. However, the hypervisor is not allowed
to update the guest registers. For the APs, the reset vector must be known
in advance. An OVMF method to provide a known reset vector address exists
by providing an SEV information block, identified by UUID, near the end of
the firmware [3]. OVMF will program the jump to the actual reset vector in
this area of memory. Since the memory location is known in advance, an AP
can be created with the known reset vector address as its starting CS:IP.
The GHCB document [2] talks about how SMP booting under SEV-ES is
performed. SEV-ES also requires the use of the in-kernel irqchip support
in order to minimize the changes required to Qemu to support AP booting.

[1] https://www.amd.com/system/files/TechDocs/24593.pdf
[2] https://developer.amd.com/wp-content/resources/56421.pdf
[3] 30937f2f98c4 ("OvmfPkg: Use the SEV-ES work area for the SEV-ES AP reset vector")
    https://github.com/tianocore/edk2/commit/30937f2f98c42496f2f143fe8374ae7f7e684847

---

These patches are based on commit:
d0ed6a69d3 ("Update version for v5.1.0 release")

(I tried basing on the latest Qemu commit, but I was having build issues
that level)

A version of the tree can be found at:
https://github.com/AMDESE/qemu/tree/sev-es-v11

Changes since v2:
- Add in-kernel irqchip requirement for SEV-ES guests

Changes since v1:
- Fixed checkpatch.pl errors/warnings

Tom Lendacky (5):
  sev/i386: Add initial support for SEV-ES
  sev/i386: Require in-kernel irqchip support for SEV-ES guests
  sev/i386: Allow AP booting under SEV-ES
  sev/i386: Don't allow a system reset under an SEV-ES guest
  sev/i386: Enable an SEV-ES guest based on SEV policy

 accel/kvm/kvm-all.c       |  73 ++++++++++++++++++++++++++
 accel/stubs/kvm-stub.c    |   5 ++
 hw/i386/pc_sysfw.c        |  10 +++-
 include/sysemu/cpus.h     |   2 +
 include/sysemu/hw_accel.h |   5 ++
 include/sysemu/kvm.h      |  18 +++++++
 include/sysemu/sev.h      |   3 ++
 softmmu/cpus.c            |   5 ++
 softmmu/vl.c              |   5 +-
 target/i386/cpu.c         |   1 +
 target/i386/kvm.c         |   2 +
 target/i386/sev-stub.c    |   5 ++
 target/i386/sev.c         | 105 +++++++++++++++++++++++++++++++++++++-
 target/i386/sev_i386.h    |   1 +
 14 files changed, 236 insertions(+), 4 deletions(-)

-- 
2.28.0


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

end of thread, other threads:[~2020-09-21 14:28 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-15 21:29 [PATCH v3 0/5] Qemu SEV-ES guest support Tom Lendacky
2020-09-15 21:29 ` Tom Lendacky
2020-09-15 21:29 ` [PATCH v3 1/5] sev/i386: Add initial support for SEV-ES Tom Lendacky
2020-09-15 21:29   ` Tom Lendacky
2020-09-17 16:36   ` Dr. David Alan Gilbert
2020-09-17 16:36     ` Dr. David Alan Gilbert
2020-09-21  6:45   ` Dov Murik
2020-09-21 13:55     ` Tom Lendacky
2020-09-15 21:29 ` [PATCH v3 2/5] sev/i386: Require in-kernel irqchip support for SEV-ES guests Tom Lendacky
2020-09-15 21:29   ` Tom Lendacky
2020-09-15 21:29 ` [PATCH v3 3/5] sev/i386: Allow AP booting under SEV-ES Tom Lendacky
2020-09-15 21:29   ` Tom Lendacky
2020-09-16  9:23   ` Laszlo Ersek
2020-09-16 20:31     ` Tom Lendacky
2020-09-17 16:46   ` Dr. David Alan Gilbert
2020-09-17 16:46     ` Dr. David Alan Gilbert
2020-09-17 18:07     ` Tom Lendacky
2020-09-17 18:07       ` Tom Lendacky
2020-09-15 21:29 ` [PATCH v3 4/5] sev/i386: Don't allow a system reset under an SEV-ES guest Tom Lendacky
2020-09-15 21:29   ` Tom Lendacky
2020-09-17 17:01   ` Dr. David Alan Gilbert
2020-09-17 17:01     ` Dr. David Alan Gilbert
2020-09-17 18:16     ` Tom Lendacky
2020-09-17 18:16       ` Tom Lendacky
2020-09-18  9:23       ` Dr. David Alan Gilbert
2020-09-18  9:23         ` Dr. David Alan Gilbert
2020-09-15 21:29 ` [PATCH v3 5/5] sev/i386: Enable an SEV-ES guest based on SEV policy Tom Lendacky
2020-09-15 21:29   ` Tom Lendacky
2020-09-17 15:34   ` Dr. David Alan Gilbert
2020-09-17 15:34     ` Dr. David Alan Gilbert
2020-09-17 16:07     ` Tom Lendacky
2020-09-17 16:07       ` Tom Lendacky
2020-09-17 16:11       ` Tom Lendacky
2020-09-17 16:11         ` Tom Lendacky
2020-09-17 17:28 ` [PATCH v3 0/5] Qemu SEV-ES guest support Dr. David Alan Gilbert
2020-09-17 17:28   ` Dr. David Alan Gilbert
2020-09-17 18:56   ` Tom Lendacky
2020-09-17 18:56     ` Tom Lendacky
2020-09-18  3:40     ` Sean Christopherson
2020-09-18 15:54       ` Tom Lendacky
2020-09-18 15:54         ` Tom Lendacky
2020-09-18 10:00     ` Dr. David Alan Gilbert
2020-09-18 10:00       ` Dr. David Alan Gilbert
2020-09-18 18:47       ` Tom Lendacky
2020-09-18 18:47         ` Tom Lendacky
2020-09-21 11:48         ` Dr. David Alan Gilbert
2020-09-21 11:48           ` Dr. David Alan Gilbert
2020-09-21 14:23           ` Tom Lendacky
2020-09-21 14:23             ` Tom Lendacky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.