aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorJoao Martins <joao.m.martins@oracle.com>2018-09-17 07:04:54 -0400
committerDavid Woodhouse <dwmw@amazon.co.uk>2023-03-01 09:07:52 +0000
commitb746a77926f6e84bdb35a38a9ee956ac12693757 (patch)
treea6966ad8607bb5ff4c3a00ec45d6fa79b7f596db /hw
parentb46f9745b1b5c8dd6ea1bd1361531f966c404f8c (diff)
downloadqemu-b746a77926f6e84bdb35a38a9ee956ac12693757.zip
qemu-b746a77926f6e84bdb35a38a9ee956ac12693757.tar.gz
qemu-b746a77926f6e84bdb35a38a9ee956ac12693757.tar.bz2
i386/xen: handle PV timer hypercalls
Introduce support for one shot and periodic mode of Xen PV timers, whereby timer interrupts come through a special virq event channel with deadlines being set through: 1) set_timer_op hypercall (only oneshot) 2) vcpu_op hypercall for {set,stop}_{singleshot,periodic}_timer hypercalls Signed-off-by: Joao Martins <joao.m.martins@oracle.com> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Reviewed-by: Paul Durrant <paul@xen.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/i386/kvm/xen_evtchn.c31
-rw-r--r--hw/i386/kvm/xen_evtchn.h2
2 files changed, 33 insertions, 0 deletions
diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c
index f39b751..71ed480 100644
--- a/hw/i386/kvm/xen_evtchn.c
+++ b/hw/i386/kvm/xen_evtchn.c
@@ -1222,6 +1222,37 @@ int xen_evtchn_send_op(struct evtchn_send *send)
return ret;
}
+int xen_evtchn_set_port(uint16_t port)
+{
+ XenEvtchnState *s = xen_evtchn_singleton;
+ XenEvtchnPort *p;
+ int ret = -EINVAL;
+
+ if (!s) {
+ return -ENOTSUP;
+ }
+
+ if (!valid_port(port)) {
+ return -EINVAL;
+ }
+
+ qemu_mutex_lock(&s->port_lock);
+
+ p = &s->port_table[port];
+
+ /* QEMU has no business sending to anything but these */
+ if (p->type == EVTCHNSTAT_virq ||
+ (p->type == EVTCHNSTAT_interdomain &&
+ (p->type_val & PORT_INFO_TYPEVAL_REMOTE_QEMU))) {
+ set_port_pending(s, port);
+ ret = 0;
+ }
+
+ qemu_mutex_unlock(&s->port_lock);
+
+ return ret;
+}
+
EvtchnInfoList *qmp_xen_event_list(Error **errp)
{
XenEvtchnState *s = xen_evtchn_singleton;
diff --git a/hw/i386/kvm/xen_evtchn.h b/hw/i386/kvm/xen_evtchn.h
index b03c310..2461147 100644
--- a/hw/i386/kvm/xen_evtchn.h
+++ b/hw/i386/kvm/xen_evtchn.h
@@ -20,6 +20,8 @@ int xen_evtchn_set_callback_param(uint64_t param);
void xen_evtchn_connect_gsis(qemu_irq *system_gsis);
void xen_evtchn_set_callback_level(int level);
+int xen_evtchn_set_port(uint16_t port);
+
struct evtchn_status;
struct evtchn_close;
struct evtchn_unmask;