xref: /openbmc/qemu/hw/i386/kvm/xen_evtchn.h (revision 799c2354)
191cce756SDavid Woodhouse /*
291cce756SDavid Woodhouse  * QEMU Xen emulation: Event channel support
391cce756SDavid Woodhouse  *
491cce756SDavid Woodhouse  * Copyright © 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
591cce756SDavid Woodhouse  *
691cce756SDavid Woodhouse  * Authors: David Woodhouse <dwmw2@infradead.org>
791cce756SDavid Woodhouse  *
891cce756SDavid Woodhouse  * This work is licensed under the terms of the GNU GPL, version 2 or later.
991cce756SDavid Woodhouse  * See the COPYING file in the top-level directory.
1091cce756SDavid Woodhouse  */
1191cce756SDavid Woodhouse 
1291cce756SDavid Woodhouse #ifndef QEMU_XEN_EVTCHN_H
1391cce756SDavid Woodhouse #define QEMU_XEN_EVTCHN_H
1491cce756SDavid Woodhouse 
15ddf0fd9aSDavid Woodhouse #include "hw/sysbus.h"
16ddf0fd9aSDavid Woodhouse 
17794fba23SDavid Woodhouse typedef uint32_t evtchn_port_t;
18794fba23SDavid Woodhouse 
1991cce756SDavid Woodhouse void xen_evtchn_create(void);
20a15b1097SDavid Woodhouse int xen_evtchn_soft_reset(void);
2191cce756SDavid Woodhouse int xen_evtchn_set_callback_param(uint64_t param);
22ddf0fd9aSDavid Woodhouse void xen_evtchn_connect_gsis(qemu_irq *system_gsis);
23ddf0fd9aSDavid Woodhouse void xen_evtchn_set_callback_level(int level);
2491cce756SDavid Woodhouse 
25b746a779SJoao Martins int xen_evtchn_set_port(uint16_t port);
26b746a779SJoao Martins 
27794fba23SDavid Woodhouse /*
28794fba23SDavid Woodhouse  * These functions mirror the libxenevtchn library API, providing the QEMU
29794fba23SDavid Woodhouse  * backend side of "interdomain" event channels.
30794fba23SDavid Woodhouse  */
31794fba23SDavid Woodhouse struct xenevtchn_handle;
32794fba23SDavid Woodhouse struct xenevtchn_handle *xen_be_evtchn_open(void);
33794fba23SDavid Woodhouse int xen_be_evtchn_bind_interdomain(struct xenevtchn_handle *xc, uint32_t domid,
34794fba23SDavid Woodhouse                                    evtchn_port_t guest_port);
35794fba23SDavid Woodhouse int xen_be_evtchn_unbind(struct xenevtchn_handle *xc, evtchn_port_t port);
36794fba23SDavid Woodhouse int xen_be_evtchn_close(struct xenevtchn_handle *xc);
37794fba23SDavid Woodhouse int xen_be_evtchn_fd(struct xenevtchn_handle *xc);
38794fba23SDavid Woodhouse int xen_be_evtchn_notify(struct xenevtchn_handle *xc, evtchn_port_t port);
39794fba23SDavid Woodhouse int xen_be_evtchn_unmask(struct xenevtchn_handle *xc, evtchn_port_t port);
40794fba23SDavid Woodhouse int xen_be_evtchn_pending(struct xenevtchn_handle *xc);
41794fba23SDavid Woodhouse /* Apart from this which is a local addition */
42794fba23SDavid Woodhouse int xen_be_evtchn_get_guest_port(struct xenevtchn_handle *xc);
43794fba23SDavid Woodhouse 
444858ba20SDavid Woodhouse struct evtchn_status;
4583eb5811SDavid Woodhouse struct evtchn_close;
46190cc3c0SDavid Woodhouse struct evtchn_unmask;
47c723d4c1SDavid Woodhouse struct evtchn_bind_virq;
48f5417856SDavid Woodhouse struct evtchn_bind_ipi;
49cf7679abSDavid Woodhouse struct evtchn_send;
50e1db61b8SDavid Woodhouse struct evtchn_alloc_unbound;
5184327881SDavid Woodhouse struct evtchn_bind_interdomain;
5230667046SDavid Woodhouse struct evtchn_bind_vcpu;
53a15b1097SDavid Woodhouse struct evtchn_reset;
544858ba20SDavid Woodhouse int xen_evtchn_status_op(struct evtchn_status *status);
5583eb5811SDavid Woodhouse int xen_evtchn_close_op(struct evtchn_close *close);
56190cc3c0SDavid Woodhouse int xen_evtchn_unmask_op(struct evtchn_unmask *unmask);
57c723d4c1SDavid Woodhouse int xen_evtchn_bind_virq_op(struct evtchn_bind_virq *virq);
58f5417856SDavid Woodhouse int xen_evtchn_bind_ipi_op(struct evtchn_bind_ipi *ipi);
59cf7679abSDavid Woodhouse int xen_evtchn_send_op(struct evtchn_send *send);
60e1db61b8SDavid Woodhouse int xen_evtchn_alloc_unbound_op(struct evtchn_alloc_unbound *alloc);
6184327881SDavid Woodhouse int xen_evtchn_bind_interdomain_op(struct evtchn_bind_interdomain *interdomain);
6230667046SDavid Woodhouse int xen_evtchn_bind_vcpu_op(struct evtchn_bind_vcpu *vcpu);
63a15b1097SDavid Woodhouse int xen_evtchn_reset_op(struct evtchn_reset *reset);
644858ba20SDavid Woodhouse 
65*799c2354SDavid Woodhouse struct physdev_map_pirq;
66*799c2354SDavid Woodhouse struct physdev_unmap_pirq;
67*799c2354SDavid Woodhouse struct physdev_eoi;
68*799c2354SDavid Woodhouse struct physdev_irq_status_query;
69*799c2354SDavid Woodhouse struct physdev_get_free_pirq;
70*799c2354SDavid Woodhouse int xen_physdev_map_pirq(struct physdev_map_pirq *map);
71*799c2354SDavid Woodhouse int xen_physdev_unmap_pirq(struct physdev_unmap_pirq *unmap);
72*799c2354SDavid Woodhouse int xen_physdev_eoi_pirq(struct physdev_eoi *eoi);
73*799c2354SDavid Woodhouse int xen_physdev_query_pirq(struct physdev_irq_status_query *query);
74*799c2354SDavid Woodhouse int xen_physdev_get_free_pirq(struct physdev_get_free_pirq *get);
75*799c2354SDavid Woodhouse 
7691cce756SDavid Woodhouse #endif /* QEMU_XEN_EVTCHN_H */
77