]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
KVM: x86/xen: add additional evtchn ops
authorAnkur Arora <ankur.a.arora@oracle.com>
Wed, 28 Nov 2018 21:34:28 +0000 (16:34 -0500)
committerJoao Martins <joao.m.martins@oracle.com>
Wed, 20 Feb 2019 17:30:52 +0000 (12:30 -0500)
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

index 1988ed3866bfe7e3e547a4715facbc0ba17c912b..666dd6d1f5a31ccb68bc637f2508155f942d37d6 100644 (file)
@@ -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;