1 /******************************************************************************
4 * Scheduler state interactions
6 * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
9 #ifndef __XEN_PUBLIC_SCHED_H__
10 #define __XEN_PUBLIC_SCHED_H__
12 #include "event_channel.h"
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.
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().
30 * Voluntarily yield the CPU.
33 #define SCHEDOP_yield 0
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.
42 #define SCHEDOP_block 1
45 * Halt execution of this domain (all VCPUs) and notify the system controller.
46 * @arg == pointer to sched_shutdown structure.
48 #define SCHEDOP_shutdown 2
49 struct sched_shutdown {
50 unsigned int reason; /* SHUTDOWN_* */
52 typedef struct sched_shutdown sched_shutdown_t;
53 DEFINE_XEN_GUEST_HANDLE(sched_shutdown_t);
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.
60 #define SCHEDOP_poll 3
62 XEN_GUEST_HANDLE(evtchn_port_t) ports;
63 unsigned int nr_ports;
66 typedef struct sched_poll sched_poll_t;
67 DEFINE_XEN_GUEST_HANDLE(sched_poll_t);
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.
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 */
80 typedef struct sched_remote_shutdown sched_remote_shutdown_t;
81 DEFINE_XEN_GUEST_HANDLE(sched_remote_shutdown_t);
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.
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. */
93 #endif /* __XEN_PUBLIC_SCHED_H__ */
101 * indent-tabs-mode: nil