1 /****************************************************************************** 2 * domctl.h 3 * 4 * Domain 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-2003, B Dragovic 25 * Copyright (c) 2002-2006, K Fraser 26 */ 27 28 #ifndef __XEN_PUBLIC_DOMCTL_H__ 29 #define __XEN_PUBLIC_DOMCTL_H__ 30 31 #if !defined(__XEN__) && !defined(__XEN_TOOLS__) 32 #error "domctl operations are intended for use by node control tools only" 33 #endif 34 35 #include "xen.h" 36 #include "event_channel.h" 37 #include "grant_table.h" 38 #include "hvm/save.h" 39 #include "memory.h" 40 41 #define XEN_DOMCTL_INTERFACE_VERSION 0x00000014 42 43 /* 44 * NB. xen_domctl.domain is an IN/OUT parameter for this operation. 45 * If it is specified as an invalid value (0 or >= DOMID_FIRST_RESERVED), 46 * an id is auto-allocated and returned. 47 */ 48 /* XEN_DOMCTL_createdomain */ 49 struct xen_domctl_createdomain { 50 /* IN parameters */ 51 uint32_t ssidref; 52 xen_domain_handle_t handle; 53 /* Is this an HVM guest (as opposed to a PV guest)? */ 54 #define _XEN_DOMCTL_CDF_hvm 0 55 #define XEN_DOMCTL_CDF_hvm (1U<<_XEN_DOMCTL_CDF_hvm) 56 /* Use hardware-assisted paging if available? */ 57 #define _XEN_DOMCTL_CDF_hap 1 58 #define XEN_DOMCTL_CDF_hap (1U<<_XEN_DOMCTL_CDF_hap) 59 /* Should domain memory integrity be verifed by tboot during Sx? */ 60 #define _XEN_DOMCTL_CDF_s3_integrity 2 61 #define XEN_DOMCTL_CDF_s3_integrity (1U<<_XEN_DOMCTL_CDF_s3_integrity) 62 /* Disable out-of-sync shadow page tables? */ 63 #define _XEN_DOMCTL_CDF_oos_off 3 64 #define XEN_DOMCTL_CDF_oos_off (1U<<_XEN_DOMCTL_CDF_oos_off) 65 /* Is this a xenstore domain? */ 66 #define _XEN_DOMCTL_CDF_xs_domain 4 67 #define XEN_DOMCTL_CDF_xs_domain (1U<<_XEN_DOMCTL_CDF_xs_domain) 68 /* Should this domain be permitted to use the IOMMU? */ 69 #define _XEN_DOMCTL_CDF_iommu 5 70 #define XEN_DOMCTL_CDF_iommu (1U<<_XEN_DOMCTL_CDF_iommu) 71 #define _XEN_DOMCTL_CDF_nested_virt 6 72 #define XEN_DOMCTL_CDF_nested_virt (1U << _XEN_DOMCTL_CDF_nested_virt) 73 /* Should we expose the vPMU to the guest? */ 74 #define XEN_DOMCTL_CDF_vpmu (1U << 7) 75 76 /* Max XEN_DOMCTL_CDF_* constant. Used for ABI checking. */ 77 #define XEN_DOMCTL_CDF_MAX XEN_DOMCTL_CDF_vpmu 78 79 uint32_t flags; 80 81 #define _XEN_DOMCTL_IOMMU_no_sharept 0 82 #define XEN_DOMCTL_IOMMU_no_sharept (1U << _XEN_DOMCTL_IOMMU_no_sharept) 83 84 /* Max XEN_DOMCTL_IOMMU_* constant. Used for ABI checking. */ 85 #define XEN_DOMCTL_IOMMU_MAX XEN_DOMCTL_IOMMU_no_sharept 86 87 uint32_t iommu_opts; 88 89 /* 90 * Various domain limits, which impact the quantity of resources 91 * (global mapping space, xenheap, etc) a guest may consume. For 92 * max_grant_frames and max_maptrack_frames, < 0 means "use the 93 * default maximum value in the hypervisor". 94 */ 95 uint32_t max_vcpus; 96 uint32_t max_evtchn_port; 97 int32_t max_grant_frames; 98 int32_t max_maptrack_frames; 99 100 /* Grant version, use low 4 bits. */ 101 #define XEN_DOMCTL_GRANT_version_mask 0xf 102 #define XEN_DOMCTL_GRANT_version(v) ((v) & XEN_DOMCTL_GRANT_version_mask) 103 104 uint32_t grant_opts; 105 106 /* Per-vCPU buffer size in bytes. 0 to disable. */ 107 uint32_t vmtrace_size; 108 109 struct xen_arch_domainconfig arch; 110 }; 111 112 /* XEN_DOMCTL_getdomaininfo */ 113 struct xen_domctl_getdomaininfo { 114 /* OUT variables. */ 115 domid_t domain; /* Also echoed in domctl.domain */ 116 uint16_t pad1; 117 /* Domain is scheduled to die. */ 118 #define _XEN_DOMINF_dying 0 119 #define XEN_DOMINF_dying (1U<<_XEN_DOMINF_dying) 120 /* Domain is an HVM guest (as opposed to a PV guest). */ 121 #define _XEN_DOMINF_hvm_guest 1 122 #define XEN_DOMINF_hvm_guest (1U<<_XEN_DOMINF_hvm_guest) 123 /* The guest OS has shut down. */ 124 #define _XEN_DOMINF_shutdown 2 125 #define XEN_DOMINF_shutdown (1U<<_XEN_DOMINF_shutdown) 126 /* Currently paused by control software. */ 127 #define _XEN_DOMINF_paused 3 128 #define XEN_DOMINF_paused (1U<<_XEN_DOMINF_paused) 129 /* Currently blocked pending an event. */ 130 #define _XEN_DOMINF_blocked 4 131 #define XEN_DOMINF_blocked (1U<<_XEN_DOMINF_blocked) 132 /* Domain is currently running. */ 133 #define _XEN_DOMINF_running 5 134 #define XEN_DOMINF_running (1U<<_XEN_DOMINF_running) 135 /* Being debugged. */ 136 #define _XEN_DOMINF_debugged 6 137 #define XEN_DOMINF_debugged (1U<<_XEN_DOMINF_debugged) 138 /* domain is a xenstore domain */ 139 #define _XEN_DOMINF_xs_domain 7 140 #define XEN_DOMINF_xs_domain (1U<<_XEN_DOMINF_xs_domain) 141 /* domain has hardware assisted paging */ 142 #define _XEN_DOMINF_hap 8 143 #define XEN_DOMINF_hap (1U<<_XEN_DOMINF_hap) 144 /* XEN_DOMINF_shutdown guest-supplied code. */ 145 #define XEN_DOMINF_shutdownmask 255 146 #define XEN_DOMINF_shutdownshift 16 147 uint32_t flags; /* XEN_DOMINF_* */ 148 uint64_aligned_t tot_pages; 149 uint64_aligned_t max_pages; 150 uint64_aligned_t outstanding_pages; 151 uint64_aligned_t shr_pages; 152 uint64_aligned_t paged_pages; 153 uint64_aligned_t shared_info_frame; /* GMFN of shared_info struct */ 154 uint64_aligned_t cpu_time; 155 uint32_t nr_online_vcpus; /* Number of VCPUs currently online. */ 156 #define XEN_INVALID_MAX_VCPU_ID (~0U) /* Domain has no vcpus? */ 157 uint32_t max_vcpu_id; /* Maximum VCPUID in use by this domain. */ 158 uint32_t ssidref; 159 xen_domain_handle_t handle; 160 uint32_t cpupool; 161 uint8_t gpaddr_bits; /* Guest physical address space size. */ 162 uint8_t pad2[7]; 163 struct xen_arch_domainconfig arch_config; 164 }; 165 typedef struct xen_domctl_getdomaininfo xen_domctl_getdomaininfo_t; 166 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getdomaininfo_t); 167 168 169 /* XEN_DOMCTL_getpageframeinfo */ 170 171 #define XEN_DOMCTL_PFINFO_LTAB_SHIFT 28 172 #define XEN_DOMCTL_PFINFO_NOTAB (0x0U<<28) 173 #define XEN_DOMCTL_PFINFO_L1TAB (0x1U<<28) 174 #define XEN_DOMCTL_PFINFO_L2TAB (0x2U<<28) 175 #define XEN_DOMCTL_PFINFO_L3TAB (0x3U<<28) 176 #define XEN_DOMCTL_PFINFO_L4TAB (0x4U<<28) 177 #define XEN_DOMCTL_PFINFO_LTABTYPE_MASK (0x7U<<28) 178 #define XEN_DOMCTL_PFINFO_LPINTAB (0x1U<<31) 179 #define XEN_DOMCTL_PFINFO_XTAB (0xfU<<28) /* invalid page */ 180 #define XEN_DOMCTL_PFINFO_XALLOC (0xeU<<28) /* allocate-only page */ 181 #define XEN_DOMCTL_PFINFO_BROKEN (0xdU<<28) /* broken page */ 182 #define XEN_DOMCTL_PFINFO_LTAB_MASK (0xfU<<28) 183 184 /* XEN_DOMCTL_getpageframeinfo3 */ 185 /* 186 * Both value `num' and `array' may get modified by the hypercall to allow 187 * preemption. 188 */ 189 struct xen_domctl_getpageframeinfo3 { 190 /* IN variables. */ 191 uint64_aligned_t num; 192 /* IN/OUT variables. */ 193 XEN_GUEST_HANDLE_64(xen_pfn_t) array; 194 }; 195 196 197 /* 198 * Control shadow pagetables operation 199 */ 200 /* XEN_DOMCTL_shadow_op */ 201 202 /* Disable shadow mode. */ 203 #define XEN_DOMCTL_SHADOW_OP_OFF 0 204 205 /* Enable shadow mode (mode contains ORed XEN_DOMCTL_SHADOW_ENABLE_* flags). */ 206 #define XEN_DOMCTL_SHADOW_OP_ENABLE 32 207 208 /* Log-dirty bitmap operations. */ 209 /* Return the bitmap and clean internal copy for next round. */ 210 #define XEN_DOMCTL_SHADOW_OP_CLEAN 11 211 /* Return the bitmap but do not modify internal copy. */ 212 #define XEN_DOMCTL_SHADOW_OP_PEEK 12 213 214 /* Memory allocation accessors. */ 215 #define XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION 30 216 #define XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION 31 217 218 /* Legacy enable operations. */ 219 /* Equiv. to ENABLE with no mode flags. */ 220 #define XEN_DOMCTL_SHADOW_OP_ENABLE_TEST 1 221 /* Equiv. to ENABLE with mode flag ENABLE_LOG_DIRTY. */ 222 #define XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY 2 223 /* 224 * No longer supported, was equiv. to ENABLE with mode flags 225 * ENABLE_REFCOUNT and ENABLE_TRANSLATE: 226 #define XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE 3 227 */ 228 229 /* Mode flags for XEN_DOMCTL_SHADOW_OP_ENABLE. */ 230 /* 231 * Shadow pagetables are refcounted: guest does not use explicit mmu 232 * operations nor write-protect its pagetables. 233 */ 234 #define XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT (1 << 1) 235 /* 236 * Log pages in a bitmap as they are dirtied. 237 * Used for live relocation to determine which pages must be re-sent. 238 */ 239 #define XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY (1 << 2) 240 /* 241 * Automatically translate GPFNs into MFNs. 242 */ 243 #define XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE (1 << 3) 244 /* 245 * Xen does not steal virtual address space from the guest. 246 * Requires HVM support. 247 */ 248 #define XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL (1 << 4) 249 250 /* Mode flags for XEN_DOMCTL_SHADOW_OP_{CLEAN,PEEK}. */ 251 /* 252 * This is the final iteration: Requesting to include pages mapped 253 * writably by the hypervisor in the dirty bitmap. 254 */ 255 #define XEN_DOMCTL_SHADOW_LOGDIRTY_FINAL (1 << 0) 256 257 struct xen_domctl_shadow_op_stats { 258 uint32_t fault_count; 259 uint32_t dirty_count; 260 }; 261 262 struct xen_domctl_shadow_op { 263 /* IN variables. */ 264 uint32_t op; /* XEN_DOMCTL_SHADOW_OP_* */ 265 266 /* OP_ENABLE: XEN_DOMCTL_SHADOW_ENABLE_* */ 267 /* OP_PEAK / OP_CLEAN: XEN_DOMCTL_SHADOW_LOGDIRTY_* */ 268 uint32_t mode; 269 270 /* OP_GET_ALLOCATION / OP_SET_ALLOCATION */ 271 uint32_t mb; /* Shadow memory allocation in MB */ 272 273 /* OP_PEEK / OP_CLEAN */ 274 XEN_GUEST_HANDLE_64(uint8) dirty_bitmap; 275 uint64_aligned_t pages; /* Size of buffer. Updated with actual size. */ 276 struct xen_domctl_shadow_op_stats stats; 277 }; 278 279 280 /* XEN_DOMCTL_max_mem */ 281 struct xen_domctl_max_mem { 282 /* IN variables. */ 283 uint64_aligned_t max_memkb; 284 }; 285 286 287 /* XEN_DOMCTL_setvcpucontext */ 288 /* XEN_DOMCTL_getvcpucontext */ 289 struct xen_domctl_vcpucontext { 290 uint32_t vcpu; /* IN */ 291 XEN_GUEST_HANDLE_64(vcpu_guest_context_t) ctxt; /* IN/OUT */ 292 }; 293 294 295 /* XEN_DOMCTL_getvcpuinfo */ 296 struct xen_domctl_getvcpuinfo { 297 /* IN variables. */ 298 uint32_t vcpu; 299 /* OUT variables. */ 300 uint8_t online; /* currently online (not hotplugged)? */ 301 uint8_t blocked; /* blocked waiting for an event? */ 302 uint8_t running; /* currently scheduled on its CPU? */ 303 uint64_aligned_t cpu_time; /* total cpu time consumed (ns) */ 304 uint32_t cpu; /* current mapping */ 305 }; 306 307 308 /* Get/set the NUMA node(s) with which the guest has affinity with. */ 309 /* XEN_DOMCTL_setnodeaffinity */ 310 /* XEN_DOMCTL_getnodeaffinity */ 311 struct xen_domctl_nodeaffinity { 312 struct xenctl_bitmap nodemap;/* IN */ 313 }; 314 315 316 /* Get/set which physical cpus a vcpu can execute on. */ 317 /* XEN_DOMCTL_setvcpuaffinity */ 318 /* XEN_DOMCTL_getvcpuaffinity */ 319 struct xen_domctl_vcpuaffinity { 320 /* IN variables. */ 321 uint32_t vcpu; 322 /* Set/get the hard affinity for vcpu */ 323 #define _XEN_VCPUAFFINITY_HARD 0 324 #define XEN_VCPUAFFINITY_HARD (1U<<_XEN_VCPUAFFINITY_HARD) 325 /* Set/get the soft affinity for vcpu */ 326 #define _XEN_VCPUAFFINITY_SOFT 1 327 #define XEN_VCPUAFFINITY_SOFT (1U<<_XEN_VCPUAFFINITY_SOFT) 328 /* Undo SCHEDOP_pin_override */ 329 #define _XEN_VCPUAFFINITY_FORCE 2 330 #define XEN_VCPUAFFINITY_FORCE (1U<<_XEN_VCPUAFFINITY_FORCE) 331 uint32_t flags; 332 /* 333 * IN/OUT variables. 334 * 335 * Both are IN/OUT for XEN_DOMCTL_setvcpuaffinity, in which case they 336 * contain effective hard or/and soft affinity. That is, upon successful 337 * return, cpumap_soft, contains the intersection of the soft affinity, 338 * hard affinity and the cpupool's online CPUs for the domain (if 339 * XEN_VCPUAFFINITY_SOFT was set in flags). cpumap_hard contains the 340 * intersection between hard affinity and the cpupool's online CPUs (if 341 * XEN_VCPUAFFINITY_HARD was set in flags). 342 * 343 * Both are OUT-only for XEN_DOMCTL_getvcpuaffinity, in which case they 344 * contain the plain hard and/or soft affinity masks that were set during 345 * previous successful calls to XEN_DOMCTL_setvcpuaffinity (or the 346 * default values), without intersecting or altering them in any way. 347 */ 348 struct xenctl_bitmap cpumap_hard; 349 struct xenctl_bitmap cpumap_soft; 350 }; 351 352 353 /* 354 * XEN_DOMCTL_max_vcpus: 355 * 356 * The parameter passed to XEN_DOMCTL_max_vcpus must match the value passed to 357 * XEN_DOMCTL_createdomain. This hypercall is in the process of being removed 358 * (once the failure paths in domain_create() have been improved), but is 359 * still required in the short term to allocate the vcpus themselves. 360 */ 361 struct xen_domctl_max_vcpus { 362 uint32_t max; /* maximum number of vcpus */ 363 }; 364 365 366 /* XEN_DOMCTL_scheduler_op */ 367 /* Scheduler types. */ 368 /* #define XEN_SCHEDULER_SEDF 4 (Removed) */ 369 #define XEN_SCHEDULER_CREDIT 5 370 #define XEN_SCHEDULER_CREDIT2 6 371 #define XEN_SCHEDULER_ARINC653 7 372 #define XEN_SCHEDULER_RTDS 8 373 #define XEN_SCHEDULER_NULL 9 374 375 struct xen_domctl_sched_credit { 376 uint16_t weight; 377 uint16_t cap; 378 }; 379 380 struct xen_domctl_sched_credit2 { 381 uint16_t weight; 382 uint16_t cap; 383 }; 384 385 struct xen_domctl_sched_rtds { 386 uint32_t period; 387 uint32_t budget; 388 /* Can this vCPU execute beyond its reserved amount of time? */ 389 #define _XEN_DOMCTL_SCHEDRT_extra 0 390 #define XEN_DOMCTL_SCHEDRT_extra (1U<<_XEN_DOMCTL_SCHEDRT_extra) 391 uint32_t flags; 392 }; 393 394 typedef struct xen_domctl_schedparam_vcpu { 395 union { 396 struct xen_domctl_sched_credit credit; 397 struct xen_domctl_sched_credit2 credit2; 398 struct xen_domctl_sched_rtds rtds; 399 } u; 400 uint32_t vcpuid; 401 } xen_domctl_schedparam_vcpu_t; 402 DEFINE_XEN_GUEST_HANDLE(xen_domctl_schedparam_vcpu_t); 403 404 /* 405 * Set or get info? 406 * For schedulers supporting per-vcpu settings (e.g., RTDS): 407 * XEN_DOMCTL_SCHEDOP_putinfo sets params for all vcpus; 408 * XEN_DOMCTL_SCHEDOP_getinfo gets default params; 409 * XEN_DOMCTL_SCHEDOP_put(get)vcpuinfo sets (gets) params of vcpus; 410 * 411 * For schedulers not supporting per-vcpu settings: 412 * XEN_DOMCTL_SCHEDOP_putinfo sets params for all vcpus; 413 * XEN_DOMCTL_SCHEDOP_getinfo gets domain-wise params; 414 * XEN_DOMCTL_SCHEDOP_put(get)vcpuinfo returns error; 415 */ 416 #define XEN_DOMCTL_SCHEDOP_putinfo 0 417 #define XEN_DOMCTL_SCHEDOP_getinfo 1 418 #define XEN_DOMCTL_SCHEDOP_putvcpuinfo 2 419 #define XEN_DOMCTL_SCHEDOP_getvcpuinfo 3 420 struct xen_domctl_scheduler_op { 421 uint32_t sched_id; /* XEN_SCHEDULER_* */ 422 uint32_t cmd; /* XEN_DOMCTL_SCHEDOP_* */ 423 /* IN/OUT */ 424 union { 425 struct xen_domctl_sched_credit credit; 426 struct xen_domctl_sched_credit2 credit2; 427 struct xen_domctl_sched_rtds rtds; 428 struct { 429 XEN_GUEST_HANDLE_64(xen_domctl_schedparam_vcpu_t) vcpus; 430 /* 431 * IN: Number of elements in vcpus array. 432 * OUT: Number of processed elements of vcpus array. 433 */ 434 uint32_t nr_vcpus; 435 uint32_t padding; 436 } v; 437 } u; 438 }; 439 440 441 /* XEN_DOMCTL_setdomainhandle */ 442 struct xen_domctl_setdomainhandle { 443 xen_domain_handle_t handle; 444 }; 445 446 447 /* XEN_DOMCTL_setdebugging */ 448 struct xen_domctl_setdebugging { 449 uint8_t enable; 450 }; 451 452 453 /* XEN_DOMCTL_irq_permission */ 454 struct xen_domctl_irq_permission { 455 uint32_t pirq; 456 uint8_t allow_access; /* flag to specify enable/disable of IRQ access */ 457 uint8_t pad[3]; 458 }; 459 460 461 /* XEN_DOMCTL_iomem_permission */ 462 struct xen_domctl_iomem_permission { 463 uint64_aligned_t first_mfn;/* first page (physical page number) in range */ 464 uint64_aligned_t nr_mfns; /* number of pages in range (>0) */ 465 uint8_t allow_access; /* allow (!0) or deny (0) access to range? */ 466 }; 467 468 469 /* XEN_DOMCTL_ioport_permission */ 470 struct xen_domctl_ioport_permission { 471 uint32_t first_port; /* first port int range */ 472 uint32_t nr_ports; /* size of port range */ 473 uint8_t allow_access; /* allow or deny access to range? */ 474 }; 475 476 477 /* XEN_DOMCTL_hypercall_init */ 478 struct xen_domctl_hypercall_init { 479 uint64_aligned_t gmfn; /* GMFN to be initialised */ 480 }; 481 482 483 /* XEN_DOMCTL_settimeoffset */ 484 struct xen_domctl_settimeoffset { 485 int64_aligned_t time_offset_seconds; /* applied to domain wallclock time */ 486 }; 487 488 /* XEN_DOMCTL_gethvmcontext */ 489 /* XEN_DOMCTL_sethvmcontext */ 490 struct xen_domctl_hvmcontext { 491 uint32_t size; /* IN/OUT: size of buffer / bytes filled */ 492 XEN_GUEST_HANDLE_64(uint8) buffer; /* IN/OUT: data, or call 493 * gethvmcontext with NULL 494 * buffer to get size req'd */ 495 }; 496 497 498 /* XEN_DOMCTL_set_address_size */ 499 /* XEN_DOMCTL_get_address_size */ 500 struct xen_domctl_address_size { 501 uint32_t size; 502 }; 503 504 505 /* XEN_DOMCTL_sendtrigger */ 506 #define XEN_DOMCTL_SENDTRIGGER_NMI 0 507 #define XEN_DOMCTL_SENDTRIGGER_RESET 1 508 #define XEN_DOMCTL_SENDTRIGGER_INIT 2 509 #define XEN_DOMCTL_SENDTRIGGER_POWER 3 510 #define XEN_DOMCTL_SENDTRIGGER_SLEEP 4 511 struct xen_domctl_sendtrigger { 512 uint32_t trigger; /* IN */ 513 uint32_t vcpu; /* IN */ 514 }; 515 516 517 /* Assign a device to a guest. Sets up IOMMU structures. */ 518 /* XEN_DOMCTL_assign_device */ 519 /* 520 * XEN_DOMCTL_test_assign_device: Pass DOMID_INVALID to find out whether the 521 * given device is assigned to any DomU at all. Pass a specific domain ID to 522 * find out whether the given device can be assigned to that domain. 523 */ 524 /* 525 * XEN_DOMCTL_deassign_device: The behavior of this DOMCTL differs 526 * between the different type of device: 527 * - PCI device (XEN_DOMCTL_DEV_PCI) will be reassigned to DOM0 528 * - DT device (XEN_DOMCTL_DEV_DT) will left unassigned. DOM0 529 * will have to call XEN_DOMCTL_assign_device in order to use the 530 * device. 531 */ 532 #define XEN_DOMCTL_DEV_PCI 0 533 #define XEN_DOMCTL_DEV_DT 1 534 struct xen_domctl_assign_device { 535 /* IN */ 536 uint32_t dev; /* XEN_DOMCTL_DEV_* */ 537 uint32_t flags; 538 #define XEN_DOMCTL_DEV_RDM_RELAXED 1 /* assign only */ 539 union { 540 struct { 541 uint32_t machine_sbdf; /* machine PCI ID of assigned device */ 542 } pci; 543 struct { 544 uint32_t size; /* Length of the path */ 545 XEN_GUEST_HANDLE_64(char) path; /* path to the device tree node */ 546 } dt; 547 } u; 548 }; 549 550 /* Retrieve sibling devices information of machine_sbdf */ 551 /* XEN_DOMCTL_get_device_group */ 552 struct xen_domctl_get_device_group { 553 uint32_t machine_sbdf; /* IN */ 554 uint32_t max_sdevs; /* IN */ 555 uint32_t num_sdevs; /* OUT */ 556 XEN_GUEST_HANDLE_64(uint32) sdev_array; /* OUT */ 557 }; 558 559 /* Pass-through interrupts: bind real irq -> hvm devfn. */ 560 /* XEN_DOMCTL_bind_pt_irq */ 561 /* XEN_DOMCTL_unbind_pt_irq */ 562 enum pt_irq_type { 563 PT_IRQ_TYPE_PCI, 564 PT_IRQ_TYPE_ISA, 565 PT_IRQ_TYPE_MSI, 566 PT_IRQ_TYPE_MSI_TRANSLATE, 567 PT_IRQ_TYPE_SPI, /* ARM: valid range 32-1019 */ 568 }; 569 struct xen_domctl_bind_pt_irq { 570 uint32_t machine_irq; 571 uint32_t irq_type; /* enum pt_irq_type */ 572 573 union { 574 struct { 575 uint8_t isa_irq; 576 } isa; 577 struct { 578 uint8_t bus; 579 uint8_t device; 580 uint8_t intx; 581 } pci; 582 struct { 583 uint8_t gvec; 584 uint32_t gflags; 585 #define XEN_DOMCTL_VMSI_X86_DEST_ID_MASK 0x0000ff 586 #define XEN_DOMCTL_VMSI_X86_RH_MASK 0x000100 587 #define XEN_DOMCTL_VMSI_X86_DM_MASK 0x000200 588 #define XEN_DOMCTL_VMSI_X86_DELIV_MASK 0x007000 589 #define XEN_DOMCTL_VMSI_X86_TRIG_MASK 0x008000 590 #define XEN_DOMCTL_VMSI_X86_UNMASKED 0x010000 591 592 uint64_aligned_t gtable; 593 } msi; 594 struct { 595 uint16_t spi; 596 } spi; 597 } u; 598 }; 599 600 601 /* Bind machine I/O address range -> HVM address range. */ 602 /* XEN_DOMCTL_memory_mapping */ 603 /* Returns 604 - zero success, everything done 605 - -E2BIG passed in nr_mfns value too large for the implementation 606 - positive partial success for the first <result> page frames (with 607 <result> less than nr_mfns), requiring re-invocation by the 608 caller after updating inputs 609 - negative error; other than -E2BIG 610 */ 611 #define DPCI_ADD_MAPPING 1 612 #define DPCI_REMOVE_MAPPING 0 613 struct xen_domctl_memory_mapping { 614 uint64_aligned_t first_gfn; /* first page (hvm guest phys page) in range */ 615 uint64_aligned_t first_mfn; /* first page (machine page) in range */ 616 uint64_aligned_t nr_mfns; /* number of pages in range (>0) */ 617 uint32_t add_mapping; /* add or remove mapping */ 618 uint32_t padding; /* padding for 64-bit aligned structure */ 619 }; 620 621 622 /* Bind machine I/O port range -> HVM I/O port range. */ 623 /* XEN_DOMCTL_ioport_mapping */ 624 struct xen_domctl_ioport_mapping { 625 uint32_t first_gport; /* first guest IO port*/ 626 uint32_t first_mport; /* first machine IO port */ 627 uint32_t nr_ports; /* size of port range */ 628 uint32_t add_mapping; /* add or remove mapping */ 629 }; 630 631 632 /* 633 * Pin caching type of RAM space for x86 HVM domU. 634 */ 635 /* XEN_DOMCTL_pin_mem_cacheattr */ 636 /* Caching types: these happen to be the same as x86 MTRR/PAT type codes. */ 637 #define XEN_DOMCTL_MEM_CACHEATTR_UC 0 638 #define XEN_DOMCTL_MEM_CACHEATTR_WC 1 639 #define XEN_DOMCTL_MEM_CACHEATTR_WT 4 640 #define XEN_DOMCTL_MEM_CACHEATTR_WP 5 641 #define XEN_DOMCTL_MEM_CACHEATTR_WB 6 642 #define XEN_DOMCTL_MEM_CACHEATTR_UCM 7 643 #define XEN_DOMCTL_DELETE_MEM_CACHEATTR (~(uint32_t)0) 644 645 646 /* XEN_DOMCTL_set_ext_vcpucontext */ 647 /* XEN_DOMCTL_get_ext_vcpucontext */ 648 struct xen_domctl_ext_vcpucontext { 649 /* IN: VCPU that this call applies to. */ 650 uint32_t vcpu; 651 /* 652 * SET: Size of struct (IN) 653 * GET: Size of struct (OUT, up to 128 bytes) 654 */ 655 uint32_t size; 656 #if defined(__i386__) || defined(__x86_64__) 657 /* SYSCALL from 32-bit mode and SYSENTER callback information. */ 658 /* NB. SYSCALL from 64-bit mode is contained in vcpu_guest_context_t */ 659 uint64_aligned_t syscall32_callback_eip; 660 uint64_aligned_t sysenter_callback_eip; 661 uint16_t syscall32_callback_cs; 662 uint16_t sysenter_callback_cs; 663 uint8_t syscall32_disables_events; 664 uint8_t sysenter_disables_events; 665 #if defined(__GNUC__) 666 union { 667 uint64_aligned_t mcg_cap; 668 struct hvm_vmce_vcpu vmce; 669 }; 670 #else 671 struct hvm_vmce_vcpu vmce; 672 #endif 673 #endif 674 }; 675 676 /* 677 * Set the target domain for a domain 678 */ 679 /* XEN_DOMCTL_set_target */ 680 struct xen_domctl_set_target { 681 domid_t target; 682 }; 683 684 #if defined(__i386__) || defined(__x86_64__) 685 # define XEN_CPUID_INPUT_UNUSED 0xFFFFFFFF 686 687 /* 688 * XEN_DOMCTL_{get,set}_cpu_policy (x86 specific) 689 * 690 * Query or set the CPUID and MSR policies for a specific domain. 691 */ 692 struct xen_domctl_cpu_policy { 693 uint32_t nr_leaves; /* IN/OUT: Number of leaves in/written to 694 * 'cpuid_policy'. */ 695 uint32_t nr_msrs; /* IN/OUT: Number of MSRs in/written to 696 * 'msr_policy' */ 697 XEN_GUEST_HANDLE_64(xen_cpuid_leaf_t) cpuid_policy; /* IN/OUT */ 698 XEN_GUEST_HANDLE_64(xen_msr_entry_t) msr_policy; /* IN/OUT */ 699 700 /* 701 * OUT, set_policy only. Written in some (but not all) error cases to 702 * identify the CPUID leaf/subleaf and/or MSR which auditing objects to. 703 */ 704 uint32_t err_leaf, err_subleaf, err_msr; 705 }; 706 typedef struct xen_domctl_cpu_policy xen_domctl_cpu_policy_t; 707 DEFINE_XEN_GUEST_HANDLE(xen_domctl_cpu_policy_t); 708 #endif 709 710 /* 711 * Arranges that if the domain suspends (specifically, if it shuts 712 * down with code SHUTDOWN_suspend), this event channel will be 713 * notified. 714 * 715 * This is _instead of_ the usual notification to the global 716 * VIRQ_DOM_EXC. (In most systems that pirq is owned by xenstored.) 717 * 718 * Only one subscription per domain is possible. Last subscriber 719 * wins; others are silently displaced. 720 * 721 * NB that contrary to the rather general name, it only applies to 722 * domain shutdown with code suspend. Shutdown for other reasons 723 * (including crash), and domain death, are notified to VIRQ_DOM_EXC 724 * regardless. 725 */ 726 /* XEN_DOMCTL_subscribe */ 727 struct xen_domctl_subscribe { 728 uint32_t port; /* IN */ 729 }; 730 731 /* XEN_DOMCTL_debug_op */ 732 #define XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_OFF 0 733 #define XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON 1 734 struct xen_domctl_debug_op { 735 uint32_t op; /* IN */ 736 uint32_t vcpu; /* IN */ 737 }; 738 739 /* 740 * Request a particular record from the HVM context 741 */ 742 /* XEN_DOMCTL_gethvmcontext_partial */ 743 struct xen_domctl_hvmcontext_partial { 744 uint32_t type; /* IN: Type of record required */ 745 uint32_t instance; /* IN: Instance of that type */ 746 uint64_aligned_t bufsz; /* IN: size of buffer */ 747 XEN_GUEST_HANDLE_64(uint8) buffer; /* OUT: buffer to write record into */ 748 }; 749 750 751 /* XEN_DOMCTL_gettscinfo */ 752 /* XEN_DOMCTL_settscinfo */ 753 struct xen_domctl_tsc_info { 754 /* IN/OUT */ 755 uint32_t tsc_mode; 756 uint32_t gtsc_khz; 757 uint32_t incarnation; 758 uint32_t pad; 759 uint64_aligned_t elapsed_nsec; 760 }; 761 762 /* XEN_DOMCTL_gdbsx_guestmemio guest mem io */ 763 struct xen_domctl_gdbsx_memio { 764 /* IN */ 765 uint64_aligned_t pgd3val;/* optional: init_mm.pgd[3] value */ 766 uint64_aligned_t gva; /* guest virtual address */ 767 uint64_aligned_t uva; /* user buffer virtual address */ 768 uint32_t len; /* number of bytes to read/write */ 769 uint8_t gwr; /* 0 = read from guest. 1 = write to guest */ 770 /* OUT */ 771 uint32_t remain; /* bytes remaining to be copied */ 772 }; 773 774 /* XEN_DOMCTL_gdbsx_pausevcpu */ 775 /* XEN_DOMCTL_gdbsx_unpausevcpu */ 776 struct xen_domctl_gdbsx_pauseunp_vcpu { /* pause/unpause a vcpu */ 777 uint32_t vcpu; /* which vcpu */ 778 }; 779 780 /* XEN_DOMCTL_gdbsx_domstatus */ 781 struct xen_domctl_gdbsx_domstatus { 782 /* OUT */ 783 uint8_t paused; /* is the domain paused */ 784 uint32_t vcpu_id; /* any vcpu in an event? */ 785 uint32_t vcpu_ev; /* if yes, what event? */ 786 }; 787 788 /* 789 * VM event operations 790 */ 791 792 /* XEN_DOMCTL_vm_event_op */ 793 794 /* 795 * There are currently three rings available for VM events: 796 * sharing, monitor and paging. This hypercall allows one to 797 * control these rings (enable/disable), as well as to signal 798 * to the hypervisor to pull responses (resume) from the given 799 * ring. 800 */ 801 #define XEN_VM_EVENT_ENABLE 0 802 #define XEN_VM_EVENT_DISABLE 1 803 #define XEN_VM_EVENT_RESUME 2 804 #define XEN_VM_EVENT_GET_VERSION 3 805 806 /* 807 * Domain memory paging 808 * Page memory in and out. 809 * Domctl interface to set up and tear down the 810 * pager<->hypervisor interface. Use XENMEM_paging_op* 811 * to perform per-page operations. 812 * 813 * The XEN_VM_EVENT_PAGING_ENABLE domctl returns several 814 * non-standard error codes to indicate why paging could not be enabled: 815 * ENODEV - host lacks HAP support (EPT/NPT) or HAP is disabled in guest 816 * EMLINK - guest has iommu passthrough enabled 817 * EXDEV - guest has PoD enabled 818 * EBUSY - guest has or had paging enabled, ring buffer still active 819 */ 820 #define XEN_DOMCTL_VM_EVENT_OP_PAGING 1 821 822 /* 823 * Monitor helper. 824 * 825 * As with paging, use the domctl for teardown/setup of the 826 * helper<->hypervisor interface. 827 * 828 * The monitor interface can be used to register for various VM events. For 829 * example, there are HVM hypercalls to set the per-page access permissions 830 * of every page in a domain. When one of these permissions--independent, 831 * read, write, and execute--is violated, the VCPU is paused and a memory event 832 * is sent with what happened. The memory event handler can then resume the 833 * VCPU and redo the access with a XEN_VM_EVENT_RESUME option. 834 * 835 * See public/vm_event.h for the list of available events that can be 836 * subscribed to via the monitor interface. 837 * 838 * The XEN_VM_EVENT_MONITOR_* domctls returns 839 * non-standard error codes to indicate why access could not be enabled: 840 * ENODEV - host lacks HAP support (EPT/NPT) or HAP is disabled in guest 841 * EBUSY - guest has or had access enabled, ring buffer still active 842 * 843 */ 844 #define XEN_DOMCTL_VM_EVENT_OP_MONITOR 2 845 846 /* 847 * Sharing ENOMEM helper. 848 * 849 * As with paging, use the domctl for teardown/setup of the 850 * helper<->hypervisor interface. 851 * 852 * If setup, this ring is used to communicate failed allocations 853 * in the unshare path. XENMEM_sharing_op_resume is used to wake up 854 * vcpus that could not unshare. 855 * 856 * Note that sharing can be turned on (as per the domctl below) 857 * *without* this ring being setup. 858 */ 859 #define XEN_DOMCTL_VM_EVENT_OP_SHARING 3 860 861 /* Use for teardown/setup of helper<->hypervisor interface for paging, 862 * access and sharing.*/ 863 struct xen_domctl_vm_event_op { 864 uint32_t op; /* XEN_VM_EVENT_* */ 865 uint32_t mode; /* XEN_DOMCTL_VM_EVENT_OP_* */ 866 867 union { 868 struct { 869 uint32_t port; /* OUT: event channel for ring */ 870 } enable; 871 872 uint32_t version; 873 } u; 874 }; 875 876 /* 877 * Memory sharing operations 878 */ 879 /* XEN_DOMCTL_mem_sharing_op. 880 * The CONTROL sub-domctl is used for bringup/teardown. */ 881 #define XEN_DOMCTL_MEM_SHARING_CONTROL 0 882 883 struct xen_domctl_mem_sharing_op { 884 uint8_t op; /* XEN_DOMCTL_MEM_SHARING_* */ 885 886 union { 887 uint8_t enable; /* CONTROL */ 888 } u; 889 }; 890 891 struct xen_domctl_audit_p2m { 892 /* OUT error counts */ 893 uint64_t orphans; 894 uint64_t m2p_bad; 895 uint64_t p2m_bad; 896 }; 897 898 struct xen_domctl_set_virq_handler { 899 uint32_t virq; /* IN */ 900 }; 901 902 #if defined(__i386__) || defined(__x86_64__) 903 /* XEN_DOMCTL_setvcpuextstate */ 904 /* XEN_DOMCTL_getvcpuextstate */ 905 struct xen_domctl_vcpuextstate { 906 /* IN: VCPU that this call applies to. */ 907 uint32_t vcpu; 908 /* 909 * SET: Ignored. 910 * GET: xfeature support mask of struct (IN/OUT) 911 * xfeature mask is served as identifications of the saving format 912 * so that compatible CPUs can have a check on format to decide 913 * whether it can restore. 914 */ 915 uint64_aligned_t xfeature_mask; 916 /* 917 * SET: Size of struct (IN) 918 * GET: Size of struct (IN/OUT) 919 */ 920 uint64_aligned_t size; 921 XEN_GUEST_HANDLE_64(uint64) buffer; 922 }; 923 #endif 924 925 /* XEN_DOMCTL_set_access_required: sets whether a memory event listener 926 * must be present to handle page access events: if false, the page 927 * access will revert to full permissions if no one is listening; 928 * */ 929 struct xen_domctl_set_access_required { 930 uint8_t access_required; 931 }; 932 933 struct xen_domctl_set_broken_page_p2m { 934 uint64_aligned_t pfn; 935 }; 936 937 /* 938 * ARM: Clean and invalidate caches associated with given region of 939 * guest memory. 940 */ 941 struct xen_domctl_cacheflush { 942 /* IN: page range to flush. */ 943 xen_pfn_t start_pfn, nr_pfns; 944 }; 945 946 #if defined(__i386__) || defined(__x86_64__) 947 struct xen_domctl_vcpu_msr { 948 uint32_t index; 949 uint32_t reserved; 950 uint64_aligned_t value; 951 }; 952 typedef struct xen_domctl_vcpu_msr xen_domctl_vcpu_msr_t; 953 DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpu_msr_t); 954 955 /* 956 * XEN_DOMCTL_set_vcpu_msrs / XEN_DOMCTL_get_vcpu_msrs. 957 * 958 * Input: 959 * - A NULL 'msrs' guest handle is a request for the maximum 'msr_count'. 960 * - Otherwise, 'msr_count' is the number of entries in 'msrs'. 961 * 962 * Output for get: 963 * - If 'msr_count' is less than the number Xen needs to write, -ENOBUFS shall 964 * be returned and 'msr_count' updated to reflect the intended number. 965 * - On success, 'msr_count' shall indicate the number of MSRs written, which 966 * may be less than the maximum if some are not currently used by the vcpu. 967 * 968 * Output for set: 969 * - If Xen encounters an error with a specific MSR, -EINVAL shall be returned 970 * and 'msr_count' shall be set to the offending index, to aid debugging. 971 */ 972 struct xen_domctl_vcpu_msrs { 973 uint32_t vcpu; /* IN */ 974 uint32_t msr_count; /* IN/OUT */ 975 XEN_GUEST_HANDLE_64(xen_domctl_vcpu_msr_t) msrs; /* IN/OUT */ 976 }; 977 #endif 978 979 /* XEN_DOMCTL_setvnumainfo: specifies a virtual NUMA topology for the guest */ 980 struct xen_domctl_vnuma { 981 /* IN: number of vNUMA nodes to setup. Shall be greater than 0 */ 982 uint32_t nr_vnodes; 983 /* IN: number of memory ranges to setup */ 984 uint32_t nr_vmemranges; 985 /* 986 * IN: number of vCPUs of the domain (used as size of the vcpu_to_vnode 987 * array declared below). Shall be equal to the domain's max_vcpus. 988 */ 989 uint32_t nr_vcpus; 990 uint32_t pad; /* must be zero */ 991 992 /* 993 * IN: array for specifying the distances of the vNUMA nodes 994 * between each others. Shall have nr_vnodes*nr_vnodes elements. 995 */ 996 XEN_GUEST_HANDLE_64(uint) vdistance; 997 /* 998 * IN: array for specifying to what vNUMA node each vCPU belongs. 999 * Shall have nr_vcpus elements. 1000 */ 1001 XEN_GUEST_HANDLE_64(uint) vcpu_to_vnode; 1002 /* 1003 * IN: array for specifying on what physical NUMA node each vNUMA 1004 * node is placed. Shall have nr_vnodes elements. 1005 */ 1006 XEN_GUEST_HANDLE_64(uint) vnode_to_pnode; 1007 /* 1008 * IN: array for specifying the memory ranges. Shall have 1009 * nr_vmemranges elements. 1010 */ 1011 XEN_GUEST_HANDLE_64(xen_vmemrange_t) vmemrange; 1012 }; 1013 1014 struct xen_domctl_psr_cmt_op { 1015 #define XEN_DOMCTL_PSR_CMT_OP_DETACH 0 1016 #define XEN_DOMCTL_PSR_CMT_OP_ATTACH 1 1017 #define XEN_DOMCTL_PSR_CMT_OP_QUERY_RMID 2 1018 uint32_t cmd; 1019 uint32_t data; 1020 }; 1021 1022 /* XEN_DOMCTL_MONITOR_* 1023 * 1024 * Enable/disable monitoring various VM events. 1025 * This domctl configures what events will be reported to helper apps 1026 * via the ring buffer "MONITOR". The ring has to be first enabled 1027 * with the domctl XEN_DOMCTL_VM_EVENT_OP_MONITOR. 1028 * 1029 * GET_CAPABILITIES can be used to determine which of these features is 1030 * available on a given platform. 1031 * 1032 * NOTICE: mem_access events are also delivered via the "MONITOR" ring buffer; 1033 * however, enabling/disabling those events is performed with the use of 1034 * memory_op hypercalls! 1035 */ 1036 #define XEN_DOMCTL_MONITOR_OP_ENABLE 0 1037 #define XEN_DOMCTL_MONITOR_OP_DISABLE 1 1038 #define XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES 2 1039 #define XEN_DOMCTL_MONITOR_OP_EMULATE_EACH_REP 3 1040 /* 1041 * Control register feature can result in guest-crashes when the monitor 1042 * subsystem is being turned off. User has to take special precautions 1043 * to ensure all vCPUs have resumed before it is safe to turn it off. 1044 */ 1045 #define XEN_DOMCTL_MONITOR_OP_CONTROL_REGISTERS 4 1046 1047 #define XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG 0 1048 #define XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR 1 1049 #define XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP 2 1050 #define XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT 3 1051 #define XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST 4 1052 #define XEN_DOMCTL_MONITOR_EVENT_DEBUG_EXCEPTION 5 1053 #define XEN_DOMCTL_MONITOR_EVENT_CPUID 6 1054 #define XEN_DOMCTL_MONITOR_EVENT_PRIVILEGED_CALL 7 1055 #define XEN_DOMCTL_MONITOR_EVENT_INTERRUPT 8 1056 #define XEN_DOMCTL_MONITOR_EVENT_DESC_ACCESS 9 1057 #define XEN_DOMCTL_MONITOR_EVENT_EMUL_UNIMPLEMENTED 10 1058 /* Enabled by default */ 1059 #define XEN_DOMCTL_MONITOR_EVENT_INGUEST_PAGEFAULT 11 1060 1061 struct xen_domctl_monitor_op { 1062 uint32_t op; /* XEN_DOMCTL_MONITOR_OP_* */ 1063 1064 /* 1065 * When used with ENABLE/DISABLE this has to be set to 1066 * the requested XEN_DOMCTL_MONITOR_EVENT_* value. 1067 * With GET_CAPABILITIES this field returns a bitmap of 1068 * events supported by the platform, in the format 1069 * (1 << XEN_DOMCTL_MONITOR_EVENT_*). 1070 */ 1071 uint32_t event; 1072 1073 /* 1074 * Further options when issuing XEN_DOMCTL_MONITOR_OP_ENABLE. 1075 */ 1076 union { 1077 struct { 1078 /* Which control register */ 1079 uint8_t index; 1080 /* Pause vCPU until response */ 1081 uint8_t sync; 1082 /* Send event only on a change of value */ 1083 uint8_t onchangeonly; 1084 /* Allignment padding */ 1085 uint8_t pad1; 1086 uint32_t pad2; 1087 /* 1088 * Send event only if the changed bit in the control register 1089 * is not masked. 1090 */ 1091 uint64_aligned_t bitmask; 1092 } mov_to_cr; 1093 1094 struct { 1095 uint32_t msr; 1096 /* Send event only on a change of value */ 1097 uint8_t onchangeonly; 1098 } mov_to_msr; 1099 1100 struct { 1101 /* Pause vCPU until response */ 1102 uint8_t sync; 1103 uint8_t allow_userspace; 1104 } guest_request; 1105 1106 struct { 1107 /* Pause vCPU until response */ 1108 uint8_t sync; 1109 } debug_exception; 1110 } u; 1111 }; 1112 1113 struct xen_domctl_psr_alloc { 1114 #define XEN_DOMCTL_PSR_SET_L3_CBM 0 1115 #define XEN_DOMCTL_PSR_GET_L3_CBM 1 1116 #define XEN_DOMCTL_PSR_SET_L3_CODE 2 1117 #define XEN_DOMCTL_PSR_SET_L3_DATA 3 1118 #define XEN_DOMCTL_PSR_GET_L3_CODE 4 1119 #define XEN_DOMCTL_PSR_GET_L3_DATA 5 1120 #define XEN_DOMCTL_PSR_SET_L2_CBM 6 1121 #define XEN_DOMCTL_PSR_GET_L2_CBM 7 1122 #define XEN_DOMCTL_PSR_SET_MBA_THRTL 8 1123 #define XEN_DOMCTL_PSR_GET_MBA_THRTL 9 1124 uint32_t cmd; /* IN: XEN_DOMCTL_PSR_* */ 1125 uint32_t target; /* IN */ 1126 uint64_t data; /* IN/OUT */ 1127 }; 1128 1129 /* XEN_DOMCTL_vuart_op */ 1130 struct xen_domctl_vuart_op { 1131 #define XEN_DOMCTL_VUART_OP_INIT 0 1132 uint32_t cmd; /* XEN_DOMCTL_VUART_OP_* */ 1133 #define XEN_DOMCTL_VUART_TYPE_VPL011 0 1134 uint32_t type; /* IN - type of vuart. 1135 * Currently only vpl011 supported. 1136 */ 1137 uint64_aligned_t gfn; /* IN - guest gfn to be used as a 1138 * ring buffer. 1139 */ 1140 domid_t console_domid; /* IN - domid of domain running the 1141 * backend console. 1142 */ 1143 uint8_t pad[2]; 1144 evtchn_port_t evtchn; /* OUT - remote port of the event 1145 * channel used for sending 1146 * ring buffer events. 1147 */ 1148 }; 1149 1150 /* XEN_DOMCTL_vmtrace_op: Perform VM tracing operations. */ 1151 struct xen_domctl_vmtrace_op { 1152 uint32_t cmd; /* IN */ 1153 uint32_t vcpu; /* IN */ 1154 uint64_aligned_t key; /* IN - @cmd specific data. */ 1155 uint64_aligned_t value; /* IN/OUT - @cmd specific data. */ 1156 1157 /* 1158 * General enable/disable of tracing. 1159 * 1160 * XEN_DOMCTL_vmtrace_reset_and_enable is provided as optimisation for 1161 * common usecases, which want to reset status and position information 1162 * when turning tracing back on. 1163 */ 1164 #define XEN_DOMCTL_vmtrace_enable 1 1165 #define XEN_DOMCTL_vmtrace_disable 2 1166 #define XEN_DOMCTL_vmtrace_reset_and_enable 3 1167 1168 /* Obtain the current output position within the buffer. Fills @value. */ 1169 #define XEN_DOMCTL_vmtrace_output_position 4 1170 1171 /* 1172 * Get/Set platform specific configuration. 1173 * 1174 * For Intel Processor Trace, @key/@value are interpreted as MSR 1175 * reads/writes to MSR_RTIT_*, filtered to a safe subset. 1176 */ 1177 #define XEN_DOMCTL_vmtrace_get_option 5 1178 #define XEN_DOMCTL_vmtrace_set_option 6 1179 }; 1180 typedef struct xen_domctl_vmtrace_op xen_domctl_vmtrace_op_t; 1181 DEFINE_XEN_GUEST_HANDLE(xen_domctl_vmtrace_op_t); 1182 1183 struct xen_domctl { 1184 uint32_t cmd; 1185 #define XEN_DOMCTL_createdomain 1 1186 #define XEN_DOMCTL_destroydomain 2 1187 #define XEN_DOMCTL_pausedomain 3 1188 #define XEN_DOMCTL_unpausedomain 4 1189 #define XEN_DOMCTL_getdomaininfo 5 1190 /* #define XEN_DOMCTL_getmemlist 6 Removed */ 1191 /* #define XEN_DOMCTL_getpageframeinfo 7 Obsolete - use getpageframeinfo3 */ 1192 /* #define XEN_DOMCTL_getpageframeinfo2 8 Obsolete - use getpageframeinfo3 */ 1193 #define XEN_DOMCTL_setvcpuaffinity 9 1194 #define XEN_DOMCTL_shadow_op 10 1195 #define XEN_DOMCTL_max_mem 11 1196 #define XEN_DOMCTL_setvcpucontext 12 1197 #define XEN_DOMCTL_getvcpucontext 13 1198 #define XEN_DOMCTL_getvcpuinfo 14 1199 #define XEN_DOMCTL_max_vcpus 15 1200 #define XEN_DOMCTL_scheduler_op 16 1201 #define XEN_DOMCTL_setdomainhandle 17 1202 #define XEN_DOMCTL_setdebugging 18 1203 #define XEN_DOMCTL_irq_permission 19 1204 #define XEN_DOMCTL_iomem_permission 20 1205 #define XEN_DOMCTL_ioport_permission 21 1206 #define XEN_DOMCTL_hypercall_init 22 1207 #ifdef __XEN__ 1208 /* #define XEN_DOMCTL_arch_setup 23 Obsolete IA64 only */ 1209 #define XEN_DOMCTL_soft_reset_cont 23 1210 #endif 1211 #define XEN_DOMCTL_settimeoffset 24 1212 #define XEN_DOMCTL_getvcpuaffinity 25 1213 #define XEN_DOMCTL_real_mode_area 26 /* Obsolete PPC only */ 1214 #define XEN_DOMCTL_resumedomain 27 1215 #define XEN_DOMCTL_sendtrigger 28 1216 #define XEN_DOMCTL_subscribe 29 1217 #define XEN_DOMCTL_gethvmcontext 33 1218 #define XEN_DOMCTL_sethvmcontext 34 1219 #define XEN_DOMCTL_set_address_size 35 1220 #define XEN_DOMCTL_get_address_size 36 1221 #define XEN_DOMCTL_assign_device 37 1222 #define XEN_DOMCTL_bind_pt_irq 38 1223 #define XEN_DOMCTL_memory_mapping 39 1224 #define XEN_DOMCTL_ioport_mapping 40 1225 /* #define XEN_DOMCTL_pin_mem_cacheattr 41 Removed - use dmop */ 1226 #define XEN_DOMCTL_set_ext_vcpucontext 42 1227 #define XEN_DOMCTL_get_ext_vcpucontext 43 1228 #define XEN_DOMCTL_set_opt_feature 44 /* Obsolete IA64 only */ 1229 #define XEN_DOMCTL_test_assign_device 45 1230 #define XEN_DOMCTL_set_target 46 1231 #define XEN_DOMCTL_deassign_device 47 1232 #define XEN_DOMCTL_unbind_pt_irq 48 1233 /* #define XEN_DOMCTL_set_cpuid 49 - Obsolete - use set_cpu_policy */ 1234 #define XEN_DOMCTL_get_device_group 50 1235 /* #define XEN_DOMCTL_set_machine_address_size 51 - Obsolete */ 1236 /* #define XEN_DOMCTL_get_machine_address_size 52 - Obsolete */ 1237 /* #define XEN_DOMCTL_suppress_spurious_page_faults 53 - Obsolete */ 1238 #define XEN_DOMCTL_debug_op 54 1239 #define XEN_DOMCTL_gethvmcontext_partial 55 1240 #define XEN_DOMCTL_vm_event_op 56 1241 #define XEN_DOMCTL_mem_sharing_op 57 1242 /* #define XEN_DOMCTL_disable_migrate 58 - Obsolete */ 1243 #define XEN_DOMCTL_gettscinfo 59 1244 #define XEN_DOMCTL_settscinfo 60 1245 #define XEN_DOMCTL_getpageframeinfo3 61 1246 #define XEN_DOMCTL_setvcpuextstate 62 1247 #define XEN_DOMCTL_getvcpuextstate 63 1248 #define XEN_DOMCTL_set_access_required 64 1249 #define XEN_DOMCTL_audit_p2m 65 1250 #define XEN_DOMCTL_set_virq_handler 66 1251 #define XEN_DOMCTL_set_broken_page_p2m 67 1252 #define XEN_DOMCTL_setnodeaffinity 68 1253 #define XEN_DOMCTL_getnodeaffinity 69 1254 /* #define XEN_DOMCTL_set_max_evtchn 70 - Moved into XEN_DOMCTL_createdomain */ 1255 #define XEN_DOMCTL_cacheflush 71 1256 #define XEN_DOMCTL_get_vcpu_msrs 72 1257 #define XEN_DOMCTL_set_vcpu_msrs 73 1258 #define XEN_DOMCTL_setvnumainfo 74 1259 #define XEN_DOMCTL_psr_cmt_op 75 1260 #define XEN_DOMCTL_monitor_op 77 1261 #define XEN_DOMCTL_psr_alloc 78 1262 #define XEN_DOMCTL_soft_reset 79 1263 /* #define XEN_DOMCTL_set_gnttab_limits 80 - Moved into XEN_DOMCTL_createdomain */ 1264 #define XEN_DOMCTL_vuart_op 81 1265 #define XEN_DOMCTL_get_cpu_policy 82 1266 #define XEN_DOMCTL_set_cpu_policy 83 1267 #define XEN_DOMCTL_vmtrace_op 84 1268 #define XEN_DOMCTL_gdbsx_guestmemio 1000 1269 #define XEN_DOMCTL_gdbsx_pausevcpu 1001 1270 #define XEN_DOMCTL_gdbsx_unpausevcpu 1002 1271 #define XEN_DOMCTL_gdbsx_domstatus 1003 1272 uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */ 1273 domid_t domain; 1274 uint16_t _pad[3]; 1275 union { 1276 struct xen_domctl_createdomain createdomain; 1277 struct xen_domctl_getdomaininfo getdomaininfo; 1278 struct xen_domctl_getpageframeinfo3 getpageframeinfo3; 1279 struct xen_domctl_nodeaffinity nodeaffinity; 1280 struct xen_domctl_vcpuaffinity vcpuaffinity; 1281 struct xen_domctl_shadow_op shadow_op; 1282 struct xen_domctl_max_mem max_mem; 1283 struct xen_domctl_vcpucontext vcpucontext; 1284 struct xen_domctl_getvcpuinfo getvcpuinfo; 1285 struct xen_domctl_max_vcpus max_vcpus; 1286 struct xen_domctl_scheduler_op scheduler_op; 1287 struct xen_domctl_setdomainhandle setdomainhandle; 1288 struct xen_domctl_setdebugging setdebugging; 1289 struct xen_domctl_irq_permission irq_permission; 1290 struct xen_domctl_iomem_permission iomem_permission; 1291 struct xen_domctl_ioport_permission ioport_permission; 1292 struct xen_domctl_hypercall_init hypercall_init; 1293 struct xen_domctl_settimeoffset settimeoffset; 1294 struct xen_domctl_tsc_info tsc_info; 1295 struct xen_domctl_hvmcontext hvmcontext; 1296 struct xen_domctl_hvmcontext_partial hvmcontext_partial; 1297 struct xen_domctl_address_size address_size; 1298 struct xen_domctl_sendtrigger sendtrigger; 1299 struct xen_domctl_get_device_group get_device_group; 1300 struct xen_domctl_assign_device assign_device; 1301 struct xen_domctl_bind_pt_irq bind_pt_irq; 1302 struct xen_domctl_memory_mapping memory_mapping; 1303 struct xen_domctl_ioport_mapping ioport_mapping; 1304 struct xen_domctl_ext_vcpucontext ext_vcpucontext; 1305 struct xen_domctl_set_target set_target; 1306 struct xen_domctl_subscribe subscribe; 1307 struct xen_domctl_debug_op debug_op; 1308 struct xen_domctl_vm_event_op vm_event_op; 1309 struct xen_domctl_mem_sharing_op mem_sharing_op; 1310 #if defined(__i386__) || defined(__x86_64__) 1311 struct xen_domctl_cpu_policy cpu_policy; 1312 struct xen_domctl_vcpuextstate vcpuextstate; 1313 struct xen_domctl_vcpu_msrs vcpu_msrs; 1314 #endif 1315 struct xen_domctl_set_access_required access_required; 1316 struct xen_domctl_audit_p2m audit_p2m; 1317 struct xen_domctl_set_virq_handler set_virq_handler; 1318 struct xen_domctl_gdbsx_memio gdbsx_guest_memio; 1319 struct xen_domctl_set_broken_page_p2m set_broken_page_p2m; 1320 struct xen_domctl_cacheflush cacheflush; 1321 struct xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu; 1322 struct xen_domctl_gdbsx_domstatus gdbsx_domstatus; 1323 struct xen_domctl_vnuma vnuma; 1324 struct xen_domctl_psr_cmt_op psr_cmt_op; 1325 struct xen_domctl_monitor_op monitor_op; 1326 struct xen_domctl_psr_alloc psr_alloc; 1327 struct xen_domctl_vuart_op vuart_op; 1328 struct xen_domctl_vmtrace_op vmtrace_op; 1329 uint8_t pad[128]; 1330 } u; 1331 }; 1332 typedef struct xen_domctl xen_domctl_t; 1333 DEFINE_XEN_GUEST_HANDLE(xen_domctl_t); 1334 1335 #endif /* __XEN_PUBLIC_DOMCTL_H__ */ 1336 1337 /* 1338 * Local variables: 1339 * mode: C 1340 * c-file-style: "BSD" 1341 * c-basic-offset: 4 1342 * tab-width: 4 1343 * indent-tabs-mode: nil 1344 * End: 1345 */ 1346