Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Permission to use, copy, modify, and/or distribute this software for any
0003  * purpose with or without fee is hereby granted, provided that the above
0004  * copyright notice and this permission notice appear in all copies.
0005  *
0006  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
0007  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
0008  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
0009  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
0010  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
0011  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
0012  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0013  *
0014  * Copyright (C) 2019 Intel Corporation
0015  */
0016 #ifndef _UAPI_LINUX_UM_TIMETRAVEL_H
0017 #define _UAPI_LINUX_UM_TIMETRAVEL_H
0018 #include <linux/types.h>
0019 
0020 /**
0021  * struct um_timetravel_msg - UM time travel message
0022  *
0023  * This is the basic message type, going in both directions.
0024  *
0025  * This is the message passed between the host (user-mode Linux instance)
0026  * and the calendar (the application on the other side of the socket) in
0027  * order to implement common scheduling.
0028  *
0029  * Whenever UML has an event it will request runtime for it from the
0030  * calendar, and then wait for its turn until it can run, etc. Note
0031  * that it will only ever request the single next runtime, i.e. multiple
0032  * REQUEST messages override each other.
0033  */
0034 struct um_timetravel_msg {
0035     /**
0036      * @op: operation value from &enum um_timetravel_ops
0037      */
0038     __u32 op;
0039 
0040     /**
0041      * @seq: sequence number for the message - shall be reflected in
0042      *  the ACK response, and should be checked while processing
0043      *  the response to see if it matches
0044      */
0045     __u32 seq;
0046 
0047     /**
0048      * @time: time in nanoseconds
0049      */
0050     __u64 time;
0051 };
0052 
0053 /**
0054  * enum um_timetravel_ops - Operation codes
0055  */
0056 enum um_timetravel_ops {
0057     /**
0058      * @UM_TIMETRAVEL_ACK: response (ACK) to any previous message,
0059      *  this usually doesn't carry any data in the 'time' field
0060      *  unless otherwise specified below
0061      */
0062     UM_TIMETRAVEL_ACK       = 0,
0063 
0064     /**
0065      * @UM_TIMETRAVEL_START: initialize the connection, the time
0066      *  field contains an (arbitrary) ID to possibly be able
0067      *  to distinguish the connections.
0068      */
0069     UM_TIMETRAVEL_START     = 1,
0070 
0071     /**
0072      * @UM_TIMETRAVEL_REQUEST: request to run at the given time
0073      *  (host -> calendar)
0074      */
0075     UM_TIMETRAVEL_REQUEST       = 2,
0076 
0077     /**
0078      * @UM_TIMETRAVEL_WAIT: Indicate waiting for the previously requested
0079      *  runtime, new requests may be made while waiting (e.g. due to
0080      *  interrupts); the time field is ignored. The calendar must process
0081      *  this message and later  send a %UM_TIMETRAVEL_RUN message when
0082      *  the host can run again.
0083      *  (host -> calendar)
0084      */
0085     UM_TIMETRAVEL_WAIT      = 3,
0086 
0087     /**
0088      * @UM_TIMETRAVEL_GET: return the current time from the calendar in the
0089      *  ACK message, the time in the request message is ignored
0090      *  (host -> calendar)
0091      */
0092     UM_TIMETRAVEL_GET       = 4,
0093 
0094     /**
0095      * @UM_TIMETRAVEL_UPDATE: time update to the calendar, must be sent e.g.
0096      *  before kicking an interrupt to another calendar
0097      *  (host -> calendar)
0098      */
0099     UM_TIMETRAVEL_UPDATE        = 5,
0100 
0101     /**
0102      * @UM_TIMETRAVEL_RUN: run time request granted, current time is in
0103      *  the time field
0104      *  (calendar -> host)
0105      */
0106     UM_TIMETRAVEL_RUN       = 6,
0107 
0108     /**
0109      * @UM_TIMETRAVEL_FREE_UNTIL: Enable free-running until the given time,
0110      *  this is a message from the calendar telling the host that it can
0111      *  freely do its own scheduling for anything before the indicated
0112      *  time.
0113      *  Note that if a calendar sends this message once, the host may
0114      *  assume that it will also do so in the future, if it implements
0115      *  wraparound semantics for the time field.
0116      *  (calendar -> host)
0117      */
0118     UM_TIMETRAVEL_FREE_UNTIL    = 7,
0119 
0120     /**
0121      * @UM_TIMETRAVEL_GET_TOD: Return time of day, typically used once at
0122      *  boot by the virtual machines to get a synchronized time from
0123      *  the simulation.
0124      */
0125     UM_TIMETRAVEL_GET_TOD       = 8,
0126 };
0127 
0128 #endif /* _UAPI_LINUX_UM_TIMETRAVEL_H */