aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kvm_host.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/kvm_host.h')
-rw-r--r--include/linux/kvm_host.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index b5021db21858..b99eacd988ab 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -98,19 +98,26 @@ int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn,
98int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu); 98int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu);
99#endif 99#endif
100 100
101enum {
102 OUTSIDE_GUEST_MODE,
103 IN_GUEST_MODE,
104 EXITING_GUEST_MODE
105};
106
101struct kvm_vcpu { 107struct kvm_vcpu {
102 struct kvm *kvm; 108 struct kvm *kvm;
103#ifdef CONFIG_PREEMPT_NOTIFIERS 109#ifdef CONFIG_PREEMPT_NOTIFIERS
104 struct preempt_notifier preempt_notifier; 110 struct preempt_notifier preempt_notifier;
105#endif 111#endif
112 int cpu;
106 int vcpu_id; 113 int vcpu_id;
107 struct mutex mutex; 114 int srcu_idx;
108 int cpu; 115 int mode;
109 atomic_t guest_mode;
110 struct kvm_run *run;
111 unsigned long requests; 116 unsigned long requests;
112 unsigned long guest_debug; 117 unsigned long guest_debug;
113 int srcu_idx; 118
119 struct mutex mutex;
120 struct kvm_run *run;
114 121
115 int fpu_active; 122 int fpu_active;
116 int guest_fpu_loaded, guest_xcr0_loaded; 123 int guest_fpu_loaded, guest_xcr0_loaded;
@@ -140,6 +147,11 @@ struct kvm_vcpu {
140 struct kvm_vcpu_arch arch; 147 struct kvm_vcpu_arch arch;
141}; 148};
142 149
150static inline int kvm_vcpu_exiting_guest_mode(struct kvm_vcpu *vcpu)
151{
152 return cmpxchg(&vcpu->mode, IN_GUEST_MODE, EXITING_GUEST_MODE);
153}
154
143/* 155/*
144 * Some of the bitops functions do not support too long bitmaps. 156 * Some of the bitops functions do not support too long bitmaps.
145 * This number must be determined not to exceed such limits. 157 * This number must be determined not to exceed such limits.