linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH Part2 RFC v4 00/40] Add AMD Secure Nested Paging (SEV-SNP) Hypervisor Support
@ 2021-07-07 18:35 Brijesh Singh
  2021-07-07 18:35 ` [PATCH Part2 RFC v4 01/40] KVM: SVM: Add support to handle AP reset MSR protocol Brijesh Singh
                   ` (40 more replies)
  0 siblings, 41 replies; 178+ messages in thread
From: Brijesh Singh @ 2021-07-07 18:35 UTC (permalink / raw)
  To: x86, linux-kernel, kvm, linux-efi, platform-driver-x86,
	linux-coco, linux-mm, linux-crypto
  Cc: Thomas Gleixner, Ingo Molnar, Joerg Roedel, Tom Lendacky,
	H. Peter Anvin, Ard Biesheuvel, Paolo Bonzini,
	Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Andy Lutomirski, Dave Hansen, Sergio Lopez, Peter Gonda,
	Peter Zijlstra, Srinivas Pandruvada, David Rientjes, Dov Murik,
	Tobin Feldman-Fitzthum, Borislav Petkov, Michael Roth,
	Vlastimil Babka, tony.luck, npmccallum, brijesh.ksingh,
	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.

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:

* Interrupt security

The series is based on the commit:
 a4345a7cecfb (origin/next, next) Merge tag 'kvmarm-fixes-5.13-1' 

Changes since v3:
 * Add support for extended guest message request.
 * Add ioctl to query the SNP Platform status.
 * Add ioctl to get and set the SNP config.
 * Add check to verify that memory reserved for the RMP covers the full system RAM.
 * Start the SNP specific commands from 256 instead of 255.
 * Multiple cleanup and fixes based on the review feedback.

Changes since v2:
 * Add AP creation support.
 * Drop the patch to handle the RMP fault for the kernel address.
 * Add functions to track the write access from the hypervisor.
 * Do not enable the SNP feature when IOMMU is disabled or is in passthrough mode.
 * Dump the RMP entry on RMP violation for the debug.
 * Shorten the GHCB macro names.
 * Start the SNP_INIT command id from 255 to give some gap for the legacy SEV.
 * Sync the header with the latest 0.9 SNP spec.
 
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 (37):
  KVM: SVM: Provide the Hypervisor Feature support VMGEXIT
  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 dump RMP entry on fault
  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
  crypto: ccp: Add the SNP_PLATFORM_STATUS command
  crypto: ccp: Add the SNP_{SET,GET}_EXT_CONFIG command
  crypto: ccp: provide APIs to query extended attestation report
  KVM: SVM: Make AVIC backing, VMSA and VMCB memory allocation SNP safe
  KVM: SVM: Add initial SEV-SNP support
  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: Add arch hooks to track the host write to guest memory
  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

Tom Lendacky (3):
  KVM: SVM: Add support to handle AP reset MSR protocol
  KVM: SVM: Use a VMSA physical address variable for populating VMCB
  KVM: SVM: Support SEV-SNP AP Creation NAE event

 Documentation/virt/coco/sevguest.rst          |   55 +
 .../virt/kvm/amd-memory-encryption.rst        |   91 ++
 arch/x86/include/asm/cpufeatures.h            |    1 +
 arch/x86/include/asm/disabled-features.h      |    8 +-
 arch/x86/include/asm/kvm_host.h               |   24 +
 arch/x86/include/asm/msr-index.h              |    6 +
 arch/x86/include/asm/sev-common.h             |   18 +
 arch/x86/include/asm/sev.h                    |    4 +-
 arch/x86/include/asm/svm.h                    |    3 +
 arch/x86/include/asm/trap_pf.h                |   18 +-
 arch/x86/include/uapi/asm/svm.h               |    4 +-
 arch/x86/kernel/cpu/amd.c                     |    3 +-
 arch/x86/kernel/sev.c                         |  217 +++
 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                        | 1321 ++++++++++++++++-
 arch/x86/kvm/svm/svm.c                        |   37 +-
 arch/x86/kvm/svm/svm.h                        |   48 +-
 arch/x86/kvm/trace.h                          |    6 +-
 arch/x86/kvm/vmx/vmx.c                        |    8 +
 arch/x86/kvm/x86.c                            |   89 +-
 arch/x86/mm/fault.c                           |  149 ++
 drivers/crypto/ccp/sev-dev.c                  |  863 ++++++++++-
 drivers/crypto/ccp/sev-dev.h                  |   18 +
 drivers/crypto/ccp/sp-pci.c                   |   12 +
 include/linux/kvm_host.h                      |    3 +
 include/linux/mm.h                            |    6 +-
 include/linux/psp-sev.h                       |  347 +++++
 include/linux/sev.h                           |   76 +
 include/uapi/linux/kvm.h                      |   47 +
 include/uapi/linux/psp-sev.h                  |   60 +
 mm/memory.c                                   |   13 +
 tools/arch/x86/include/asm/cpufeatures.h      |    1 +
 virt/kvm/kvm_main.c                           |   21 +-
 35 files changed, 3571 insertions(+), 92 deletions(-)
 create mode 100644 include/linux/sev.h

-- 
2.17.1



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

end of thread, other threads:[~2022-06-06 11:42 UTC | newest]

Thread overview: 178+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 18:35 [PATCH Part2 RFC v4 00/40] Add AMD Secure Nested Paging (SEV-SNP) Hypervisor Support Brijesh Singh
2021-07-07 18:35 ` [PATCH Part2 RFC v4 01/40] KVM: SVM: Add support to handle AP reset MSR protocol Brijesh Singh
2021-07-14 20:17   ` Sean Christopherson
2021-07-15  7:39     ` Joerg Roedel
2021-07-15 13:42     ` Tom Lendacky
2021-07-15 15:45       ` Sean Christopherson
2021-07-15 17:05         ` Tom Lendacky
2021-07-07 18:35 ` [PATCH Part2 RFC v4 02/40] KVM: SVM: Provide the Hypervisor Feature support VMGEXIT Brijesh Singh
2021-07-14 20:37   ` Sean Christopherson
2021-07-14 21:00     ` Brijesh Singh
2021-07-07 18:35 ` [PATCH Part2 RFC v4 03/40] x86/cpufeatures: Add SEV-SNP CPU feature Brijesh Singh
2021-07-07 18:35 ` [PATCH Part2 RFC v4 04/40] x86/sev: Add the host SEV-SNP initialization support Brijesh Singh
2021-07-14 21:07   ` Sean Christopherson
2021-07-14 22:02     ` Brijesh Singh
2021-07-14 22:06       ` Sean Christopherson
2021-07-14 22:11         ` Brijesh Singh
2022-06-02 11:47   ` Jarkko Sakkinen
2022-06-06 11:42     ` Dr. David Alan Gilbert
2021-07-07 18:35 ` [PATCH Part2 RFC v4 05/40] x86/sev: Add RMP entry lookup helpers Brijesh Singh
2021-07-15 18:37   ` Sean Christopherson
2021-07-15 19:28     ` Brijesh Singh
2021-07-16 17:22       ` Brijesh Singh
2021-07-20 22:06         ` Sean Christopherson
2021-07-20 23:10           ` Brijesh Singh
2021-07-07 18:35 ` [PATCH Part2 RFC v4 06/40] x86/sev: Add helper functions for RMPUPDATE and PSMASH instruction Brijesh Singh
2021-07-12 18:44   ` Peter Gonda
2021-07-12 19:00     ` Dave Hansen
2021-07-15 18:56       ` Sean Christopherson
2021-07-15 19:08         ` Dave Hansen
2021-07-15 19:18           ` Sean Christopherson
2021-07-07 18:35 ` [PATCH Part2 RFC v4 07/40] x86/sev: Split the physmap when adding the page in RMP table Brijesh Singh
2021-07-14 22:25   ` Sean Christopherson
2021-07-15 17:05     ` Brijesh Singh
2021-07-15 17:51       ` Sean Christopherson
2021-07-15 18:14         ` Brijesh Singh
2021-07-15 18:39           ` Sean Christopherson
2021-07-15 19:38             ` Brijesh Singh
2021-07-15 22:01               ` Sean Christopherson
2021-07-15 22:11                 ` Brijesh Singh
2021-07-30 11:31               ` Vlastimil Babka
2021-07-30 16:10                 ` Brijesh Singh
2021-07-07 18:35 ` [PATCH Part2 RFC v4 08/40] x86/traps: Define RMP violation #PF error code Brijesh Singh
2021-07-15 19:02   ` Sean Christopherson
2021-07-15 19:16     ` Dave Hansen
2021-07-07 18:35 ` [PATCH Part2 RFC v4 09/40] x86/fault: Add support to dump RMP entry on fault Brijesh Singh
2021-07-07 19:21   ` Dave Hansen
2021-07-08 15:02     ` Brijesh Singh
2021-07-08 15:30       ` Dave Hansen
2021-07-08 16:48         ` Brijesh Singh
2021-07-08 16:58           ` Dave Hansen
2021-07-08 17:11             ` Brijesh Singh
2021-07-08 17:15               ` Dave Hansen
2021-07-07 18:35 ` [PATCH Part2 RFC v4 10/40] x86/fault: Add support to handle the RMP fault for user address Brijesh Singh
2021-07-08 16:16   ` Dave Hansen
2021-07-12 15:43     ` Brijesh Singh
2021-07-12 16:00       ` Dave Hansen
2021-07-12 16:11         ` Brijesh Singh
2021-07-12 16:15           ` Dave Hansen
2021-07-12 16:24             ` Brijesh Singh
2021-07-12 16:29               ` Dave Hansen
2021-07-12 16:49                 ` Brijesh Singh
2021-07-15 21:53                   ` Sean Christopherson
2021-07-30 16:00   ` Vlastimil Babka
2021-07-30 16:31     ` Dave Hansen
2021-07-07 18:35 ` [PATCH Part2 RFC v4 11/40] crypto:ccp: Define the SEV-SNP commands Brijesh Singh
2021-07-07 18:35 ` [PATCH Part2 RFC v4 12/40] crypto: ccp: Add support to initialize the AMD-SP for SEV-SNP Brijesh Singh
2021-07-07 18:35 ` [PATCH Part2 RFC v4 13/40] crypto: ccp: Shutdown SNP firmware on kexec Brijesh Singh
2021-07-07 18:35 ` [PATCH Part2 RFC v4 14/40] crypto:ccp: Provide APIs to issue SEV-SNP commands Brijesh Singh
2021-07-08 18:56   ` Dr. David Alan Gilbert
2021-07-07 18:35 ` [PATCH Part2 RFC v4 15/40] crypto: ccp: Handle the legacy TMR allocation when SNP is enabled Brijesh Singh
2021-07-14 13:22   ` Marc Orr
2021-07-14 16:45     ` Brijesh Singh
2021-07-14 18:14       ` Marc Orr
2021-07-15 23:48   ` Sean Christopherson
2021-07-16 12:55     ` Brijesh Singh
2021-07-16 15:35       ` Sean Christopherson
2021-07-16 15:47         ` Brijesh Singh
2021-07-07 18:35 ` [PATCH Part2 RFC v4 16/40] crypto: ccp: Handle the legacy SEV command " Brijesh Singh
2021-07-07 18:35 ` [PATCH Part2 RFC v4 17/40] crypto: ccp: Add the SNP_PLATFORM_STATUS command Brijesh Singh
2021-07-07 18:35 ` [PATCH Part2 RFC v4 18/40] crypto: ccp: Add the SNP_{SET,GET}_EXT_CONFIG command Brijesh Singh
2021-07-07 18:35 ` [PATCH Part2 RFC v4 19/40] crypto: ccp: provide APIs to query extended attestation report Brijesh Singh
2021-07-07 18:35 ` [PATCH Part2 RFC v4 20/40] KVM: SVM: Make AVIC backing, VMSA and VMCB memory allocation SNP safe Brijesh Singh
2021-07-14 13:35   ` Marc Orr
2021-07-14 16:47     ` Brijesh Singh
2021-07-20 18:02   ` Sean Christopherson
2021-08-03 14:38     ` Brijesh Singh
2021-07-07 18:35 ` [PATCH Part2 RFC v4 21/40] KVM: SVM: Add initial SEV-SNP support Brijesh Singh
2021-07-16 18:00   ` Sean Christopherson
2021-07-16 18:46     ` Brijesh Singh
2021-07-16 19:31       ` Sean Christopherson
2021-07-16 21:03         ` Brijesh Singh
2021-07-07 18:35 ` [PATCH Part2 RFC v4 22/40] KVM: SVM: Add KVM_SNP_INIT command Brijesh Singh
2021-07-16 19:33   ` Sean Christopherson
2021-07-16 21:25     ` Brijesh Singh
2021-07-19 20:24       ` Sean Christopherson
2021-07-07 18:35 ` [PATCH Part2 RFC v4 23/40] KVM: SVM: Add KVM_SEV_SNP_LAUNCH_START command Brijesh Singh
2021-07-12 18:45   ` Peter Gonda
2021-07-16 19:43   ` Sean Christopherson
2021-07-16 21:42     ` Brijesh Singh
2021-07-07 18:36 ` [PATCH Part2 RFC v4 24/40] KVM: SVM: Add KVM_SEV_SNP_LAUNCH_UPDATE command Brijesh Singh
2021-07-16 20:01   ` Sean Christopherson
2021-07-16 22:00     ` Brijesh Singh
2021-07-19 20:51       ` Sean Christopherson
2021-07-19 21:34         ` Brijesh Singh
2021-07-19 21:36           ` Brijesh Singh
2021-07-07 18:36 ` [PATCH Part2 RFC v4 25/40] KVM: SVM: Reclaim the guest pages when SEV-SNP VM terminates Brijesh Singh
2021-07-16 20:09   ` Sean Christopherson
2021-07-16 22:16     ` Brijesh Singh
2021-07-17  0:46       ` Sean Christopherson
2021-07-19 12:55         ` Brijesh Singh
2021-07-19 17:18           ` Sean Christopherson
2021-07-19 18:34             ` Brijesh Singh
2021-07-19 19:03               ` Sean Christopherson
2021-07-19 19:14                 ` Sean Christopherson
2021-07-19 19:37                 ` Brijesh Singh
2021-07-20 16:40                   ` Sean Christopherson
2021-07-20 18:23                     ` Brijesh Singh
2021-07-07 18:36 ` [PATCH Part2 RFC v4 26/40] KVM: SVM: Add KVM_SEV_SNP_LAUNCH_FINISH command Brijesh Singh
2021-07-16 20:18   ` Sean Christopherson
2021-07-16 22:48     ` Brijesh Singh
2021-07-19 16:54       ` Sean Christopherson
2021-07-19 18:29         ` Brijesh Singh
2021-07-19 19:14           ` Sean Christopherson
2021-07-19 19:49             ` Brijesh Singh
2021-07-19 20:13               ` Sean Christopherson
2021-07-21 17:53         ` Marc Orr
2021-07-07 18:36 ` [PATCH Part2 RFC v4 27/40] KVM: X86: Add kvm_x86_ops to get the max page level for the TDP Brijesh Singh
2021-07-16 19:19   ` Sean Christopherson
2021-07-16 20:41     ` Brijesh Singh
2021-07-20 19:38       ` Sean Christopherson
2021-07-20 20:06         ` Brijesh Singh
2021-07-07 18:36 ` [PATCH Part2 RFC v4 28/40] KVM: X86: Introduce kvm_mmu_map_tdp_page() for use by SEV Brijesh Singh
2021-07-16 18:15   ` Sean Christopherson
2021-07-07 18:36 ` [PATCH Part2 RFC v4 29/40] KVM: X86: Introduce kvm_mmu_get_tdp_walk() for SEV-SNP use Brijesh Singh
2021-07-07 18:36 ` [PATCH Part2 RFC v4 30/40] KVM: X86: Define new RMP check related #NPF error bits Brijesh Singh
2021-07-16 20:22   ` Sean Christopherson
2021-07-17  0:34     ` Brijesh Singh
2021-07-07 18:36 ` [PATCH Part2 RFC v4 31/40] KVM: X86: update page-fault trace to log the 64-bit error code Brijesh Singh
2021-07-16 20:25   ` Sean Christopherson
2021-07-17  0:35     ` Brijesh Singh
2021-07-07 18:36 ` [PATCH Part2 RFC v4 32/40] KVM: SVM: Add support to handle GHCB GPA register VMGEXIT Brijesh Singh
2021-07-16 20:45   ` Sean Christopherson
2021-07-17  0:44     ` Brijesh Singh
2021-07-19 20:04       ` Sean Christopherson
2021-07-07 18:36 ` [PATCH Part2 RFC v4 33/40] KVM: SVM: Add support to handle MSR based Page State Change VMGEXIT Brijesh Singh
2021-07-16 21:00   ` Sean Christopherson
2021-07-19 14:19     ` Brijesh Singh
2021-07-19 18:55       ` Sean Christopherson
2021-07-19 19:15         ` Brijesh Singh
2021-08-13 16:32         ` Borislav Petkov
2021-07-07 18:36 ` [PATCH Part2 RFC v4 34/40] KVM: SVM: Add support to handle " Brijesh Singh
2021-07-16 21:14   ` Sean Christopherson
2021-07-19 14:24     ` Brijesh Singh
2021-07-07 18:36 ` [PATCH Part2 RFC v4 35/40] KVM: Add arch hooks to track the host write to guest memory Brijesh Singh
2021-07-19 23:30   ` Sean Christopherson
2021-07-20 15:15     ` Brijesh Singh
2021-07-07 18:36 ` [PATCH Part2 RFC v4 36/40] KVM: X86: Export the kvm_zap_gfn_range() for the SNP use Brijesh Singh
2021-07-07 18:36 ` [PATCH Part2 RFC v4 37/40] KVM: SVM: Add support to handle the RMP nested page fault Brijesh Singh
2021-07-20  0:10   ` Sean Christopherson
2021-07-20 17:55     ` Brijesh Singh
2021-07-20 22:31       ` Sean Christopherson
2021-07-20 23:53         ` Brijesh Singh
2021-07-21 20:15           ` Sean Christopherson
2021-07-07 18:36 ` [PATCH Part2 RFC v4 38/40] KVM: SVM: Provide support for SNP_GUEST_REQUEST NAE event Brijesh Singh
2021-07-19 22:50   ` Sean Christopherson
2021-07-20 14:37     ` Brijesh Singh
2021-07-20 16:28       ` Sean Christopherson
2021-07-20 18:21         ` Brijesh Singh
2021-07-20 22:09           ` Sean Christopherson
2021-07-07 18:36 ` [PATCH Part2 RFC v4 39/40] KVM: SVM: Use a VMSA physical address variable for populating VMCB Brijesh Singh
2021-07-21  0:20   ` Sean Christopherson
2021-07-21 16:26     ` Tom Lendacky
2021-07-07 18:36 ` [PATCH Part2 RFC v4 40/40] KVM: SVM: Support SEV-SNP AP Creation NAE event Brijesh Singh
2021-07-21  0:01   ` Sean Christopherson
2021-07-21 17:47     ` Tom Lendacky
2021-07-21 19:52       ` Sean Christopherson
2021-08-20 14:44         ` Tom Lendacky
2021-07-08 15:40 ` [PATCH Part2 RFC v4 00/40] Add AMD Secure Nested Paging (SEV-SNP) Hypervisor Support Dave Hansen

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).