ia64/linux-2.6.18-xen.hg

view include/xen/evtchn.h @ 659:ad374a7a9f3e

Revert 654:8925ce7552528 (linux/pci-msi: translate Xen-provided PIRQs)

Breaks the -xenU configuration ("MAX_IO_APICS undefined")

Also implicated in kernel crash during save/restore in our automated
tests.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Sep 05 12:39:29 2008 +0100 (2008-09-05)
parents 8925ce755252
children 7886619f623e
line source
1 /******************************************************************************
2 * evtchn.h
3 *
4 * Communication via Xen event channels.
5 * Also definitions for the device that demuxes notifications to userspace.
6 *
7 * Copyright (c) 2004-2005, K A Fraser
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version 2
11 * as published by the Free Software Foundation; or, when distributed
12 * separately from the Linux kernel or incorporated into other
13 * software packages, subject to the following license:
14 *
15 * Permission is hereby granted, free of charge, to any person obtaining a copy
16 * of this source file (the "Software"), to deal in the Software without
17 * restriction, including without limitation the rights to use, copy, modify,
18 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
19 * and to permit persons to whom the Software is furnished to do so, subject to
20 * the following conditions:
21 *
22 * The above copyright notice and this permission notice shall be included in
23 * all copies or substantial portions of the Software.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
31 * IN THE SOFTWARE.
32 */
34 #ifndef __ASM_EVTCHN_H__
35 #define __ASM_EVTCHN_H__
37 #include <linux/interrupt.h>
38 #include <asm/hypervisor.h>
39 #include <asm/ptrace.h>
40 #include <asm/synch_bitops.h>
41 #include <xen/interface/event_channel.h>
42 #include <linux/smp.h>
44 /*
45 * LOW-LEVEL DEFINITIONS
46 */
48 /*
49 * Dynamically bind an event source to an IRQ-like callback handler.
50 * On some platforms this may not be implemented via the Linux IRQ subsystem.
51 * The IRQ argument passed to the callback handler is the same as returned
52 * from the bind call. It may not correspond to a Linux IRQ number.
53 * Returns IRQ or negative errno.
54 */
55 int bind_caller_port_to_irqhandler(
56 unsigned int caller_port,
57 irqreturn_t (*handler)(int, void *, struct pt_regs *),
58 unsigned long irqflags,
59 const char *devname,
60 void *dev_id);
61 int bind_listening_port_to_irqhandler(
62 unsigned int remote_domain,
63 irqreturn_t (*handler)(int, void *, struct pt_regs *),
64 unsigned long irqflags,
65 const char *devname,
66 void *dev_id);
67 int bind_interdomain_evtchn_to_irqhandler(
68 unsigned int remote_domain,
69 unsigned int remote_port,
70 irqreturn_t (*handler)(int, void *, struct pt_regs *),
71 unsigned long irqflags,
72 const char *devname,
73 void *dev_id);
74 int bind_virq_to_irqhandler(
75 unsigned int virq,
76 unsigned int cpu,
77 irqreturn_t (*handler)(int, void *, struct pt_regs *),
78 unsigned long irqflags,
79 const char *devname,
80 void *dev_id);
81 int bind_ipi_to_irqhandler(
82 unsigned int ipi,
83 unsigned int cpu,
84 irqreturn_t (*handler)(int, void *, struct pt_regs *),
85 unsigned long irqflags,
86 const char *devname,
87 void *dev_id);
89 /*
90 * Common unbind function for all event sources. Takes IRQ to unbind from.
91 * Automatically closes the underlying event channel (except for bindings
92 * made with bind_caller_port_to_irqhandler()).
93 */
94 void unbind_from_irqhandler(unsigned int irq, void *dev_id);
96 void irq_resume(void);
98 /* Entry point for notifications into Linux subsystems. */
99 asmlinkage void evtchn_do_upcall(struct pt_regs *regs);
101 /* Entry point for notifications into the userland character device. */
102 void evtchn_device_upcall(int port);
104 void mask_evtchn(int port);
105 void disable_all_local_evtchn(void);
106 void unmask_evtchn(int port);
108 #ifdef CONFIG_SMP
109 void rebind_evtchn_to_cpu(int port, unsigned int cpu);
110 #else
111 #define rebind_evtchn_to_cpu(port, cpu) ((void)0)
112 #endif
114 static inline int test_and_set_evtchn_mask(int port)
115 {
116 shared_info_t *s = HYPERVISOR_shared_info;
117 return synch_test_and_set_bit(port, s->evtchn_mask);
118 }
120 static inline void clear_evtchn(int port)
121 {
122 shared_info_t *s = HYPERVISOR_shared_info;
123 synch_clear_bit(port, s->evtchn_pending);
124 }
126 static inline void notify_remote_via_evtchn(int port)
127 {
128 struct evtchn_send send = { .port = port };
129 VOID(HYPERVISOR_event_channel_op(EVTCHNOP_send, &send));
130 }
132 /*
133 * Use these to access the event channel underlying the IRQ handle returned
134 * by bind_*_to_irqhandler().
135 */
136 void notify_remote_via_irq(int irq);
137 int irq_to_evtchn_port(int irq);
139 #define PIRQ_SET_MAPPING 0x0
140 #define PIRQ_CLEAR_MAPPING 0x1
141 #define PIRQ_GET_MAPPING 0x3
142 int pirq_mapstatus(int pirq, int action);
143 int set_pirq_hw_action(int pirq, int (*action)(int pirq, int action));
144 int clear_pirq_hw_action(int pirq);
146 #define PIRQ_STARTUP 1
147 #define PIRQ_SHUTDOWN 2
148 #define PIRQ_ENABLE 3
149 #define PIRQ_DISABLE 4
150 #define PIRQ_END 5
151 #define PIRQ_ACK 6
153 #endif /* __ASM_EVTCHN_H__ */