1
/******************************************************************************
4
* Scheduler state interactions
6
* Permission is hereby granted, free of charge, to any person obtaining a copy
7
* of this software and associated documentation files (the "Software"), to
8
* deal in the Software without restriction, including without limitation the
9
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10
* sell copies of the Software, and to permit persons to whom the Software is
11
* furnished to do so, subject to the following conditions:
13
* The above copyright notice and this permission notice shall be included in
14
* all copies or substantial portions of the Software.
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
* DEALINGS IN THE SOFTWARE.
24
* Copyright (c) 2005, Keir Fraser <keir@xensource.com>
27
#ifndef __XEN_PUBLIC_SCHED_H__
28
#define __XEN_PUBLIC_SCHED_H__
30
#include "event_channel.h"
33
* The prototype for this hypercall is:
34
* long sched_op(int cmd, void *arg)
35
* @cmd == SCHEDOP_??? (scheduler operation).
36
* @arg == Operation-specific extra argument(s), as described below.
38
* Versions of Xen prior to 3.0.2 provided only the following legacy version
39
* of this hypercall, supporting only the commands yield, block and shutdown:
40
* long sched_op(int cmd, unsigned long arg)
41
* @cmd == SCHEDOP_??? (scheduler operation).
42
* @arg == 0 (SCHEDOP_yield and SCHEDOP_block)
43
* == SHUTDOWN_* code (SCHEDOP_shutdown)
44
* This legacy version is available to new guests as sched_op_compat().
48
* Voluntarily yield the CPU.
51
#define SCHEDOP_yield 0
54
* Block execution of this VCPU until an event is received for processing.
55
* If called with event upcalls masked, this operation will atomically
56
* reenable event delivery and check for pending events before blocking the
57
* VCPU. This avoids a "wakeup waiting" race.
60
#define SCHEDOP_block 1
63
* Halt execution of this domain (all VCPUs) and notify the system controller.
64
* @arg == pointer to sched_shutdown structure.
66
#define SCHEDOP_shutdown 2
67
struct sched_shutdown {
68
unsigned int reason; /* SHUTDOWN_* */
70
typedef struct sched_shutdown sched_shutdown_t;
71
DEFINE_XEN_GUEST_HANDLE(sched_shutdown_t);
74
* Poll a set of event-channel ports. Return when one or more are pending. An
75
* optional timeout may be specified.
76
* @arg == pointer to sched_poll structure.
78
#define SCHEDOP_poll 3
80
XEN_GUEST_HANDLE(evtchn_port_t) ports;
81
unsigned int nr_ports;
84
typedef struct sched_poll sched_poll_t;
85
DEFINE_XEN_GUEST_HANDLE(sched_poll_t);
88
* Declare a shutdown for another domain. The main use of this function is
89
* in interpreting shutdown requests and reasons for fully-virtualized
90
* domains. A para-virtualized domain may use SCHEDOP_shutdown directly.
91
* @arg == pointer to sched_remote_shutdown structure.
93
#define SCHEDOP_remote_shutdown 4
94
struct sched_remote_shutdown {
95
domid_t domain_id; /* Remote domain ID */
96
unsigned int reason; /* SHUTDOWN_xxx reason */
98
typedef struct sched_remote_shutdown sched_remote_shutdown_t;
99
DEFINE_XEN_GUEST_HANDLE(sched_remote_shutdown_t);
102
* Reason codes for SCHEDOP_shutdown. These may be interpreted by control
103
* software to determine the appropriate action. For the most part, Xen does
104
* not care about the shutdown code.
106
#define SHUTDOWN_poweroff 0 /* Domain exited normally. Clean up and kill. */
107
#define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */
108
#define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */
109
#define SHUTDOWN_crash 3 /* Tell controller we've crashed. */
111
#endif /* __XEN_PUBLIC_SCHED_H__ */
119
* indent-tabs-mode: nil