[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1517856451-2932-7-git-send-email-karahmed@amazon.de>
Date: Mon, 5 Feb 2018 19:47:25 +0100
From: KarimAllah Ahmed <karahmed@...zon.de>
To: linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Cc: KarimAllah Ahmed <karahmed@...zon.de>,
Paolo Bonzini <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>
Subject: [RFC 06/12] KVM/VMX: Use the new host mapping API for handle_vmptrld
Cc: Paolo Bonzini <pbonzini@...hat.com>
Cc: Radim Krčmář <rkrcmar@...hat.com>
Cc: kvm@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Signed-off-by: KarimAllah Ahmed <karahmed@...zon.de>
---
arch/x86/kvm/vmx.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 9e45bd1..9544df0 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -7865,30 +7865,30 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu)
}
if (vmx->nested.current_vmptr != vmptr) {
+ struct kvm_host_mapping mapping;
struct vmcs12 *new_vmcs12;
- struct page *page;
- page = kvm_vcpu_gpa_to_page(vcpu, vmptr);
- if (is_error_page(page)) {
+
+ if (!kvm_vcpu_gpa_to_host_mapping(vcpu, vmptr, &mapping, true)) {
nested_vmx_failInvalid(vcpu);
return kvm_skip_emulated_instruction(vcpu);
}
- new_vmcs12 = kmap(page);
+
+ new_vmcs12 = mapping.kaddr;
if (new_vmcs12->revision_id != VMCS12_REVISION) {
- kunmap(page);
- kvm_release_page_clean(page);
+ kvm_release_host_mapping(&mapping, false);
nested_vmx_failValid(vcpu,
VMXERR_VMPTRLD_INCORRECT_VMCS_REVISION_ID);
return kvm_skip_emulated_instruction(vcpu);
}
nested_release_vmcs12(vmx);
+
/*
* Load VMCS12 from guest memory since it is not already
* cached.
*/
memcpy(vmx->nested.cached_vmcs12, new_vmcs12, VMCS12_SIZE);
- kunmap(page);
- kvm_release_page_clean(page);
+ kvm_release_host_mapping(&mapping, false);
set_current_vmptr(vmx, vmptr);
}
--
2.7.4
Powered by blists - more mailing lists