printf: Remove unused 'bprintf'
[drm/drm-misc.git] / kernel / entry / kvm.c
blob8485f63863afcc413f39f117e4d157b50f03d179
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)
8 do {
9 int ret;
11 if (ti_work & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL)) {
12 kvm_handle_signal_exit(vcpu);
13 return -EINTR;
16 if (ti_work & (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY))
17 schedule();
19 if (ti_work & _TIF_NOTIFY_RESUME)
20 resume_user_mode_work(NULL);
22 ret = arch_xfer_to_guest_mode_handle_work(vcpu, ti_work);
23 if (ret)
24 return ret;
26 ti_work = read_thread_flags();
27 } while (ti_work & XFER_TO_GUEST_MODE_WORK);
28 return 0;
31 int xfer_to_guest_mode_handle_work(struct kvm_vcpu *vcpu)
33 unsigned long ti_work;
36 * This is invoked from the outer guest loop with interrupts and
37 * preemption enabled.
39 * KVM invokes xfer_to_guest_mode_work_pending() with interrupts
40 * disabled in the inner loop before going into guest mode. No need
41 * to disable interrupts here.
43 ti_work = read_thread_flags();
44 if (!(ti_work & XFER_TO_GUEST_MODE_WORK))
45 return 0;
47 return xfer_to_guest_mode_work(vcpu, ti_work);
49 EXPORT_SYMBOL_GPL(xfer_to_guest_mode_handle_work);