Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / xen / include / xen3-public / sched.h
blob05d582f9695f9773d32926baad370933da01fbaa
1 /* $NetBSD: sched.h,v 1.4.28.1 2007/10/03 19:26:08 garbled Exp $ */
2 /******************************************************************************
3 * sched.h
4 *
5 * Scheduler state interactions
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to
9 * deal in the Software without restriction, including without limitation the
10 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
11 * sell copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
25 * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
28 #ifndef __XEN_PUBLIC_SCHED_H__
29 #define __XEN_PUBLIC_SCHED_H__
31 #include "event_channel.h"
34 * The prototype for this hypercall is:
35 * long sched_op(int cmd, void *arg)
36 * @cmd == SCHEDOP_??? (scheduler operation).
37 * @arg == Operation-specific extra argument(s), as described below.
39 * Versions of Xen prior to 3.0.2 provided only the following legacy version
40 * of this hypercall, supporting only the commands yield, block and shutdown:
41 * long sched_op(int cmd, unsigned long arg)
42 * @cmd == SCHEDOP_??? (scheduler operation).
43 * @arg == 0 (SCHEDOP_yield and SCHEDOP_block)
44 * == SHUTDOWN_* code (SCHEDOP_shutdown)
45 * This legacy version is available to new guests as sched_op_compat().
49 * Voluntarily yield the CPU.
50 * @arg == NULL.
52 #define SCHEDOP_yield 0
55 * Block execution of this VCPU until an event is received for processing.
56 * If called with event upcalls masked, this operation will atomically
57 * reenable event delivery and check for pending events before blocking the
58 * VCPU. This avoids a "wakeup waiting" race.
59 * @arg == NULL.
61 #define SCHEDOP_block 1
64 * Halt execution of this domain (all VCPUs) and notify the system controller.
65 * @arg == pointer to sched_shutdown structure.
67 #define SCHEDOP_shutdown 2
68 struct sched_shutdown {
69 unsigned int reason; /* SHUTDOWN_* */
71 typedef struct sched_shutdown sched_shutdown_t;
72 DEFINE_XEN_GUEST_HANDLE(sched_shutdown_t);
75 * Poll a set of event-channel ports. Return when one or more are pending. An
76 * optional timeout may be specified.
77 * @arg == pointer to sched_poll structure.
79 #define SCHEDOP_poll 3
80 struct sched_poll {
81 XEN_GUEST_HANDLE(evtchn_port_t) ports;
82 unsigned int nr_ports;
83 uint64_t timeout;
85 typedef struct sched_poll sched_poll_t;
86 DEFINE_XEN_GUEST_HANDLE(sched_poll_t);
89 * Declare a shutdown for another domain. The main use of this function is
90 * in interpreting shutdown requests and reasons for fully-virtualized
91 * domains. A para-virtualized domain may use SCHEDOP_shutdown directly.
92 * @arg == pointer to sched_remote_shutdown structure.
94 #define SCHEDOP_remote_shutdown 4
95 struct sched_remote_shutdown {
96 domid_t domain_id; /* Remote domain ID */
97 unsigned int reason; /* SHUTDOWN_xxx reason */
99 typedef struct sched_remote_shutdown sched_remote_shutdown_t;
100 DEFINE_XEN_GUEST_HANDLE(sched_remote_shutdown_t);
103 * Reason codes for SCHEDOP_shutdown. These may be interpreted by control
104 * software to determine the appropriate action. For the most part, Xen does
105 * not care about the shutdown code.
107 #define SHUTDOWN_poweroff 0 /* Domain exited normally. Clean up and kill. */
108 #define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */
109 #define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */
110 #define SHUTDOWN_crash 3 /* Tell controller we've crashed. */
112 #endif /* __XEN_PUBLIC_SCHED_H__ */
115 * Local variables:
116 * mode: C
117 * c-set-style: "BSD"
118 * c-basic-offset: 4
119 * tab-width: 4
120 * indent-tabs-mode: nil
121 * End: