xref: /onnv-gate/usr/src/uts/common/xen/public/sysctl.h (revision 5084:7d838c5c0eed)
1*5084Sjohnlev /******************************************************************************
2*5084Sjohnlev  * sysctl.h
3*5084Sjohnlev  *
4*5084Sjohnlev  * System management operations. For use by node control stack.
5*5084Sjohnlev  *
6*5084Sjohnlev  * Permission is hereby granted, free of charge, to any person obtaining a copy
7*5084Sjohnlev  * of this software and associated documentation files (the "Software"), to
8*5084Sjohnlev  * deal in the Software without restriction, including without limitation the
9*5084Sjohnlev  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10*5084Sjohnlev  * sell copies of the Software, and to permit persons to whom the Software is
11*5084Sjohnlev  * furnished to do so, subject to the following conditions:
12*5084Sjohnlev  *
13*5084Sjohnlev  * The above copyright notice and this permission notice shall be included in
14*5084Sjohnlev  * all copies or substantial portions of the Software.
15*5084Sjohnlev  *
16*5084Sjohnlev  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17*5084Sjohnlev  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18*5084Sjohnlev  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19*5084Sjohnlev  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20*5084Sjohnlev  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21*5084Sjohnlev  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22*5084Sjohnlev  * DEALINGS IN THE SOFTWARE.
23*5084Sjohnlev  *
24*5084Sjohnlev  * Copyright (c) 2002-2006, K Fraser
25*5084Sjohnlev  */
26*5084Sjohnlev 
27*5084Sjohnlev #ifndef __XEN_PUBLIC_SYSCTL_H__
28*5084Sjohnlev #define __XEN_PUBLIC_SYSCTL_H__
29*5084Sjohnlev 
30*5084Sjohnlev /*
31*5084Sjohnlev  * XXPV - We need sysctl (physinfo) in the solaris kernel.
32*5084Sjohnlev  */
33*5084Sjohnlev #if 0
34*5084Sjohnlev 
35*5084Sjohnlev #if !defined(__XEN__) && !defined(__XEN_TOOLS__)
36*5084Sjohnlev #error "sysctl operations are intended for use by node control tools only"
37*5084Sjohnlev #endif
38*5084Sjohnlev 
39*5084Sjohnlev #endif /* XXPV */
40*5084Sjohnlev 
41*5084Sjohnlev #include "xen.h"
42*5084Sjohnlev #include "domctl.h"
43*5084Sjohnlev 
44*5084Sjohnlev #define XEN_SYSCTL_INTERFACE_VERSION 0x00000002
45*5084Sjohnlev 
46*5084Sjohnlev /*
47*5084Sjohnlev  * Read console content from Xen buffer ring.
48*5084Sjohnlev  */
49*5084Sjohnlev #define XEN_SYSCTL_readconsole       1
50*5084Sjohnlev struct xen_sysctl_readconsole {
51*5084Sjohnlev     /* IN variables. */
52*5084Sjohnlev     uint32_t clear;                /* Non-zero -> clear after reading. */
53*5084Sjohnlev     XEN_GUEST_HANDLE(char) buffer; /* Buffer start */
54*5084Sjohnlev     /* IN/OUT variables. */
55*5084Sjohnlev     uint32_t count;            /* In: Buffer size;  Out: Used buffer size  */
56*5084Sjohnlev };
57*5084Sjohnlev typedef struct xen_sysctl_readconsole xen_sysctl_readconsole_t;
58*5084Sjohnlev DEFINE_XEN_GUEST_HANDLE(xen_sysctl_readconsole_t);
59*5084Sjohnlev 
60*5084Sjohnlev /* Get trace buffers machine base address */
61*5084Sjohnlev #define XEN_SYSCTL_tbuf_op           2
62*5084Sjohnlev struct xen_sysctl_tbuf_op {
63*5084Sjohnlev     /* IN variables */
64*5084Sjohnlev #define XEN_SYSCTL_TBUFOP_get_info     0
65*5084Sjohnlev #define XEN_SYSCTL_TBUFOP_set_cpu_mask 1
66*5084Sjohnlev #define XEN_SYSCTL_TBUFOP_set_evt_mask 2
67*5084Sjohnlev #define XEN_SYSCTL_TBUFOP_set_size     3
68*5084Sjohnlev #define XEN_SYSCTL_TBUFOP_enable       4
69*5084Sjohnlev #define XEN_SYSCTL_TBUFOP_disable      5
70*5084Sjohnlev     uint32_t cmd;
71*5084Sjohnlev     /* IN/OUT variables */
72*5084Sjohnlev     struct xenctl_cpumap cpu_mask;
73*5084Sjohnlev     uint32_t             evt_mask;
74*5084Sjohnlev     /* OUT variables */
75*5084Sjohnlev     uint64_t buffer_mfn;
76*5084Sjohnlev     uint32_t size;
77*5084Sjohnlev };
78*5084Sjohnlev typedef struct xen_sysctl_tbuf_op xen_sysctl_tbuf_op_t;
79*5084Sjohnlev DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t);
80*5084Sjohnlev 
81*5084Sjohnlev /*
82*5084Sjohnlev  * Get physical information about the host machine
83*5084Sjohnlev  */
84*5084Sjohnlev #define XEN_SYSCTL_physinfo          3
85*5084Sjohnlev struct xen_sysctl_physinfo {
86*5084Sjohnlev     uint32_t threads_per_core;
87*5084Sjohnlev     uint32_t cores_per_socket;
88*5084Sjohnlev     uint32_t sockets_per_node;
89*5084Sjohnlev     uint32_t nr_nodes;
90*5084Sjohnlev     uint32_t cpu_khz;
91*5084Sjohnlev     uint64_t total_pages;
92*5084Sjohnlev     uint64_t free_pages;
93*5084Sjohnlev     uint64_t scrub_pages;
94*5084Sjohnlev     uint32_t hw_cap[8];
95*5084Sjohnlev };
96*5084Sjohnlev typedef struct xen_sysctl_physinfo xen_sysctl_physinfo_t;
97*5084Sjohnlev DEFINE_XEN_GUEST_HANDLE(xen_sysctl_physinfo_t);
98*5084Sjohnlev 
99*5084Sjohnlev /*
100*5084Sjohnlev  * Get the ID of the current scheduler.
101*5084Sjohnlev  */
102*5084Sjohnlev #define XEN_SYSCTL_sched_id          4
103*5084Sjohnlev struct xen_sysctl_sched_id {
104*5084Sjohnlev     /* OUT variable */
105*5084Sjohnlev     uint32_t sched_id;
106*5084Sjohnlev };
107*5084Sjohnlev typedef struct xen_sysctl_sched_id xen_sysctl_sched_id_t;
108*5084Sjohnlev DEFINE_XEN_GUEST_HANDLE(xen_sysctl_sched_id_t);
109*5084Sjohnlev 
110*5084Sjohnlev /* Interface for controlling Xen software performance counters. */
111*5084Sjohnlev #define XEN_SYSCTL_perfc_op          5
112*5084Sjohnlev /* Sub-operations: */
113*5084Sjohnlev #define XEN_SYSCTL_PERFCOP_reset 1   /* Reset all counters to zero. */
114*5084Sjohnlev #define XEN_SYSCTL_PERFCOP_query 2   /* Get perfctr information. */
115*5084Sjohnlev struct xen_sysctl_perfc_desc {
116*5084Sjohnlev     char         name[80];             /* name of perf counter */
117*5084Sjohnlev     uint32_t     nr_vals;              /* number of values for this counter */
118*5084Sjohnlev };
119*5084Sjohnlev typedef struct xen_sysctl_perfc_desc xen_sysctl_perfc_desc_t;
120*5084Sjohnlev DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_desc_t);
121*5084Sjohnlev typedef uint32_t xen_sysctl_perfc_val_t;
122*5084Sjohnlev DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_val_t);
123*5084Sjohnlev 
124*5084Sjohnlev struct xen_sysctl_perfc_op {
125*5084Sjohnlev     /* IN variables. */
126*5084Sjohnlev     uint32_t       cmd;                /*  XEN_SYSCTL_PERFCOP_??? */
127*5084Sjohnlev     /* OUT variables. */
128*5084Sjohnlev     uint32_t       nr_counters;       /*  number of counters description  */
129*5084Sjohnlev     uint32_t       nr_vals;           /*  number of values  */
130*5084Sjohnlev     /* counter information (or NULL) */
131*5084Sjohnlev     XEN_GUEST_HANDLE(xen_sysctl_perfc_desc_t) desc;
132*5084Sjohnlev     /* counter values (or NULL) */
133*5084Sjohnlev     XEN_GUEST_HANDLE(xen_sysctl_perfc_val_t) val;
134*5084Sjohnlev };
135*5084Sjohnlev typedef struct xen_sysctl_perfc_op xen_sysctl_perfc_op_t;
136*5084Sjohnlev DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_op_t);
137*5084Sjohnlev 
138*5084Sjohnlev #define XEN_SYSCTL_getdomaininfolist 6
139*5084Sjohnlev struct xen_sysctl_getdomaininfolist {
140*5084Sjohnlev     /* IN variables. */
141*5084Sjohnlev     domid_t               first_domain;
142*5084Sjohnlev     uint32_t              max_domains;
143*5084Sjohnlev     XEN_GUEST_HANDLE(xen_domctl_getdomaininfo_t) buffer;
144*5084Sjohnlev     /* OUT variables. */
145*5084Sjohnlev     uint32_t              num_domains;
146*5084Sjohnlev };
147*5084Sjohnlev typedef struct xen_sysctl_getdomaininfolist xen_sysctl_getdomaininfolist_t;
148*5084Sjohnlev DEFINE_XEN_GUEST_HANDLE(xen_sysctl_getdomaininfolist_t);
149*5084Sjohnlev 
150*5084Sjohnlev struct xen_sysctl {
151*5084Sjohnlev     uint32_t cmd;
152*5084Sjohnlev     uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
153*5084Sjohnlev     union {
154*5084Sjohnlev         struct xen_sysctl_readconsole       readconsole;
155*5084Sjohnlev         struct xen_sysctl_tbuf_op           tbuf_op;
156*5084Sjohnlev         struct xen_sysctl_physinfo          physinfo;
157*5084Sjohnlev         struct xen_sysctl_sched_id          sched_id;
158*5084Sjohnlev         struct xen_sysctl_perfc_op          perfc_op;
159*5084Sjohnlev         struct xen_sysctl_getdomaininfolist getdomaininfolist;
160*5084Sjohnlev         uint8_t                             pad[128];
161*5084Sjohnlev     } u;
162*5084Sjohnlev };
163*5084Sjohnlev typedef struct xen_sysctl xen_sysctl_t;
164*5084Sjohnlev DEFINE_XEN_GUEST_HANDLE(xen_sysctl_t);
165*5084Sjohnlev 
166*5084Sjohnlev #endif /* __XEN_PUBLIC_SYSCTL_H__ */
167*5084Sjohnlev 
168*5084Sjohnlev /*
169*5084Sjohnlev  * Local variables:
170*5084Sjohnlev  * mode: C
171*5084Sjohnlev  * c-set-style: "BSD"
172*5084Sjohnlev  * c-basic-offset: 4
173*5084Sjohnlev  * tab-width: 4
174*5084Sjohnlev  * indent-tabs-mode: nil
175*5084Sjohnlev  * End:
176*5084Sjohnlev  */
177