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.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index db9aa917840..361b36fe7ec 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -183,6 +183,18 @@ struct kvm_vcpu {
183 } async_pf; 183 } async_pf;
184#endif 184#endif
185 185
186#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT
187 /*
188 * Cpu relax intercept or pause loop exit optimization
189 * in_spin_loop: set when a vcpu does a pause loop exit
190 * or cpu relax intercepted.
191 * dy_eligible: indicates whether vcpu is eligible for directed yield.
192 */
193 struct {
194 bool in_spin_loop;
195 bool dy_eligible;
196 } spin_loop;
197#endif
186 struct kvm_vcpu_arch arch; 198 struct kvm_vcpu_arch arch;
187}; 199};
188 200
@@ -898,5 +910,27 @@ static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu)
898 } 910 }
899} 911}
900 912
913#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT
914
915static inline void kvm_vcpu_set_in_spin_loop(struct kvm_vcpu *vcpu, bool val)
916{
917 vcpu->spin_loop.in_spin_loop = val;
918}
919static inline void kvm_vcpu_set_dy_eligible(struct kvm_vcpu *vcpu, bool val)
920{
921 vcpu->spin_loop.dy_eligible = val;
922}
923
924#else /* !CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT */
925
926static inline void kvm_vcpu_set_in_spin_loop(struct kvm_vcpu *vcpu, bool val)
927{
928}
929
930static inline void kvm_vcpu_set_dy_eligible(struct kvm_vcpu *vcpu, bool val)
931{
932}
933
934#endif /* CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT */
901#endif 935#endif
902 936