]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64: Implement do_share() helper for sharing memory
authorWill Deacon <will@kernel.org>
Wed, 15 Dec 2021 16:12:27 +0000 (16:12 +0000)
committerMarc Zyngier <maz@kernel.org>
Thu, 16 Dec 2021 12:58:57 +0000 (12:58 +0000)
commit4b806e7037745233ff7b86d6ef43c14aaf747e88
tree8067bd77451a49c0669653d9f5bc3fc7d9dfa380
parent927b1331ca7ed791a3be04719f7918e183d4f1c4
KVM: arm64: Implement do_share() helper for sharing memory

By default, protected KVM isolates memory pages so that they are
accessible only to their owner: be it the host kernel, the hypervisor
at EL2 or (in future) the guest. Establishing shared-memory regions
between these components therefore involves a transition for each page
so that the owner can share memory with a borrower under a certain set
of permissions.

Introduce a do_share() helper for safely sharing a memory region between
two components. Currently, only host-to-hyp sharing is implemented, but
the code is easily extended to handle other combinations and the
permission checks for each component are reusable.

Reviewed-by: Andrew Walbran <qwandor@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Quentin Perret <qperret@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20211215161232.1480836-11-qperret@google.com
arch/arm64/kvm/hyp/nvhe/mem_protect.c