This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / xen / interface / sched.h
1 /******************************************************************************
2  * sched.h
3  * 
4  * Scheduler state interactions
5  * 
6  * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
7  */
8
9 #ifndef __XEN_PUBLIC_SCHED_H__
10 #define __XEN_PUBLIC_SCHED_H__
11
12 #include "event_channel.h"
13
14 /*
15  * The prototype for this hypercall is:
16  *  long sched_op(int cmd, void *arg)
17  * @cmd == SCHEDOP_??? (scheduler operation).
18  * @arg == Operation-specific extra argument(s), as described below.
19  * 
20  * Versions of Xen prior to 3.0.2 provided only the following legacy version
21  * of this hypercall, supporting only the commands yield, block and shutdown:
22  *  long sched_op(int cmd, unsigned long arg)
23  * @cmd == SCHEDOP_??? (scheduler operation).
24  * @arg == 0               (SCHEDOP_yield and SCHEDOP_block)
25  *      == SHUTDOWN_* code (SCHEDOP_shutdown)
26  * This legacy version is available to new guests as sched_op_compat().
27  */
28
29 /*
30  * Voluntarily yield the CPU.
31  * @arg == NULL.
32  */
33 #define SCHEDOP_yield       0
34
35 /*
36  * Block execution of this VCPU until an event is received for processing.
37  * If called with event upcalls masked, this operation will atomically
38  * reenable event delivery and check for pending events before blocking the
39  * VCPU. This avoids a "wakeup waiting" race.
40  * @arg == NULL.
41  */
42 #define SCHEDOP_block       1
43
44 /*
45  * Halt execution of this domain (all VCPUs) and notify the system controller.
46  * @arg == pointer to sched_shutdown structure.
47  */
48 #define SCHEDOP_shutdown    2
49 struct sched_shutdown {
50     unsigned int reason; /* SHUTDOWN_* */
51 };
52 typedef struct sched_shutdown sched_shutdown_t;
53 DEFINE_XEN_GUEST_HANDLE(sched_shutdown_t);
54
55 /*
56  * Poll a set of event-channel ports. Return when one or more are pending. An
57  * optional timeout may be specified.
58  * @arg == pointer to sched_poll structure.
59  */
60 #define SCHEDOP_poll        3
61 struct sched_poll {
62     XEN_GUEST_HANDLE(evtchn_port_t) ports;
63     unsigned int nr_ports;
64     uint64_t timeout;
65 };
66 typedef struct sched_poll sched_poll_t;
67 DEFINE_XEN_GUEST_HANDLE(sched_poll_t);
68
69 /*
70  * Declare a shutdown for another domain. The main use of this function is
71  * in interpreting shutdown requests and reasons for fully-virtualized
72  * domains.  A para-virtualized domain may use SCHEDOP_shutdown directly.
73  * @arg == pointer to sched_remote_shutdown structure.
74  */
75 #define SCHEDOP_remote_shutdown        4
76 struct sched_remote_shutdown {
77     domid_t domain_id;         /* Remote domain ID */
78     unsigned int reason;       /* SHUTDOWN_xxx reason */
79 };
80 typedef struct sched_remote_shutdown sched_remote_shutdown_t;
81 DEFINE_XEN_GUEST_HANDLE(sched_remote_shutdown_t);
82
83 /*
84  * Reason codes for SCHEDOP_shutdown. These may be interpreted by control
85  * software to determine the appropriate action. For the most part, Xen does
86  * not care about the shutdown code.
87  */
88 #define SHUTDOWN_poweroff   0  /* Domain exited normally. Clean up and kill. */
89 #define SHUTDOWN_reboot     1  /* Clean up, kill, and then restart.          */
90 #define SHUTDOWN_suspend    2  /* Clean up, save suspend info, kill.         */
91 #define SHUTDOWN_crash      3  /* Tell controller we've crashed.             */
92
93 #endif /* __XEN_PUBLIC_SCHED_H__ */
94
95 /*
96  * Local variables:
97  * mode: C
98  * c-set-style: "BSD"
99  * c-basic-offset: 4
100  * tab-width: 4
101  * indent-tabs-mode: nil
102  * End:
103  */