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