ANDROID: KVM: arm64: Expose host_{un}share_hyp() to modules

pKVM modules may need to access memory that is kept map in the host's
stage-2 page-table. Expose the host_{un}share_hyp() API to allow the
use-case, as well as the pinning API that goes with it.

Bug: 245034629
Change-Id: I1b5abacfcd2f066b1cbb1bbac43b77e6808f559c
Signed-off-by: Quentin Perret <qperret@google.com>
This commit is contained in:
Quentin Perret
2023-03-02 08:10:04 +00:00
committed by Greg Kroah-Hartman
parent 509a7a32a5
commit b4b279e9e3
2 changed files with 8 additions and 0 deletions

View File

@@ -39,6 +39,10 @@ struct pkvm_module_ops {
int (*register_hyp_panic_notifier)(void (*cb)(struct kvm_cpu_context *host_ctxt));
int (*host_donate_hyp)(u64 pfn, u64 nr_pages);
int (*hyp_donate_host)(u64 pfn, u64 nr_pages);
int (*host_share_hyp)(u64 pfn);
int (*host_unshare_hyp)(u64 pfn);
int (*pin_shared_mem)(void *from, void *to);
void (*unpin_shared_mem)(void *from, void *to);
void* (*memcpy)(void *to, const void *from, size_t count);
void* (*memset)(void *dst, int c, size_t count);
phys_addr_t (*hyp_pa)(void *x);

View File

@@ -88,6 +88,10 @@ const struct pkvm_module_ops module_ops = {
.register_hyp_panic_notifier = __pkvm_register_hyp_panic_notifier,
.host_donate_hyp = __pkvm_host_donate_hyp,
.hyp_donate_host = __pkvm_hyp_donate_host,
.host_share_hyp = __pkvm_host_share_hyp,
.host_unshare_hyp = __pkvm_host_unshare_hyp,
.pin_shared_mem = hyp_pin_shared_mem,
.unpin_shared_mem = hyp_unpin_shared_mem,
.memcpy = memcpy,
.memset = memset,
.hyp_pa = hyp_virt_to_phys,