1843e1988Sjohnlev /****************************************************************************** 2843e1988Sjohnlev * sched.h 3*55fea89dSDan Cross * 4843e1988Sjohnlev * Scheduler state interactions 5*55fea89dSDan Cross * 6843e1988Sjohnlev * Permission is hereby granted, free of charge, to any person obtaining a copy 7843e1988Sjohnlev * of this software and associated documentation files (the "Software"), to 8843e1988Sjohnlev * deal in the Software without restriction, including without limitation the 9843e1988Sjohnlev * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10843e1988Sjohnlev * sell copies of the Software, and to permit persons to whom the Software is 11843e1988Sjohnlev * furnished to do so, subject to the following conditions: 12843e1988Sjohnlev * 13843e1988Sjohnlev * The above copyright notice and this permission notice shall be included in 14843e1988Sjohnlev * all copies or substantial portions of the Software. 15843e1988Sjohnlev * 16843e1988Sjohnlev * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17843e1988Sjohnlev * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18843e1988Sjohnlev * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19843e1988Sjohnlev * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20843e1988Sjohnlev * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21843e1988Sjohnlev * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22843e1988Sjohnlev * DEALINGS IN THE SOFTWARE. 23843e1988Sjohnlev * 24843e1988Sjohnlev * Copyright (c) 2005, Keir Fraser <keir@xensource.com> 25843e1988Sjohnlev */ 26843e1988Sjohnlev 27843e1988Sjohnlev #ifndef __XEN_PUBLIC_SCHED_H__ 28843e1988Sjohnlev #define __XEN_PUBLIC_SCHED_H__ 29843e1988Sjohnlev 30843e1988Sjohnlev #include "event_channel.h" 31843e1988Sjohnlev 32843e1988Sjohnlev /* 33843e1988Sjohnlev * The prototype for this hypercall is: 34843e1988Sjohnlev * long sched_op(int cmd, void *arg) 35843e1988Sjohnlev * @cmd == SCHEDOP_??? (scheduler operation). 36843e1988Sjohnlev * @arg == Operation-specific extra argument(s), as described below. 37*55fea89dSDan Cross * 38843e1988Sjohnlev * Versions of Xen prior to 3.0.2 provided only the following legacy version 39843e1988Sjohnlev * of this hypercall, supporting only the commands yield, block and shutdown: 40843e1988Sjohnlev * long sched_op(int cmd, unsigned long arg) 41843e1988Sjohnlev * @cmd == SCHEDOP_??? (scheduler operation). 42843e1988Sjohnlev * @arg == 0 (SCHEDOP_yield and SCHEDOP_block) 43843e1988Sjohnlev * == SHUTDOWN_* code (SCHEDOP_shutdown) 44843e1988Sjohnlev * This legacy version is available to new guests as sched_op_compat(). 45843e1988Sjohnlev */ 46843e1988Sjohnlev 47843e1988Sjohnlev /* 48843e1988Sjohnlev * Voluntarily yield the CPU. 49843e1988Sjohnlev * @arg == NULL. 50843e1988Sjohnlev */ 51843e1988Sjohnlev #define SCHEDOP_yield 0 52843e1988Sjohnlev 53843e1988Sjohnlev /* 54843e1988Sjohnlev * Block execution of this VCPU until an event is received for processing. 55843e1988Sjohnlev * If called with event upcalls masked, this operation will atomically 56843e1988Sjohnlev * reenable event delivery and check for pending events before blocking the 57843e1988Sjohnlev * VCPU. This avoids a "wakeup waiting" race. 58843e1988Sjohnlev * @arg == NULL. 59843e1988Sjohnlev */ 60843e1988Sjohnlev #define SCHEDOP_block 1 61843e1988Sjohnlev 62843e1988Sjohnlev /* 63843e1988Sjohnlev * Halt execution of this domain (all VCPUs) and notify the system controller. 64843e1988Sjohnlev * @arg == pointer to sched_shutdown structure. 65843e1988Sjohnlev */ 66843e1988Sjohnlev #define SCHEDOP_shutdown 2 67843e1988Sjohnlev struct sched_shutdown { 68843e1988Sjohnlev unsigned int reason; /* SHUTDOWN_* */ 69843e1988Sjohnlev }; 70843e1988Sjohnlev typedef struct sched_shutdown sched_shutdown_t; 71843e1988Sjohnlev DEFINE_XEN_GUEST_HANDLE(sched_shutdown_t); 72843e1988Sjohnlev 73843e1988Sjohnlev /* 74843e1988Sjohnlev * Poll a set of event-channel ports. Return when one or more are pending. An 75843e1988Sjohnlev * optional timeout may be specified. 76843e1988Sjohnlev * @arg == pointer to sched_poll structure. 77843e1988Sjohnlev */ 78843e1988Sjohnlev #define SCHEDOP_poll 3 79843e1988Sjohnlev struct sched_poll { 80843e1988Sjohnlev XEN_GUEST_HANDLE(evtchn_port_t) ports; 81843e1988Sjohnlev unsigned int nr_ports; 82843e1988Sjohnlev uint64_t timeout; 83843e1988Sjohnlev }; 84843e1988Sjohnlev typedef struct sched_poll sched_poll_t; 85843e1988Sjohnlev DEFINE_XEN_GUEST_HANDLE(sched_poll_t); 86843e1988Sjohnlev 87843e1988Sjohnlev /* 88843e1988Sjohnlev * Declare a shutdown for another domain. The main use of this function is 89843e1988Sjohnlev * in interpreting shutdown requests and reasons for fully-virtualized 90843e1988Sjohnlev * domains. A para-virtualized domain may use SCHEDOP_shutdown directly. 91843e1988Sjohnlev * @arg == pointer to sched_remote_shutdown structure. 92843e1988Sjohnlev */ 93843e1988Sjohnlev #define SCHEDOP_remote_shutdown 4 94843e1988Sjohnlev struct sched_remote_shutdown { 95843e1988Sjohnlev domid_t domain_id; /* Remote domain ID */ 96843e1988Sjohnlev unsigned int reason; /* SHUTDOWN_xxx reason */ 97843e1988Sjohnlev }; 98843e1988Sjohnlev typedef struct sched_remote_shutdown sched_remote_shutdown_t; 99843e1988Sjohnlev DEFINE_XEN_GUEST_HANDLE(sched_remote_shutdown_t); 100843e1988Sjohnlev 101843e1988Sjohnlev /* 102843e1988Sjohnlev * Reason codes for SCHEDOP_shutdown. These may be interpreted by control 103843e1988Sjohnlev * software to determine the appropriate action. For the most part, Xen does 104843e1988Sjohnlev * not care about the shutdown code. 105843e1988Sjohnlev */ 106843e1988Sjohnlev #define SHUTDOWN_poweroff 0 /* Domain exited normally. Clean up and kill. */ 107843e1988Sjohnlev #define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */ 108843e1988Sjohnlev #define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */ 109843e1988Sjohnlev #define SHUTDOWN_crash 3 /* Tell controller we've crashed. */ 110843e1988Sjohnlev 111843e1988Sjohnlev #endif /* __XEN_PUBLIC_SCHED_H__ */ 112843e1988Sjohnlev 113843e1988Sjohnlev /* 114843e1988Sjohnlev * Local variables: 115843e1988Sjohnlev * mode: C 116843e1988Sjohnlev * c-set-style: "BSD" 117843e1988Sjohnlev * c-basic-offset: 4 118843e1988Sjohnlev * tab-width: 4 119843e1988Sjohnlev * indent-tabs-mode: nil 120843e1988Sjohnlev * End: 121843e1988Sjohnlev */ 122