xref: /freebsd/sys/contrib/xen/sysctl.h (revision 3a9fd8242b35884921dfc4e886f284a75870a536)
1*3a9fd824SRoger Pau Monné /******************************************************************************
2*3a9fd824SRoger Pau Monné  * sysctl.h
3*3a9fd824SRoger Pau Monné  *
4*3a9fd824SRoger Pau Monné  * System management operations. For use by node control stack.
5*3a9fd824SRoger Pau Monné  *
6*3a9fd824SRoger Pau Monné  * Permission is hereby granted, free of charge, to any person obtaining a copy
7*3a9fd824SRoger Pau Monné  * of this software and associated documentation files (the "Software"), to
8*3a9fd824SRoger Pau Monné  * deal in the Software without restriction, including without limitation the
9*3a9fd824SRoger Pau Monné  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10*3a9fd824SRoger Pau Monné  * sell copies of the Software, and to permit persons to whom the Software is
11*3a9fd824SRoger Pau Monné  * furnished to do so, subject to the following conditions:
12*3a9fd824SRoger Pau Monné  *
13*3a9fd824SRoger Pau Monné  * The above copyright notice and this permission notice shall be included in
14*3a9fd824SRoger Pau Monné  * all copies or substantial portions of the Software.
15*3a9fd824SRoger Pau Monné  *
16*3a9fd824SRoger Pau Monné  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17*3a9fd824SRoger Pau Monné  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18*3a9fd824SRoger Pau Monné  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19*3a9fd824SRoger Pau Monné  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20*3a9fd824SRoger Pau Monné  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21*3a9fd824SRoger Pau Monné  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22*3a9fd824SRoger Pau Monné  * DEALINGS IN THE SOFTWARE.
23*3a9fd824SRoger Pau Monné  *
24*3a9fd824SRoger Pau Monné  * Copyright (c) 2002-2006, K Fraser
25*3a9fd824SRoger Pau Monné  */
26*3a9fd824SRoger Pau Monné 
27*3a9fd824SRoger Pau Monné #ifndef __XEN_PUBLIC_SYSCTL_H__
28*3a9fd824SRoger Pau Monné #define __XEN_PUBLIC_SYSCTL_H__
29*3a9fd824SRoger Pau Monné 
30*3a9fd824SRoger Pau Monné #if !defined(__XEN__) && !defined(__XEN_TOOLS__)
31*3a9fd824SRoger Pau Monné #error "sysctl operations are intended for use by node control tools only"
32*3a9fd824SRoger Pau Monné #endif
33*3a9fd824SRoger Pau Monné 
34*3a9fd824SRoger Pau Monné #include "xen.h"
35*3a9fd824SRoger Pau Monné #include "domctl.h"
36*3a9fd824SRoger Pau Monné #include "physdev.h"
37*3a9fd824SRoger Pau Monné 
38*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_INTERFACE_VERSION 0x00000014
39*3a9fd824SRoger Pau Monné 
40*3a9fd824SRoger Pau Monné /*
41*3a9fd824SRoger Pau Monné  * Read console content from Xen buffer ring.
42*3a9fd824SRoger Pau Monné  */
43*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_readconsole */
44*3a9fd824SRoger Pau Monné struct xen_sysctl_readconsole {
45*3a9fd824SRoger Pau Monné     /* IN: Non-zero -> clear after reading. */
46*3a9fd824SRoger Pau Monné     uint8_t clear;
47*3a9fd824SRoger Pau Monné     /* IN: Non-zero -> start index specified by @index field. */
48*3a9fd824SRoger Pau Monné     uint8_t incremental;
49*3a9fd824SRoger Pau Monné     uint8_t pad0, pad1;
50*3a9fd824SRoger Pau Monné     /*
51*3a9fd824SRoger Pau Monné      * IN:  Start index for consuming from ring buffer (if @incremental);
52*3a9fd824SRoger Pau Monné      * OUT: End index after consuming from ring buffer.
53*3a9fd824SRoger Pau Monné      */
54*3a9fd824SRoger Pau Monné     uint32_t index;
55*3a9fd824SRoger Pau Monné     /* IN: Virtual address to write console data. */
56*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(char) buffer;
57*3a9fd824SRoger Pau Monné     /* IN: Size of buffer; OUT: Bytes written to buffer. */
58*3a9fd824SRoger Pau Monné     uint32_t count;
59*3a9fd824SRoger Pau Monné };
60*3a9fd824SRoger Pau Monné 
61*3a9fd824SRoger Pau Monné /* Get trace buffers machine base address */
62*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_tbuf_op */
63*3a9fd824SRoger Pau Monné struct xen_sysctl_tbuf_op {
64*3a9fd824SRoger Pau Monné     /* IN variables */
65*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_TBUFOP_get_info     0
66*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_TBUFOP_set_cpu_mask 1
67*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_TBUFOP_set_evt_mask 2
68*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_TBUFOP_set_size     3
69*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_TBUFOP_enable       4
70*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_TBUFOP_disable      5
71*3a9fd824SRoger Pau Monné     uint32_t cmd;
72*3a9fd824SRoger Pau Monné     /* IN/OUT variables */
73*3a9fd824SRoger Pau Monné     struct xenctl_bitmap cpu_mask;
74*3a9fd824SRoger Pau Monné     uint32_t             evt_mask;
75*3a9fd824SRoger Pau Monné     /* OUT variables */
76*3a9fd824SRoger Pau Monné     uint64_aligned_t buffer_mfn;
77*3a9fd824SRoger Pau Monné     uint32_t size;  /* Also an IN variable! */
78*3a9fd824SRoger Pau Monné };
79*3a9fd824SRoger Pau Monné 
80*3a9fd824SRoger Pau Monné /*
81*3a9fd824SRoger Pau Monné  * Get physical information about the host machine
82*3a9fd824SRoger Pau Monné  */
83*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_physinfo */
84*3a9fd824SRoger Pau Monné  /* The platform supports HVM guests. */
85*3a9fd824SRoger Pau Monné #define _XEN_SYSCTL_PHYSCAP_hvm          0
86*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PHYSCAP_hvm           (1u<<_XEN_SYSCTL_PHYSCAP_hvm)
87*3a9fd824SRoger Pau Monné  /* The platform supports PV guests. */
88*3a9fd824SRoger Pau Monné #define _XEN_SYSCTL_PHYSCAP_pv           1
89*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PHYSCAP_pv            (1u<<_XEN_SYSCTL_PHYSCAP_pv)
90*3a9fd824SRoger Pau Monné  /* The platform supports direct access to I/O devices with IOMMU. */
91*3a9fd824SRoger Pau Monné #define _XEN_SYSCTL_PHYSCAP_directio     2
92*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PHYSCAP_directio  (1u<<_XEN_SYSCTL_PHYSCAP_directio)
93*3a9fd824SRoger Pau Monné /* The platform supports Hardware Assisted Paging. */
94*3a9fd824SRoger Pau Monné #define _XEN_SYSCTL_PHYSCAP_hap          3
95*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PHYSCAP_hap           (1u<<_XEN_SYSCTL_PHYSCAP_hap)
96*3a9fd824SRoger Pau Monné /* The platform supports software paging. */
97*3a9fd824SRoger Pau Monné #define _XEN_SYSCTL_PHYSCAP_shadow       4
98*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PHYSCAP_shadow        (1u<<_XEN_SYSCTL_PHYSCAP_shadow)
99*3a9fd824SRoger Pau Monné /* The platform supports sharing of HAP page tables with the IOMMU. */
100*3a9fd824SRoger Pau Monné #define _XEN_SYSCTL_PHYSCAP_iommu_hap_pt_share 5
101*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PHYSCAP_iommu_hap_pt_share  \
102*3a9fd824SRoger Pau Monné     (1u << _XEN_SYSCTL_PHYSCAP_iommu_hap_pt_share)
103*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PHYSCAP_vmtrace       (1u << 6)
104*3a9fd824SRoger Pau Monné /* The platform supports vPMU. */
105*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PHYSCAP_vpmu          (1u << 7)
106*3a9fd824SRoger Pau Monné 
107*3a9fd824SRoger Pau Monné /* Xen supports the Grant v1 and/or v2 ABIs. */
108*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PHYSCAP_gnttab_v1     (1u << 8)
109*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PHYSCAP_gnttab_v2     (1u << 9)
110*3a9fd824SRoger Pau Monné 
111*3a9fd824SRoger Pau Monné /* Max XEN_SYSCTL_PHYSCAP_* constant.  Used for ABI checking. */
112*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PHYSCAP_MAX XEN_SYSCTL_PHYSCAP_gnttab_v2
113*3a9fd824SRoger Pau Monné 
114*3a9fd824SRoger Pau Monné struct xen_sysctl_physinfo {
115*3a9fd824SRoger Pau Monné     uint32_t threads_per_core;
116*3a9fd824SRoger Pau Monné     uint32_t cores_per_socket;
117*3a9fd824SRoger Pau Monné     uint32_t nr_cpus;     /* # CPUs currently online */
118*3a9fd824SRoger Pau Monné     uint32_t max_cpu_id;  /* Largest possible CPU ID on this host */
119*3a9fd824SRoger Pau Monné     uint32_t nr_nodes;    /* # nodes currently online */
120*3a9fd824SRoger Pau Monné     uint32_t max_node_id; /* Largest possible node ID on this host */
121*3a9fd824SRoger Pau Monné     uint32_t cpu_khz;
122*3a9fd824SRoger Pau Monné     uint32_t capabilities;/* XEN_SYSCTL_PHYSCAP_??? */
123*3a9fd824SRoger Pau Monné     uint64_aligned_t total_pages;
124*3a9fd824SRoger Pau Monné     uint64_aligned_t free_pages;
125*3a9fd824SRoger Pau Monné     uint64_aligned_t scrub_pages;
126*3a9fd824SRoger Pau Monné     uint64_aligned_t outstanding_pages;
127*3a9fd824SRoger Pau Monné     uint64_aligned_t max_mfn; /* Largest possible MFN on this host */
128*3a9fd824SRoger Pau Monné     uint32_t hw_cap[8];
129*3a9fd824SRoger Pau Monné };
130*3a9fd824SRoger Pau Monné 
131*3a9fd824SRoger Pau Monné /*
132*3a9fd824SRoger Pau Monné  * Get the ID of the current scheduler.
133*3a9fd824SRoger Pau Monné  */
134*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_sched_id */
135*3a9fd824SRoger Pau Monné struct xen_sysctl_sched_id {
136*3a9fd824SRoger Pau Monné     /* OUT variable */
137*3a9fd824SRoger Pau Monné     uint32_t sched_id;
138*3a9fd824SRoger Pau Monné };
139*3a9fd824SRoger Pau Monné 
140*3a9fd824SRoger Pau Monné /* Interface for controlling Xen software performance counters. */
141*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_perfc_op */
142*3a9fd824SRoger Pau Monné /* Sub-operations: */
143*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PERFCOP_reset 1   /* Reset all counters to zero. */
144*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PERFCOP_query 2   /* Get perfctr information. */
145*3a9fd824SRoger Pau Monné struct xen_sysctl_perfc_desc {
146*3a9fd824SRoger Pau Monné     char         name[80];             /* name of perf counter */
147*3a9fd824SRoger Pau Monné     uint32_t     nr_vals;              /* number of values for this counter */
148*3a9fd824SRoger Pau Monné };
149*3a9fd824SRoger Pau Monné typedef struct xen_sysctl_perfc_desc xen_sysctl_perfc_desc_t;
150*3a9fd824SRoger Pau Monné DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_desc_t);
151*3a9fd824SRoger Pau Monné typedef uint32_t xen_sysctl_perfc_val_t;
152*3a9fd824SRoger Pau Monné DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_val_t);
153*3a9fd824SRoger Pau Monné 
154*3a9fd824SRoger Pau Monné struct xen_sysctl_perfc_op {
155*3a9fd824SRoger Pau Monné     /* IN variables. */
156*3a9fd824SRoger Pau Monné     uint32_t       cmd;                /*  XEN_SYSCTL_PERFCOP_??? */
157*3a9fd824SRoger Pau Monné     /* OUT variables. */
158*3a9fd824SRoger Pau Monné     uint32_t       nr_counters;       /*  number of counters description  */
159*3a9fd824SRoger Pau Monné     uint32_t       nr_vals;           /*  number of values  */
160*3a9fd824SRoger Pau Monné     /* counter information (or NULL) */
161*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(xen_sysctl_perfc_desc_t) desc;
162*3a9fd824SRoger Pau Monné     /* counter values (or NULL) */
163*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(xen_sysctl_perfc_val_t) val;
164*3a9fd824SRoger Pau Monné };
165*3a9fd824SRoger Pau Monné 
166*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_getdomaininfolist */
167*3a9fd824SRoger Pau Monné struct xen_sysctl_getdomaininfolist {
168*3a9fd824SRoger Pau Monné     /* IN variables. */
169*3a9fd824SRoger Pau Monné     domid_t               first_domain;
170*3a9fd824SRoger Pau Monné     uint32_t              max_domains;
171*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(xen_domctl_getdomaininfo_t) buffer;
172*3a9fd824SRoger Pau Monné     /* OUT variables. */
173*3a9fd824SRoger Pau Monné     uint32_t              num_domains;
174*3a9fd824SRoger Pau Monné };
175*3a9fd824SRoger Pau Monné 
176*3a9fd824SRoger Pau Monné /* Inject debug keys into Xen. */
177*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_debug_keys */
178*3a9fd824SRoger Pau Monné struct xen_sysctl_debug_keys {
179*3a9fd824SRoger Pau Monné     /* IN variables. */
180*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(const_char) keys;
181*3a9fd824SRoger Pau Monné     uint32_t nr_keys;
182*3a9fd824SRoger Pau Monné };
183*3a9fd824SRoger Pau Monné 
184*3a9fd824SRoger Pau Monné /* Get physical CPU information. */
185*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_getcpuinfo */
186*3a9fd824SRoger Pau Monné struct xen_sysctl_cpuinfo {
187*3a9fd824SRoger Pau Monné     uint64_aligned_t idletime;
188*3a9fd824SRoger Pau Monné };
189*3a9fd824SRoger Pau Monné typedef struct xen_sysctl_cpuinfo xen_sysctl_cpuinfo_t;
190*3a9fd824SRoger Pau Monné DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpuinfo_t);
191*3a9fd824SRoger Pau Monné struct xen_sysctl_getcpuinfo {
192*3a9fd824SRoger Pau Monné     /* IN variables. */
193*3a9fd824SRoger Pau Monné     uint32_t max_cpus;
194*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(xen_sysctl_cpuinfo_t) info;
195*3a9fd824SRoger Pau Monné     /* OUT variables. */
196*3a9fd824SRoger Pau Monné     uint32_t nr_cpus;
197*3a9fd824SRoger Pau Monné };
198*3a9fd824SRoger Pau Monné 
199*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_availheap */
200*3a9fd824SRoger Pau Monné struct xen_sysctl_availheap {
201*3a9fd824SRoger Pau Monné     /* IN variables. */
202*3a9fd824SRoger Pau Monné     uint32_t min_bitwidth;  /* Smallest address width (zero if don't care). */
203*3a9fd824SRoger Pau Monné     uint32_t max_bitwidth;  /* Largest address width (zero if don't care). */
204*3a9fd824SRoger Pau Monné     int32_t  node;          /* NUMA node of interest (-1 for all nodes). */
205*3a9fd824SRoger Pau Monné     /* OUT variables. */
206*3a9fd824SRoger Pau Monné     uint64_aligned_t avail_bytes;/* Bytes available in the specified region. */
207*3a9fd824SRoger Pau Monné };
208*3a9fd824SRoger Pau Monné 
209*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_get_pmstat */
210*3a9fd824SRoger Pau Monné struct pm_px_val {
211*3a9fd824SRoger Pau Monné     uint64_aligned_t freq;        /* Px core frequency */
212*3a9fd824SRoger Pau Monné     uint64_aligned_t residency;   /* Px residency time */
213*3a9fd824SRoger Pau Monné     uint64_aligned_t count;       /* Px transition count */
214*3a9fd824SRoger Pau Monné };
215*3a9fd824SRoger Pau Monné typedef struct pm_px_val pm_px_val_t;
216*3a9fd824SRoger Pau Monné DEFINE_XEN_GUEST_HANDLE(pm_px_val_t);
217*3a9fd824SRoger Pau Monné 
218*3a9fd824SRoger Pau Monné struct pm_px_stat {
219*3a9fd824SRoger Pau Monné     uint8_t total;        /* total Px states */
220*3a9fd824SRoger Pau Monné     uint8_t usable;       /* usable Px states */
221*3a9fd824SRoger Pau Monné     uint8_t last;         /* last Px state */
222*3a9fd824SRoger Pau Monné     uint8_t cur;          /* current Px state */
223*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(uint64) trans_pt;   /* Px transition table */
224*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(pm_px_val_t) pt;
225*3a9fd824SRoger Pau Monné };
226*3a9fd824SRoger Pau Monné 
227*3a9fd824SRoger Pau Monné struct pm_cx_stat {
228*3a9fd824SRoger Pau Monné     uint32_t nr;    /* entry nr in triggers & residencies, including C0 */
229*3a9fd824SRoger Pau Monné     uint32_t last;  /* last Cx state */
230*3a9fd824SRoger Pau Monné     uint64_aligned_t idle_time;                 /* idle time from boot */
231*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(uint64) triggers;    /* Cx trigger counts */
232*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(uint64) residencies; /* Cx residencies */
233*3a9fd824SRoger Pau Monné     uint32_t nr_pc;                          /* entry nr in pc[] */
234*3a9fd824SRoger Pau Monné     uint32_t nr_cc;                          /* entry nr in cc[] */
235*3a9fd824SRoger Pau Monné     /*
236*3a9fd824SRoger Pau Monné      * These two arrays may (and generally will) have unused slots; slots not
237*3a9fd824SRoger Pau Monné      * having a corresponding hardware register will not be written by the
238*3a9fd824SRoger Pau Monné      * hypervisor. It is therefore up to the caller to put a suitable sentinel
239*3a9fd824SRoger Pau Monné      * into all slots before invoking the function.
240*3a9fd824SRoger Pau Monné      * Indexing is 1-biased (PC1/CC1 being at index 0).
241*3a9fd824SRoger Pau Monné      */
242*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(uint64) pc;
243*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(uint64) cc;
244*3a9fd824SRoger Pau Monné };
245*3a9fd824SRoger Pau Monné 
246*3a9fd824SRoger Pau Monné struct xen_sysctl_get_pmstat {
247*3a9fd824SRoger Pau Monné #define PMSTAT_CATEGORY_MASK 0xf0
248*3a9fd824SRoger Pau Monné #define PMSTAT_PX            0x10
249*3a9fd824SRoger Pau Monné #define PMSTAT_CX            0x20
250*3a9fd824SRoger Pau Monné #define PMSTAT_get_max_px    (PMSTAT_PX | 0x1)
251*3a9fd824SRoger Pau Monné #define PMSTAT_get_pxstat    (PMSTAT_PX | 0x2)
252*3a9fd824SRoger Pau Monné #define PMSTAT_reset_pxstat  (PMSTAT_PX | 0x3)
253*3a9fd824SRoger Pau Monné #define PMSTAT_get_max_cx    (PMSTAT_CX | 0x1)
254*3a9fd824SRoger Pau Monné #define PMSTAT_get_cxstat    (PMSTAT_CX | 0x2)
255*3a9fd824SRoger Pau Monné #define PMSTAT_reset_cxstat  (PMSTAT_CX | 0x3)
256*3a9fd824SRoger Pau Monné     uint32_t type;
257*3a9fd824SRoger Pau Monné     uint32_t cpuid;
258*3a9fd824SRoger Pau Monné     union {
259*3a9fd824SRoger Pau Monné         struct pm_px_stat getpx;
260*3a9fd824SRoger Pau Monné         struct pm_cx_stat getcx;
261*3a9fd824SRoger Pau Monné         /* other struct for tx, etc */
262*3a9fd824SRoger Pau Monné     } u;
263*3a9fd824SRoger Pau Monné };
264*3a9fd824SRoger Pau Monné 
265*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_cpu_hotplug */
266*3a9fd824SRoger Pau Monné struct xen_sysctl_cpu_hotplug {
267*3a9fd824SRoger Pau Monné     /* IN variables */
268*3a9fd824SRoger Pau Monné     uint32_t cpu;   /* Physical cpu. */
269*3a9fd824SRoger Pau Monné 
270*3a9fd824SRoger Pau Monné     /* Single CPU enable/disable. */
271*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPU_HOTPLUG_ONLINE  0
272*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPU_HOTPLUG_OFFLINE 1
273*3a9fd824SRoger Pau Monné 
274*3a9fd824SRoger Pau Monné     /*
275*3a9fd824SRoger Pau Monné      * SMT enable/disable.
276*3a9fd824SRoger Pau Monné      *
277*3a9fd824SRoger Pau Monné      * These two ops loop over all present CPUs, and either online or offline
278*3a9fd824SRoger Pau Monné      * every non-primary sibling thread (those with a thread id which is not
279*3a9fd824SRoger Pau Monné      * 0).  This behaviour is chosen to simplify the implementation.
280*3a9fd824SRoger Pau Monné      *
281*3a9fd824SRoger Pau Monné      * They are intended as a shorthand for identifying and feeding the cpu
282*3a9fd824SRoger Pau Monné      * numbers individually to HOTPLUG_{ON,OFF}LINE.
283*3a9fd824SRoger Pau Monné      *
284*3a9fd824SRoger Pau Monné      * These are not expected to be used in conjunction with debugging options
285*3a9fd824SRoger Pau Monné      * such as `maxcpus=` or when other manual configuration of offline cpus
286*3a9fd824SRoger Pau Monné      * is in use.
287*3a9fd824SRoger Pau Monné      */
288*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPU_HOTPLUG_SMT_ENABLE  2
289*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPU_HOTPLUG_SMT_DISABLE 3
290*3a9fd824SRoger Pau Monné     uint32_t op;    /* hotplug opcode */
291*3a9fd824SRoger Pau Monné };
292*3a9fd824SRoger Pau Monné 
293*3a9fd824SRoger Pau Monné /*
294*3a9fd824SRoger Pau Monné  * Get/set xen power management, include
295*3a9fd824SRoger Pau Monné  * 1. cpufreq governors and related parameters
296*3a9fd824SRoger Pau Monné  */
297*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_pm_op */
298*3a9fd824SRoger Pau Monné struct xen_userspace {
299*3a9fd824SRoger Pau Monné     uint32_t scaling_setspeed;
300*3a9fd824SRoger Pau Monné };
301*3a9fd824SRoger Pau Monné 
302*3a9fd824SRoger Pau Monné struct xen_ondemand {
303*3a9fd824SRoger Pau Monné     uint32_t sampling_rate_max;
304*3a9fd824SRoger Pau Monné     uint32_t sampling_rate_min;
305*3a9fd824SRoger Pau Monné 
306*3a9fd824SRoger Pau Monné     uint32_t sampling_rate;
307*3a9fd824SRoger Pau Monné     uint32_t up_threshold;
308*3a9fd824SRoger Pau Monné };
309*3a9fd824SRoger Pau Monné 
310*3a9fd824SRoger Pau Monné /*
311*3a9fd824SRoger Pau Monné  * cpufreq para name of this structure named
312*3a9fd824SRoger Pau Monné  * same as sysfs file name of native linux
313*3a9fd824SRoger Pau Monné  */
314*3a9fd824SRoger Pau Monné #define CPUFREQ_NAME_LEN 16
315*3a9fd824SRoger Pau Monné struct xen_get_cpufreq_para {
316*3a9fd824SRoger Pau Monné     /* IN/OUT variable */
317*3a9fd824SRoger Pau Monné     uint32_t cpu_num;
318*3a9fd824SRoger Pau Monné     uint32_t freq_num;
319*3a9fd824SRoger Pau Monné     uint32_t gov_num;
320*3a9fd824SRoger Pau Monné 
321*3a9fd824SRoger Pau Monné     /* for all governors */
322*3a9fd824SRoger Pau Monné     /* OUT variable */
323*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(uint32) affected_cpus;
324*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(uint32) scaling_available_frequencies;
325*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(char)   scaling_available_governors;
326*3a9fd824SRoger Pau Monné     char scaling_driver[CPUFREQ_NAME_LEN];
327*3a9fd824SRoger Pau Monné 
328*3a9fd824SRoger Pau Monné     uint32_t cpuinfo_cur_freq;
329*3a9fd824SRoger Pau Monné     uint32_t cpuinfo_max_freq;
330*3a9fd824SRoger Pau Monné     uint32_t cpuinfo_min_freq;
331*3a9fd824SRoger Pau Monné     uint32_t scaling_cur_freq;
332*3a9fd824SRoger Pau Monné 
333*3a9fd824SRoger Pau Monné     char scaling_governor[CPUFREQ_NAME_LEN];
334*3a9fd824SRoger Pau Monné     uint32_t scaling_max_freq;
335*3a9fd824SRoger Pau Monné     uint32_t scaling_min_freq;
336*3a9fd824SRoger Pau Monné 
337*3a9fd824SRoger Pau Monné     /* for specific governor */
338*3a9fd824SRoger Pau Monné     union {
339*3a9fd824SRoger Pau Monné         struct  xen_userspace userspace;
340*3a9fd824SRoger Pau Monné         struct  xen_ondemand ondemand;
341*3a9fd824SRoger Pau Monné     } u;
342*3a9fd824SRoger Pau Monné 
343*3a9fd824SRoger Pau Monné     int32_t turbo_enabled;
344*3a9fd824SRoger Pau Monné };
345*3a9fd824SRoger Pau Monné 
346*3a9fd824SRoger Pau Monné struct xen_set_cpufreq_gov {
347*3a9fd824SRoger Pau Monné     char scaling_governor[CPUFREQ_NAME_LEN];
348*3a9fd824SRoger Pau Monné };
349*3a9fd824SRoger Pau Monné 
350*3a9fd824SRoger Pau Monné struct xen_set_cpufreq_para {
351*3a9fd824SRoger Pau Monné     #define SCALING_MAX_FREQ           1
352*3a9fd824SRoger Pau Monné     #define SCALING_MIN_FREQ           2
353*3a9fd824SRoger Pau Monné     #define SCALING_SETSPEED           3
354*3a9fd824SRoger Pau Monné     #define SAMPLING_RATE              4
355*3a9fd824SRoger Pau Monné     #define UP_THRESHOLD               5
356*3a9fd824SRoger Pau Monné 
357*3a9fd824SRoger Pau Monné     uint32_t ctrl_type;
358*3a9fd824SRoger Pau Monné     uint32_t ctrl_value;
359*3a9fd824SRoger Pau Monné };
360*3a9fd824SRoger Pau Monné 
361*3a9fd824SRoger Pau Monné struct xen_sysctl_pm_op {
362*3a9fd824SRoger Pau Monné     #define PM_PARA_CATEGORY_MASK      0xf0
363*3a9fd824SRoger Pau Monné     #define CPUFREQ_PARA               0x10
364*3a9fd824SRoger Pau Monné 
365*3a9fd824SRoger Pau Monné     /* cpufreq command type */
366*3a9fd824SRoger Pau Monné     #define GET_CPUFREQ_PARA           (CPUFREQ_PARA | 0x01)
367*3a9fd824SRoger Pau Monné     #define SET_CPUFREQ_GOV            (CPUFREQ_PARA | 0x02)
368*3a9fd824SRoger Pau Monné     #define SET_CPUFREQ_PARA           (CPUFREQ_PARA | 0x03)
369*3a9fd824SRoger Pau Monné     #define GET_CPUFREQ_AVGFREQ        (CPUFREQ_PARA | 0x04)
370*3a9fd824SRoger Pau Monné 
371*3a9fd824SRoger Pau Monné     /* set/reset scheduler power saving option */
372*3a9fd824SRoger Pau Monné     #define XEN_SYSCTL_pm_op_set_sched_opt_smt    0x21
373*3a9fd824SRoger Pau Monné 
374*3a9fd824SRoger Pau Monné     /*
375*3a9fd824SRoger Pau Monné      * cpuidle max C-state and max C-sub-state access command:
376*3a9fd824SRoger Pau Monné      * Set cpuid to 0 for max C-state.
377*3a9fd824SRoger Pau Monné      * Set cpuid to 1 for max C-sub-state.
378*3a9fd824SRoger Pau Monné      */
379*3a9fd824SRoger Pau Monné     #define XEN_SYSCTL_pm_op_get_max_cstate       0x22
380*3a9fd824SRoger Pau Monné     #define XEN_SYSCTL_pm_op_set_max_cstate       0x23
381*3a9fd824SRoger Pau Monné 
382*3a9fd824SRoger Pau Monné     /* set scheduler migration cost value */
383*3a9fd824SRoger Pau Monné     #define XEN_SYSCTL_pm_op_set_vcpu_migration_delay   0x24
384*3a9fd824SRoger Pau Monné     #define XEN_SYSCTL_pm_op_get_vcpu_migration_delay   0x25
385*3a9fd824SRoger Pau Monné 
386*3a9fd824SRoger Pau Monné     /* enable/disable turbo mode when in dbs governor */
387*3a9fd824SRoger Pau Monné     #define XEN_SYSCTL_pm_op_enable_turbo               0x26
388*3a9fd824SRoger Pau Monné     #define XEN_SYSCTL_pm_op_disable_turbo              0x27
389*3a9fd824SRoger Pau Monné 
390*3a9fd824SRoger Pau Monné     uint32_t cmd;
391*3a9fd824SRoger Pau Monné     uint32_t cpuid;
392*3a9fd824SRoger Pau Monné     union {
393*3a9fd824SRoger Pau Monné         struct xen_get_cpufreq_para get_para;
394*3a9fd824SRoger Pau Monné         struct xen_set_cpufreq_gov  set_gov;
395*3a9fd824SRoger Pau Monné         struct xen_set_cpufreq_para set_para;
396*3a9fd824SRoger Pau Monné         uint64_aligned_t get_avgfreq;
397*3a9fd824SRoger Pau Monné         uint32_t                    set_sched_opt_smt;
398*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CX_UNLIMITED 0xffffffff
399*3a9fd824SRoger Pau Monné         uint32_t                    get_max_cstate;
400*3a9fd824SRoger Pau Monné         uint32_t                    set_max_cstate;
401*3a9fd824SRoger Pau Monné     } u;
402*3a9fd824SRoger Pau Monné };
403*3a9fd824SRoger Pau Monné 
404*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_page_offline_op */
405*3a9fd824SRoger Pau Monné struct xen_sysctl_page_offline_op {
406*3a9fd824SRoger Pau Monné     /* IN: range of page to be offlined */
407*3a9fd824SRoger Pau Monné #define sysctl_page_offline     1
408*3a9fd824SRoger Pau Monné #define sysctl_page_online      2
409*3a9fd824SRoger Pau Monné #define sysctl_query_page_offline  3
410*3a9fd824SRoger Pau Monné     uint32_t cmd;
411*3a9fd824SRoger Pau Monné     uint32_t start;
412*3a9fd824SRoger Pau Monné     uint32_t end;
413*3a9fd824SRoger Pau Monné     /* OUT: result of page offline request */
414*3a9fd824SRoger Pau Monné     /*
415*3a9fd824SRoger Pau Monné      * bit 0~15: result flags
416*3a9fd824SRoger Pau Monné      * bit 16~31: owner
417*3a9fd824SRoger Pau Monné      */
418*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE(uint32) status;
419*3a9fd824SRoger Pau Monné };
420*3a9fd824SRoger Pau Monné 
421*3a9fd824SRoger Pau Monné #define PG_OFFLINE_STATUS_MASK    (0xFFUL)
422*3a9fd824SRoger Pau Monné 
423*3a9fd824SRoger Pau Monné /* The result is invalid, i.e. HV does not handle it */
424*3a9fd824SRoger Pau Monné #define PG_OFFLINE_INVALID   (0x1UL << 0)
425*3a9fd824SRoger Pau Monné 
426*3a9fd824SRoger Pau Monné #define PG_OFFLINE_OFFLINED  (0x1UL << 1)
427*3a9fd824SRoger Pau Monné #define PG_OFFLINE_PENDING   (0x1UL << 2)
428*3a9fd824SRoger Pau Monné #define PG_OFFLINE_FAILED    (0x1UL << 3)
429*3a9fd824SRoger Pau Monné #define PG_OFFLINE_AGAIN     (0x1UL << 4)
430*3a9fd824SRoger Pau Monné 
431*3a9fd824SRoger Pau Monné #define PG_ONLINE_FAILED     PG_OFFLINE_FAILED
432*3a9fd824SRoger Pau Monné #define PG_ONLINE_ONLINED    PG_OFFLINE_OFFLINED
433*3a9fd824SRoger Pau Monné 
434*3a9fd824SRoger Pau Monné #define PG_OFFLINE_STATUS_OFFLINED              (0x1UL << 1)
435*3a9fd824SRoger Pau Monné #define PG_OFFLINE_STATUS_ONLINE                (0x1UL << 2)
436*3a9fd824SRoger Pau Monné #define PG_OFFLINE_STATUS_OFFLINE_PENDING       (0x1UL << 3)
437*3a9fd824SRoger Pau Monné #define PG_OFFLINE_STATUS_BROKEN                (0x1UL << 4)
438*3a9fd824SRoger Pau Monné 
439*3a9fd824SRoger Pau Monné #define PG_OFFLINE_MISC_MASK    (0xFFUL << 4)
440*3a9fd824SRoger Pau Monné 
441*3a9fd824SRoger Pau Monné /* valid when PG_OFFLINE_FAILED or PG_OFFLINE_PENDING */
442*3a9fd824SRoger Pau Monné #define PG_OFFLINE_XENPAGE   (0x1UL << 8)
443*3a9fd824SRoger Pau Monné #define PG_OFFLINE_DOM0PAGE  (0x1UL << 9)
444*3a9fd824SRoger Pau Monné #define PG_OFFLINE_ANONYMOUS (0x1UL << 10)
445*3a9fd824SRoger Pau Monné #define PG_OFFLINE_NOT_CONV_RAM   (0x1UL << 11)
446*3a9fd824SRoger Pau Monné #define PG_OFFLINE_OWNED     (0x1UL << 12)
447*3a9fd824SRoger Pau Monné 
448*3a9fd824SRoger Pau Monné #define PG_OFFLINE_BROKEN    (0x1UL << 13)
449*3a9fd824SRoger Pau Monné #define PG_ONLINE_BROKEN     PG_OFFLINE_BROKEN
450*3a9fd824SRoger Pau Monné 
451*3a9fd824SRoger Pau Monné #define PG_OFFLINE_OWNER_SHIFT 16
452*3a9fd824SRoger Pau Monné 
453*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_lockprof_op */
454*3a9fd824SRoger Pau Monné /* Sub-operations: */
455*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_LOCKPROF_reset 1   /* Reset all profile data to zero. */
456*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_LOCKPROF_query 2   /* Get lock profile information. */
457*3a9fd824SRoger Pau Monné /* Record-type: */
458*3a9fd824SRoger Pau Monné #define LOCKPROF_TYPE_GLOBAL      0   /* global lock, idx meaningless */
459*3a9fd824SRoger Pau Monné #define LOCKPROF_TYPE_PERDOM      1   /* per-domain lock, idx is domid */
460*3a9fd824SRoger Pau Monné #define LOCKPROF_TYPE_N           2   /* number of types */
461*3a9fd824SRoger Pau Monné struct xen_sysctl_lockprof_data {
462*3a9fd824SRoger Pau Monné     char     name[40];     /* lock name (may include up to 2 %d specifiers) */
463*3a9fd824SRoger Pau Monné     int32_t  type;         /* LOCKPROF_TYPE_??? */
464*3a9fd824SRoger Pau Monné     int32_t  idx;          /* index (e.g. domain id) */
465*3a9fd824SRoger Pau Monné     uint64_aligned_t lock_cnt;     /* # of locking succeeded */
466*3a9fd824SRoger Pau Monné     uint64_aligned_t block_cnt;    /* # of wait for lock */
467*3a9fd824SRoger Pau Monné     uint64_aligned_t lock_time;    /* nsecs lock held */
468*3a9fd824SRoger Pau Monné     uint64_aligned_t block_time;   /* nsecs waited for lock */
469*3a9fd824SRoger Pau Monné };
470*3a9fd824SRoger Pau Monné typedef struct xen_sysctl_lockprof_data xen_sysctl_lockprof_data_t;
471*3a9fd824SRoger Pau Monné DEFINE_XEN_GUEST_HANDLE(xen_sysctl_lockprof_data_t);
472*3a9fd824SRoger Pau Monné struct xen_sysctl_lockprof_op {
473*3a9fd824SRoger Pau Monné     /* IN variables. */
474*3a9fd824SRoger Pau Monné     uint32_t       cmd;               /* XEN_SYSCTL_LOCKPROF_??? */
475*3a9fd824SRoger Pau Monné     uint32_t       max_elem;          /* size of output buffer */
476*3a9fd824SRoger Pau Monné     /* OUT variables (query only). */
477*3a9fd824SRoger Pau Monné     uint32_t       nr_elem;           /* number of elements available */
478*3a9fd824SRoger Pau Monné     uint64_aligned_t time;            /* nsecs of profile measurement */
479*3a9fd824SRoger Pau Monné     /* profile information (or NULL) */
480*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(xen_sysctl_lockprof_data_t) data;
481*3a9fd824SRoger Pau Monné };
482*3a9fd824SRoger Pau Monné 
483*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_cputopoinfo */
484*3a9fd824SRoger Pau Monné #define XEN_INVALID_CORE_ID     (~0U)
485*3a9fd824SRoger Pau Monné #define XEN_INVALID_SOCKET_ID   (~0U)
486*3a9fd824SRoger Pau Monné #define XEN_INVALID_NODE_ID     (~0U)
487*3a9fd824SRoger Pau Monné 
488*3a9fd824SRoger Pau Monné struct xen_sysctl_cputopo {
489*3a9fd824SRoger Pau Monné     uint32_t core;
490*3a9fd824SRoger Pau Monné     uint32_t socket;
491*3a9fd824SRoger Pau Monné     uint32_t node;
492*3a9fd824SRoger Pau Monné };
493*3a9fd824SRoger Pau Monné typedef struct xen_sysctl_cputopo xen_sysctl_cputopo_t;
494*3a9fd824SRoger Pau Monné DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cputopo_t);
495*3a9fd824SRoger Pau Monné 
496*3a9fd824SRoger Pau Monné /*
497*3a9fd824SRoger Pau Monné  * IN:
498*3a9fd824SRoger Pau Monné  *  - a NULL 'cputopo' handle is a request for maximun 'num_cpus'.
499*3a9fd824SRoger Pau Monné  *  - otherwise it's the number of entries in 'cputopo'
500*3a9fd824SRoger Pau Monné  *
501*3a9fd824SRoger Pau Monné  * OUT:
502*3a9fd824SRoger Pau Monné  *  - If 'num_cpus' is less than the number Xen wants to write but the handle
503*3a9fd824SRoger Pau Monné  *    handle is not a NULL one, partial data gets returned and 'num_cpus' gets
504*3a9fd824SRoger Pau Monné  *    updated to reflect the intended number.
505*3a9fd824SRoger Pau Monné  *  - Otherwise, 'num_cpus' shall indicate the number of entries written, which
506*3a9fd824SRoger Pau Monné  *    may be less than the input value.
507*3a9fd824SRoger Pau Monné  */
508*3a9fd824SRoger Pau Monné struct xen_sysctl_cputopoinfo {
509*3a9fd824SRoger Pau Monné     uint32_t num_cpus;
510*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(xen_sysctl_cputopo_t) cputopo;
511*3a9fd824SRoger Pau Monné };
512*3a9fd824SRoger Pau Monné 
513*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_numainfo */
514*3a9fd824SRoger Pau Monné #define XEN_INVALID_MEM_SZ     (~0U)
515*3a9fd824SRoger Pau Monné #define XEN_INVALID_NODE_DIST  (~0U)
516*3a9fd824SRoger Pau Monné 
517*3a9fd824SRoger Pau Monné struct xen_sysctl_meminfo {
518*3a9fd824SRoger Pau Monné     uint64_t memsize;
519*3a9fd824SRoger Pau Monné     uint64_t memfree;
520*3a9fd824SRoger Pau Monné };
521*3a9fd824SRoger Pau Monné typedef struct xen_sysctl_meminfo xen_sysctl_meminfo_t;
522*3a9fd824SRoger Pau Monné DEFINE_XEN_GUEST_HANDLE(xen_sysctl_meminfo_t);
523*3a9fd824SRoger Pau Monné 
524*3a9fd824SRoger Pau Monné /*
525*3a9fd824SRoger Pau Monné  * IN:
526*3a9fd824SRoger Pau Monné  *  - Both 'meminfo' and 'distance' handles being null is a request
527*3a9fd824SRoger Pau Monné  *    for maximum value of 'num_nodes'.
528*3a9fd824SRoger Pau Monné  *  - Otherwise it's the number of entries in 'meminfo' and square root
529*3a9fd824SRoger Pau Monné  *    of number of entries in 'distance' (when corresponding handle is
530*3a9fd824SRoger Pau Monné  *    non-null)
531*3a9fd824SRoger Pau Monné  *
532*3a9fd824SRoger Pau Monné  * OUT:
533*3a9fd824SRoger Pau Monné  *  - If 'num_nodes' is less than the number Xen wants to write but either
534*3a9fd824SRoger Pau Monné  *    handle is not a NULL one, partial data gets returned and 'num_nodes'
535*3a9fd824SRoger Pau Monné  *    gets updated to reflect the intended number.
536*3a9fd824SRoger Pau Monné  *  - Otherwise, 'num_nodes' shall indicate the number of entries written, which
537*3a9fd824SRoger Pau Monné  *    may be less than the input value.
538*3a9fd824SRoger Pau Monné  */
539*3a9fd824SRoger Pau Monné 
540*3a9fd824SRoger Pau Monné struct xen_sysctl_numainfo {
541*3a9fd824SRoger Pau Monné     uint32_t num_nodes;
542*3a9fd824SRoger Pau Monné 
543*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(xen_sysctl_meminfo_t) meminfo;
544*3a9fd824SRoger Pau Monné 
545*3a9fd824SRoger Pau Monné     /*
546*3a9fd824SRoger Pau Monné      * Distance between nodes 'i' and 'j' is stored in index 'i*N + j',
547*3a9fd824SRoger Pau Monné      * where N is the number of nodes that will be returned in 'num_nodes'
548*3a9fd824SRoger Pau Monné      * (i.e. not 'num_nodes' provided by the caller)
549*3a9fd824SRoger Pau Monné      */
550*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(uint32) distance;
551*3a9fd824SRoger Pau Monné };
552*3a9fd824SRoger Pau Monné 
553*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_cpupool_op */
554*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPUPOOL_OP_CREATE                1  /* C */
555*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPUPOOL_OP_DESTROY               2  /* D */
556*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPUPOOL_OP_INFO                  3  /* I */
557*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPUPOOL_OP_ADDCPU                4  /* A */
558*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPUPOOL_OP_RMCPU                 5  /* R */
559*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPUPOOL_OP_MOVEDOMAIN            6  /* M */
560*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPUPOOL_OP_FREEINFO              7  /* F */
561*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPUPOOL_PAR_ANY     0xFFFFFFFF
562*3a9fd824SRoger Pau Monné struct xen_sysctl_cpupool_op {
563*3a9fd824SRoger Pau Monné     uint32_t op;          /* IN */
564*3a9fd824SRoger Pau Monné     uint32_t cpupool_id;  /* IN: CDIARM OUT: CI */
565*3a9fd824SRoger Pau Monné     uint32_t sched_id;    /* IN: C      OUT: I  */
566*3a9fd824SRoger Pau Monné     uint32_t domid;       /* IN: M              */
567*3a9fd824SRoger Pau Monné     uint32_t cpu;         /* IN: AR             */
568*3a9fd824SRoger Pau Monné     uint32_t n_dom;       /*            OUT: I  */
569*3a9fd824SRoger Pau Monné     struct xenctl_bitmap cpumap; /*     OUT: IF */
570*3a9fd824SRoger Pau Monné };
571*3a9fd824SRoger Pau Monné 
572*3a9fd824SRoger Pau Monné /*
573*3a9fd824SRoger Pau Monné  * Error return values of cpupool operations:
574*3a9fd824SRoger Pau Monné  *
575*3a9fd824SRoger Pau Monné  * -EADDRINUSE:
576*3a9fd824SRoger Pau Monné  *  XEN_SYSCTL_CPUPOOL_OP_RMCPU: A vcpu is temporarily pinned to the cpu
577*3a9fd824SRoger Pau Monné  *    which is to be removed from a cpupool.
578*3a9fd824SRoger Pau Monné  * -EADDRNOTAVAIL:
579*3a9fd824SRoger Pau Monné  *  XEN_SYSCTL_CPUPOOL_OP_ADDCPU, XEN_SYSCTL_CPUPOOL_OP_RMCPU: A previous
580*3a9fd824SRoger Pau Monné  *    request to remove a cpu from a cpupool was terminated with -EAGAIN
581*3a9fd824SRoger Pau Monné  *    and has not been retried using the same parameters.
582*3a9fd824SRoger Pau Monné  * -EAGAIN:
583*3a9fd824SRoger Pau Monné  *  XEN_SYSCTL_CPUPOOL_OP_RMCPU: The cpu can't be removed from the cpupool
584*3a9fd824SRoger Pau Monné  *    as it is active in the hypervisor. A retry will succeed soon.
585*3a9fd824SRoger Pau Monné  * -EBUSY:
586*3a9fd824SRoger Pau Monné  *  XEN_SYSCTL_CPUPOOL_OP_DESTROY, XEN_SYSCTL_CPUPOOL_OP_RMCPU: A cpupool
587*3a9fd824SRoger Pau Monné  *    can't be destroyed or the last cpu can't be removed as there is still
588*3a9fd824SRoger Pau Monné  *    a running domain in that cpupool.
589*3a9fd824SRoger Pau Monné  * -EEXIST:
590*3a9fd824SRoger Pau Monné  *  XEN_SYSCTL_CPUPOOL_OP_CREATE: A cpupool_id was specified and is already
591*3a9fd824SRoger Pau Monné  *    existing.
592*3a9fd824SRoger Pau Monné  * -EINVAL:
593*3a9fd824SRoger Pau Monné  *  XEN_SYSCTL_CPUPOOL_OP_ADDCPU, XEN_SYSCTL_CPUPOOL_OP_RMCPU: An illegal
594*3a9fd824SRoger Pau Monné  *    cpu was specified (cpu does not exist).
595*3a9fd824SRoger Pau Monné  *  XEN_SYSCTL_CPUPOOL_OP_MOVEDOMAIN: An illegal domain was specified
596*3a9fd824SRoger Pau Monné  *    (domain id illegal or not suitable for operation).
597*3a9fd824SRoger Pau Monné  * -ENODEV:
598*3a9fd824SRoger Pau Monné  *  XEN_SYSCTL_CPUPOOL_OP_ADDCPU, XEN_SYSCTL_CPUPOOL_OP_RMCPU: The specified
599*3a9fd824SRoger Pau Monné  *    cpu is either not free (add) or not member of the specified cpupool
600*3a9fd824SRoger Pau Monné  *    (remove).
601*3a9fd824SRoger Pau Monné  * -ENOENT:
602*3a9fd824SRoger Pau Monné  *  all: The cpupool with the specified cpupool_id doesn't exist.
603*3a9fd824SRoger Pau Monné  *
604*3a9fd824SRoger Pau Monné  * Some common error return values like -ENOMEM and -EFAULT are possible for
605*3a9fd824SRoger Pau Monné  * all the operations.
606*3a9fd824SRoger Pau Monné  */
607*3a9fd824SRoger Pau Monné 
608*3a9fd824SRoger Pau Monné #define ARINC653_MAX_DOMAINS_PER_SCHEDULE   64
609*3a9fd824SRoger Pau Monné /*
610*3a9fd824SRoger Pau Monné  * This structure is used to pass a new ARINC653 schedule from a
611*3a9fd824SRoger Pau Monné  * privileged domain (ie dom0) to Xen.
612*3a9fd824SRoger Pau Monné  */
613*3a9fd824SRoger Pau Monné struct xen_sysctl_arinc653_schedule {
614*3a9fd824SRoger Pau Monné     /* major_frame holds the time for the new schedule's major frame
615*3a9fd824SRoger Pau Monné      * in nanoseconds. */
616*3a9fd824SRoger Pau Monné     uint64_aligned_t     major_frame;
617*3a9fd824SRoger Pau Monné     /* num_sched_entries holds how many of the entries in the
618*3a9fd824SRoger Pau Monné      * sched_entries[] array are valid. */
619*3a9fd824SRoger Pau Monné     uint8_t     num_sched_entries;
620*3a9fd824SRoger Pau Monné     /* The sched_entries array holds the actual schedule entries. */
621*3a9fd824SRoger Pau Monné     struct {
622*3a9fd824SRoger Pau Monné         /* dom_handle must match a domain's UUID */
623*3a9fd824SRoger Pau Monné         xen_domain_handle_t dom_handle;
624*3a9fd824SRoger Pau Monné         /* If a domain has multiple VCPUs, vcpu_id specifies which one
625*3a9fd824SRoger Pau Monné          * this schedule entry applies to. It should be set to 0 if
626*3a9fd824SRoger Pau Monné          * there is only one VCPU for the domain. */
627*3a9fd824SRoger Pau Monné         unsigned int vcpu_id;
628*3a9fd824SRoger Pau Monné         /* runtime specifies the amount of time that should be allocated
629*3a9fd824SRoger Pau Monné          * to this VCPU per major frame. It is specified in nanoseconds */
630*3a9fd824SRoger Pau Monné         uint64_aligned_t runtime;
631*3a9fd824SRoger Pau Monné     } sched_entries[ARINC653_MAX_DOMAINS_PER_SCHEDULE];
632*3a9fd824SRoger Pau Monné };
633*3a9fd824SRoger Pau Monné typedef struct xen_sysctl_arinc653_schedule xen_sysctl_arinc653_schedule_t;
634*3a9fd824SRoger Pau Monné DEFINE_XEN_GUEST_HANDLE(xen_sysctl_arinc653_schedule_t);
635*3a9fd824SRoger Pau Monné 
636*3a9fd824SRoger Pau Monné /*
637*3a9fd824SRoger Pau Monné  * Valid range for context switch rate limit (in microseconds).
638*3a9fd824SRoger Pau Monné  * Applicable to Credit and Credit2 schedulers.
639*3a9fd824SRoger Pau Monné  */
640*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_SCHED_RATELIMIT_MAX 500000
641*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_SCHED_RATELIMIT_MIN 100
642*3a9fd824SRoger Pau Monné 
643*3a9fd824SRoger Pau Monné struct xen_sysctl_credit_schedule {
644*3a9fd824SRoger Pau Monné     /* Length of timeslice in milliseconds */
645*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CSCHED_TSLICE_MAX 1000
646*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CSCHED_TSLICE_MIN 1
647*3a9fd824SRoger Pau Monné     unsigned tslice_ms;
648*3a9fd824SRoger Pau Monné     unsigned ratelimit_us;
649*3a9fd824SRoger Pau Monné     /*
650*3a9fd824SRoger Pau Monné      * How long we consider a vCPU to be cache-hot on the
651*3a9fd824SRoger Pau Monné      * CPU where it has run (max 100ms, in microseconds)
652*3a9fd824SRoger Pau Monné     */
653*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CSCHED_MGR_DLY_MAX_US (100 * 1000)
654*3a9fd824SRoger Pau Monné     unsigned vcpu_migr_delay_us;
655*3a9fd824SRoger Pau Monné };
656*3a9fd824SRoger Pau Monné 
657*3a9fd824SRoger Pau Monné struct xen_sysctl_credit2_schedule {
658*3a9fd824SRoger Pau Monné     unsigned ratelimit_us;
659*3a9fd824SRoger Pau Monné };
660*3a9fd824SRoger Pau Monné 
661*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_scheduler_op */
662*3a9fd824SRoger Pau Monné /* Set or get info? */
663*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_SCHEDOP_putinfo 0
664*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_SCHEDOP_getinfo 1
665*3a9fd824SRoger Pau Monné struct xen_sysctl_scheduler_op {
666*3a9fd824SRoger Pau Monné     uint32_t cpupool_id; /* Cpupool whose scheduler is to be targetted. */
667*3a9fd824SRoger Pau Monné     uint32_t sched_id;   /* XEN_SCHEDULER_* (domctl.h) */
668*3a9fd824SRoger Pau Monné     uint32_t cmd;        /* XEN_SYSCTL_SCHEDOP_* */
669*3a9fd824SRoger Pau Monné     union {
670*3a9fd824SRoger Pau Monné         struct xen_sysctl_sched_arinc653 {
671*3a9fd824SRoger Pau Monné             XEN_GUEST_HANDLE_64(xen_sysctl_arinc653_schedule_t) schedule;
672*3a9fd824SRoger Pau Monné         } sched_arinc653;
673*3a9fd824SRoger Pau Monné         struct xen_sysctl_credit_schedule sched_credit;
674*3a9fd824SRoger Pau Monné         struct xen_sysctl_credit2_schedule sched_credit2;
675*3a9fd824SRoger Pau Monné     } u;
676*3a9fd824SRoger Pau Monné };
677*3a9fd824SRoger Pau Monné 
678*3a9fd824SRoger Pau Monné /*
679*3a9fd824SRoger Pau Monné  * Output format of gcov data:
680*3a9fd824SRoger Pau Monné  *
681*3a9fd824SRoger Pau Monné  * XEN_GCOV_FORMAT_MAGIC XEN_GCOV_RECORD ... XEN_GCOV_RECORD
682*3a9fd824SRoger Pau Monné  *
683*3a9fd824SRoger Pau Monné  * That is, one magic number followed by 0 or more record.
684*3a9fd824SRoger Pau Monné  *
685*3a9fd824SRoger Pau Monné  * The magic number is stored as an uint32_t field.
686*3a9fd824SRoger Pau Monné  *
687*3a9fd824SRoger Pau Monné  * The record is packed and variable in length. It has the form:
688*3a9fd824SRoger Pau Monné  *
689*3a9fd824SRoger Pau Monné  *  filename: a NULL terminated path name extracted from gcov, used to
690*3a9fd824SRoger Pau Monné  *            create the name of gcda file.
691*3a9fd824SRoger Pau Monné  *  size:     a uint32_t field indicating the size of the payload, the
692*3a9fd824SRoger Pau Monné  *            unit is byte.
693*3a9fd824SRoger Pau Monné  *  payload:  the actual payload, length is `size' bytes.
694*3a9fd824SRoger Pau Monné  *
695*3a9fd824SRoger Pau Monné  * Userspace tool will split the record to different files.
696*3a9fd824SRoger Pau Monné  */
697*3a9fd824SRoger Pau Monné 
698*3a9fd824SRoger Pau Monné #define XEN_GCOV_FORMAT_MAGIC    0x58434f56 /* XCOV */
699*3a9fd824SRoger Pau Monné 
700*3a9fd824SRoger Pau Monné /*
701*3a9fd824SRoger Pau Monné  * Ouput format of LLVM coverage data is just a raw stream, as would be
702*3a9fd824SRoger Pau Monné  * written by the compiler_rt run time library into a .profraw file. There
703*3a9fd824SRoger Pau Monné  * are no special Xen tags or delimiters because none are needed.
704*3a9fd824SRoger Pau Monné  */
705*3a9fd824SRoger Pau Monné 
706*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_COVERAGE_get_size 0 /* Get total size of output data */
707*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_COVERAGE_read     1 /* Read output data */
708*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_COVERAGE_reset    2 /* Reset all counters */
709*3a9fd824SRoger Pau Monné 
710*3a9fd824SRoger Pau Monné struct xen_sysctl_coverage_op {
711*3a9fd824SRoger Pau Monné     uint32_t cmd;
712*3a9fd824SRoger Pau Monné     uint32_t size; /* IN/OUT: size of the buffer  */
713*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(char) buffer; /* OUT */
714*3a9fd824SRoger Pau Monné };
715*3a9fd824SRoger Pau Monné 
716*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PSR_CMT_get_total_rmid            0
717*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PSR_CMT_get_l3_upscaling_factor   1
718*3a9fd824SRoger Pau Monné /* The L3 cache size is returned in KB unit */
719*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PSR_CMT_get_l3_cache_size         2
720*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PSR_CMT_enabled                   3
721*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PSR_CMT_get_l3_event_mask         4
722*3a9fd824SRoger Pau Monné struct xen_sysctl_psr_cmt_op {
723*3a9fd824SRoger Pau Monné     uint32_t cmd;       /* IN: XEN_SYSCTL_PSR_CMT_* */
724*3a9fd824SRoger Pau Monné     uint32_t flags;     /* padding variable, may be extended for future use */
725*3a9fd824SRoger Pau Monné     union {
726*3a9fd824SRoger Pau Monné         uint64_t data;  /* OUT */
727*3a9fd824SRoger Pau Monné         struct {
728*3a9fd824SRoger Pau Monné             uint32_t cpu;   /* IN */
729*3a9fd824SRoger Pau Monné             uint32_t rsvd;
730*3a9fd824SRoger Pau Monné         } l3_cache;
731*3a9fd824SRoger Pau Monné     } u;
732*3a9fd824SRoger Pau Monné };
733*3a9fd824SRoger Pau Monné 
734*3a9fd824SRoger Pau Monné /* XEN_SYSCTL_pcitopoinfo */
735*3a9fd824SRoger Pau Monné #define XEN_INVALID_DEV (XEN_INVALID_NODE_ID - 1)
736*3a9fd824SRoger Pau Monné struct xen_sysctl_pcitopoinfo {
737*3a9fd824SRoger Pau Monné     /*
738*3a9fd824SRoger Pau Monné      * IN: Number of elements in 'devs' and 'nodes' arrays.
739*3a9fd824SRoger Pau Monné      * OUT: Number of processed elements of those arrays.
740*3a9fd824SRoger Pau Monné      */
741*3a9fd824SRoger Pau Monné     uint32_t num_devs;
742*3a9fd824SRoger Pau Monné 
743*3a9fd824SRoger Pau Monné     /* IN: list of devices for which node IDs are requested. */
744*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(physdev_pci_device_t) devs;
745*3a9fd824SRoger Pau Monné 
746*3a9fd824SRoger Pau Monné     /*
747*3a9fd824SRoger Pau Monné      * OUT: node identifier for each device.
748*3a9fd824SRoger Pau Monné      * If information for a particular device is not available then
749*3a9fd824SRoger Pau Monné      * corresponding entry will be set to XEN_INVALID_NODE_ID. If
750*3a9fd824SRoger Pau Monné      * device is not known to the hypervisor then XEN_INVALID_DEV
751*3a9fd824SRoger Pau Monné      * will be provided.
752*3a9fd824SRoger Pau Monné      */
753*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(uint32) nodes;
754*3a9fd824SRoger Pau Monné };
755*3a9fd824SRoger Pau Monné 
756*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PSR_get_l3_info               0
757*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PSR_get_l2_info               1
758*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PSR_get_mba_info              2
759*3a9fd824SRoger Pau Monné struct xen_sysctl_psr_alloc {
760*3a9fd824SRoger Pau Monné     uint32_t cmd;       /* IN: XEN_SYSCTL_PSR_* */
761*3a9fd824SRoger Pau Monné     uint32_t target;    /* IN */
762*3a9fd824SRoger Pau Monné     union {
763*3a9fd824SRoger Pau Monné         struct {
764*3a9fd824SRoger Pau Monné             uint32_t cbm_len;   /* OUT: CBM length */
765*3a9fd824SRoger Pau Monné             uint32_t cos_max;   /* OUT: Maximum COS */
766*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PSR_CAT_L3_CDP       (1u << 0)
767*3a9fd824SRoger Pau Monné             uint32_t flags;     /* OUT: CAT flags */
768*3a9fd824SRoger Pau Monné         } cat_info;
769*3a9fd824SRoger Pau Monné 
770*3a9fd824SRoger Pau Monné         struct {
771*3a9fd824SRoger Pau Monné             uint32_t thrtl_max; /* OUT: Maximum throttle */
772*3a9fd824SRoger Pau Monné             uint32_t cos_max;   /* OUT: Maximum COS */
773*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_PSR_MBA_LINEAR      (1u << 0)
774*3a9fd824SRoger Pau Monné             uint32_t flags;     /* OUT: MBA flags */
775*3a9fd824SRoger Pau Monné         } mba_info;
776*3a9fd824SRoger Pau Monné     } u;
777*3a9fd824SRoger Pau Monné };
778*3a9fd824SRoger Pau Monné 
779*3a9fd824SRoger Pau Monné /*
780*3a9fd824SRoger Pau Monné  * XEN_SYSCTL_get_cpu_levelling_caps (x86 specific)
781*3a9fd824SRoger Pau Monné  *
782*3a9fd824SRoger Pau Monné  * Return hardware capabilities concerning masking or faulting of the cpuid
783*3a9fd824SRoger Pau Monné  * instruction for PV guests.
784*3a9fd824SRoger Pau Monné  */
785*3a9fd824SRoger Pau Monné struct xen_sysctl_cpu_levelling_caps {
786*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPU_LEVELCAP_faulting    (1ul <<  0) /* CPUID faulting    */
787*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPU_LEVELCAP_ecx         (1ul <<  1) /* 0x00000001.ecx    */
788*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPU_LEVELCAP_edx         (1ul <<  2) /* 0x00000001.edx    */
789*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPU_LEVELCAP_extd_ecx    (1ul <<  3) /* 0x80000001.ecx    */
790*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPU_LEVELCAP_extd_edx    (1ul <<  4) /* 0x80000001.edx    */
791*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPU_LEVELCAP_xsave_eax   (1ul <<  5) /* 0x0000000D:1.eax  */
792*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPU_LEVELCAP_thermal_ecx (1ul <<  6) /* 0x00000006.ecx    */
793*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPU_LEVELCAP_l7s0_eax    (1ul <<  7) /* 0x00000007:0.eax  */
794*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_CPU_LEVELCAP_l7s0_ebx    (1ul <<  8) /* 0x00000007:0.ebx  */
795*3a9fd824SRoger Pau Monné     uint32_t caps;
796*3a9fd824SRoger Pau Monné };
797*3a9fd824SRoger Pau Monné 
798*3a9fd824SRoger Pau Monné /*
799*3a9fd824SRoger Pau Monné  * XEN_SYSCTL_get_cpu_featureset (x86 specific)
800*3a9fd824SRoger Pau Monné  *
801*3a9fd824SRoger Pau Monné  * Return information about featuresets available on this host.
802*3a9fd824SRoger Pau Monné  *  -  Raw: The real cpuid values.
803*3a9fd824SRoger Pau Monné  *  - Host: The values Xen is using, (after command line overrides, etc).
804*3a9fd824SRoger Pau Monné  *  -   PV: Maximum set of features which can be given to a PV guest.
805*3a9fd824SRoger Pau Monné  *  -  HVM: Maximum set of features which can be given to a HVM guest.
806*3a9fd824SRoger Pau Monné  * May fail with -EOPNOTSUPP if querying for PV or HVM data when support is
807*3a9fd824SRoger Pau Monné  * compiled out of Xen.
808*3a9fd824SRoger Pau Monné  */
809*3a9fd824SRoger Pau Monné struct xen_sysctl_cpu_featureset {
810*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_cpu_featureset_raw      0
811*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_cpu_featureset_host     1
812*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_cpu_featureset_pv       2
813*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_cpu_featureset_hvm      3
814*3a9fd824SRoger Pau Monné     uint32_t index;       /* IN: Which featureset to query? */
815*3a9fd824SRoger Pau Monné     uint32_t nr_features; /* IN/OUT: Number of entries in/written to
816*3a9fd824SRoger Pau Monné                            * 'features', or the maximum number of features if
817*3a9fd824SRoger Pau Monné                            * the guest handle is NULL.  NB. All featuresets
818*3a9fd824SRoger Pau Monné                            * come from the same numberspace, so have the same
819*3a9fd824SRoger Pau Monné                            * maximum length. */
820*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(uint32) features; /* OUT: */
821*3a9fd824SRoger Pau Monné };
822*3a9fd824SRoger Pau Monné 
823*3a9fd824SRoger Pau Monné /*
824*3a9fd824SRoger Pau Monné  * XEN_SYSCTL_LIVEPATCH_op
825*3a9fd824SRoger Pau Monné  *
826*3a9fd824SRoger Pau Monné  * Refer to the docs/unstable/misc/livepatch.markdown
827*3a9fd824SRoger Pau Monné  * for the design details of this hypercall.
828*3a9fd824SRoger Pau Monné  *
829*3a9fd824SRoger Pau Monné  * There are four sub-ops:
830*3a9fd824SRoger Pau Monné  *  XEN_SYSCTL_LIVEPATCH_UPLOAD (0)
831*3a9fd824SRoger Pau Monné  *  XEN_SYSCTL_LIVEPATCH_GET (1)
832*3a9fd824SRoger Pau Monné  *  XEN_SYSCTL_LIVEPATCH_LIST (2)
833*3a9fd824SRoger Pau Monné  *  XEN_SYSCTL_LIVEPATCH_ACTION (3)
834*3a9fd824SRoger Pau Monné  *
835*3a9fd824SRoger Pau Monné  * The normal sequence of sub-ops is to:
836*3a9fd824SRoger Pau Monné  *  1) XEN_SYSCTL_LIVEPATCH_UPLOAD to upload the payload. If errors STOP.
837*3a9fd824SRoger Pau Monné  *  2) XEN_SYSCTL_LIVEPATCH_GET to check the `->rc`. If -XEN_EAGAIN spin.
838*3a9fd824SRoger Pau Monné  *     If zero go to next step.
839*3a9fd824SRoger Pau Monné  *  3) XEN_SYSCTL_LIVEPATCH_ACTION with LIVEPATCH_ACTION_APPLY to apply the patch.
840*3a9fd824SRoger Pau Monné  *  4) XEN_SYSCTL_LIVEPATCH_GET to check the `->rc`. If in -XEN_EAGAIN spin.
841*3a9fd824SRoger Pau Monné  *     If zero exit with success.
842*3a9fd824SRoger Pau Monné  */
843*3a9fd824SRoger Pau Monné 
844*3a9fd824SRoger Pau Monné #define LIVEPATCH_PAYLOAD_VERSION 2
845*3a9fd824SRoger Pau Monné /*
846*3a9fd824SRoger Pau Monné  * .livepatch.funcs structure layout defined in the `Payload format`
847*3a9fd824SRoger Pau Monné  * section in the Live Patch design document.
848*3a9fd824SRoger Pau Monné  *
849*3a9fd824SRoger Pau Monné  * We guard this with __XEN__ as toolstacks SHOULD not use it.
850*3a9fd824SRoger Pau Monné  */
851*3a9fd824SRoger Pau Monné #ifdef __XEN__
852*3a9fd824SRoger Pau Monné #define LIVEPATCH_OPAQUE_SIZE 31
853*3a9fd824SRoger Pau Monné 
854*3a9fd824SRoger Pau Monné struct livepatch_expectation {
855*3a9fd824SRoger Pau Monné     uint8_t enabled : 1;
856*3a9fd824SRoger Pau Monné     uint8_t len : 5;        /* Length of data up to LIVEPATCH_OPAQUE_SIZE
857*3a9fd824SRoger Pau Monné                                (5 bits is enough for now) */
858*3a9fd824SRoger Pau Monné     uint8_t rsv : 2;        /* Reserved. Zero value */
859*3a9fd824SRoger Pau Monné     uint8_t data[LIVEPATCH_OPAQUE_SIZE]; /* Same size as opaque[] buffer of
860*3a9fd824SRoger Pau Monné                                             struct livepatch_func. This is the
861*3a9fd824SRoger Pau Monné                                             max number of bytes to be patched */
862*3a9fd824SRoger Pau Monné };
863*3a9fd824SRoger Pau Monné typedef struct livepatch_expectation livepatch_expectation_t;
864*3a9fd824SRoger Pau Monné 
865*3a9fd824SRoger Pau Monné typedef enum livepatch_func_state {
866*3a9fd824SRoger Pau Monné     LIVEPATCH_FUNC_NOT_APPLIED,
867*3a9fd824SRoger Pau Monné     LIVEPATCH_FUNC_APPLIED
868*3a9fd824SRoger Pau Monné } livepatch_func_state_t;
869*3a9fd824SRoger Pau Monné 
870*3a9fd824SRoger Pau Monné struct livepatch_func {
871*3a9fd824SRoger Pau Monné     const char *name;       /* Name of function to be patched. */
872*3a9fd824SRoger Pau Monné     void *new_addr;
873*3a9fd824SRoger Pau Monné     void *old_addr;
874*3a9fd824SRoger Pau Monné     uint32_t new_size;
875*3a9fd824SRoger Pau Monné     uint32_t old_size;
876*3a9fd824SRoger Pau Monné     uint8_t version;        /* MUST be LIVEPATCH_PAYLOAD_VERSION. */
877*3a9fd824SRoger Pau Monné     uint8_t opaque[LIVEPATCH_OPAQUE_SIZE];
878*3a9fd824SRoger Pau Monné     uint8_t applied;
879*3a9fd824SRoger Pau Monné     uint8_t _pad[7];
880*3a9fd824SRoger Pau Monné     livepatch_expectation_t expect;
881*3a9fd824SRoger Pau Monné };
882*3a9fd824SRoger Pau Monné typedef struct livepatch_func livepatch_func_t;
883*3a9fd824SRoger Pau Monné #endif
884*3a9fd824SRoger Pau Monné 
885*3a9fd824SRoger Pau Monné /*
886*3a9fd824SRoger Pau Monné  * Structure describing an ELF payload. Uniquely identifies the
887*3a9fd824SRoger Pau Monné  * payload. Should be human readable.
888*3a9fd824SRoger Pau Monné  * Recommended length is upto XEN_LIVEPATCH_NAME_SIZE.
889*3a9fd824SRoger Pau Monné  * Includes the NUL terminator.
890*3a9fd824SRoger Pau Monné  */
891*3a9fd824SRoger Pau Monné #define XEN_LIVEPATCH_NAME_SIZE 128
892*3a9fd824SRoger Pau Monné struct xen_livepatch_name {
893*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(char) name;         /* IN: pointer to name. */
894*3a9fd824SRoger Pau Monné     uint16_t size;                          /* IN: size of name. May be upto
895*3a9fd824SRoger Pau Monné                                                XEN_LIVEPATCH_NAME_SIZE. */
896*3a9fd824SRoger Pau Monné     uint16_t pad[3];                        /* IN: MUST be zero. */
897*3a9fd824SRoger Pau Monné };
898*3a9fd824SRoger Pau Monné 
899*3a9fd824SRoger Pau Monné /*
900*3a9fd824SRoger Pau Monné  * Upload a payload to the hypervisor. The payload is verified
901*3a9fd824SRoger Pau Monné  * against basic checks and if there are any issues the proper return code
902*3a9fd824SRoger Pau Monné  * will be returned. The payload is not applied at this time - that is
903*3a9fd824SRoger Pau Monné  * controlled by XEN_SYSCTL_LIVEPATCH_ACTION.
904*3a9fd824SRoger Pau Monné  *
905*3a9fd824SRoger Pau Monné  * The return value is zero if the payload was succesfully uploaded.
906*3a9fd824SRoger Pau Monné  * Otherwise an EXX return value is provided. Duplicate `name` are not
907*3a9fd824SRoger Pau Monné  * supported.
908*3a9fd824SRoger Pau Monné  *
909*3a9fd824SRoger Pau Monné  * The payload at this point is verified against basic checks.
910*3a9fd824SRoger Pau Monné  *
911*3a9fd824SRoger Pau Monné  * The `payload` is the ELF payload as mentioned in the `Payload format`
912*3a9fd824SRoger Pau Monné  * section in the Live Patch design document.
913*3a9fd824SRoger Pau Monné  */
914*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_LIVEPATCH_UPLOAD 0
915*3a9fd824SRoger Pau Monné struct xen_sysctl_livepatch_upload {
916*3a9fd824SRoger Pau Monné     struct xen_livepatch_name name;         /* IN, name of the patch. */
917*3a9fd824SRoger Pau Monné     uint64_t size;                          /* IN, size of the ELF file. */
918*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(uint8) payload;     /* IN, the ELF file. */
919*3a9fd824SRoger Pau Monné };
920*3a9fd824SRoger Pau Monné 
921*3a9fd824SRoger Pau Monné /*
922*3a9fd824SRoger Pau Monné  * Retrieve an status of an specific payload.
923*3a9fd824SRoger Pau Monné  *
924*3a9fd824SRoger Pau Monné  * Upon completion the `struct xen_livepatch_status` is updated.
925*3a9fd824SRoger Pau Monné  *
926*3a9fd824SRoger Pau Monné  * The return value is zero on success and XEN_EXX on failure. This operation
927*3a9fd824SRoger Pau Monné  * is synchronous and does not require preemption.
928*3a9fd824SRoger Pau Monné  */
929*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_LIVEPATCH_GET 1
930*3a9fd824SRoger Pau Monné 
931*3a9fd824SRoger Pau Monné struct xen_livepatch_status {
932*3a9fd824SRoger Pau Monné #define LIVEPATCH_STATE_CHECKED      1
933*3a9fd824SRoger Pau Monné #define LIVEPATCH_STATE_APPLIED      2
934*3a9fd824SRoger Pau Monné     uint32_t state;                /* OUT: LIVEPATCH_STATE_*. */
935*3a9fd824SRoger Pau Monné     int32_t rc;                    /* OUT: 0 if no error, otherwise -XEN_EXX. */
936*3a9fd824SRoger Pau Monné };
937*3a9fd824SRoger Pau Monné typedef struct xen_livepatch_status xen_livepatch_status_t;
938*3a9fd824SRoger Pau Monné DEFINE_XEN_GUEST_HANDLE(xen_livepatch_status_t);
939*3a9fd824SRoger Pau Monné 
940*3a9fd824SRoger Pau Monné struct xen_sysctl_livepatch_get {
941*3a9fd824SRoger Pau Monné     struct xen_livepatch_name name;         /* IN, name of the payload. */
942*3a9fd824SRoger Pau Monné     struct xen_livepatch_status status;     /* IN/OUT, state of it. */
943*3a9fd824SRoger Pau Monné };
944*3a9fd824SRoger Pau Monné 
945*3a9fd824SRoger Pau Monné /*
946*3a9fd824SRoger Pau Monné  * Retrieve an array of abbreviated status, names and metadata of payloads that
947*3a9fd824SRoger Pau Monné  * are loaded in the hypervisor.
948*3a9fd824SRoger Pau Monné  *
949*3a9fd824SRoger Pau Monné  * If the hypercall returns an positive number, it is the number (up to `nr`)
950*3a9fd824SRoger Pau Monné  * of the payloads returned, along with `nr` updated with the number of remaining
951*3a9fd824SRoger Pau Monné  * payloads, `version` updated (it may be the same across hypercalls. If it varies
952*3a9fd824SRoger Pau Monné  * the data is stale and further calls could fail), `name_total_size` and
953*3a9fd824SRoger Pau Monné  * `metadata_total_size` containing total sizes of transferred data for both the
954*3a9fd824SRoger Pau Monné  * arrays.
955*3a9fd824SRoger Pau Monné  * The `status`, `name`, `len`, `metadata` and `metadata_len` are updated at their
956*3a9fd824SRoger Pau Monné  * designed index value (`idx`) with the returned value of data.
957*3a9fd824SRoger Pau Monné  *
958*3a9fd824SRoger Pau Monné  * If the hypercall returns E2BIG the `nr` is too big and should be
959*3a9fd824SRoger Pau Monné  * lowered. The upper limit of `nr` is left to the implemention.
960*3a9fd824SRoger Pau Monné  *
961*3a9fd824SRoger Pau Monné  * Note that due to the asynchronous nature of hypercalls the domain might have
962*3a9fd824SRoger Pau Monné  * added or removed the number of payloads making this information stale. It is
963*3a9fd824SRoger Pau Monné  * the responsibility of the toolstack to use the `version` field to check
964*3a9fd824SRoger Pau Monné  * between each invocation. if the version differs it should discard the stale
965*3a9fd824SRoger Pau Monné  * data and start from scratch. It is OK for the toolstack to use the new
966*3a9fd824SRoger Pau Monné  * `version` field.
967*3a9fd824SRoger Pau Monné  */
968*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_LIVEPATCH_LIST 2
969*3a9fd824SRoger Pau Monné struct xen_sysctl_livepatch_list {
970*3a9fd824SRoger Pau Monné     uint32_t version;                       /* OUT: Hypervisor stamps value.
971*3a9fd824SRoger Pau Monné                                                If varies between calls, we are
972*3a9fd824SRoger Pau Monné                                              * getting stale data. */
973*3a9fd824SRoger Pau Monné     uint32_t idx;                           /* IN: Index into hypervisor list. */
974*3a9fd824SRoger Pau Monné     uint32_t nr;                            /* IN: How many status, name, and len
975*3a9fd824SRoger Pau Monné                                                should fill out. Can be zero to get
976*3a9fd824SRoger Pau Monné                                                amount of payloads and version.
977*3a9fd824SRoger Pau Monné                                                OUT: How many payloads left. */
978*3a9fd824SRoger Pau Monné     uint32_t pad;                           /* IN: Must be zero. */
979*3a9fd824SRoger Pau Monné     uint32_t name_total_size;               /* OUT: Total size of all transfer names */
980*3a9fd824SRoger Pau Monné     uint32_t metadata_total_size;           /* OUT: Total size of all transfer metadata */
981*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(xen_livepatch_status_t) status;  /* OUT. Must have enough
982*3a9fd824SRoger Pau Monné                                                space allocate for nr of them. */
983*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(char) name;         /* OUT: Array of names. Each member
984*3a9fd824SRoger Pau Monné                                                may have an arbitrary length up to
985*3a9fd824SRoger Pau Monné                                                XEN_LIVEPATCH_NAME_SIZE bytes. Must have
986*3a9fd824SRoger Pau Monné                                                nr of them. */
987*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(uint32) len;        /* OUT: Array of lengths of name's.
988*3a9fd824SRoger Pau Monné                                                Must have nr of them. */
989*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(char) metadata;     /* OUT: Array of metadata strings. Each
990*3a9fd824SRoger Pau Monné                                                member may have an arbitrary length.
991*3a9fd824SRoger Pau Monné                                                Must have nr of them. */
992*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(uint32) metadata_len;  /* OUT: Array of lengths of metadata's.
993*3a9fd824SRoger Pau Monné                                                   Must have nr of them. */
994*3a9fd824SRoger Pau Monné };
995*3a9fd824SRoger Pau Monné 
996*3a9fd824SRoger Pau Monné /*
997*3a9fd824SRoger Pau Monné  * Perform an operation on the payload structure referenced by the `name` field.
998*3a9fd824SRoger Pau Monné  * The operation request is asynchronous and the status should be retrieved
999*3a9fd824SRoger Pau Monné  * by using either XEN_SYSCTL_LIVEPATCH_GET or XEN_SYSCTL_LIVEPATCH_LIST hypercall.
1000*3a9fd824SRoger Pau Monné  */
1001*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_LIVEPATCH_ACTION 3
1002*3a9fd824SRoger Pau Monné struct xen_sysctl_livepatch_action {
1003*3a9fd824SRoger Pau Monné     struct xen_livepatch_name name;         /* IN, name of the patch. */
1004*3a9fd824SRoger Pau Monné #define LIVEPATCH_ACTION_UNLOAD       1
1005*3a9fd824SRoger Pau Monné #define LIVEPATCH_ACTION_REVERT       2
1006*3a9fd824SRoger Pau Monné #define LIVEPATCH_ACTION_APPLY        3
1007*3a9fd824SRoger Pau Monné #define LIVEPATCH_ACTION_REPLACE      4
1008*3a9fd824SRoger Pau Monné     uint32_t cmd;                           /* IN: LIVEPATCH_ACTION_*. */
1009*3a9fd824SRoger Pau Monné     uint32_t timeout;                       /* IN: If zero then uses */
1010*3a9fd824SRoger Pau Monné                                             /* hypervisor default. */
1011*3a9fd824SRoger Pau Monné                                             /* Or upper bound of time (ns) */
1012*3a9fd824SRoger Pau Monné                                             /* for operation to take. */
1013*3a9fd824SRoger Pau Monné 
1014*3a9fd824SRoger Pau Monné /*
1015*3a9fd824SRoger Pau Monné  * Override default inter-module buildid dependency chain enforcement.
1016*3a9fd824SRoger Pau Monné  * Check only if module is built for given hypervisor by comparing buildid.
1017*3a9fd824SRoger Pau Monné  */
1018*3a9fd824SRoger Pau Monné #define LIVEPATCH_ACTION_APPLY_NODEPS (1 << 0)
1019*3a9fd824SRoger Pau Monné     uint32_t flags;                         /* IN: action flags. */
1020*3a9fd824SRoger Pau Monné                                             /* Provide additional parameters */
1021*3a9fd824SRoger Pau Monné                                             /* for an action. */
1022*3a9fd824SRoger Pau Monné     uint32_t pad;                           /* IN: Always zero. */
1023*3a9fd824SRoger Pau Monné };
1024*3a9fd824SRoger Pau Monné 
1025*3a9fd824SRoger Pau Monné struct xen_sysctl_livepatch_op {
1026*3a9fd824SRoger Pau Monné     uint32_t cmd;                           /* IN: XEN_SYSCTL_LIVEPATCH_*. */
1027*3a9fd824SRoger Pau Monné     uint32_t pad;                           /* IN: Always zero. */
1028*3a9fd824SRoger Pau Monné     union {
1029*3a9fd824SRoger Pau Monné         struct xen_sysctl_livepatch_upload upload;
1030*3a9fd824SRoger Pau Monné         struct xen_sysctl_livepatch_list list;
1031*3a9fd824SRoger Pau Monné         struct xen_sysctl_livepatch_get get;
1032*3a9fd824SRoger Pau Monné         struct xen_sysctl_livepatch_action action;
1033*3a9fd824SRoger Pau Monné     } u;
1034*3a9fd824SRoger Pau Monné };
1035*3a9fd824SRoger Pau Monné 
1036*3a9fd824SRoger Pau Monné #if defined(__i386__) || defined(__x86_64__)
1037*3a9fd824SRoger Pau Monné /*
1038*3a9fd824SRoger Pau Monné  * XEN_SYSCTL_get_cpu_policy (x86 specific)
1039*3a9fd824SRoger Pau Monné  *
1040*3a9fd824SRoger Pau Monné  * Return information about CPUID and MSR policies available on this host.
1041*3a9fd824SRoger Pau Monné  *  -       Raw: The real H/W values.
1042*3a9fd824SRoger Pau Monné  *  -      Host: The values Xen is using, (after command line overrides, etc).
1043*3a9fd824SRoger Pau Monné  *  -     Max_*: Maximum set of features a PV or HVM guest can use.  Includes
1044*3a9fd824SRoger Pau Monné  *               experimental features outside of security support.
1045*3a9fd824SRoger Pau Monné  *  - Default_*: Default set of features a PV or HVM guest can use.  This is
1046*3a9fd824SRoger Pau Monné  *               the security supported set.
1047*3a9fd824SRoger Pau Monné  * May fail with -EOPNOTSUPP if querying for PV or HVM data when support is
1048*3a9fd824SRoger Pau Monné  * compiled out of Xen.
1049*3a9fd824SRoger Pau Monné  */
1050*3a9fd824SRoger Pau Monné struct xen_sysctl_cpu_policy {
1051*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_cpu_policy_raw          0
1052*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_cpu_policy_host         1
1053*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_cpu_policy_pv_max       2
1054*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_cpu_policy_hvm_max      3
1055*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_cpu_policy_pv_default   4
1056*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_cpu_policy_hvm_default  5
1057*3a9fd824SRoger Pau Monné     uint32_t index;       /* IN: Which policy to query? */
1058*3a9fd824SRoger Pau Monné     uint32_t nr_leaves;   /* IN/OUT: Number of leaves in/written to
1059*3a9fd824SRoger Pau Monné                            * 'cpuid_policy', or the maximum number of leaves
1060*3a9fd824SRoger Pau Monné                            * if the guest handle is NULL. */
1061*3a9fd824SRoger Pau Monné     uint32_t nr_msrs;     /* IN/OUT: Number of MSRs in/written to
1062*3a9fd824SRoger Pau Monné                            * 'msr_policy', or the maximum number of MSRs if
1063*3a9fd824SRoger Pau Monné                            * the guest handle is NULL. */
1064*3a9fd824SRoger Pau Monné     uint32_t _rsvd;       /* Must be zero. */
1065*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(xen_cpuid_leaf_t) cpuid_policy; /* OUT */
1066*3a9fd824SRoger Pau Monné     XEN_GUEST_HANDLE_64(xen_msr_entry_t) msr_policy;    /* OUT */
1067*3a9fd824SRoger Pau Monné };
1068*3a9fd824SRoger Pau Monné typedef struct xen_sysctl_cpu_policy xen_sysctl_cpu_policy_t;
1069*3a9fd824SRoger Pau Monné DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpu_policy_t);
1070*3a9fd824SRoger Pau Monné #endif
1071*3a9fd824SRoger Pau Monné 
1072*3a9fd824SRoger Pau Monné struct xen_sysctl {
1073*3a9fd824SRoger Pau Monné     uint32_t cmd;
1074*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_readconsole                    1
1075*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_tbuf_op                        2
1076*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_physinfo                       3
1077*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_sched_id                       4
1078*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_perfc_op                       5
1079*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_getdomaininfolist              6
1080*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_debug_keys                     7
1081*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_getcpuinfo                     8
1082*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_availheap                      9
1083*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_get_pmstat                    10
1084*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_cpu_hotplug                   11
1085*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_pm_op                         12
1086*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_page_offline_op               14
1087*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_lockprof_op                   15
1088*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_cputopoinfo                   16
1089*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_numainfo                      17
1090*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_cpupool_op                    18
1091*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_scheduler_op                  19
1092*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_coverage_op                   20
1093*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_psr_cmt_op                    21
1094*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_pcitopoinfo                   22
1095*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_psr_alloc                     23
1096*3a9fd824SRoger Pau Monné /* #define XEN_SYSCTL_tmem_op                       24 */
1097*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_get_cpu_levelling_caps        25
1098*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_get_cpu_featureset            26
1099*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_livepatch_op                  27
1100*3a9fd824SRoger Pau Monné /* #define XEN_SYSCTL_set_parameter              28 */
1101*3a9fd824SRoger Pau Monné #define XEN_SYSCTL_get_cpu_policy                29
1102*3a9fd824SRoger Pau Monné     uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
1103*3a9fd824SRoger Pau Monné     union {
1104*3a9fd824SRoger Pau Monné         struct xen_sysctl_readconsole       readconsole;
1105*3a9fd824SRoger Pau Monné         struct xen_sysctl_tbuf_op           tbuf_op;
1106*3a9fd824SRoger Pau Monné         struct xen_sysctl_physinfo          physinfo;
1107*3a9fd824SRoger Pau Monné         struct xen_sysctl_cputopoinfo       cputopoinfo;
1108*3a9fd824SRoger Pau Monné         struct xen_sysctl_pcitopoinfo       pcitopoinfo;
1109*3a9fd824SRoger Pau Monné         struct xen_sysctl_numainfo          numainfo;
1110*3a9fd824SRoger Pau Monné         struct xen_sysctl_sched_id          sched_id;
1111*3a9fd824SRoger Pau Monné         struct xen_sysctl_perfc_op          perfc_op;
1112*3a9fd824SRoger Pau Monné         struct xen_sysctl_getdomaininfolist getdomaininfolist;
1113*3a9fd824SRoger Pau Monné         struct xen_sysctl_debug_keys        debug_keys;
1114*3a9fd824SRoger Pau Monné         struct xen_sysctl_getcpuinfo        getcpuinfo;
1115*3a9fd824SRoger Pau Monné         struct xen_sysctl_availheap         availheap;
1116*3a9fd824SRoger Pau Monné         struct xen_sysctl_get_pmstat        get_pmstat;
1117*3a9fd824SRoger Pau Monné         struct xen_sysctl_cpu_hotplug       cpu_hotplug;
1118*3a9fd824SRoger Pau Monné         struct xen_sysctl_pm_op             pm_op;
1119*3a9fd824SRoger Pau Monné         struct xen_sysctl_page_offline_op   page_offline;
1120*3a9fd824SRoger Pau Monné         struct xen_sysctl_lockprof_op       lockprof_op;
1121*3a9fd824SRoger Pau Monné         struct xen_sysctl_cpupool_op        cpupool_op;
1122*3a9fd824SRoger Pau Monné         struct xen_sysctl_scheduler_op      scheduler_op;
1123*3a9fd824SRoger Pau Monné         struct xen_sysctl_coverage_op       coverage_op;
1124*3a9fd824SRoger Pau Monné         struct xen_sysctl_psr_cmt_op        psr_cmt_op;
1125*3a9fd824SRoger Pau Monné         struct xen_sysctl_psr_alloc         psr_alloc;
1126*3a9fd824SRoger Pau Monné         struct xen_sysctl_cpu_levelling_caps cpu_levelling_caps;
1127*3a9fd824SRoger Pau Monné         struct xen_sysctl_cpu_featureset    cpu_featureset;
1128*3a9fd824SRoger Pau Monné         struct xen_sysctl_livepatch_op      livepatch;
1129*3a9fd824SRoger Pau Monné #if defined(__i386__) || defined(__x86_64__)
1130*3a9fd824SRoger Pau Monné         struct xen_sysctl_cpu_policy        cpu_policy;
1131*3a9fd824SRoger Pau Monné #endif
1132*3a9fd824SRoger Pau Monné         uint8_t                             pad[128];
1133*3a9fd824SRoger Pau Monné     } u;
1134*3a9fd824SRoger Pau Monné };
1135*3a9fd824SRoger Pau Monné typedef struct xen_sysctl xen_sysctl_t;
1136*3a9fd824SRoger Pau Monné DEFINE_XEN_GUEST_HANDLE(xen_sysctl_t);
1137*3a9fd824SRoger Pau Monné 
1138*3a9fd824SRoger Pau Monné #endif /* __XEN_PUBLIC_SYSCTL_H__ */
1139*3a9fd824SRoger Pau Monné 
1140*3a9fd824SRoger Pau Monné /*
1141*3a9fd824SRoger Pau Monné  * Local variables:
1142*3a9fd824SRoger Pau Monné  * mode: C
1143*3a9fd824SRoger Pau Monné  * c-file-style: "BSD"
1144*3a9fd824SRoger Pau Monné  * c-basic-offset: 4
1145*3a9fd824SRoger Pau Monné  * tab-width: 4
1146*3a9fd824SRoger Pau Monné  * indent-tabs-mode: nil
1147*3a9fd824SRoger Pau Monné  * End:
1148*3a9fd824SRoger Pau Monné  */
1149