qemu/hw/i386/kvm/xen_evtchn.h
<<
>>
Prefs
   1/*
   2 * QEMU Xen emulation: Event channel support
   3 *
   4 * Copyright © 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   5 *
   6 * Authors: David Woodhouse <dwmw2@infradead.org>
   7 *
   8 * This work is licensed under the terms of the GNU GPL, version 2 or later.
   9 * See the COPYING file in the top-level directory.
  10 */
  11
  12#ifndef QEMU_XEN_EVTCHN_H
  13#define QEMU_XEN_EVTCHN_H
  14
  15#include "hw/sysbus.h"
  16
  17typedef uint32_t evtchn_port_t;
  18
  19void xen_evtchn_create(void);
  20int xen_evtchn_soft_reset(void);
  21int xen_evtchn_set_callback_param(uint64_t param);
  22void xen_evtchn_connect_gsis(qemu_irq *system_gsis);
  23void xen_evtchn_set_callback_level(int level);
  24
  25int xen_evtchn_set_port(uint16_t port);
  26
  27bool xen_evtchn_set_gsi(int gsi, int level);
  28void xen_evtchn_snoop_msi(PCIDevice *dev, bool is_msix, unsigned int vector,
  29                          uint64_t addr, uint32_t data, bool is_masked);
  30void xen_evtchn_remove_pci_device(PCIDevice *dev);
  31struct kvm_irq_routing_entry;
  32int xen_evtchn_translate_pirq_msi(struct kvm_irq_routing_entry *route,
  33                                  uint64_t address, uint32_t data);
  34bool xen_evtchn_deliver_pirq_msi(uint64_t address, uint32_t data);
  35
  36
  37/*
  38 * These functions mirror the libxenevtchn library API, providing the QEMU
  39 * backend side of "interdomain" event channels.
  40 */
  41struct xenevtchn_handle;
  42struct xenevtchn_handle *xen_be_evtchn_open(void);
  43int xen_be_evtchn_bind_interdomain(struct xenevtchn_handle *xc, uint32_t domid,
  44                                   evtchn_port_t guest_port);
  45int xen_be_evtchn_unbind(struct xenevtchn_handle *xc, evtchn_port_t port);
  46int xen_be_evtchn_close(struct xenevtchn_handle *xc);
  47int xen_be_evtchn_fd(struct xenevtchn_handle *xc);
  48int xen_be_evtchn_notify(struct xenevtchn_handle *xc, evtchn_port_t port);
  49int xen_be_evtchn_unmask(struct xenevtchn_handle *xc, evtchn_port_t port);
  50int xen_be_evtchn_pending(struct xenevtchn_handle *xc);
  51/* Apart from this which is a local addition */
  52int xen_be_evtchn_get_guest_port(struct xenevtchn_handle *xc);
  53
  54struct evtchn_status;
  55struct evtchn_close;
  56struct evtchn_unmask;
  57struct evtchn_bind_virq;
  58struct evtchn_bind_pirq;
  59struct evtchn_bind_ipi;
  60struct evtchn_send;
  61struct evtchn_alloc_unbound;
  62struct evtchn_bind_interdomain;
  63struct evtchn_bind_vcpu;
  64struct evtchn_reset;
  65int xen_evtchn_status_op(struct evtchn_status *status);
  66int xen_evtchn_close_op(struct evtchn_close *close);
  67int xen_evtchn_unmask_op(struct evtchn_unmask *unmask);
  68int xen_evtchn_bind_virq_op(struct evtchn_bind_virq *virq);
  69int xen_evtchn_bind_pirq_op(struct evtchn_bind_pirq *pirq);
  70int xen_evtchn_bind_ipi_op(struct evtchn_bind_ipi *ipi);
  71int xen_evtchn_send_op(struct evtchn_send *send);
  72int xen_evtchn_alloc_unbound_op(struct evtchn_alloc_unbound *alloc);
  73int xen_evtchn_bind_interdomain_op(struct evtchn_bind_interdomain *interdomain);
  74int xen_evtchn_bind_vcpu_op(struct evtchn_bind_vcpu *vcpu);
  75int xen_evtchn_reset_op(struct evtchn_reset *reset);
  76
  77struct physdev_map_pirq;
  78struct physdev_unmap_pirq;
  79struct physdev_eoi;
  80struct physdev_irq_status_query;
  81struct physdev_get_free_pirq;
  82int xen_physdev_map_pirq(struct physdev_map_pirq *map);
  83int xen_physdev_unmap_pirq(struct physdev_unmap_pirq *unmap);
  84int xen_physdev_eoi_pirq(struct physdev_eoi *eoi);
  85int xen_physdev_query_pirq(struct physdev_irq_status_query *query);
  86int xen_physdev_get_free_pirq(struct physdev_get_free_pirq *get);
  87
  88#endif /* QEMU_XEN_EVTCHN_H */
  89