This series adds event channel acceleration for Xen guests. In particular it allows guest vCPUs to send each other IPIs without having to bounce all the way out to the userspace VMM in order to do so. Likewise, the Xen singleshot timer is added, and a version of SCHEDOP_poll. Those major features are based on Joao and Boris' patches from 2019. Cleaning up the event delivery into the vcpu_info involved using the new gfn_to_pfn_cache for that, and that means I ended up doing so for *all* the places the guest can have a pvclock. And the runstate too, having rediscovered a bugfix I'd been carrying in my internal tree that got forgotten upstream until today. I'm calling this v0 because there's a little bit more work to be done on documentation and especially self tests for these, but it's basically ready for review and I wanted to post a version as a fixed point while I backport it to our environment and do some more testing with actual Xen guest VMs. With this, I think the Xen support is as complete as it needs to be for now. There were more patches in the original set from Oracle, which allowed the KVM host to act as a Xen dom0 and the Xen PV back end drivers (netback, blkback, etc.) to communicate via the KVM-emulated event channels as if it was running underneath true Xen. I haven't done anything to deliberately break those, although there's been a certain amount of refactoring as I've merged the other bits so far. But neither am I planning to pick those up and work on them any further. I'm OK with the VMM emulating those in userspace, with a VFIO shim to an underlying NIC or NVMe device. Boris Ostrovsky (1): KVM: x86/xen: handle PV spinlocks slowpath David Woodhouse (11): KVM: x86/xen: Fix runstate updates to be atomic when preempting vCPU KVM: x86/xen: Use gfn_to_pfn_cache for runstate area KVM: x86: Use gfn_to_pfn_cache for pv_time KVM: x86/xen: Use gfn_to_pfn_cache for vcpu_info KVM: x86/xen: Use gfn_to_pfn_cache for vcpu_time_info KVM: x86/xen: Make kvm_xen_set_evtchn() reusable from other places KVM: x86/xen: Support direct injection of event channel events KVM: x86/xen: Add KVM_XEN_VCPU_ATTR_TYPE_VCPU_ID KVM: x86/xen: Kernel acceleration for XENVER_version KVM: x86/xen: Support per-vCPU event channel upcall via local APIC KVM: x86/xen: Advertise and document KVM_XEN_HVM_CONFIG_EVTCHN_SEND Joao Martins (3): KVM: x86/xen: intercept EVTCHNOP_send from guests KVM: x86/xen: handle PV IPI vcpu yield KVM: x86/xen: handle PV timers oneshot mode Documentation/virt/kvm/api.rst | 129 ++- arch/x86/include/asm/kvm_host.h | 22 +- arch/x86/kvm/irq.c | 11 +- arch/x86/kvm/irq_comm.c | 2 +- arch/x86/kvm/x86.c | 123 +- arch/x86/kvm/xen.c | 1191 ++++++++++++++++---- arch/x86/kvm/xen.h | 69 +- include/linux/kvm_host.h | 3 +- include/uapi/linux/kvm.h | 43 + .../testing/selftests/kvm/x86_64/xen_shinfo_test.c | 6 + 10 files changed, 1315 insertions(+), 284 deletions(-)