]> www.infradead.org Git - users/dwmw2/linux.git/commit
KVM: x86/xen: Make kvm_xen_set_evtchn() reusable from other places
authorDavid Woodhouse <dwmw@amazon.co.uk>
Mon, 7 Feb 2022 14:04:24 +0000 (14:04 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Wed, 9 Feb 2022 21:37:04 +0000 (21:37 +0000)
commiteb8482ef5507c74e9d7c13e57bd0b67b6f02d93e
tree992bf3d8be44ba2368c660e9405f94a0f1ac0315
parentffacbcc536e45a968642cc990a94a700f9f60c0d
KVM: x86/xen: Make kvm_xen_set_evtchn() reusable from other places

Clean it up to return -errno on error consistently, while still being
compatible with the return conventions for kvm_arch_set_irq_inatomic()
and the kvm_set_irq() callback.

We use -ENOTCONN to indicate when the port is masked. No existing users
care, except that it's negative.

Also allow it to optimise the vCPU lookup. Unless we abuse the lapic
map, there is no quick lookup from APIC ID to a vCPU; the logic in
kvm_get_vcpu_by_id() will just iterate over all vCPUs till it finds
the one it wants. So do that just once and stash the result in the
struct kvm_xen_evtchn for next time.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
arch/x86/kvm/irq_comm.c
arch/x86/kvm/xen.c
arch/x86/kvm/xen.h
include/linux/kvm_host.h