[PATCH v2 0/9] Add AMD SEV page encryption bitmap support.

From: Ashish Kalra
Date: Mon Nov 30 2020 - 19:47:02 EST


From: Ashish Kalra <ashish.kalra@xxxxxxx>

The series add support for AMD SEV page encryption bitmap.

SEV guest VMs have the concept of private and shared memory. Private memory
is encrypted with the guest-specific key, while shared memory may be encrypted
with hypervisor key. The patch series introduces a new hypercall.
The guest OS can use this hypercall to notify the page encryption status.

The patch adds new ioctls KVM_{SET,GET}_PAGE_ENC_BITMAP. The ioctl can be used
by qemu to get the page encryption bitmap. Qemu can consult this bitmap
during guest live migration / page migration and/or guest debugging to know
whether the page is encrypted.

The page encryption bitmap support is required for SEV guest live migration,
guest page migration and guest debugging.

The patch-set also adds support for bypassing unencrypted guest memory
regions for DBG_DECRYPT API calls, guest memory region encryption status
in sev_dbg_decrypt() is now referenced using the page encryption bitmap.

A branch containing these patches is available here:
https://github.com/AMDESE/linux/tree/sev-page-encryption-bitmap-v2

Changes since v1:
- Fix in sev_dbg_crypt() to release RCU read lock if hva_to_gfn() fails
when bypassing DBG_DECRYPT API calls for unencrypted guest memory.
- Comment fix for Patch 7/9.

Ashish Kalra (4):
KVM: SVM: Add support for static allocation of unified Page Encryption
Bitmap.
KVM: x86: Mark _bss_decrypted section variables as decrypted in page
encryption bitmap.
KVM: x86: Add kexec support for SEV page encryption bitmap.
KVM: SVM: Bypass DBG_DECRYPT API calls for unecrypted guest memory.

Brijesh Singh (5):
KVM: x86: Add AMD SEV specific Hypercall3
KVM: X86: Introduce KVM_HC_PAGE_ENC_STATUS hypercall
KVM: x86: Introduce KVM_GET_PAGE_ENC_BITMAP ioctl
mm: x86: Invoke hypercall when page encryption status is changed.
KVM: x86: Introduce KVM_SET_PAGE_ENC_BITMAP ioctl

Documentation/virt/kvm/api.rst | 71 ++++++
Documentation/virt/kvm/hypercalls.rst | 15 ++
arch/x86/include/asm/kvm_host.h | 7 +
arch/x86/include/asm/kvm_para.h | 12 +
arch/x86/include/asm/mem_encrypt.h | 4 +
arch/x86/include/asm/paravirt.h | 10 +
arch/x86/include/asm/paravirt_types.h | 2 +
arch/x86/kernel/kvm.c | 28 +++
arch/x86/kernel/kvmclock.c | 12 +
arch/x86/kernel/paravirt.c | 1 +
arch/x86/kvm/svm/sev.c | 321 ++++++++++++++++++++++++++
arch/x86/kvm/svm/svm.c | 5 +
arch/x86/kvm/svm/svm.h | 7 +
arch/x86/kvm/vmx/vmx.c | 1 +
arch/x86/kvm/x86.c | 35 +++
arch/x86/mm/mem_encrypt.c | 63 ++++-
arch/x86/mm/pat/set_memory.c | 7 +
include/uapi/linux/kvm.h | 13 ++
include/uapi/linux/kvm_para.h | 1 +
19 files changed, 614 insertions(+), 1 deletion(-)

--
2.17.1