]>
Commit | Line | Data |
---|---|---|
a42089dd JF |
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 | ||
a1ce3928 | 12 | #include <xen/interface/event_channel.h> |
a42089dd JF |
13 | |
14 | /* | |
15 | * The prototype for this hypercall is: | |
16 | * long sched_op_new(int cmd, void *arg) | |
17 | * @cmd == SCHEDOP_??? (scheduler operation). | |
18 | * @arg == Operation-specific extra argument(s), as described below. | |
19 | * | |
20 | * **NOTE**: | |
21 | * Versions of Xen prior to 3.0.2 provide only the following legacy version | |
22 | * of this hypercall, supporting only the commands yield, block and shutdown: | |
23 | * long sched_op(int cmd, unsigned long arg) | |
24 | * @cmd == SCHEDOP_??? (scheduler operation). | |
25 | * @arg == 0 (SCHEDOP_yield and SCHEDOP_block) | |
26 | * == SHUTDOWN_* code (SCHEDOP_shutdown) | |
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 | DEFINE_GUEST_HANDLE_STRUCT(sched_shutdown); | |
53 | ||
54 | /* | |
55 | * Poll a set of event-channel ports. Return when one or more are pending. An | |
56 | * optional timeout may be specified. | |
57 | * @arg == pointer to sched_poll structure. | |
58 | */ | |
59 | #define SCHEDOP_poll 3 | |
60 | struct sched_poll { | |
61 | GUEST_HANDLE(evtchn_port_t) ports; | |
62 | unsigned int nr_ports; | |
63 | uint64_t timeout; | |
64 | }; | |
65 | DEFINE_GUEST_HANDLE_STRUCT(sched_poll); | |
66 | ||
066d6c7f JB |
67 | /* |
68 | * Declare a shutdown for another domain. The main use of this function is | |
69 | * in interpreting shutdown requests and reasons for fully-virtualized | |
70 | * domains. A para-virtualized domain may use SCHEDOP_shutdown directly. | |
71 | * @arg == pointer to sched_remote_shutdown structure. | |
72 | */ | |
73 | #define SCHEDOP_remote_shutdown 4 | |
74 | struct sched_remote_shutdown { | |
75 | domid_t domain_id; /* Remote domain ID */ | |
76 | unsigned int reason; /* SHUTDOWN_xxx reason */ | |
77 | }; | |
78 | ||
79 | /* | |
80 | * Latch a shutdown code, so that when the domain later shuts down it | |
81 | * reports this code to the control tools. | |
82 | * @arg == as for SCHEDOP_shutdown. | |
83 | */ | |
84 | #define SCHEDOP_shutdown_code 5 | |
85 | ||
86 | /* | |
87 | * Setup, poke and destroy a domain watchdog timer. | |
88 | * @arg == pointer to sched_watchdog structure. | |
89 | * With id == 0, setup a domain watchdog timer to cause domain shutdown | |
90 | * after timeout, returns watchdog id. | |
91 | * With id != 0 and timeout == 0, destroy domain watchdog timer. | |
92 | * With id != 0 and timeout != 0, poke watchdog timer and set new timeout. | |
93 | */ | |
94 | #define SCHEDOP_watchdog 6 | |
95 | struct sched_watchdog { | |
96 | uint32_t id; /* watchdog ID */ | |
97 | uint32_t timeout; /* timeout */ | |
98 | }; | |
99 | ||
a42089dd JF |
100 | /* |
101 | * Reason codes for SCHEDOP_shutdown. These may be interpreted by control | |
102 | * software to determine the appropriate action. For the most part, Xen does | |
103 | * not care about the shutdown code. | |
104 | */ | |
105 | #define SHUTDOWN_poweroff 0 /* Domain exited normally. Clean up and kill. */ | |
106 | #define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */ | |
107 | #define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */ | |
108 | #define SHUTDOWN_crash 3 /* Tell controller we've crashed. */ | |
066d6c7f | 109 | #define SHUTDOWN_watchdog 4 /* Restart because watchdog time expired. */ |
a42089dd JF |
110 | |
111 | #endif /* __XEN_PUBLIC_SCHED_H__ */ |