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