0001
0002 #ifndef __LINUX_ENTRYKVM_H
0003 #define __LINUX_ENTRYKVM_H
0004
0005 #include <linux/static_call_types.h>
0006 #include <linux/resume_user_mode.h>
0007 #include <linux/syscalls.h>
0008 #include <linux/seccomp.h>
0009 #include <linux/sched.h>
0010 #include <linux/tick.h>
0011
0012
0013 #ifdef CONFIG_KVM_XFER_TO_GUEST_WORK
0014
0015 #ifndef ARCH_XFER_TO_GUEST_MODE_WORK
0016 # define ARCH_XFER_TO_GUEST_MODE_WORK (0)
0017 #endif
0018
0019 #define XFER_TO_GUEST_MODE_WORK \
0020 (_TIF_NEED_RESCHED | _TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL | \
0021 _TIF_NOTIFY_RESUME | ARCH_XFER_TO_GUEST_MODE_WORK)
0022
0023 struct kvm_vcpu;
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 static inline int arch_xfer_to_guest_mode_handle_work(struct kvm_vcpu *vcpu,
0035 unsigned long ti_work);
0036
0037 #ifndef arch_xfer_to_guest_mode_work
0038 static inline int arch_xfer_to_guest_mode_handle_work(struct kvm_vcpu *vcpu,
0039 unsigned long ti_work)
0040 {
0041 return 0;
0042 }
0043 #endif
0044
0045
0046
0047
0048
0049
0050
0051
0052 int xfer_to_guest_mode_handle_work(struct kvm_vcpu *vcpu);
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062 static inline void xfer_to_guest_mode_prepare(void)
0063 {
0064 lockdep_assert_irqs_disabled();
0065 tick_nohz_user_enter_prepare();
0066 }
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076 static inline bool __xfer_to_guest_mode_work_pending(void)
0077 {
0078 unsigned long ti_work = read_thread_flags();
0079
0080 return !!(ti_work & XFER_TO_GUEST_MODE_WORK);
0081 }
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092 static inline bool xfer_to_guest_mode_work_pending(void)
0093 {
0094 lockdep_assert_irqs_disabled();
0095 return __xfer_to_guest_mode_work_pending();
0096 }
0097 #endif
0098
0099 #endif