Skip to content

Commit 04c30fb

Browse files
mingqiangchiwenlingz
authored andcommitted
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>
1 parent 07656a9 commit 04c30fb

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

hypervisor/arch/x86/guest/guest_memory.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,3 +424,14 @@ int32_t copy_to_gva(struct acrn_vcpu *vcpu, void *h_ptr, uint64_t gva,
424424
{
425425
return copy_gva(vcpu, h_ptr, gva, size, err_code, fault_addr, 0);
426426
}
427+
428+
/* gpa --> hpa -->hva */
429+
void *gpa2hva(struct acrn_vm *vm, uint64_t x)
430+
{
431+
return hpa2hva(gpa2hpa(vm, x));
432+
}
433+
434+
uint64_t hva2gpa(struct acrn_vm *vm, void *x)
435+
{
436+
return (is_sos_vm(vm)) ? sos_vm_hpa2gpa(hva2hpa(x)) : INVALID_GPA;
437+
}

hypervisor/include/arch/x86/guest/guest_memory.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ int32_t gva2gpa(struct acrn_vcpu *vcpu, uint64_t gva, uint64_t *gpa, uint32_t *e
3131

3232
enum vm_paging_mode get_vcpu_paging_mode(struct acrn_vcpu *vcpu);
3333

34+
/* gpa --> hpa -->hva */
35+
void *gpa2hva(struct acrn_vm *vm, uint64_t x);
36+
37+
uint64_t hva2gpa(struct acrn_vm *vm, void *x);
38+
3439
/**
3540
* @brief Data transfering between hypervisor and VM
3641
*

hypervisor/include/hypervisor.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,4 @@
3636
#include <hv_arch.h>
3737
#include <hv_debug.h>
3838

39-
#ifndef ASSEMBLER
40-
/* gpa --> hpa -->hva */
41-
static inline void *gpa2hva(struct acrn_vm *vm, uint64_t x)
42-
{
43-
return hpa2hva(gpa2hpa(vm, x));
44-
}
45-
46-
static inline uint64_t hva2gpa(struct acrn_vm *vm, void *x)
47-
{
48-
return (is_sos_vm(vm)) ? sos_vm_hpa2gpa(hva2hpa(x)) : INVALID_GPA;
49-
}
50-
51-
#endif /* !ASSEMBLER */
52-
5339
#endif /* HYPERVISOR_H */

0 commit comments

Comments
 (0)