|
|
1.1 ! root 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: ! 37: #define XEN_SYSCTL_INTERFACE_VERSION 0x00000006 ! 38: ! 39: /* ! 40: * Read console content from Xen buffer ring. ! 41: */ ! 42: #define XEN_SYSCTL_readconsole 1 ! 43: struct xen_sysctl_readconsole { ! 44: /* IN: Non-zero -> clear after reading. */ ! 45: uint8_t clear; ! 46: /* IN: Non-zero -> start index specified by @index field. */ ! 47: uint8_t incremental; ! 48: uint8_t pad0, pad1; ! 49: /* ! 50: * IN: Start index for consuming from ring buffer (if @incremental); ! 51: * OUT: End index after consuming from ring buffer. ! 52: */ ! 53: uint32_t index; ! 54: /* IN: Virtual address to write console data. */ ! 55: XEN_GUEST_HANDLE_64(char) buffer; ! 56: /* IN: Size of buffer; OUT: Bytes written to buffer. */ ! 57: uint32_t count; ! 58: }; ! 59: typedef struct xen_sysctl_readconsole xen_sysctl_readconsole_t; ! 60: DEFINE_XEN_GUEST_HANDLE(xen_sysctl_readconsole_t); ! 61: ! 62: /* Get trace buffers machine base address */ ! 63: #define XEN_SYSCTL_tbuf_op 2 ! 64: struct xen_sysctl_tbuf_op { ! 65: /* IN variables */ ! 66: #define XEN_SYSCTL_TBUFOP_get_info 0 ! 67: #define XEN_SYSCTL_TBUFOP_set_cpu_mask 1 ! 68: #define XEN_SYSCTL_TBUFOP_set_evt_mask 2 ! 69: #define XEN_SYSCTL_TBUFOP_set_size 3 ! 70: #define XEN_SYSCTL_TBUFOP_enable 4 ! 71: #define XEN_SYSCTL_TBUFOP_disable 5 ! 72: uint32_t cmd; ! 73: /* IN/OUT variables */ ! 74: struct xenctl_cpumap cpu_mask; ! 75: uint32_t evt_mask; ! 76: /* OUT variables */ ! 77: uint64_aligned_t buffer_mfn; ! 78: uint32_t size; ! 79: }; ! 80: typedef struct xen_sysctl_tbuf_op xen_sysctl_tbuf_op_t; ! 81: DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t); ! 82: ! 83: /* ! 84: * Get physical information about the host machine ! 85: */ ! 86: #define XEN_SYSCTL_physinfo 3 ! 87: /* (x86) The platform supports HVM guests. */ ! 88: #define _XEN_SYSCTL_PHYSCAP_hvm 0 ! 89: #define XEN_SYSCTL_PHYSCAP_hvm (1u<<_XEN_SYSCTL_PHYSCAP_hvm) ! 90: /* (x86) The platform supports HVM-guest direct access to I/O devices. */ ! 91: #define _XEN_SYSCTL_PHYSCAP_hvm_directio 1 ! 92: #define XEN_SYSCTL_PHYSCAP_hvm_directio (1u<<_XEN_SYSCTL_PHYSCAP_hvm_directio) ! 93: struct xen_sysctl_physinfo { ! 94: uint32_t threads_per_core; ! 95: uint32_t cores_per_socket; ! 96: uint32_t nr_cpus; ! 97: uint32_t nr_nodes; ! 98: uint32_t cpu_khz; ! 99: uint64_aligned_t total_pages; ! 100: uint64_aligned_t free_pages; ! 101: uint64_aligned_t scrub_pages; ! 102: uint32_t hw_cap[8]; ! 103: ! 104: /* ! 105: * IN: maximum addressable entry in the caller-provided cpu_to_node array. ! 106: * OUT: largest cpu identifier in the system. ! 107: * If OUT is greater than IN then the cpu_to_node array is truncated! ! 108: */ ! 109: uint32_t max_cpu_id; ! 110: /* ! 111: * If not NULL, this array is filled with node identifier for each cpu. ! 112: * If a cpu has no node information (e.g., cpu not present) then the ! 113: * sentinel value ~0u is written. ! 114: * The size of this array is specified by the caller in @max_cpu_id. ! 115: * If the actual @max_cpu_id is smaller than the array then the trailing ! 116: * elements of the array will not be written by the sysctl. ! 117: */ ! 118: XEN_GUEST_HANDLE_64(uint32) cpu_to_node; ! 119: ! 120: /* XEN_SYSCTL_PHYSCAP_??? */ ! 121: uint32_t capabilities; ! 122: }; ! 123: typedef struct xen_sysctl_physinfo xen_sysctl_physinfo_t; ! 124: DEFINE_XEN_GUEST_HANDLE(xen_sysctl_physinfo_t); ! 125: ! 126: /* ! 127: * Get the ID of the current scheduler. ! 128: */ ! 129: #define XEN_SYSCTL_sched_id 4 ! 130: struct xen_sysctl_sched_id { ! 131: /* OUT variable */ ! 132: uint32_t sched_id; ! 133: }; ! 134: typedef struct xen_sysctl_sched_id xen_sysctl_sched_id_t; ! 135: DEFINE_XEN_GUEST_HANDLE(xen_sysctl_sched_id_t); ! 136: ! 137: /* Interface for controlling Xen software performance counters. */ ! 138: #define XEN_SYSCTL_perfc_op 5 ! 139: /* Sub-operations: */ ! 140: #define XEN_SYSCTL_PERFCOP_reset 1 /* Reset all counters to zero. */ ! 141: #define XEN_SYSCTL_PERFCOP_query 2 /* Get perfctr information. */ ! 142: struct xen_sysctl_perfc_desc { ! 143: char name[80]; /* name of perf counter */ ! 144: uint32_t nr_vals; /* number of values for this counter */ ! 145: }; ! 146: typedef struct xen_sysctl_perfc_desc xen_sysctl_perfc_desc_t; ! 147: DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_desc_t); ! 148: typedef uint32_t xen_sysctl_perfc_val_t; ! 149: DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_val_t); ! 150: ! 151: struct xen_sysctl_perfc_op { ! 152: /* IN variables. */ ! 153: uint32_t cmd; /* XEN_SYSCTL_PERFCOP_??? */ ! 154: /* OUT variables. */ ! 155: uint32_t nr_counters; /* number of counters description */ ! 156: uint32_t nr_vals; /* number of values */ ! 157: /* counter information (or NULL) */ ! 158: XEN_GUEST_HANDLE_64(xen_sysctl_perfc_desc_t) desc; ! 159: /* counter values (or NULL) */ ! 160: XEN_GUEST_HANDLE_64(xen_sysctl_perfc_val_t) val; ! 161: }; ! 162: typedef struct xen_sysctl_perfc_op xen_sysctl_perfc_op_t; ! 163: DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_op_t); ! 164: ! 165: #define XEN_SYSCTL_getdomaininfolist 6 ! 166: struct xen_sysctl_getdomaininfolist { ! 167: /* IN variables. */ ! 168: domid_t first_domain; ! 169: uint32_t max_domains; ! 170: XEN_GUEST_HANDLE_64(xen_domctl_getdomaininfo_t) buffer; ! 171: /* OUT variables. */ ! 172: uint32_t num_domains; ! 173: }; ! 174: typedef struct xen_sysctl_getdomaininfolist xen_sysctl_getdomaininfolist_t; ! 175: DEFINE_XEN_GUEST_HANDLE(xen_sysctl_getdomaininfolist_t); ! 176: ! 177: /* Inject debug keys into Xen. */ ! 178: #define XEN_SYSCTL_debug_keys 7 ! 179: struct xen_sysctl_debug_keys { ! 180: /* IN variables. */ ! 181: XEN_GUEST_HANDLE_64(char) keys; ! 182: uint32_t nr_keys; ! 183: }; ! 184: typedef struct xen_sysctl_debug_keys xen_sysctl_debug_keys_t; ! 185: DEFINE_XEN_GUEST_HANDLE(xen_sysctl_debug_keys_t); ! 186: ! 187: /* Get physical CPU information. */ ! 188: #define XEN_SYSCTL_getcpuinfo 8 ! 189: struct xen_sysctl_cpuinfo { ! 190: uint64_aligned_t idletime; ! 191: }; ! 192: typedef struct xen_sysctl_cpuinfo xen_sysctl_cpuinfo_t; ! 193: DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpuinfo_t); ! 194: struct xen_sysctl_getcpuinfo { ! 195: /* IN variables. */ ! 196: uint32_t max_cpus; ! 197: XEN_GUEST_HANDLE_64(xen_sysctl_cpuinfo_t) info; ! 198: /* OUT variables. */ ! 199: uint32_t nr_cpus; ! 200: }; ! 201: typedef struct xen_sysctl_getcpuinfo xen_sysctl_getcpuinfo_t; ! 202: DEFINE_XEN_GUEST_HANDLE(xen_sysctl_getcpuinfo_t); ! 203: ! 204: #define XEN_SYSCTL_availheap 9 ! 205: struct xen_sysctl_availheap { ! 206: /* IN variables. */ ! 207: uint32_t min_bitwidth; /* Smallest address width (zero if don't care). */ ! 208: uint32_t max_bitwidth; /* Largest address width (zero if don't care). */ ! 209: int32_t node; /* NUMA node of interest (-1 for all nodes). */ ! 210: /* OUT variables. */ ! 211: uint64_aligned_t avail_bytes;/* Bytes available in the specified region. */ ! 212: }; ! 213: typedef struct xen_sysctl_availheap xen_sysctl_availheap_t; ! 214: DEFINE_XEN_GUEST_HANDLE(xen_sysctl_availheap_t); ! 215: ! 216: #define XEN_SYSCTL_get_pmstat 10 ! 217: struct pm_px_val { ! 218: uint64_aligned_t freq; /* Px core frequency */ ! 219: uint64_aligned_t residency; /* Px residency time */ ! 220: uint64_aligned_t count; /* Px transition count */ ! 221: }; ! 222: typedef struct pm_px_val pm_px_val_t; ! 223: DEFINE_XEN_GUEST_HANDLE(pm_px_val_t); ! 224: ! 225: struct pm_px_stat { ! 226: uint8_t total; /* total Px states */ ! 227: uint8_t usable; /* usable Px states */ ! 228: uint8_t last; /* last Px state */ ! 229: uint8_t cur; /* current Px state */ ! 230: XEN_GUEST_HANDLE_64(uint64) trans_pt; /* Px transition table */ ! 231: XEN_GUEST_HANDLE_64(pm_px_val_t) pt; ! 232: }; ! 233: typedef struct pm_px_stat pm_px_stat_t; ! 234: DEFINE_XEN_GUEST_HANDLE(pm_px_stat_t); ! 235: ! 236: struct pm_cx_stat { ! 237: uint32_t nr; /* entry nr in triggers & residencies, including C0 */ ! 238: uint32_t last; /* last Cx state */ ! 239: uint64_aligned_t idle_time; /* idle time from boot */ ! 240: XEN_GUEST_HANDLE_64(uint64) triggers; /* Cx trigger counts */ ! 241: XEN_GUEST_HANDLE_64(uint64) residencies; /* Cx residencies */ ! 242: }; ! 243: ! 244: struct xen_sysctl_get_pmstat { ! 245: #define PMSTAT_CATEGORY_MASK 0xf0 ! 246: #define PMSTAT_PX 0x10 ! 247: #define PMSTAT_CX 0x20 ! 248: #define PMSTAT_get_max_px (PMSTAT_PX | 0x1) ! 249: #define PMSTAT_get_pxstat (PMSTAT_PX | 0x2) ! 250: #define PMSTAT_reset_pxstat (PMSTAT_PX | 0x3) ! 251: #define PMSTAT_get_max_cx (PMSTAT_CX | 0x1) ! 252: #define PMSTAT_get_cxstat (PMSTAT_CX | 0x2) ! 253: #define PMSTAT_reset_cxstat (PMSTAT_CX | 0x3) ! 254: uint32_t type; ! 255: uint32_t cpuid; ! 256: union { ! 257: struct pm_px_stat getpx; ! 258: struct pm_cx_stat getcx; ! 259: /* other struct for tx, etc */ ! 260: } u; ! 261: }; ! 262: typedef struct xen_sysctl_get_pmstat xen_sysctl_get_pmstat_t; ! 263: DEFINE_XEN_GUEST_HANDLE(xen_sysctl_get_pmstat_t); ! 264: ! 265: #define XEN_SYSCTL_cpu_hotplug 11 ! 266: struct xen_sysctl_cpu_hotplug { ! 267: /* IN variables */ ! 268: uint32_t cpu; /* Physical cpu. */ ! 269: #define XEN_SYSCTL_CPU_HOTPLUG_ONLINE 0 ! 270: #define XEN_SYSCTL_CPU_HOTPLUG_OFFLINE 1 ! 271: uint32_t op; /* hotplug opcode */ ! 272: }; ! 273: typedef struct xen_sysctl_cpu_hotplug xen_sysctl_cpu_hotplug_t; ! 274: DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpu_hotplug_t); ! 275: ! 276: ! 277: struct xen_sysctl { ! 278: uint32_t cmd; ! 279: uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */ ! 280: union { ! 281: struct xen_sysctl_readconsole readconsole; ! 282: struct xen_sysctl_tbuf_op tbuf_op; ! 283: struct xen_sysctl_physinfo physinfo; ! 284: struct xen_sysctl_sched_id sched_id; ! 285: struct xen_sysctl_perfc_op perfc_op; ! 286: struct xen_sysctl_getdomaininfolist getdomaininfolist; ! 287: struct xen_sysctl_debug_keys debug_keys; ! 288: struct xen_sysctl_getcpuinfo getcpuinfo; ! 289: struct xen_sysctl_availheap availheap; ! 290: struct xen_sysctl_get_pmstat get_pmstat; ! 291: struct xen_sysctl_cpu_hotplug cpu_hotplug; ! 292: uint8_t pad[128]; ! 293: } u; ! 294: }; ! 295: typedef struct xen_sysctl xen_sysctl_t; ! 296: DEFINE_XEN_GUEST_HANDLE(xen_sysctl_t); ! 297: ! 298: #endif /* __XEN_PUBLIC_SYSCTL_H__ */ ! 299: ! 300: /* ! 301: * Local variables: ! 302: * mode: C ! 303: * c-set-style: "BSD" ! 304: * c-basic-offset: 4 ! 305: * tab-width: 4 ! 306: * indent-tabs-mode: nil ! 307: * End: ! 308: */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.