[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 35/62] hw/xen: Implement EVTCHNOP_alloc_unbound
From: |
Paolo Bonzini |
Subject: |
[PULL 35/62] hw/xen: Implement EVTCHNOP_alloc_unbound |
Date: |
Thu, 2 Mar 2023 13:30:02 +0100 |
From: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
---
hw/i386/kvm/xen_evtchn.c | 32 ++++++++++++++++++++++++++++++++
hw/i386/kvm/xen_evtchn.h | 2 ++
target/i386/kvm/xen-emu.c | 15 +++++++++++++++
3 files changed, 49 insertions(+)
diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c
index ce7a96923409..df25bf0806a6 100644
--- a/hw/i386/kvm/xen_evtchn.c
+++ b/hw/i386/kvm/xen_evtchn.c
@@ -837,6 +837,38 @@ int xen_evtchn_bind_ipi_op(struct evtchn_bind_ipi *ipi)
return ret;
}
+int xen_evtchn_alloc_unbound_op(struct evtchn_alloc_unbound *alloc)
+{
+ XenEvtchnState *s = xen_evtchn_singleton;
+ uint16_t type_val;
+ int ret;
+
+ if (!s) {
+ return -ENOTSUP;
+ }
+
+ if (alloc->dom != DOMID_SELF && alloc->dom != xen_domid) {
+ return -ESRCH;
+ }
+
+ if (alloc->remote_dom == DOMID_QEMU) {
+ type_val = PORT_INFO_TYPEVAL_REMOTE_QEMU;
+ } else if (alloc->remote_dom == DOMID_SELF ||
+ alloc->remote_dom == xen_domid) {
+ type_val = 0;
+ } else {
+ return -EPERM;
+ }
+
+ qemu_mutex_lock(&s->port_lock);
+
+ ret = allocate_port(s, 0, EVTCHNSTAT_unbound, type_val, &alloc->port);
+
+ qemu_mutex_unlock(&s->port_lock);
+
+ return ret;
+}
+
int xen_evtchn_send_op(struct evtchn_send *send)
{
XenEvtchnState *s = xen_evtchn_singleton;
diff --git a/hw/i386/kvm/xen_evtchn.h b/hw/i386/kvm/xen_evtchn.h
index 500fdbe8b804..fc080138e3f2 100644
--- a/hw/i386/kvm/xen_evtchn.h
+++ b/hw/i386/kvm/xen_evtchn.h
@@ -21,11 +21,13 @@ struct evtchn_unmask;
struct evtchn_bind_virq;
struct evtchn_bind_ipi;
struct evtchn_send;
+struct evtchn_alloc_unbound;
int xen_evtchn_status_op(struct evtchn_status *status);
int xen_evtchn_close_op(struct evtchn_close *close);
int xen_evtchn_unmask_op(struct evtchn_unmask *unmask);
int xen_evtchn_bind_virq_op(struct evtchn_bind_virq *virq);
int xen_evtchn_bind_ipi_op(struct evtchn_bind_ipi *ipi);
int xen_evtchn_send_op(struct evtchn_send *send);
+int xen_evtchn_alloc_unbound_op(struct evtchn_alloc_unbound *alloc);
#endif /* QEMU_XEN_EVTCHN_H */
diff --git a/target/i386/kvm/xen-emu.c b/target/i386/kvm/xen-emu.c
index 19a7f16ebe6b..ac04387a6a12 100644
--- a/target/i386/kvm/xen-emu.c
+++ b/target/i386/kvm/xen-emu.c
@@ -921,6 +921,21 @@ static bool kvm_xen_hcall_evtchn_op(struct kvm_xen_exit
*exit, X86CPU *cpu,
err = xen_evtchn_send_op(&send);
break;
}
+ case EVTCHNOP_alloc_unbound: {
+ struct evtchn_alloc_unbound alloc;
+
+ qemu_build_assert(sizeof(alloc) == 8);
+ if (kvm_copy_from_gva(cs, arg, &alloc, sizeof(alloc))) {
+ err = -EFAULT;
+ break;
+ }
+
+ err = xen_evtchn_alloc_unbound_op(&alloc);
+ if (!err && kvm_copy_to_gva(cs, arg, &alloc, sizeof(alloc))) {
+ err = -EFAULT;
+ }
+ break;
+ }
default:
return false;
}
--
2.39.1
- [PULL 41/62] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_PCI_INTX callback, (continued)
- [PULL 41/62] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_PCI_INTX callback, Paolo Bonzini, 2023/03/02
- [PULL 22/62] i386/xen: handle VCPUOP_register_vcpu_time_info, Paolo Bonzini, 2023/03/02
- [PULL 42/62] kvm/i386: Add xen-gnttab-max-frames property, Paolo Bonzini, 2023/03/02
- [PULL 45/62] i386/xen: Implement HYPERVISOR_grant_table_op and GNTTABOP_[gs]et_verson, Paolo Bonzini, 2023/03/02
- [PULL 49/62] i386/xen: handle HVMOP_get_param, Paolo Bonzini, 2023/03/02
- [PULL 62/62] Makefile: qemu-bundle is a directory, Paolo Bonzini, 2023/03/02
- [PULL 23/62] i386/xen: handle VCPUOP_register_runstate_memory_area, Paolo Bonzini, 2023/03/02
- [PULL 24/62] i386/xen: implement HYPERVISOR_event_channel_op, Paolo Bonzini, 2023/03/02
- [PULL 33/62] hw/xen: Implement EVTCHNOP_bind_ipi, Paolo Bonzini, 2023/03/02
- [PULL 30/62] hw/xen: Implement EVTCHNOP_close, Paolo Bonzini, 2023/03/02
- [PULL 35/62] hw/xen: Implement EVTCHNOP_alloc_unbound,
Paolo Bonzini <=
- [PULL 37/62] hw/xen: Implement EVTCHNOP_bind_vcpu, Paolo Bonzini, 2023/03/02
- [PULL 40/62] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_GSI callback, Paolo Bonzini, 2023/03/02
- [PULL 44/62] hw/xen: Support mapping grant frames, Paolo Bonzini, 2023/03/02
- [PULL 51/62] hw/xen: Add xen_xenstore device for xenstore emulation, Paolo Bonzini, 2023/03/02
- [PULL 47/62] i386/xen: handle PV timer hypercalls, Paolo Bonzini, 2023/03/02
- [PULL 48/62] i386/xen: Reserve Xen special pages for console, xenstore rings, Paolo Bonzini, 2023/03/02
- [PULL 50/62] hw/xen: Add backend implementation of interdomain event channel support, Paolo Bonzini, 2023/03/02
- [PULL 46/62] hw/xen: Implement GNTTABOP_query_size, Paolo Bonzini, 2023/03/02
- [PULL 43/62] hw/xen: Add xen_gnttab device for grant table emulation, Paolo Bonzini, 2023/03/02
- [PULL 56/62] hw/xen: Support GSI mapping to PIRQ, Paolo Bonzini, 2023/03/02