ia64/linux-2.6.18-xen.hg

view include/xen/interface/sysctl.h @ 540:db71fb3204b5

Sync public Xen hedaers with xen-unstable.hg
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon May 12 10:03:08 2008 +0100 (2008-05-12)
parents 854690f06ed9
children 8ce60d057d0c
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 /* (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;
96 uint32_t nr_cpus;
97 uint32_t nr_nodes;
98 uint32_t cpu_khz;
99 uint64_aligned_t total_pages;
100 uint64_aligned_t free_pages;
101 uint64_aligned_t scrub_pages;
102 uint32_t hw_cap[8];
104 /*
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!
108 */
109 uint32_t max_cpu_id;
110 /*
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.
117 */
118 XEN_GUEST_HANDLE_64(uint32) cpu_to_node;
120 /* XEN_SYSCTL_PHYSCAP_??? */
121 uint32_t capabilities;
122 };
123 typedef struct xen_sysctl_physinfo xen_sysctl_physinfo_t;
124 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_physinfo_t);
126 /*
127 * Get the ID of the current scheduler.
128 */
129 #define XEN_SYSCTL_sched_id 4
130 struct xen_sysctl_sched_id {
131 /* OUT variable */
132 uint32_t sched_id;
133 };
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 */
145 };
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 {
152 /* IN variables. */
153 uint32_t cmd; /* XEN_SYSCTL_PERFCOP_??? */
154 /* OUT variables. */
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;
161 };
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 {
167 /* IN variables. */
168 domid_t first_domain;
169 uint32_t max_domains;
170 XEN_GUEST_HANDLE_64(xen_domctl_getdomaininfo_t) buffer;
171 /* OUT variables. */
172 uint32_t num_domains;
173 };
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 {
180 /* IN variables. */
181 XEN_GUEST_HANDLE_64(char) keys;
182 uint32_t nr_keys;
183 };
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;
191 };
192 typedef struct xen_sysctl_cpuinfo xen_sysctl_cpuinfo_t;
193 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpuinfo_t);
194 struct xen_sysctl_getcpuinfo {
195 /* IN variables. */
196 uint32_t max_cpus;
197 XEN_GUEST_HANDLE_64(xen_sysctl_cpuinfo_t) info;
198 /* OUT variables. */
199 uint32_t nr_cpus;
200 };
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 {
206 /* IN variables. */
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). */
210 /* OUT variables. */
211 uint64_aligned_t avail_bytes;/* Bytes available in the specified region. */
212 };
213 typedef struct xen_sysctl_availheap xen_sysctl_availheap_t;
214 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_availheap_t);
216 struct xen_sysctl {
217 uint32_t cmd;
218 uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
219 union {
220 struct xen_sysctl_readconsole readconsole;
221 struct xen_sysctl_tbuf_op tbuf_op;
222 struct xen_sysctl_physinfo physinfo;
223 struct xen_sysctl_sched_id sched_id;
224 struct xen_sysctl_perfc_op perfc_op;
225 struct xen_sysctl_getdomaininfolist getdomaininfolist;
226 struct xen_sysctl_debug_keys debug_keys;
227 struct xen_sysctl_getcpuinfo getcpuinfo;
228 struct xen_sysctl_availheap availheap;
229 uint8_t pad[128];
230 } u;
231 };
232 typedef struct xen_sysctl xen_sysctl_t;
233 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_t);
235 #endif /* __XEN_PUBLIC_SYSCTL_H__ */
237 /*
238 * Local variables:
239 * mode: C
240 * c-set-style: "BSD"
241 * c-basic-offset: 4
242 * tab-width: 4
243 * indent-tabs-mode: nil
244 * End:
245 */