]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/xen/events/events_internal.h
xen/events: move 2-level specific code into its own file
[mirror_ubuntu-bionic-kernel.git] / drivers / xen / events / events_internal.h
CommitLineData
9a489f45
DV
1/*
2 * Xen Event Channels (internal header)
3 *
4 * Copyright (C) 2013 Citrix Systems R&D Ltd.
5 *
6 * This source code is licensed under the GNU General Public License,
7 * Version 2 or later. See the file COPYING for more details.
8 */
9#ifndef __EVENTS_INTERNAL_H__
10#define __EVENTS_INTERNAL_H__
11
12/* Interrupt types. */
13enum xen_irq_type {
14 IRQT_UNBOUND = 0,
15 IRQT_PIRQ,
16 IRQT_VIRQ,
17 IRQT_IPI,
18 IRQT_EVTCHN
19};
20
21/*
22 * Packed IRQ information:
23 * type - enum xen_irq_type
24 * event channel - irq->event channel mapping
25 * cpu - cpu this event channel is bound to
26 * index - type-specific information:
27 * PIRQ - vector, with MSB being "needs EIO", or physical IRQ of the HVM
28 * guest, or GSI (real passthrough IRQ) of the device.
29 * VIRQ - virq number
30 * IPI - IPI vector
31 * EVTCHN -
32 */
33struct irq_info {
34 struct list_head list;
35 int refcnt;
36 enum xen_irq_type type; /* type */
37 unsigned irq;
38 unsigned short evtchn; /* event channel */
39 unsigned short cpu; /* cpu bound */
40
41 union {
42 unsigned short virq;
43 enum ipi_vector ipi;
44 struct {
45 unsigned short pirq;
46 unsigned short gsi;
47 unsigned char vector;
48 unsigned char flags;
49 uint16_t domid;
50 } pirq;
51 } u;
52};
53
54#define PIRQ_NEEDS_EOI (1 << 0)
55#define PIRQ_SHAREABLE (1 << 1)
56
57extern int *evtchn_to_irq;
58
59struct irq_info *info_for_irq(unsigned irq);
60unsigned cpu_from_irq(unsigned irq);
61unsigned cpu_from_evtchn(unsigned int evtchn);
62
63void xen_evtchn_port_bind_to_cpu(struct irq_info *info, int cpu);
64
65void clear_evtchn(int port);
66void set_evtchn(int port);
67int test_evtchn(int port);
68int test_and_set_mask(int port);
69void mask_evtchn(int port);
70void unmask_evtchn(int port);
71
72void xen_evtchn_handle_events(int cpu);
73
74#endif /* #ifndef __EVENTS_INTERNAL_H__ */