From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joao Martins Subject: [PATCH RFC 30/39] KVM: x86/xen: add additional evtchn ops Date: Wed, 20 Feb 2019 20:16:00 +0000 Message-ID: <20190220201609.28290-31-joao.m.martins@oracle.com> References: <20190220201609.28290-1-joao.m.martins@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Ankur Arora , Boris Ostrovsky , Joao Martins , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Return-path: In-Reply-To: <20190220201609.28290-1-joao.m.martins@oracle.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org From: Ankur Arora Add support for changing event channel affinity (EVTCHNOP_bind_vcpu) and closing an event (EVTCHNOP_close). We just piggy back on the functionality already implemented for guest event channels. Signed-off-by: Ankur Arora --- arch/x86/kvm/xen.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c index 1988ed3866bf..666dd6d1f5a3 100644 --- a/arch/x86/kvm/xen.c +++ b/arch/x86/kvm/xen.c @@ -2188,6 +2188,38 @@ static int shim_hcall_evtchn(int op, void *p) ret = shim_hcall_evtchn_send(xen_shim, send); break; } + case EVTCHNOP_bind_virq: { + struct evtchn_bind_virq *un; + + un = (struct evtchn_bind_virq *) p; + + evt.fd = -1; + evt.port = 0; + evt.type = XEN_EVTCHN_TYPE_VIRQ; + ret = kvm_xen_eventfd_assign(NULL, &xen_shim->port_to_evt, + &xen_shim->xen_lock, &evt); + un->port = evt.port; + break; + } + case EVTCHNOP_bind_vcpu: { + struct evtchn_bind_vcpu *bind_vcpu; + + bind_vcpu = (struct evtchn_bind_vcpu *) p; + + evt.port = bind_vcpu->port; + evt.vcpu = bind_vcpu->vcpu; + ret = kvm_xen_eventfd_update(NULL, &xen_shim->port_to_evt, + &xen_shim->xen_lock, &evt); + break; + } + case EVTCHNOP_close: { + struct evtchn_close *cls; + + cls = (struct evtchn_close *) p; + ret = kvm_xen_eventfd_deassign(NULL, &xen_shim->port_to_evt, + &xen_shim->xen_lock, cls->port); + break; + } default: ret = -EINVAL; break; -- 2.11.0