[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210430123822.13825-1-brijesh.singh@amd.com>
Date: Fri, 30 Apr 2021 07:37:45 -0500
From: Brijesh Singh <brijesh.singh@....com>
To: x86@...nel.org, linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Cc: tglx@...utronix.de, bp@...en8.de, jroedel@...e.de,
thomas.lendacky@....com, pbonzini@...hat.com, mingo@...hat.com,
dave.hansen@...el.com, rientjes@...gle.com, seanjc@...gle.com,
peterz@...radead.org, hpa@...or.com, tony.luck@...el.com,
Brijesh Singh <brijesh.singh@....com>
Subject: [PATCH Part2 RFC v2 00/37] Add AMD Secure Nested Paging (SEV-SNP) Hypervisor Support
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
Powered by blists - more mailing lists