lkml.org 
[lkml]   [2019]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH RFC 30/39] KVM: x86/xen: add additional evtchn ops
Date
From: Ankur Arora <ankur.a.arora@oracle.com>

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 <ankur.a.arora@oracle.com>
---
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
\
 
 \ /
  Last update: 2019-02-20 21:20    [W:0.595 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site