From 0f5c6e2c1826dae7633a5a4ae79f67d66197659a Mon Sep 17 00:00:00 2001 From: Yonghua Huang Date: Thu, 31 Jan 2019 23:12:27 +0800 Subject: [PATCH] HV: fix address type violation for MSR_LOAD/STORE According to SDM 24.7.2, these two MSRs should be configured with physical address. Tracked-On: #861 Signed-off-by: Yonghua Huang Acked-by: Eddie Dong --- hypervisor/arch/x86/guest/vmcs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hypervisor/arch/x86/guest/vmcs.c b/hypervisor/arch/x86/guest/vmcs.c index cf2e45abe..8c5775e22 100644 --- a/hypervisor/arch/x86/guest/vmcs.c +++ b/hypervisor/arch/x86/guest/vmcs.c @@ -477,7 +477,7 @@ static void init_entry_ctrl(const struct acrn_vcpu *vcpu) * VM-entry MSR load address field */ exec_vmwrite32(VMX_ENTRY_MSR_LOAD_COUNT, MSR_AREA_COUNT); - exec_vmwrite64(VMX_ENTRY_MSR_LOAD_ADDR_FULL, (uint64_t)vcpu->arch.msr_area.guest); + exec_vmwrite64(VMX_ENTRY_MSR_LOAD_ADDR_FULL, hva2hpa((void *)vcpu->arch.msr_area.guest)); /* Set up VM entry interrupt information field pg 2909 24.8.3 */ exec_vmwrite32(VMX_ENTRY_INT_INFO_FIELD, 0U); @@ -520,8 +520,8 @@ static void init_exit_ctrl(const struct acrn_vcpu *vcpu) */ exec_vmwrite32(VMX_EXIT_MSR_STORE_COUNT, MSR_AREA_COUNT); exec_vmwrite32(VMX_EXIT_MSR_LOAD_COUNT, MSR_AREA_COUNT); - exec_vmwrite64(VMX_EXIT_MSR_STORE_ADDR_FULL, (uint64_t)vcpu->arch.msr_area.guest); - exec_vmwrite64(VMX_EXIT_MSR_LOAD_ADDR_FULL, (uint64_t)vcpu->arch.msr_area.host); + exec_vmwrite64(VMX_EXIT_MSR_STORE_ADDR_FULL, hva2hpa((void *)vcpu->arch.msr_area.guest)); + exec_vmwrite64(VMX_EXIT_MSR_LOAD_ADDR_FULL, hva2hpa((void *)vcpu->arch.msr_area.host)); } /**