1 /******************************************************************************
4 * System management operations. For use by node control stack.
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
24 * Copyright (c) 2002-2006, K Fraser
27 #ifndef __XEN_PUBLIC_SYSCTL_H__
28 #define __XEN_PUBLIC_SYSCTL_H__
30 #if !defined(__XEN__) && !defined(__XEN_TOOLS__)
31 #error "sysctl operations are intended for use by node control tools only"
37 #define XEN_SYSCTL_INTERFACE_VERSION 0x00000006
40 * Read console content from Xen buffer ring.
42 #define XEN_SYSCTL_readconsole 1
43 struct xen_sysctl_readconsole {
44 /* IN: Non-zero -> clear after reading. */
46 /* IN: Non-zero -> start index specified by @index field. */
50 * IN: Start index for consuming from ring buffer (if @incremental);
51 * OUT: End index after consuming from ring buffer.
54 /* IN: Virtual address to write console data. */
55 XEN_GUEST_HANDLE_64(char) buffer;
56 /* IN: Size of buffer; OUT: Bytes written to buffer. */
59 typedef struct xen_sysctl_readconsole xen_sysctl_readconsole_t;
60 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_readconsole_t);
62 /* Get trace buffers machine base address */
63 #define XEN_SYSCTL_tbuf_op 2
64 struct xen_sysctl_tbuf_op {
66 #define XEN_SYSCTL_TBUFOP_get_info 0
67 #define XEN_SYSCTL_TBUFOP_set_cpu_mask 1
68 #define XEN_SYSCTL_TBUFOP_set_evt_mask 2
69 #define XEN_SYSCTL_TBUFOP_set_size 3
70 #define XEN_SYSCTL_TBUFOP_enable 4
71 #define XEN_SYSCTL_TBUFOP_disable 5
73 /* IN/OUT variables */
74 struct xenctl_cpumap cpu_mask;
77 uint64_aligned_t buffer_mfn;
80 typedef struct xen_sysctl_tbuf_op xen_sysctl_tbuf_op_t;
81 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t);
84 * Get physical information about the host machine
86 #define XEN_SYSCTL_physinfo 3
87 /* (x86) The platform supports HVM guests. */
88 #define _XEN_SYSCTL_PHYSCAP_hvm 0
89 #define XEN_SYSCTL_PHYSCAP_hvm (1u<<_XEN_SYSCTL_PHYSCAP_hvm)
90 /* (x86) The platform supports HVM-guest direct access to I/O devices. */
91 #define _XEN_SYSCTL_PHYSCAP_hvm_directio 1
92 #define XEN_SYSCTL_PHYSCAP_hvm_directio (1u<<_XEN_SYSCTL_PHYSCAP_hvm_directio)
93 struct xen_sysctl_physinfo {
94 uint32_t threads_per_core;
95 uint32_t cores_per_socket;
99 uint64_aligned_t total_pages;
100 uint64_aligned_t free_pages;
101 uint64_aligned_t scrub_pages;
105 * IN: maximum addressable entry in the caller-provided cpu_to_node array.
106 * OUT: largest cpu identifier in the system.
107 * If OUT is greater than IN then the cpu_to_node array is truncated!
111 * If not NULL, this array is filled with node identifier for each cpu.
112 * If a cpu has no node information (e.g., cpu not present) then the
113 * sentinel value ~0u is written.
114 * The size of this array is specified by the caller in @max_cpu_id.
115 * If the actual @max_cpu_id is smaller than the array then the trailing
116 * elements of the array will not be written by the sysctl.
118 XEN_GUEST_HANDLE_64(uint32) cpu_to_node;
120 /* XEN_SYSCTL_PHYSCAP_??? */
121 uint32_t capabilities;
123 typedef struct xen_sysctl_physinfo xen_sysctl_physinfo_t;
124 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_physinfo_t);
127 * Get the ID of the current scheduler.
129 #define XEN_SYSCTL_sched_id 4
130 struct xen_sysctl_sched_id {
134 typedef struct xen_sysctl_sched_id xen_sysctl_sched_id_t;
135 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_sched_id_t);
137 /* Interface for controlling Xen software performance counters. */
138 #define XEN_SYSCTL_perfc_op 5
139 /* Sub-operations: */
140 #define XEN_SYSCTL_PERFCOP_reset 1 /* Reset all counters to zero. */
141 #define XEN_SYSCTL_PERFCOP_query 2 /* Get perfctr information. */
142 struct xen_sysctl_perfc_desc {
143 char name[80]; /* name of perf counter */
144 uint32_t nr_vals; /* number of values for this counter */
146 typedef struct xen_sysctl_perfc_desc xen_sysctl_perfc_desc_t;
147 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_desc_t);
148 typedef uint32_t xen_sysctl_perfc_val_t;
149 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_val_t);
151 struct xen_sysctl_perfc_op {
153 uint32_t cmd; /* XEN_SYSCTL_PERFCOP_??? */
155 uint32_t nr_counters; /* number of counters description */
156 uint32_t nr_vals; /* number of values */
157 /* counter information (or NULL) */
158 XEN_GUEST_HANDLE_64(xen_sysctl_perfc_desc_t) desc;
159 /* counter values (or NULL) */
160 XEN_GUEST_HANDLE_64(xen_sysctl_perfc_val_t) val;
162 typedef struct xen_sysctl_perfc_op xen_sysctl_perfc_op_t;
163 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_op_t);
165 #define XEN_SYSCTL_getdomaininfolist 6
166 struct xen_sysctl_getdomaininfolist {
168 domid_t first_domain;
169 uint32_t max_domains;
170 XEN_GUEST_HANDLE_64(xen_domctl_getdomaininfo_t) buffer;
172 uint32_t num_domains;
174 typedef struct xen_sysctl_getdomaininfolist xen_sysctl_getdomaininfolist_t;
175 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_getdomaininfolist_t);
177 /* Inject debug keys into Xen. */
178 #define XEN_SYSCTL_debug_keys 7
179 struct xen_sysctl_debug_keys {
181 XEN_GUEST_HANDLE_64(char) keys;
184 typedef struct xen_sysctl_debug_keys xen_sysctl_debug_keys_t;
185 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_debug_keys_t);
187 /* Get physical CPU information. */
188 #define XEN_SYSCTL_getcpuinfo 8
189 struct xen_sysctl_cpuinfo {
190 uint64_aligned_t idletime;
192 typedef struct xen_sysctl_cpuinfo xen_sysctl_cpuinfo_t;
193 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpuinfo_t);
194 struct xen_sysctl_getcpuinfo {
197 XEN_GUEST_HANDLE_64(xen_sysctl_cpuinfo_t) info;
201 typedef struct xen_sysctl_getcpuinfo xen_sysctl_getcpuinfo_t;
202 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_getcpuinfo_t);
204 #define XEN_SYSCTL_availheap 9
205 struct xen_sysctl_availheap {
207 uint32_t min_bitwidth; /* Smallest address width (zero if don't care). */
208 uint32_t max_bitwidth; /* Largest address width (zero if don't care). */
209 int32_t node; /* NUMA node of interest (-1 for all nodes). */
211 uint64_aligned_t avail_bytes;/* Bytes available in the specified region. */
213 typedef struct xen_sysctl_availheap xen_sysctl_availheap_t;
214 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_availheap_t);
216 #define XEN_SYSCTL_get_pmstat 10
218 uint64_aligned_t freq; /* Px core frequency */
219 uint64_aligned_t residency; /* Px residency time */
220 uint64_aligned_t count; /* Px transition count */
222 typedef struct pm_px_val pm_px_val_t;
223 DEFINE_XEN_GUEST_HANDLE(pm_px_val_t);
226 uint8_t total; /* total Px states */
227 uint8_t usable; /* usable Px states */
228 uint8_t last; /* last Px state */
229 uint8_t cur; /* current Px state */
230 XEN_GUEST_HANDLE_64(uint64) trans_pt; /* Px transition table */
231 XEN_GUEST_HANDLE_64(pm_px_val_t) pt;
233 typedef struct pm_px_stat pm_px_stat_t;
234 DEFINE_XEN_GUEST_HANDLE(pm_px_stat_t);
237 uint32_t nr; /* entry nr in triggers & residencies, including C0 */
238 uint32_t last; /* last Cx state */
239 uint64_aligned_t idle_time; /* idle time from boot */
240 XEN_GUEST_HANDLE_64(uint64) triggers; /* Cx trigger counts */
241 XEN_GUEST_HANDLE_64(uint64) residencies; /* Cx residencies */
244 struct xen_sysctl_get_pmstat {
245 #define PMSTAT_CATEGORY_MASK 0xf0
246 #define PMSTAT_PX 0x10
247 #define PMSTAT_CX 0x20
248 #define PMSTAT_get_max_px (PMSTAT_PX | 0x1)
249 #define PMSTAT_get_pxstat (PMSTAT_PX | 0x2)
250 #define PMSTAT_reset_pxstat (PMSTAT_PX | 0x3)
251 #define PMSTAT_get_max_cx (PMSTAT_CX | 0x1)
252 #define PMSTAT_get_cxstat (PMSTAT_CX | 0x2)
253 #define PMSTAT_reset_cxstat (PMSTAT_CX | 0x3)
257 struct pm_px_stat getpx;
258 struct pm_cx_stat getcx;
259 /* other struct for tx, etc */
262 typedef struct xen_sysctl_get_pmstat xen_sysctl_get_pmstat_t;
263 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_get_pmstat_t);
265 #define XEN_SYSCTL_cpu_hotplug 11
266 struct xen_sysctl_cpu_hotplug {
268 uint32_t cpu; /* Physical cpu. */
269 #define XEN_SYSCTL_CPU_HOTPLUG_ONLINE 0
270 #define XEN_SYSCTL_CPU_HOTPLUG_OFFLINE 1
271 uint32_t op; /* hotplug opcode */
273 typedef struct xen_sysctl_cpu_hotplug xen_sysctl_cpu_hotplug_t;
274 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpu_hotplug_t);
279 uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
281 struct xen_sysctl_readconsole readconsole;
282 struct xen_sysctl_tbuf_op tbuf_op;
283 struct xen_sysctl_physinfo physinfo;
284 struct xen_sysctl_sched_id sched_id;
285 struct xen_sysctl_perfc_op perfc_op;
286 struct xen_sysctl_getdomaininfolist getdomaininfolist;
287 struct xen_sysctl_debug_keys debug_keys;
288 struct xen_sysctl_getcpuinfo getcpuinfo;
289 struct xen_sysctl_availheap availheap;
290 struct xen_sysctl_get_pmstat get_pmstat;
291 struct xen_sysctl_cpu_hotplug cpu_hotplug;
295 typedef struct xen_sysctl xen_sysctl_t;
296 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_t);
298 #endif /* __XEN_PUBLIC_SYSCTL_H__ */
306 * indent-tabs-mode: nil