/******************************************************************************1* sched.h2*3* Scheduler state interactions4*5* Copyright (c) 2005, Keir Fraser <[email protected]>6*/78#ifndef __XEN_PUBLIC_SCHED_H__9#define __XEN_PUBLIC_SCHED_H__1011#include "event_channel.h"1213/*14* The prototype for this hypercall is:15* long sched_op_new(int cmd, void *arg)16* @cmd == SCHEDOP_??? (scheduler operation).17* @arg == Operation-specific extra argument(s), as described below.18*19* **NOTE**:20* Versions of Xen prior to 3.0.2 provide only the following legacy version21* 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*/2728/*29* Voluntarily yield the CPU.30* @arg == NULL.31*/32#define SCHEDOP_yield 03334/*35* Block execution of this VCPU until an event is received for processing.36* If called with event upcalls masked, this operation will atomically37* reenable event delivery and check for pending events before blocking the38* VCPU. This avoids a "wakeup waiting" race.39* @arg == NULL.40*/41#define SCHEDOP_block 14243/*44* Halt execution of this domain (all VCPUs) and notify the system controller.45* @arg == pointer to sched_shutdown structure.46*/47#define SCHEDOP_shutdown 248struct sched_shutdown {49unsigned int reason; /* SHUTDOWN_* */50};51DEFINE_GUEST_HANDLE_STRUCT(sched_shutdown);5253/*54* Poll a set of event-channel ports. Return when one or more are pending. An55* optional timeout may be specified.56* @arg == pointer to sched_poll structure.57*/58#define SCHEDOP_poll 359struct sched_poll {60GUEST_HANDLE(evtchn_port_t) ports;61unsigned int nr_ports;62uint64_t timeout;63};64DEFINE_GUEST_HANDLE_STRUCT(sched_poll);6566/*67* Declare a shutdown for another domain. The main use of this function is68* in interpreting shutdown requests and reasons for fully-virtualized69* domains. A para-virtualized domain may use SCHEDOP_shutdown directly.70* @arg == pointer to sched_remote_shutdown structure.71*/72#define SCHEDOP_remote_shutdown 473struct sched_remote_shutdown {74domid_t domain_id; /* Remote domain ID */75unsigned int reason; /* SHUTDOWN_xxx reason */76};7778/*79* Latch a shutdown code, so that when the domain later shuts down it80* reports this code to the control tools.81* @arg == as for SCHEDOP_shutdown.82*/83#define SCHEDOP_shutdown_code 58485/*86* Setup, poke and destroy a domain watchdog timer.87* @arg == pointer to sched_watchdog structure.88* With id == 0, setup a domain watchdog timer to cause domain shutdown89* after timeout, returns watchdog id.90* With id != 0 and timeout == 0, destroy domain watchdog timer.91* With id != 0 and timeout != 0, poke watchdog timer and set new timeout.92*/93#define SCHEDOP_watchdog 694struct sched_watchdog {95uint32_t id; /* watchdog ID */96uint32_t timeout; /* timeout */97};9899/*100* Reason codes for SCHEDOP_shutdown. These may be interpreted by control101* software to determine the appropriate action. For the most part, Xen does102* not care about the shutdown code.103*/104#define SHUTDOWN_poweroff 0 /* Domain exited normally. Clean up and kill. */105#define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */106#define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */107#define SHUTDOWN_crash 3 /* Tell controller we've crashed. */108#define SHUTDOWN_watchdog 4 /* Restart because watchdog time expired. */109110#endif /* __XEN_PUBLIC_SCHED_H__ */111112113