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