diff mbox series

[RFC,v3,36/38] i386/xen: Implement SCHEDOP_poll

Message ID 20221216004117.862106-37-dwmw2@infradead.org
State New
Headers show
Series Xen HVM support under KVM | expand

Commit Message

David Woodhouse Dec. 16, 2022, 12:41 a.m. UTC
From: David Woodhouse <dwmw@amazon.co.uk>

Just a dummy implementation which will sched_yield(), but it's enough to
stop the Linux guest panicking when running on a host kernel which doesn't
intercept SCHEDOP_poll and lets it reach userspace.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
 target/i386/kvm/xen-emu.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/target/i386/kvm/xen-emu.c b/target/i386/kvm/xen-emu.c
index 055afba627..a8c953e3ca 100644
--- a/target/i386/kvm/xen-emu.c
+++ b/target/i386/kvm/xen-emu.c
@@ -919,6 +919,17 @@  static bool kvm_xen_hcall_sched_op(struct kvm_xen_exit *exit, X86CPU *cpu,
         err = schedop_shutdown(cs, arg);
         break;
 
+    case SCHEDOP_poll:
+        /*
+         * Linux will panic if this doesn't work. Just yield; it's not
+         * worth overthinking it because wWith event channel handling
+         * in KVM, the kernel will intercept this and it will never
+         * reach QEMU anyway.
+         */
+        sched_yield();
+        err = 0;
+        break;
+
     default:
         return false;
     }