ANDROID: KVM: arm64: Expose pKVM module mm APIs in module_ops

Some partners may need to load plug-ins in their modules, which will
require mapping the plugin code in a way that is very similar to how
pKVM maps module code. To ease this use-case, expose the pKVM module
memory-management APIs in the module_ops struct.

Bug: 264070847
Change-Id: I8b30ca50692c6860e3988b847b63ba1553c729cb
Signed-off-by: Quentin Perret <qperret@google.com>
This commit is contained in:
Quentin Perret
2023-01-04 16:43:01 +00:00
parent fc4c55e592
commit 3c064ef0c9
2 changed files with 4 additions and 0 deletions

View File

@@ -19,6 +19,8 @@ struct pkvm_module_ops {
int (*create_private_mapping)(phys_addr_t phys, size_t size,
enum kvm_pgtable_prot prot,
unsigned long *haddr);
void *(*alloc_module_va)(u64 nr_pages);
int (*map_module_page)(u64 pfn, void *va, enum kvm_pgtable_prot prot);
int (*register_serial_driver)(void (*hyp_putc_cb)(char));
void (*puts)(const char *str);
void (*putx64)(u64 num);

View File

@@ -95,6 +95,8 @@ int __pkvm_close_module_registration(void)
const struct pkvm_module_ops module_ops = {
.create_private_mapping = __pkvm_create_private_mapping,
.alloc_module_va = __pkvm_alloc_module_va,
.map_module_page = __pkvm_map_module_page,
.register_serial_driver = __pkvm_register_serial_driver,
.puts = hyp_puts,
.putx64 = hyp_putx64,