Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags   |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * vcpu.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * VCPU initialisation, query, and hotplug.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Permission is hereby granted, free of charge, to any person obtaining a copy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * of this software and associated documentation files (the "Software"), to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * deal in the Software without restriction, including without limitation the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * sell copies of the Software, and to permit persons to whom the Software is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * furnished to do so, subject to the following conditions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * The above copyright notice and this permission notice shall be included in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * all copies or substantial portions of the Software.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * DEALINGS IN THE SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #ifndef __XEN_PUBLIC_VCPU_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #define __XEN_PUBLIC_VCPU_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * Prototype for this hypercall is:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  *	int vcpu_op(int cmd, int vcpuid, void *extra_args)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  * @cmd		   == VCPUOP_??? (VCPU operation).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  * @vcpuid	   == VCPU to operate on.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  * @extra_args == Operation-specific extra arguments (NULL if none).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  * Initialise a VCPU. Each VCPU can be initialised only once. A
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  * newly-initialised VCPU will not run until it is brought up by VCPUOP_up.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  * @extra_arg == pointer to vcpu_guest_context structure containing initial
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  *				 state for the VCPU.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #define VCPUOP_initialise			 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * Bring up a VCPU. This makes the VCPU runnable. This operation will fail
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  * if the VCPU has not been initialised (VCPUOP_initialise).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #define VCPUOP_up					 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)  * Bring down a VCPU (i.e., make it non-runnable).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)  * There are a few caveats that callers should observe:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)  *	1. This operation may return, and VCPU_is_up may return false, before the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)  *	   VCPU stops running (i.e., the command is asynchronous). It is a good
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)  *	   idea to ensure that the VCPU has entered a non-critical loop before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)  *	   bringing it down. Alternatively, this operation is guaranteed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)  *	   synchronous if invoked by the VCPU itself.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  *	2. After a VCPU is initialised, there is currently no way to drop all its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)  *	   references to domain memory. Even a VCPU that is down still holds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)  *	   memory references via its pagetable base pointer and GDT. It is good
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)  *	   practise to move a VCPU onto an 'idle' or default page table, LDT and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  *	   GDT before bringing it down.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) #define VCPUOP_down					 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) /* Returns 1 if the given VCPU is up. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) #define VCPUOP_is_up				 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)  * Return information about the state and running time of a VCPU.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)  * @extra_arg == pointer to vcpu_runstate_info structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) #define VCPUOP_get_runstate_info	 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) struct vcpu_runstate_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	/* VCPU's current state (RUNSTATE_*). */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	int		 state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	/* When was current state entered (system time, ns)? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	uint64_t state_entry_time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	 * Update indicator set in state_entry_time:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	 * When activated via VMASST_TYPE_runstate_update_flag, set during
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	 * updates in guest memory mapped copy of vcpu_runstate_info.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) #define XEN_RUNSTATE_UPDATE	(1ULL << 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	 * Time spent in each RUNSTATE_* (ns). The sum of these times is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	 * guaranteed not to drift from system time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	uint64_t time[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) DEFINE_GUEST_HANDLE_STRUCT(vcpu_runstate_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) /* VCPU is currently running on a physical CPU. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) #define RUNSTATE_running  0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) /* VCPU is runnable, but not currently scheduled on any physical CPU. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #define RUNSTATE_runnable 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) /* VCPU is blocked (a.k.a. idle). It is therefore not runnable. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #define RUNSTATE_blocked  2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)  * VCPU is not runnable, but it is not blocked.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)  * This is a 'catch all' state for things like hotplug and pauses by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)  * system administrator (or for critical sections in the hypervisor).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)  * RUNSTATE_blocked dominates this state (it is the preferred state).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) #define RUNSTATE_offline  3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)  * Register a shared memory area from which the guest may obtain its own
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)  * runstate information without needing to execute a hypercall.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)  * Notes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)  *	1. The registered address may be virtual or physical, depending on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)  *	   platform. The virtual address should be registered on x86 systems.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)  *	2. Only one shared area may be registered per VCPU. The shared area is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)  *	   updated by the hypervisor each time the VCPU is scheduled. Thus
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)  *	   runstate.state will always be RUNSTATE_running and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)  *	   runstate.state_entry_time will indicate the system time at which the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)  *	   VCPU was last scheduled to run.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)  * @extra_arg == pointer to vcpu_register_runstate_memory_area structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) #define VCPUOP_register_runstate_memory_area 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) struct vcpu_register_runstate_memory_area {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 		union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 				GUEST_HANDLE(vcpu_runstate_info) h;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 				struct vcpu_runstate_info *v;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 				uint64_t p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		} addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)  * Set or stop a VCPU's periodic timer. Every VCPU has one periodic timer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)  * which can be set via these commands. Periods smaller than one millisecond
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)  * may not be supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) #define VCPUOP_set_periodic_timer	 6 /* arg == vcpu_set_periodic_timer_t */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) #define VCPUOP_stop_periodic_timer	 7 /* arg == NULL */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) struct vcpu_set_periodic_timer {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 		uint64_t period_ns;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) DEFINE_GUEST_HANDLE_STRUCT(vcpu_set_periodic_timer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)  * Set or stop a VCPU's single-shot timer. Every VCPU has one single-shot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)  * timer which can be set via these commands.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) #define VCPUOP_set_singleshot_timer	 8 /* arg == vcpu_set_singleshot_timer_t */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) #define VCPUOP_stop_singleshot_timer 9 /* arg == NULL */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) struct vcpu_set_singleshot_timer {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 		uint64_t timeout_abs_ns;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 		uint32_t flags;			   /* VCPU_SSHOTTMR_??? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) DEFINE_GUEST_HANDLE_STRUCT(vcpu_set_singleshot_timer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) /* Flags to VCPUOP_set_singleshot_timer. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)  /* Require the timeout to be in the future (return -ETIME if it's passed). */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) #define _VCPU_SSHOTTMR_future (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) #define VCPU_SSHOTTMR_future  (1U << _VCPU_SSHOTTMR_future)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)  * Register a memory location in the guest address space for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)  * vcpu_info structure.  This allows the guest to place the vcpu_info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)  * structure in a convenient place, such as in a per-cpu data area.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)  * The pointer need not be page aligned, but the structure must not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)  * cross a page boundary.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) #define VCPUOP_register_vcpu_info   10  /* arg == struct vcpu_info */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) struct vcpu_register_vcpu_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)     uint64_t mfn;    /* mfn of page to place vcpu_info */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)     uint32_t offset; /* offset within page */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)     uint32_t rsvd;   /* unused */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) DEFINE_GUEST_HANDLE_STRUCT(vcpu_register_vcpu_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) /* Send an NMI to the specified VCPU. @extra_arg == NULL. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) #define VCPUOP_send_nmi             11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)  * Get the physical ID information for a pinned vcpu's underlying physical
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)  * processor.  The physical ID informmation is architecture-specific.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)  * On x86: id[31:0]=apic_id, id[63:32]=acpi_id.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)  * This command returns -EINVAL if it is not a valid operation for this VCPU.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) #define VCPUOP_get_physid           12 /* arg == vcpu_get_physid_t */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) struct vcpu_get_physid {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	uint64_t phys_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) DEFINE_GUEST_HANDLE_STRUCT(vcpu_get_physid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) #define xen_vcpu_physid_to_x86_apicid(physid) ((uint32_t)(physid))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) #define xen_vcpu_physid_to_x86_acpiid(physid) ((uint32_t)((physid) >> 32))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)  * Register a memory location to get a secondary copy of the vcpu time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)  * parameters.  The master copy still exists as part of the vcpu shared
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)  * memory area, and this secondary copy is updated whenever the master copy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)  * is updated (and using the same versioning scheme for synchronisation).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)  * The intent is that this copy may be mapped (RO) into userspace so
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)  * that usermode can compute system time using the time info and the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)  * tsc.  Usermode will see an array of vcpu_time_info structures, one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)  * for each vcpu, and choose the right one by an existing mechanism
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)  * which allows it to get the current vcpu number (such as via a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)  * segment limit).  It can then apply the normal algorithm to compute
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)  * system time from the tsc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)  * @extra_arg == pointer to vcpu_register_time_info_memory_area structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) #define VCPUOP_register_vcpu_time_memory_area   13
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) DEFINE_GUEST_HANDLE_STRUCT(vcpu_time_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) struct vcpu_register_time_memory_area {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 		GUEST_HANDLE(vcpu_time_info) h;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 		struct pvclock_vcpu_time_info *v;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 		uint64_t p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	} addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) DEFINE_GUEST_HANDLE_STRUCT(vcpu_register_time_memory_area);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) #endif /* __XEN_PUBLIC_VCPU_H__ */