Commit 2a6d4f48 authored by Will Deacon's avatar Will Deacon Committed by Quentin Perret
Browse files

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: default avatarWill 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: default avatarWill Deacon <willdeacon@google.com>
Signed-off-by: default avatarQuentin Perret <qperret@google.com>
parent ead4a2ad
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment