xen/x86: set VIRQ_TIMER priority to maximum
[deliverable/linux.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;
d0b075ff 38 unsigned int evtchn; /* event channel */
9a489f45
DV
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
ab9a1cca 57struct evtchn_ops {
d0b075ff
DV
58 unsigned (*max_channels)(void);
59 unsigned (*nr_channels)(void);
60
08385875 61 int (*setup)(struct irq_info *info);
ab9a1cca
DV
62 void (*bind_to_cpu)(struct irq_info *info, unsigned cpu);
63
64 void (*clear_pending)(unsigned port);
65 void (*set_pending)(unsigned port);
66 bool (*is_pending)(unsigned port);
67 bool (*test_and_set_mask)(unsigned port);
68 void (*mask)(unsigned port);
69 void (*unmask)(unsigned port);
70
71 void (*handle_events)(unsigned cpu);
72};
73
74extern const struct evtchn_ops *evtchn_ops;
75
d0b075ff
DV
76extern int **evtchn_to_irq;
77int get_evtchn_to_irq(unsigned int evtchn);
9a489f45
DV
78
79struct irq_info *info_for_irq(unsigned irq);
80unsigned cpu_from_irq(unsigned irq);
81unsigned cpu_from_evtchn(unsigned int evtchn);
82
d0b075ff
DV
83static inline unsigned xen_evtchn_max_channels(void)
84{
85 return evtchn_ops->max_channels();
86}
87
08385875
DV
88/*
89 * Do any ABI specific setup for a bound event channel before it can
90 * be unmasked and used.
91 */
92static inline int xen_evtchn_port_setup(struct irq_info *info)
93{
94 if (evtchn_ops->setup)
95 return evtchn_ops->setup(info);
96 return 0;
97}
98
ab9a1cca
DV
99static inline void xen_evtchn_port_bind_to_cpu(struct irq_info *info,
100 unsigned cpu)
101{
102 evtchn_ops->bind_to_cpu(info, cpu);
103}
104
105static inline void clear_evtchn(unsigned port)
106{
107 evtchn_ops->clear_pending(port);
108}
109
110static inline void set_evtchn(unsigned port)
111{
112 evtchn_ops->set_pending(port);
113}
114
115static inline bool test_evtchn(unsigned port)
116{
117 return evtchn_ops->is_pending(port);
118}
119
120static inline bool test_and_set_mask(unsigned port)
121{
122 return evtchn_ops->test_and_set_mask(port);
123}
124
125static inline void mask_evtchn(unsigned port)
126{
127 return evtchn_ops->mask(port);
128}
129
130static inline void unmask_evtchn(unsigned port)
131{
132 return evtchn_ops->unmask(port);
133}
9a489f45 134
ab9a1cca
DV
135static inline void xen_evtchn_handle_events(unsigned cpu)
136{
137 return evtchn_ops->handle_events(cpu);
138}
9a489f45 139
ab9a1cca 140void xen_evtchn_2l_init(void);
9a489f45
DV
141
142#endif /* #ifndef __EVENTS_INTERNAL_H__ */
This page took 0.029652 seconds and 5 git commands to generate.