debuggers.hg

view xen/include/public/sysctl.h @ 16712:ad0f20f5590a

Rename uintN_t guest handles to uintN, to avoid nameclash with uintN_t
macros during the handle definitions.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Dec 28 15:44:51 2007 +0000 (2007-12-28)
parents 3bb94bb35dad
children 250606290439
line source
1 /******************************************************************************
2 * sysctl.h
3 *
4 * System management operations. For use by node control stack.
5 *
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:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
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.
23 *
24 * Copyright (c) 2002-2006, K Fraser
25 */
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"
32 #endif
34 #include "xen.h"
35 #include "domctl.h"
37 #define XEN_SYSCTL_INTERFACE_VERSION 0x00000006
39 /*
40 * Read console content from Xen buffer ring.
41 */
42 #define XEN_SYSCTL_readconsole 1
43 struct xen_sysctl_readconsole {
44 /* IN: Non-zero -> clear after reading. */
45 uint8_t clear;
46 /* IN: Non-zero -> start index specified by @index field. */
47 uint8_t incremental;
48 uint8_t pad0, pad1;
49 /*
50 * IN: Start index for consuming from ring buffer (if @incremental);
51 * OUT: End index after consuming from ring buffer.
52 */
53 uint32_t index;
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. */
57 uint32_t count;
58 };
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 {
65 /* IN variables */
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
72 uint32_t cmd;
73 /* IN/OUT variables */
74 struct xenctl_cpumap cpu_mask;
75 uint32_t evt_mask;
76 /* OUT variables */
77 uint64_aligned_t buffer_mfn;
78 uint32_t size;
79 };
80 typedef struct xen_sysctl_tbuf_op xen_sysctl_tbuf_op_t;
81 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t);
83 /*
84 * Get physical information about the host machine
85 */
86 #define XEN_SYSCTL_physinfo 3
87 struct xen_sysctl_physinfo {
88 /* IN variables. */
89 uint32_t threads_per_core;
90 uint32_t cores_per_socket;
91 uint32_t nr_cpus;
92 uint32_t nr_nodes;
93 uint32_t cpu_khz;
94 uint64_aligned_t total_pages;
95 uint64_aligned_t free_pages;
96 uint64_aligned_t scrub_pages;
97 uint32_t hw_cap[8];
99 /* IN/OUT variables. */
100 /*
101 * IN: maximum addressable entry in the caller-provided cpu_to_node array.
102 * OUT: largest cpu identifier in the system.
103 * If OUT is greater than IN then the cpu_to_node array is truncated!
104 */
105 uint32_t max_cpu_id;
106 /*
107 * If not NULL, this array is filled with node identifier for each cpu.
108 * If a cpu has no node information (e.g., cpu not present) then the
109 * sentinel value ~0u is written.
110 * The size of this array is specified by the caller in @max_cpu_id.
111 * If the actual @max_cpu_id is smaller than the array then the trailing
112 * elements of the array will not be written by the sysctl.
113 */
114 XEN_GUEST_HANDLE_64(uint32) cpu_to_node;
115 };
116 typedef struct xen_sysctl_physinfo xen_sysctl_physinfo_t;
117 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_physinfo_t);
119 /*
120 * Get the ID of the current scheduler.
121 */
122 #define XEN_SYSCTL_sched_id 4
123 struct xen_sysctl_sched_id {
124 /* OUT variable */
125 uint32_t sched_id;
126 };
127 typedef struct xen_sysctl_sched_id xen_sysctl_sched_id_t;
128 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_sched_id_t);
130 /* Interface for controlling Xen software performance counters. */
131 #define XEN_SYSCTL_perfc_op 5
132 /* Sub-operations: */
133 #define XEN_SYSCTL_PERFCOP_reset 1 /* Reset all counters to zero. */
134 #define XEN_SYSCTL_PERFCOP_query 2 /* Get perfctr information. */
135 struct xen_sysctl_perfc_desc {
136 char name[80]; /* name of perf counter */
137 uint32_t nr_vals; /* number of values for this counter */
138 };
139 typedef struct xen_sysctl_perfc_desc xen_sysctl_perfc_desc_t;
140 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_desc_t);
141 typedef uint32_t xen_sysctl_perfc_val_t;
142 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_val_t);
144 struct xen_sysctl_perfc_op {
145 /* IN variables. */
146 uint32_t cmd; /* XEN_SYSCTL_PERFCOP_??? */
147 /* OUT variables. */
148 uint32_t nr_counters; /* number of counters description */
149 uint32_t nr_vals; /* number of values */
150 /* counter information (or NULL) */
151 XEN_GUEST_HANDLE_64(xen_sysctl_perfc_desc_t) desc;
152 /* counter values (or NULL) */
153 XEN_GUEST_HANDLE_64(xen_sysctl_perfc_val_t) val;
154 };
155 typedef struct xen_sysctl_perfc_op xen_sysctl_perfc_op_t;
156 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_op_t);
158 #define XEN_SYSCTL_getdomaininfolist 6
159 struct xen_sysctl_getdomaininfolist {
160 /* IN variables. */
161 domid_t first_domain;
162 uint32_t max_domains;
163 XEN_GUEST_HANDLE_64(xen_domctl_getdomaininfo_t) buffer;
164 /* OUT variables. */
165 uint32_t num_domains;
166 };
167 typedef struct xen_sysctl_getdomaininfolist xen_sysctl_getdomaininfolist_t;
168 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_getdomaininfolist_t);
170 /* Inject debug keys into Xen. */
171 #define XEN_SYSCTL_debug_keys 7
172 struct xen_sysctl_debug_keys {
173 /* IN variables. */
174 XEN_GUEST_HANDLE_64(char) keys;
175 uint32_t nr_keys;
176 };
177 typedef struct xen_sysctl_debug_keys xen_sysctl_debug_keys_t;
178 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_debug_keys_t);
180 /* Get physical CPU information. */
181 #define XEN_SYSCTL_getcpuinfo 8
182 struct xen_sysctl_cpuinfo {
183 uint64_aligned_t idletime;
184 };
185 typedef struct xen_sysctl_cpuinfo xen_sysctl_cpuinfo_t;
186 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpuinfo_t);
187 struct xen_sysctl_getcpuinfo {
188 /* IN variables. */
189 uint32_t max_cpus;
190 XEN_GUEST_HANDLE_64(xen_sysctl_cpuinfo_t) info;
191 /* OUT variables. */
192 uint32_t nr_cpus;
193 };
194 typedef struct xen_sysctl_getcpuinfo xen_sysctl_getcpuinfo_t;
195 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_getcpuinfo_t);
197 #define XEN_SYSCTL_availheap 9
198 struct xen_sysctl_availheap {
199 /* IN variables. */
200 uint32_t min_bitwidth; /* Smallest address width (zero if don't care). */
201 uint32_t max_bitwidth; /* Largest address width (zero if don't care). */
202 int32_t node; /* NUMA node of interest (-1 for all nodes). */
203 /* OUT variables. */
204 uint64_aligned_t avail_bytes;/* Bytes available in the specified region. */
205 };
206 typedef struct xen_sysctl_availheap xen_sysctl_availheap_t;
207 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_availheap_t);
209 struct xen_sysctl {
210 uint32_t cmd;
211 uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
212 union {
213 struct xen_sysctl_readconsole readconsole;
214 struct xen_sysctl_tbuf_op tbuf_op;
215 struct xen_sysctl_physinfo physinfo;
216 struct xen_sysctl_sched_id sched_id;
217 struct xen_sysctl_perfc_op perfc_op;
218 struct xen_sysctl_getdomaininfolist getdomaininfolist;
219 struct xen_sysctl_debug_keys debug_keys;
220 struct xen_sysctl_getcpuinfo getcpuinfo;
221 struct xen_sysctl_availheap availheap;
222 uint8_t pad[128];
223 } u;
224 };
225 typedef struct xen_sysctl xen_sysctl_t;
226 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_t);
228 #endif /* __XEN_PUBLIC_SYSCTL_H__ */
230 /*
231 * Local variables:
232 * mode: C
233 * c-set-style: "BSD"
234 * c-basic-offset: 4
235 * tab-width: 4
236 * indent-tabs-mode: nil
237 * End:
238 */