debuggers.hg

view xen/include/xen/event.h @ 3329:37cb59b9ddfd

bitkeeper revision 1.1159.1.484 (41c1a3e20WEWxhNQDQK6avGv36pVEA)

Remove per vcpu misdirect virq support.
author cl349@arcadians.cl.cam.ac.uk
date Thu Dec 16 15:04:02 2004 +0000 (2004-12-16)
parents b12c5094e28c
children cd853615e655
line source
1 /******************************************************************************
2 * event.h
3 *
4 * A nice interface for passing asynchronous events to guest OSes.
5 *
6 * Copyright (c) 2002, K A Fraser
7 */
9 #ifndef __XEN_EVENT_H__
10 #define __XEN_EVENT_H__
12 #include <xen/config.h>
13 #include <xen/sched.h>
14 #include <asm/bitops.h>
16 /*
17 * EVENT-CHANNEL NOTIFICATIONS
18 * NB. On x86, the atomic bit operations also act as memory barriers. There
19 * is therefore sufficiently strict ordering for this architecture -- others
20 * may require explicit memory barriers.
21 */
23 static inline void evtchn_set_pending(struct exec_domain *ed, int port)
24 {
25 struct domain *d = ed->domain;
26 shared_info_t *s = d->shared_info;
27 int running;
29 /* These three operations must happen in strict order. */
30 if ( !test_and_set_bit(port, &s->evtchn_pending[0]) &&
31 !test_bit (port, &s->evtchn_mask[0]) &&
32 !test_and_set_bit(port>>5, &ed->vcpu_info->evtchn_pending_sel) )
33 {
34 /* The VCPU pending flag must be set /after/ update to evtchn-pend. */
35 set_bit(0, &ed->vcpu_info->evtchn_upcall_pending);
37 /*
38 * NB1. 'flags' and 'processor' must be checked /after/ update of
39 * pending flag. These values may fluctuate (after all, we hold no
40 * locks) but the key insight is that each change will cause
41 * evtchn_upcall_pending to be polled.
42 *
43 * NB2. We save DF_RUNNING across the unblock to avoid a needless
44 * IPI for domains that we IPI'd to unblock.
45 */
46 running = test_bit(EDF_RUNNING, &ed->ed_flags);
47 exec_domain_unblock(ed);
48 if ( running )
49 smp_send_event_check_cpu(ed->processor);
50 }
51 }
53 /*
54 * send_guest_virq:
55 * @d: Domain to which virtual IRQ should be sent
56 * @virq: Virtual IRQ number (VIRQ_*)
57 */
58 static inline void send_guest_virq(struct exec_domain *ed, int virq)
59 {
60 int port = ed->virq_to_evtchn[virq];
62 /* Always deliver misdirect virq's to exec domain 0. */
63 if ( unlikely(port == 0) )
64 ed = ed->domain->exec_domain[0];
65 evtchn_set_pending(ed, port);
66 }
68 /*
69 * send_guest_pirq:
70 * @d: Domain to which physical IRQ should be sent
71 * @pirq: Physical IRQ number
72 */
73 static inline void send_guest_pirq(struct exec_domain *ed, int pirq)
74 {
75 evtchn_set_pending(ed, ed->domain->pirq_to_evtchn[pirq]);
76 }
78 #define event_pending(_d) \
79 ((_d)->vcpu_info->evtchn_upcall_pending && \
80 !(_d)->vcpu_info->evtchn_upcall_mask)
82 #endif /* __XEN_EVENT_H__ */