1 #ifndef __VKI_XEN_SYSCTL_H
2 #define __VKI_XEN_SYSCTL_H
3 
4 /*
5  * The sysctl interface is versioned via the interface_version
6  * field. This structures in this header supports sysctl interfaces:
7  *
8  * - 00000008: Xen 4.1
9  * - 00000009: Xen 4.2
10  * - 0000000a: Xen 4.3
11  *
12  * When adding a new subop be sure to include the variants used by all
13  * of the above, both here and in syswrap-xen.c
14  *
15  * Structs which are identical in all supported versions have no
16  * version suffix. Structs which do differ are defined multiple times
17  * and use the suffix of the latest version to contain that particular
18  * variant.
19  */
20 
21 #define VKI_XEN_SYSCTL_readconsole                    1
22 #define VKI_XEN_SYSCTL_tbuf_op                        2
23 #define VKI_XEN_SYSCTL_physinfo                       3
24 #define VKI_XEN_SYSCTL_sched_id                       4
25 #define VKI_XEN_SYSCTL_perfc_op                       5
26 #define VKI_XEN_SYSCTL_getdomaininfolist              6
27 #define VKI_XEN_SYSCTL_debug_keys                     7
28 #define VKI_XEN_SYSCTL_getcpuinfo                     8
29 #define VKI_XEN_SYSCTL_availheap                      9
30 #define VKI_XEN_SYSCTL_get_pmstat                    10
31 #define VKI_XEN_SYSCTL_cpu_hotplug                   11
32 #define VKI_XEN_SYSCTL_pm_op                         12
33 #define VKI_XEN_SYSCTL_page_offline_op               14
34 #define VKI_XEN_SYSCTL_lockprof_op                   15
35 #define VKI_XEN_SYSCTL_topologyinfo                  16
36 #define VKI_XEN_SYSCTL_numainfo                      17
37 #define VKI_XEN_SYSCTL_cpupool_op                    18
38 #define VKI_XEN_SYSCTL_scheduler_op                  19
39 #define VKI_XEN_SYSCTL_coverage_op                   20
40 
41 struct vki_xen_sysctl_readconsole {
42     /* IN */
43     vki_uint8_t clear;
44     vki_uint8_t incremental;
45 
46     vki_uint8_t pad0, pad1;
47 
48     /*
49      * IN:  Start index for consumption if @incremental.
50      * OUT: End index after consuming from the console.
51      */
52     vki_uint32_t index;
53     VKI_XEN_GUEST_HANDLE_64(char) buffer; /* IN */
54 
55     /*
56      * IN:  size of buffer.
57      * OUT: bytes written into buffer.
58      */
59     vki_uint32_t count;
60 };
61 
62 struct vki_xen_sysctl_getdomaininfolist_00000008 {
63     /* IN variables. */
64     vki_xen_domid_t           first_domain;
65     vki_uint32_t              max_domains;
66     VKI_XEN_GUEST_HANDLE_64(vki_xen_domctl_getdomaininfo_00000007_t) buffer;
67     /* OUT variables. */
68     vki_uint32_t              num_domains;
69 };
70 
71 struct vki_xen_sysctl_getdomaininfolist_00000009 {
72     /* IN variables. */
73     vki_xen_domid_t           first_domain;
74     vki_uint32_t              max_domains;
75     VKI_XEN_GUEST_HANDLE_64(vki_xen_domctl_getdomaininfo_00000008_t) buffer;
76     /* OUT variables. */
77     vki_uint32_t              num_domains;
78 };
79 
80 struct vki_xen_sysctl_getdomaininfolist_0000000a {
81     /* IN variables. */
82     vki_xen_domid_t           first_domain;
83     vki_uint32_t              max_domains;
84     VKI_XEN_GUEST_HANDLE_64(vki_xen_domctl_getdomaininfo_00000009_t) buffer;
85     /* OUT variables. */
86     vki_uint32_t              num_domains;
87 };
88 
89 #define VKI_XEN_SYSCTL_CPUPOOL_OP_CREATE                1  /* C */
90 #define VKI_XEN_SYSCTL_CPUPOOL_OP_DESTROY               2  /* D */
91 #define VKI_XEN_SYSCTL_CPUPOOL_OP_INFO                  3  /* I */
92 #define VKI_XEN_SYSCTL_CPUPOOL_OP_ADDCPU                4  /* A */
93 #define VKI_XEN_SYSCTL_CPUPOOL_OP_RMCPU                 5  /* R */
94 #define VKI_XEN_SYSCTL_CPUPOOL_OP_MOVEDOMAIN            6  /* M */
95 #define VKI_XEN_SYSCTL_CPUPOOL_OP_FREEINFO              7  /* F */
96 #define VKI_XEN_SYSCTL_CPUPOOL_PAR_ANY     0xFFFFFFFF
97 struct vki_xen_sysctl_cpupool_op {
98     vki_uint32_t op;          /* IN */
99     vki_uint32_t cpupool_id;  /* IN: CDIARM OUT: CI */
100     vki_uint32_t sched_id;    /* IN: C      OUT: I  */
101     vki_uint32_t domid;       /* IN: M              */
102     vki_uint32_t cpu;         /* IN: AR             */
103     vki_uint32_t n_dom;       /*            OUT: I  */
104     struct vki_xenctl_bitmap cpumap; /*     OUT: IF */
105 };
106 
107 struct vki_xen_sysctl_debug_keys {
108     /* IN variables. */
109     VKI_XEN_GUEST_HANDLE_64(char) keys;
110     vki_uint32_t nr_keys;
111 };
112 
113 struct vki_xen_sysctl_topologyinfo {
114     vki_uint32_t max_cpu_index;
115     VKI_XEN_GUEST_HANDLE_64(vki_uint32) cpu_to_core;
116     VKI_XEN_GUEST_HANDLE_64(vki_uint32) cpu_to_socket;
117     VKI_XEN_GUEST_HANDLE_64(vki_uint32) cpu_to_node;
118 };
119 
120 struct vki_xen_sysctl_numainfo {
121     vki_uint32_t max_node_index;
122     VKI_XEN_GUEST_HANDLE_64(vki_uint64) node_to_memsize;
123     VKI_XEN_GUEST_HANDLE_64(vki_uint64) node_to_memfree;
124     VKI_XEN_GUEST_HANDLE_64(vki_uint32) node_to_node_distance;
125 };
126 struct vki_xen_sysctl_physinfo_00000008 {
127     vki_uint32_t threads_per_core;
128     vki_uint32_t cores_per_socket;
129     vki_uint32_t nr_cpus;     /* # CPUs currently online */
130     vki_uint32_t max_cpu_id;  /* Largest possible CPU ID on this host */
131     vki_uint32_t nr_nodes;    /* # nodes currently online */
132     vki_uint32_t max_node_id; /* Largest possible node ID on this host */
133     vki_uint32_t cpu_khz;
134     vki_xen_uint64_aligned_t total_pages;
135     vki_xen_uint64_aligned_t free_pages;
136     vki_xen_uint64_aligned_t scrub_pages;
137     vki_uint32_t hw_cap[8];
138 
139     vki_uint32_t capabilities;
140 };
141 
142 struct vki_xen_sysctl_physinfo_0000000a {
143     vki_uint32_t threads_per_core;
144     vki_uint32_t cores_per_socket;
145     vki_uint32_t nr_cpus;     /* # CPUs currently online */
146     vki_uint32_t max_cpu_id;  /* Largest possible CPU ID on this host */
147     vki_uint32_t nr_nodes;    /* # nodes currently online */
148     vki_uint32_t max_node_id; /* Largest possible node ID on this host */
149     vki_uint32_t cpu_khz;
150     vki_xen_uint64_aligned_t total_pages;
151     vki_xen_uint64_aligned_t free_pages;
152     vki_xen_uint64_aligned_t scrub_pages;
153     vki_xen_uint64_aligned_t outstanding_pages;
154     vki_uint32_t hw_cap[8];
155 
156     vki_uint32_t capabilities;
157 };
158 
159 struct vki_xen_sysctl_sched_id {
160     /* OUT variable. */
161     vki_uint32_t              sched_id;
162 };
163 
164 struct vki_xen_sysctl {
165     vki_uint32_t cmd;
166     vki_uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
167     union {
168         struct vki_xen_sysctl_readconsole       readconsole;
169         //struct vki_xen_sysctl_tbuf_op           tbuf_op;
170         struct vki_xen_sysctl_physinfo_00000008 physinfo_00000008;
171         struct vki_xen_sysctl_physinfo_0000000a physinfo_0000000a;
172         struct vki_xen_sysctl_topologyinfo      topologyinfo;
173         struct vki_xen_sysctl_numainfo          numainfo;
174         struct vki_xen_sysctl_sched_id          sched_id;
175         //struct vki_xen_sysctl_perfc_op          perfc_op;
176         struct vki_xen_sysctl_getdomaininfolist_00000008 getdomaininfolist_00000008;
177         struct vki_xen_sysctl_getdomaininfolist_00000009 getdomaininfolist_00000009;
178         struct vki_xen_sysctl_getdomaininfolist_0000000a getdomaininfolist_0000000a;
179         struct vki_xen_sysctl_debug_keys        debug_keys;
180         //struct vki_xen_sysctl_getcpuinfo        getcpuinfo;
181         //struct vki_xen_sysctl_availheap         availheap;
182         //struct vki_xen_sysctl_get_pmstat        get_pmstat;
183         //struct vki_xen_sysctl_cpu_hotplug       cpu_hotplug;
184         //struct vki_xen_sysctl_pm_op             pm_op;
185         //struct vki_xen_sysctl_page_offline_op   page_offline;
186         //struct vki_xen_sysctl_lockprof_op       lockprof_op;
187         struct vki_xen_sysctl_cpupool_op        cpupool_op;
188         //struct vki_xen_sysctl_scheduler_op      scheduler_op;
189         //struct vki_xen_sysctl_coverage_op       coverage_op;
190 
191         vki_uint8_t                             pad[128];
192     } u;
193 };
194 
195 #endif // __VKI_XEN_SYSCTL_H
196 
197 /*--------------------------------------------------------------------*/
198 /*--- end                                                          ---*/
199 /*--------------------------------------------------------------------*/
200