[RFC KVM 20/27] kvm/isolation: initialize the KVM page table with vmx specific data

From: Alexandre Chartre
Date: Mon May 13 2019 - 10:41:55 EST


In addition of core memory mappings, the KVM page table has to be
initialized with vmx specific data.

Signed-off-by: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
---
arch/x86/kvm/vmx/vmx.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 0c955bb..f181b3c 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -63,6 +63,7 @@
#include "vmcs12.h"
#include "vmx.h"
#include "x86.h"
+#include "isolation.h"

MODULE_AUTHOR("Qumranet");
MODULE_LICENSE("GPL");
@@ -7830,6 +7831,24 @@ static int __init vmx_init(void)
}
}

+ if (kvm_isolation()) {
+ pr_debug("mapping vmx init");
+ /* copy mapping of the current module (kvm_intel) */
+ r = kvm_copy_module_mapping();
+ if (r) {
+ vmx_exit();
+ return r;
+ }
+ if (vmx_l1d_flush_pages) {
+ r = kvm_copy_ptes(vmx_l1d_flush_pages,
+ PAGE_SIZE << L1D_CACHE_ORDER);
+ if (r) {
+ vmx_exit();
+ return r;
+ }
+ }
+ }
+
#ifdef CONFIG_KEXEC_CORE
rcu_assign_pointer(crash_vmclear_loaded_vmcss,
crash_vmclear_local_loaded_vmcss);
--
1.7.1