1 // SPDX-License-Identifier: GPL-2.0
3 #include <linux/entry-kvm.h>
4 #include <linux/kvm_host.h>
6 static int xfer_to_guest_mode_work(struct kvm_vcpu *vcpu, unsigned long ti_work)
11 if (ti_work & _TIF_NOTIFY_SIGNAL)
12 tracehook_notify_signal();
14 if (ti_work & _TIF_SIGPENDING) {
15 kvm_handle_signal_exit(vcpu);
19 if (ti_work & _TIF_NEED_RESCHED)
22 if (ti_work & _TIF_NOTIFY_RESUME) {
23 tracehook_notify_resume(NULL);
24 rseq_handle_notify_resume(NULL, NULL);
27 ret = arch_xfer_to_guest_mode_handle_work(vcpu, ti_work);
31 ti_work = READ_ONCE(current_thread_info()->flags);
32 } while (ti_work & XFER_TO_GUEST_MODE_WORK || need_resched());
36 int xfer_to_guest_mode_handle_work(struct kvm_vcpu *vcpu)
38 unsigned long ti_work;
41 * This is invoked from the outer guest loop with interrupts and
44 * KVM invokes xfer_to_guest_mode_work_pending() with interrupts
45 * disabled in the inner loop before going into guest mode. No need
46 * to disable interrupts here.
48 ti_work = READ_ONCE(current_thread_info()->flags);
49 if (!(ti_work & XFER_TO_GUEST_MODE_WORK))
52 return xfer_to_guest_mode_work(vcpu, ti_work);
54 EXPORT_SYMBOL_GPL(xfer_to_guest_mode_handle_work);