hv:move 2 APIs from hypervisor.h to guest_memory.c

move gva2hva() & hva2gpa() to guest_memory.c,
we will remove hypervisor.h in the future.

Tracked-On: #1842
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
Mingqiang Chi 2019-02-15 09:28:24 +08:00 committed by wenlingz
parent 07656a9cc6
commit 04c30fb380
3 changed files with 16 additions and 14 deletions

View File

@ -424,3 +424,14 @@ int32_t copy_to_gva(struct acrn_vcpu *vcpu, void *h_ptr, uint64_t gva,
{
return copy_gva(vcpu, h_ptr, gva, size, err_code, fault_addr, 0);
}
/* gpa --> hpa -->hva */
void *gpa2hva(struct acrn_vm *vm, uint64_t x)
{
return hpa2hva(gpa2hpa(vm, x));
}
uint64_t hva2gpa(struct acrn_vm *vm, void *x)
{
return (is_sos_vm(vm)) ? sos_vm_hpa2gpa(hva2hpa(x)) : INVALID_GPA;
}

View File

@ -31,6 +31,11 @@ int32_t gva2gpa(struct acrn_vcpu *vcpu, uint64_t gva, uint64_t *gpa, uint32_t *e
enum vm_paging_mode get_vcpu_paging_mode(struct acrn_vcpu *vcpu);
/* gpa --> hpa -->hva */
void *gpa2hva(struct acrn_vm *vm, uint64_t x);
uint64_t hva2gpa(struct acrn_vm *vm, void *x);
/**
* @brief Data transfering between hypervisor and VM
*

View File

@ -36,18 +36,4 @@
#include <hv_arch.h>
#include <hv_debug.h>
#ifndef ASSEMBLER
/* gpa --> hpa -->hva */
static inline void *gpa2hva(struct acrn_vm *vm, uint64_t x)
{
return hpa2hva(gpa2hpa(vm, x));
}
static inline uint64_t hva2gpa(struct acrn_vm *vm, void *x)
{
return (is_sos_vm(vm)) ? sos_vm_hpa2gpa(hva2hpa(x)) : INVALID_GPA;
}
#endif /* !ASSEMBLER */
#endif /* HYPERVISOR_H */