kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH Part2 RFC v2 00/37] Add AMD Secure Nested Paging (SEV-SNP) Hypervisor Support
@ 2021-04-30 12:37 Brijesh Singh
  2021-04-30 12:37 ` [PATCH Part2 RFC v2 01/37] KVM: SVM: Add support to handle AP reset MSR protocol Brijesh Singh
                   ` (36 more replies)
  0 siblings, 37 replies; 67+ messages in thread
From: Brijesh Singh @ 2021-04-30 12:37 UTC (permalink / raw)
  To: x86, linux-kernel, kvm
  Cc: tglx, bp, jroedel, thomas.lendacky, pbonzini, mingo, dave.hansen,
	rientjes, seanjc, peterz, hpa, tony.luck, Brijesh Singh

This part of the Secure Encrypted Paging (SEV-SNP) series focuses on the
changes required in a host OS for SEV-SNP support. The series builds upon
SEV-SNP Part-1 https://marc.info/?l=kvm&m=161978500619624&w=2 .

This series provides the basic building blocks to support booting the SEV-SNP
VMs, it does not cover all the security enhancement introduced by the SEV-SNP
such as interrupt protection.

The CCP driver is enhanced to provide new APIs that use the SEV-SNP
specific commands defined in the SEV-SNP firmware specification. The KVM
driver uses those APIs to create and managed the SEV-SNP guests.

The GHCB specification version 2 introduces new set of NAE's that is
used by the SEV-SNP guest to communicate with the hypervisor. The series
provides support to handle the following new NAE events:
- Register GHCB GPA
- Page State Change Request
- Hypevisor feature
- Guest message request

The RMP check is enforced as soon as SEV-SNP is enabled. Not every memory
access requires an RMP check. In particular, the read accesses from the
hypervisor do not require RMP checks because the data confidentiality is
already protected via memory encryption. When hardware encounters an RMP
checks failure, it raises a page-fault exception. If RMP check failure
is due to the page-size mismatch, then split the large page to resolve
the fault.

The series does not provide support for the following SEV-SNP specific
NAE's yet:

* Extended guest request
* AP bring up
* Interrupt security

The series is based on the commit:
 3bf0fcd75434 (tag: kvm-5.13-1, origin/next, next) KVM: selftests: Speed up set_memory_region_test

Changes since v1:
 * Add AP reset MSR protocol VMGEXIT NAE.
 * Add Hypervisor features VMGEXIT NAE.
 * Move the RMP table initialization and RMPUPDATE/PSMASH helper in
   arch/x86/kernel/sev.c.
 * Add support to map/unmap SEV legacy command buffer to firmware state when
   SNP is active.
 * Enhance PSP driver to provide helper to allocate/free memory used for the
   firmware context page.
 * Add support to handle RMP fault for the kernel address.
 * Add support to handle GUEST_REQUEST NAE event for attestation.
 * Rename RMP table lookup helper.
 * Drop typedef from rmpentry struct definition.
 * Drop SNP static key and use cpu_feature_enabled() to check whether SEV-SNP
   is active.
 * Multiple cleanup/fixes to address Boris review feedback.

Brijesh Singh (36):
  KVM: SVM: Provide the Hypervisor Feature support VMGEXIT
  KVM: SVM: Increase the GHCB protocol version
  x86/cpufeatures: Add SEV-SNP CPU feature
  x86/sev: Add the host SEV-SNP initialization support
  x86/sev: Add RMP entry lookup helpers
  x86/sev: Add helper functions for RMPUPDATE and PSMASH instruction
  x86/sev: Split the physmap when adding the page in RMP table
  x86/traps: Define RMP violation #PF error code
  x86/fault: Add support to handle the RMP fault for kernel address
  x86/fault: Add support to handle the RMP fault for user address
  crypto:ccp: Define the SEV-SNP commands
  crypto: ccp: Add support to initialize the AMD-SP for SEV-SNP
  crypto: ccp: Shutdown SNP firmware on kexec
  crypto:ccp: Provide APIs to issue SEV-SNP commands
  crypto: ccp: Handle the legacy TMR allocation when SNP is enabled
  crypto: ccp: Handle the legacy SEV command when SNP is enabled
  KVM: SVM: make AVIC backing, VMSA and VMCB memory allocation SNP safe
  KVM: SVM: Add initial SEV-SNP support
  KVM: SVM: define new SEV_FEATURES field in the VMCB Save State Area
  KVM: SVM: Add KVM_SNP_INIT command
  KVM: SVM: Add KVM_SEV_SNP_LAUNCH_START command
  KVM: SVM: Add KVM_SEV_SNP_LAUNCH_UPDATE command
  KVM: SVM: Reclaim the guest pages when SEV-SNP VM terminates
  KVM: SVM: Add KVM_SEV_SNP_LAUNCH_FINISH command
  KVM: X86: Add kvm_x86_ops to get the max page level for the TDP
  KVM: X86: Introduce kvm_mmu_map_tdp_page() for use by SEV
  KVM: X86: Introduce kvm_mmu_get_tdp_walk() for SEV-SNP use
  KVM: X86: Define new RMP check related #NPF error bits
  KVM: X86: update page-fault trace to log the 64-bit error code
  KVM: SVM: Add support to handle GHCB GPA register VMGEXIT
  KVM: SVM: Add support to handle MSR based Page State Change VMGEXIT
  KVM: SVM: Add support to handle Page State Change VMGEXIT
  KVM: X86: Export the kvm_zap_gfn_range() for the SNP use
  KVM: SVM: Add support to handle the RMP nested page fault
  KVM: SVM: Provide support for SNP_GUEST_REQUEST NAE event
  KVM: SVM: Advertise the SEV-SNP feature support

Tom Lendacky (1):
  KVM: SVM: Add support to handle AP reset MSR protocol

 arch/x86/include/asm/cpufeatures.h       |   1 +
 arch/x86/include/asm/disabled-features.h |   8 +-
 arch/x86/include/asm/kvm_host.h          |  14 +
 arch/x86/include/asm/msr-index.h         |   6 +
 arch/x86/include/asm/sev.h               |   5 +-
 arch/x86/include/asm/svm.h               |  15 +-
 arch/x86/include/asm/trap_pf.h           |  18 +-
 arch/x86/kernel/cpu/amd.c                |   3 +-
 arch/x86/kernel/sev.c                    | 167 ++++
 arch/x86/kvm/lapic.c                     |   5 +-
 arch/x86/kvm/mmu.h                       |   5 +-
 arch/x86/kvm/mmu/mmu.c                   |  76 +-
 arch/x86/kvm/svm/sev.c                   | 961 ++++++++++++++++++++++-
 arch/x86/kvm/svm/svm.c                   |  22 +-
 arch/x86/kvm/svm/svm.h                   |  31 +-
 arch/x86/kvm/trace.h                     |   6 +-
 arch/x86/kvm/vmx/vmx.c                   |   8 +
 arch/x86/mm/fault.c                      | 207 +++++
 drivers/crypto/ccp/sev-dev.c             | 647 ++++++++++++++-
 drivers/crypto/ccp/sev-dev.h             |  14 +
 drivers/crypto/ccp/sp-pci.c              |  12 +
 include/linux/mm.h                       |   6 +-
 include/linux/psp-sev.h                  | 323 ++++++++
 include/linux/sev.h                      |  81 ++
 include/uapi/linux/kvm.h                 |  43 +
 include/uapi/linux/psp-sev.h             |  44 ++
 mm/memory.c                              |  13 +
 tools/arch/x86/include/asm/cpufeatures.h |   1 +
 28 files changed, 2664 insertions(+), 78 deletions(-)
 create mode 100644 include/linux/sev.h

-- 
2.17.1


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

end of thread, other threads:[~2021-05-11 18:34 UTC | newest]

Thread overview: 67+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-30 12:37 [PATCH Part2 RFC v2 00/37] Add AMD Secure Nested Paging (SEV-SNP) Hypervisor Support Brijesh Singh
2021-04-30 12:37 ` [PATCH Part2 RFC v2 01/37] KVM: SVM: Add support to handle AP reset MSR protocol Brijesh Singh
2021-04-30 12:37 ` [PATCH Part2 RFC v2 02/37] KVM: SVM: Provide the Hypervisor Feature support VMGEXIT Brijesh Singh
2021-04-30 12:37 ` [PATCH Part2 RFC v2 03/37] KVM: SVM: Increase the GHCB protocol version Brijesh Singh
2021-04-30 12:37 ` [PATCH Part2 RFC v2 04/37] x86/cpufeatures: Add SEV-SNP CPU feature Brijesh Singh
2021-04-30 12:37 ` [PATCH Part2 RFC v2 05/37] x86/sev: Add the host SEV-SNP initialization support Brijesh Singh
2021-04-30 12:37 ` [PATCH Part2 RFC v2 06/37] x86/sev: Add RMP entry lookup helpers Brijesh Singh
2021-04-30 12:37 ` [PATCH Part2 RFC v2 07/37] x86/sev: Add helper functions for RMPUPDATE and PSMASH instruction Brijesh Singh
2021-04-30 12:37 ` [PATCH Part2 RFC v2 08/37] x86/sev: Split the physmap when adding the page in RMP table Brijesh Singh
2021-05-03 15:07   ` Peter Zijlstra
2021-05-03 15:15   ` Andy Lutomirski
2021-05-03 15:41     ` Dave Hansen
2021-05-07 11:28       ` Vlastimil Babka
2021-04-30 12:37 ` [PATCH Part2 RFC v2 09/37] x86/traps: Define RMP violation #PF error code Brijesh Singh
2021-04-30 12:37 ` [PATCH Part2 RFC v2 10/37] x86/fault: Add support to handle the RMP fault for kernel address Brijesh Singh
2021-05-03 14:44   ` Dave Hansen
2021-05-03 15:03     ` Andy Lutomirski
2021-05-03 15:49       ` Brijesh Singh
2021-05-03 15:37     ` Brijesh Singh
2021-05-03 16:15       ` Dave Hansen
2021-05-03 17:19         ` Brijesh Singh
2021-05-03 17:31           ` Brijesh Singh
2021-05-03 17:40           ` Andy Lutomirski
2021-05-03 19:41             ` Brijesh Singh
2021-05-03 19:43               ` Dave Hansen
2021-05-04 12:31                 ` Brijesh Singh
2021-05-04 14:33                   ` Dave Hansen
2021-05-04 15:16                     ` Brijesh Singh
2021-04-30 12:37 ` [PATCH Part2 RFC v2 11/37] x86/fault: Add support to handle the RMP fault for user address Brijesh Singh
2021-04-30 12:37 ` [PATCH Part2 RFC v2 12/37] crypto:ccp: Define the SEV-SNP commands Brijesh Singh
2021-04-30 12:37 ` [PATCH Part2 RFC v2 13/37] crypto: ccp: Add support to initialize the AMD-SP for SEV-SNP Brijesh Singh
2021-04-30 12:37 ` [PATCH Part2 RFC v2 14/37] crypto: ccp: Shutdown SNP firmware on kexec Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 15/37] crypto:ccp: Provide APIs to issue SEV-SNP commands Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 16/37] crypto: ccp: Handle the legacy TMR allocation when SNP is enabled Brijesh Singh
2021-05-10 18:23   ` Peter Gonda
2021-05-10 20:07     ` Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 17/37] crypto: ccp: Handle the legacy SEV command " Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 18/37] KVM: SVM: make AVIC backing, VMSA and VMCB memory allocation SNP safe Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 19/37] KVM: SVM: Add initial SEV-SNP support Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 20/37] KVM: SVM: define new SEV_FEATURES field in the VMCB Save State Area Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 21/37] KVM: SVM: Add KVM_SNP_INIT command Brijesh Singh
2021-05-06 20:25   ` Peter Gonda
2021-05-06 22:29     ` Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 22/37] KVM: SVM: Add KVM_SEV_SNP_LAUNCH_START command Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 23/37] KVM: SVM: Add KVM_SEV_SNP_LAUNCH_UPDATE command Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 24/37] KVM: SVM: Reclaim the guest pages when SEV-SNP VM terminates Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 25/37] KVM: SVM: Add KVM_SEV_SNP_LAUNCH_FINISH command Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 26/37] KVM: X86: Add kvm_x86_ops to get the max page level for the TDP Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 27/37] KVM: X86: Introduce kvm_mmu_map_tdp_page() for use by SEV Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 28/37] KVM: X86: Introduce kvm_mmu_get_tdp_walk() for SEV-SNP use Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 29/37] KVM: X86: Define new RMP check related #NPF error bits Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 30/37] KVM: X86: update page-fault trace to log the 64-bit error code Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 31/37] KVM: SVM: Add support to handle GHCB GPA register VMGEXIT Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 32/37] KVM: SVM: Add support to handle MSR based Page State Change VMGEXIT Brijesh Singh
2021-05-10 17:30   ` Peter Gonda
2021-05-10 17:51     ` Brijesh Singh
2021-05-10 19:59       ` Peter Gonda
2021-05-10 20:50         ` Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 33/37] KVM: SVM: Add support to handle " Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 34/37] KVM: X86: Export the kvm_zap_gfn_range() for the SNP use Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 35/37] KVM: SVM: Add support to handle the RMP nested page fault Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 36/37] KVM: SVM: Provide support for SNP_GUEST_REQUEST NAE event Brijesh Singh
2021-05-10 18:57   ` Peter Gonda
2021-05-10 20:14     ` Brijesh Singh
2021-05-10 21:17       ` Sean Christopherson
2021-05-11 18:34         ` Brijesh Singh
2021-04-30 12:38 ` [PATCH Part2 RFC v2 37/37] KVM: SVM: Advertise the SEV-SNP feature support Brijesh Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).