ANDROID: BACKPORT: arm64: mm: Implement memory encryption API using KVM sharing hypercalls
When running as a protected guest, the KVM host does not have access to any pages mapped into the guest. Consequently, KVM exposes hypercalls to the guest so that pages can be shared back with the host for the purposes of shared memory communication such as virtio. Detect the presence of these hypercalls when running as a guest and use them to implement the memory encryption interfaces gated by CONFIG_ARCH_HAS_MEM_ENCRYPT which are called from the DMA layer to share SWIOTLB bounce buffers for virtio. Although no encryption is actually performed, "sharing" a page is akin to decryption, whereas "unsharing" a page maps to encryption, albeit without destruction of the underlying page contents. Signed-off-by:Will Deacon <will@kernel.org> [willdeacon@: Use asm/mem_encrypt.h instead of asm/set_memory.h; Implement mem_encrypt_active(); Add hypercall IDs; Drop unneeded GIC change] [qperret@: Export set_memory_{en,de}crypted() to fix allmodconfig modpost failures] Bug: 233587962 Change-Id: I5955ff0dca65561183f9a60e94be87f28fbf14ec Signed-off-by:
Will Deacon <willdeacon@google.com> Signed-off-by:
Quentin Perret <qperret@google.com>
Loading
Please sign in to comment