From c3db83c87f5eec9f3976a75ef718285b028e970a Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Mon, 19 Sep 2022 13:12:44 +0000 Subject: [PATCH] ANDROID: KVM: arm64: Expose __pkvm_create_private_mapping to pKVM modules pKVM has an internal API allowing to create mappings in the 'private' range of the hypervisor VA space for which there are no rules constraining the VA-PA relation (hence comparable to the vmalloc area in the kernel). This will be a useful API for hypervisor modules, so expose it in the recently introduced module ops struct. Bug: 244543039 Bug: 244373730 Change-Id: I2a8f958a02c3c3b9871224b65b00b207820a507a Signed-off-by: Quentin Perret --- arch/arm64/include/asm/kvm_pkvm_module.h | 4 ++++ arch/arm64/kvm/hyp/nvhe/modules.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/arch/arm64/include/asm/kvm_pkvm_module.h b/arch/arm64/include/asm/kvm_pkvm_module.h index 7d0b680d38e1..8b45704529e7 100644 --- a/arch/arm64/include/asm/kvm_pkvm_module.h +++ b/arch/arm64/include/asm/kvm_pkvm_module.h @@ -3,9 +3,13 @@ #ifndef __ARM64_KVM_PKVM_MODULE_H__ #define __ARM64_KVM_PKVM_MODULE_H__ +#include #include struct pkvm_module_ops { + int (*create_private_mapping)(phys_addr_t phys, size_t size, + enum kvm_pgtable_prot prot, + unsigned long *haddr); }; struct pkvm_module_section { diff --git a/arch/arm64/kvm/hyp/nvhe/modules.c b/arch/arm64/kvm/hyp/nvhe/modules.c index 9e695d9a4243..43c670d4f7cf 100644 --- a/arch/arm64/kvm/hyp/nvhe/modules.c +++ b/arch/arm64/kvm/hyp/nvhe/modules.c @@ -6,8 +6,10 @@ #include #include +#include const struct pkvm_module_ops module_ops = { + .create_private_mapping = __pkvm_create_private_mapping, }; int __pkvm_init_module(void *module_init)