// SPDX-License-Identifier: GPL-2.0 /* * ACRN: Memory mapping management * * Copyright (C) 2020 Intel Corporation. All rights reserved. * * Authors: * Fei Li <[email protected]> * Shuo Liu <[email protected]> */ #include <linux/io.h> #include <linux/mm.h> #include <linux/slab.h> #include <linux/vmalloc.h> #include "acrn_drv.h" static int modify_region(struct acrn_vm *vm, struct vm_memory_region_op *region) { … } /** * acrn_mm_region_add() - Set up the EPT mapping of a memory region. * @vm: User VM. * @user_gpa: A GPA of User VM. * @service_gpa: A GPA of Service VM. * @size: Size of the region. * @mem_type: Combination of ACRN_MEM_TYPE_*. * @mem_access_right: Combination of ACRN_MEM_ACCESS_*. * * Return: 0 on success, <0 on error. */ int acrn_mm_region_add(struct acrn_vm *vm, u64 user_gpa, u64 service_gpa, u64 size, u32 mem_type, u32 mem_access_right) { … } /** * acrn_mm_region_del() - Del the EPT mapping of a memory region. * @vm: User VM. * @user_gpa: A GPA of the User VM. * @size: Size of the region. * * Return: 0 on success, <0 for error. */ int acrn_mm_region_del(struct acrn_vm *vm, u64 user_gpa, u64 size) { … } int acrn_vm_memseg_map(struct acrn_vm *vm, struct acrn_vm_memmap *memmap) { … } int acrn_vm_memseg_unmap(struct acrn_vm *vm, struct acrn_vm_memmap *memmap) { … } /** * acrn_vm_ram_map() - Create a RAM EPT mapping of User VM. * @vm: The User VM pointer * @memmap: Info of the EPT mapping * * Return: 0 on success, <0 for error. */ int acrn_vm_ram_map(struct acrn_vm *vm, struct acrn_vm_memmap *memmap) { … } /** * acrn_vm_all_ram_unmap() - Destroy a RAM EPT mapping of User VM. * @vm: The User VM */ void acrn_vm_all_ram_unmap(struct acrn_vm *vm) { … }