KVM: x86: Add a framework for supporting MSR-based features
[GitHub/LineageOS/android_kernel_motorola_exynos9610.git] / arch / x86 / include / asm / kvm_host.h
index c73e493adf0748108c31389ca62437267ea877e2..017dbbde399e0b7c6664fea0ad250f45e6e59fed 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/tracepoint.h>
 #include <linux/cpumask.h>
 #include <linux/irq_work.h>
+#include <linux/irq.h>
 
 #include <linux/kvm.h>
 #include <linux/kvm_para.h>
@@ -693,6 +694,9 @@ struct kvm_vcpu_arch {
 
        /* be preempted when it's in kernel-mode(cpl=0) */
        bool preempted_in_kernel;
+
+       /* Flush the L1 Data cache for L1TF mitigation on VMENTER */
+       bool l1tf_flush_l1d;
 };
 
 struct kvm_lpage_info {
@@ -862,6 +866,7 @@ struct kvm_vcpu_stat {
        u64 signal_exits;
        u64 irq_window_exits;
        u64 nmi_window_exits;
+       u64 l1d_flush;
        u64 halt_exits;
        u64 halt_successful_poll;
        u64 halt_attempted_poll;
@@ -908,7 +913,7 @@ struct kvm_x86_ops {
        int (*hardware_setup)(void);               /* __init */
        void (*hardware_unsetup)(void);            /* __exit */
        bool (*cpu_has_accelerated_tpr)(void);
-       bool (*cpu_has_high_real_mode_segbase)(void);
+       bool (*has_emulated_msr)(int index);
        void (*cpuid_update)(struct kvm_vcpu *vcpu);
 
        int (*vm_init)(struct kvm *kvm);
@@ -1061,6 +1066,8 @@ struct kvm_x86_ops {
        void (*cancel_hv_timer)(struct kvm_vcpu *vcpu);
 
        void (*setup_mce)(struct kvm_vcpu *vcpu);
+
+       int (*get_msr_feature)(struct kvm_msr_entry *entry);
 };
 
 struct kvm_arch_async_pf {
@@ -1156,7 +1163,8 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu, unsigned long cr2,
 static inline int emulate_instruction(struct kvm_vcpu *vcpu,
                        int emulation_type)
 {
-       return x86_emulate_instruction(vcpu, 0, emulation_type, NULL, 0);
+       return x86_emulate_instruction(vcpu, 0,
+                       emulation_type | EMULTYPE_NO_REEXECUTE, NULL, 0);
 }
 
 void kvm_enable_efer_bits(u64);
@@ -1426,4 +1434,7 @@ static inline int kvm_cpu_get_apicid(int mps_cpu)
 #endif
 }
 
+void kvm_arch_mmu_notifier_invalidate_range(struct kvm *kvm,
+               unsigned long start, unsigned long end);
+
 #endif /* _ASM_X86_KVM_HOST_H */