Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

docs: kvm: Convert api.txt to ReST format

convert api.txt document to ReST format while trying to keep
its format as close as possible with the authors intent, and
avoid adding uneeded markups.

- Use document title and chapter markups;
- Convert tables;
- Add markups for literal blocks;
- use :field: for field descriptions;
- Add blank lines and adjust indentation

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

authored by

Mauro Carvalho Chehab and committed by
Paolo Bonzini
106ee47d d3b52e49

+1968 -1391
+1967 -1391
Documentation/virt/kvm/api.txt Documentation/virt/kvm/api.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + =================================================================== 1 4 The Definitive KVM (Kernel-based Virtual Machine) API Documentation 2 5 =================================================================== 3 6 4 7 1. General description 5 - ---------------------- 8 + ====================== 6 9 7 10 The kvm API is a set of ioctls that are issued to control various aspects 8 11 of a virtual machine. The ioctls belong to the following classes: ··· 36 33 was used to create the VM. 37 34 38 35 2. File descriptors 39 - ------------------- 36 + =================== 40 37 41 38 The kvm API is centered around file descriptors. An initial 42 39 open("/dev/kvm") obtains a handle to the kvm subsystem; this handle ··· 73 70 74 71 75 72 3. Extensions 76 - ------------- 73 + ============= 77 74 78 75 As of Linux 2.6.22, the KVM ABI has been stabilized: no backward 79 76 incompatible change are allowed. However, there is an extension ··· 87 84 88 85 89 86 4. API description 90 - ------------------ 87 + ================== 91 88 92 89 This section describes ioctls that can be used to control kvm guests. 93 90 For each ioctl, the following information is provided along with a 94 91 description: 95 92 96 - Capability: which KVM extension provides this ioctl. Can be 'basic', 93 + Capability: 94 + which KVM extension provides this ioctl. Can be 'basic', 97 95 which means that is will be provided by any kernel that supports 98 96 API version 12 (see section 4.1), a KVM_CAP_xyz constant, which 99 97 means availability needs to be checked with KVM_CHECK_EXTENSION ··· 103 99 availability: for kernels that don't support the ioctl, 104 100 the ioctl returns -ENOTTY. 105 101 106 - Architectures: which instruction set architectures provide this ioctl. 102 + Architectures: 103 + which instruction set architectures provide this ioctl. 107 104 x86 includes both i386 and x86_64. 108 105 109 - Type: system, vm, or vcpu. 106 + Type: 107 + system, vm, or vcpu. 110 108 111 - Parameters: what parameters are accepted by the ioctl. 109 + Parameters: 110 + what parameters are accepted by the ioctl. 112 111 113 - Returns: the return value. General error numbers (EBADF, ENOMEM, EINVAL) 112 + Returns: 113 + the return value. General error numbers (EBADF, ENOMEM, EINVAL) 114 114 are not detailed, but errors with specific meanings are. 115 115 116 116 117 117 4.1 KVM_GET_API_VERSION 118 + ----------------------- 118 119 119 - Capability: basic 120 - Architectures: all 121 - Type: system ioctl 122 - Parameters: none 123 - Returns: the constant KVM_API_VERSION (=12) 120 + :Capability: basic 121 + :Architectures: all 122 + :Type: system ioctl 123 + :Parameters: none 124 + :Returns: the constant KVM_API_VERSION (=12) 124 125 125 126 This identifies the API version as the stable kvm API. It is not 126 127 expected that this number will change. However, Linux 2.6.20 and ··· 136 127 137 128 138 129 4.2 KVM_CREATE_VM 130 + ----------------- 139 131 140 - Capability: basic 141 - Architectures: all 142 - Type: system ioctl 143 - Parameters: machine type identifier (KVM_VM_*) 144 - Returns: a VM fd that can be used to control the new virtual machine. 132 + :Capability: basic 133 + :Architectures: all 134 + :Type: system ioctl 135 + :Parameters: machine type identifier (KVM_VM_*) 136 + :Returns: a VM fd that can be used to control the new virtual machine. 145 137 146 138 The new VM has no virtual cpus and no memory. 147 139 You probably want to use 0 as machine type. ··· 165 155 address used by the VM. The IPA_Bits is encoded in bits[7-0] of the 166 156 machine type identifier. 167 157 168 - e.g, to configure a guest to use 48bit physical address size : 158 + e.g, to configure a guest to use 48bit physical address size:: 169 159 170 160 vm_fd = ioctl(dev_fd, KVM_CREATE_VM, KVM_VM_TYPE_ARM_IPA_SIZE(48)); 171 161 172 - The requested size (IPA_Bits) must be : 173 - 0 - Implies default size, 40bits (for backward compatibility) 162 + The requested size (IPA_Bits) must be: 174 163 175 - or 176 - 177 - N - Implies N bits, where N is a positive integer such that, 164 + == ========================================================= 165 + 0 Implies default size, 40bits (for backward compatibility) 166 + N Implies N bits, where N is a positive integer such that, 178 167 32 <= N <= Host_IPA_Limit 168 + == ========================================================= 179 169 180 170 Host_IPA_Limit is the maximum possible value for IPA_Bits on the host and 181 171 is dependent on the CPU capability and the kernel configuration. The limit can ··· 189 179 190 180 191 181 4.3 KVM_GET_MSR_INDEX_LIST, KVM_GET_MSR_FEATURE_INDEX_LIST 182 + ---------------------------------------------------------- 192 183 193 - Capability: basic, KVM_CAP_GET_MSR_FEATURES for KVM_GET_MSR_FEATURE_INDEX_LIST 194 - Architectures: x86 195 - Type: system ioctl 196 - Parameters: struct kvm_msr_list (in/out) 197 - Returns: 0 on success; -1 on error 184 + :Capability: basic, KVM_CAP_GET_MSR_FEATURES for KVM_GET_MSR_FEATURE_INDEX_LIST 185 + :Architectures: x86 186 + :Type: system ioctl 187 + :Parameters: struct kvm_msr_list (in/out) 188 + :Returns: 0 on success; -1 on error 189 + 198 190 Errors: 199 - EFAULT: the msr index list cannot be read from or written to 200 - E2BIG: the msr index list is to be to fit in the array specified by 201 - the user. 202 191 203 - struct kvm_msr_list { 192 + ====== ============================================================ 193 + EFAULT the msr index list cannot be read from or written to 194 + E2BIG the msr index list is to be to fit in the array specified by 195 + the user. 196 + ====== ============================================================ 197 + 198 + :: 199 + 200 + struct kvm_msr_list { 204 201 __u32 nmsrs; /* number of msrs in entries */ 205 202 __u32 indices[0]; 206 - }; 203 + }; 207 204 208 205 The user fills in the size of the indices array in nmsrs, and in return 209 206 kvm adjusts nmsrs to reflect the actual number of msrs and fills in the ··· 231 214 232 215 233 216 4.4 KVM_CHECK_EXTENSION 217 + ----------------------- 234 218 235 - Capability: basic, KVM_CAP_CHECK_EXTENSION_VM for vm ioctl 236 - Architectures: all 237 - Type: system ioctl, vm ioctl 238 - Parameters: extension identifier (KVM_CAP_*) 239 - Returns: 0 if unsupported; 1 (or some other positive integer) if supported 219 + :Capability: basic, KVM_CAP_CHECK_EXTENSION_VM for vm ioctl 220 + :Architectures: all 221 + :Type: system ioctl, vm ioctl 222 + :Parameters: extension identifier (KVM_CAP_*) 223 + :Returns: 0 if unsupported; 1 (or some other positive integer) if supported 240 224 241 225 The API allows the application to query about extensions to the core 242 226 kvm API. Userspace passes an extension identifier (an integer) and ··· 250 232 with KVM_CAP_CHECK_EXTENSION_VM on the vm fd) 251 233 252 234 4.5 KVM_GET_VCPU_MMAP_SIZE 235 + -------------------------- 253 236 254 - Capability: basic 255 - Architectures: all 256 - Type: system ioctl 257 - Parameters: none 258 - Returns: size of vcpu mmap area, in bytes 237 + :Capability: basic 238 + :Architectures: all 239 + :Type: system ioctl 240 + :Parameters: none 241 + :Returns: size of vcpu mmap area, in bytes 259 242 260 243 The KVM_RUN ioctl (cf.) communicates with userspace via a shared 261 244 memory region. This ioctl returns the size of that region. See the ··· 264 245 265 246 266 247 4.6 KVM_SET_MEMORY_REGION 248 + ------------------------- 267 249 268 - Capability: basic 269 - Architectures: all 270 - Type: vm ioctl 271 - Parameters: struct kvm_memory_region (in) 272 - Returns: 0 on success, -1 on error 250 + :Capability: basic 251 + :Architectures: all 252 + :Type: vm ioctl 253 + :Parameters: struct kvm_memory_region (in) 254 + :Returns: 0 on success, -1 on error 273 255 274 256 This ioctl is obsolete and has been removed. 275 257 276 258 277 259 4.7 KVM_CREATE_VCPU 260 + ------------------- 278 261 279 - Capability: basic 280 - Architectures: all 281 - Type: vm ioctl 282 - Parameters: vcpu id (apic id on x86) 283 - Returns: vcpu fd on success, -1 on error 262 + :Capability: basic 263 + :Architectures: all 264 + :Type: vm ioctl 265 + :Parameters: vcpu id (apic id on x86) 266 + :Returns: vcpu fd on success, -1 on error 284 267 285 268 This API adds a vcpu to a virtual machine. No more than max_vcpus may be added. 286 269 The vcpu id is an integer in the range [0, max_vcpu_id). ··· 323 302 324 303 325 304 4.8 KVM_GET_DIRTY_LOG (vm ioctl) 305 + -------------------------------- 326 306 327 - Capability: basic 328 - Architectures: all 329 - Type: vm ioctl 330 - Parameters: struct kvm_dirty_log (in/out) 331 - Returns: 0 on success, -1 on error 307 + :Capability: basic 308 + :Architectures: all 309 + :Type: vm ioctl 310 + :Parameters: struct kvm_dirty_log (in/out) 311 + :Returns: 0 on success, -1 on error 332 312 333 - /* for KVM_GET_DIRTY_LOG */ 334 - struct kvm_dirty_log { 313 + :: 314 + 315 + /* for KVM_GET_DIRTY_LOG */ 316 + struct kvm_dirty_log { 335 317 __u32 slot; 336 318 __u32 padding; 337 319 union { 338 320 void __user *dirty_bitmap; /* one bit per page */ 339 321 __u64 padding; 340 322 }; 341 - }; 323 + }; 342 324 343 325 Given a memory slot, return a bitmap containing any pages dirtied 344 326 since the last call to this ioctl. Bit 0 is the first page in the ··· 358 334 see the description of the capability. 359 335 360 336 4.9 KVM_SET_MEMORY_ALIAS 337 + ------------------------ 361 338 362 - Capability: basic 363 - Architectures: x86 364 - Type: vm ioctl 365 - Parameters: struct kvm_memory_alias (in) 366 - Returns: 0 (success), -1 (error) 339 + :Capability: basic 340 + :Architectures: x86 341 + :Type: vm ioctl 342 + :Parameters: struct kvm_memory_alias (in) 343 + :Returns: 0 (success), -1 (error) 367 344 368 345 This ioctl is obsolete and has been removed. 369 346 370 347 371 348 4.10 KVM_RUN 349 + ------------ 372 350 373 - Capability: basic 374 - Architectures: all 375 - Type: vcpu ioctl 376 - Parameters: none 377 - Returns: 0 on success, -1 on error 351 + :Capability: basic 352 + :Architectures: all 353 + :Type: vcpu ioctl 354 + :Parameters: none 355 + :Returns: 0 on success, -1 on error 356 + 378 357 Errors: 379 - EINTR: an unmasked signal is pending 358 + 359 + ===== ============================= 360 + EINTR an unmasked signal is pending 361 + ===== ============================= 380 362 381 363 This ioctl is used to run a guest virtual cpu. While there are no 382 364 explicit parameters, there is an implicit parameter block that can be ··· 392 362 393 363 394 364 4.11 KVM_GET_REGS 365 + ----------------- 395 366 396 - Capability: basic 397 - Architectures: all except ARM, arm64 398 - Type: vcpu ioctl 399 - Parameters: struct kvm_regs (out) 400 - Returns: 0 on success, -1 on error 367 + :Capability: basic 368 + :Architectures: all except ARM, arm64 369 + :Type: vcpu ioctl 370 + :Parameters: struct kvm_regs (out) 371 + :Returns: 0 on success, -1 on error 401 372 402 373 Reads the general purpose registers from the vcpu. 403 374 404 - /* x86 */ 405 - struct kvm_regs { 375 + :: 376 + 377 + /* x86 */ 378 + struct kvm_regs { 406 379 /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */ 407 380 __u64 rax, rbx, rcx, rdx; 408 381 __u64 rsi, rdi, rsp, rbp; 409 382 __u64 r8, r9, r10, r11; 410 383 __u64 r12, r13, r14, r15; 411 384 __u64 rip, rflags; 412 - }; 385 + }; 413 386 414 - /* mips */ 415 - struct kvm_regs { 387 + /* mips */ 388 + struct kvm_regs { 416 389 /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */ 417 390 __u64 gpr[32]; 418 391 __u64 hi; 419 392 __u64 lo; 420 393 __u64 pc; 421 - }; 394 + }; 422 395 423 396 424 397 4.12 KVM_SET_REGS 398 + ----------------- 425 399 426 - Capability: basic 427 - Architectures: all except ARM, arm64 428 - Type: vcpu ioctl 429 - Parameters: struct kvm_regs (in) 430 - Returns: 0 on success, -1 on error 400 + :Capability: basic 401 + :Architectures: all except ARM, arm64 402 + :Type: vcpu ioctl 403 + :Parameters: struct kvm_regs (in) 404 + :Returns: 0 on success, -1 on error 431 405 432 406 Writes the general purpose registers into the vcpu. 433 407 ··· 439 405 440 406 441 407 4.13 KVM_GET_SREGS 408 + ------------------ 442 409 443 - Capability: basic 444 - Architectures: x86, ppc 445 - Type: vcpu ioctl 446 - Parameters: struct kvm_sregs (out) 447 - Returns: 0 on success, -1 on error 410 + :Capability: basic 411 + :Architectures: x86, ppc 412 + :Type: vcpu ioctl 413 + :Parameters: struct kvm_sregs (out) 414 + :Returns: 0 on success, -1 on error 448 415 449 416 Reads special registers from the vcpu. 450 417 451 - /* x86 */ 452 - struct kvm_sregs { 418 + :: 419 + 420 + /* x86 */ 421 + struct kvm_sregs { 453 422 struct kvm_segment cs, ds, es, fs, gs, ss; 454 423 struct kvm_segment tr, ldt; 455 424 struct kvm_dtable gdt, idt; ··· 460 423 __u64 efer; 461 424 __u64 apic_base; 462 425 __u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64]; 463 - }; 426 + }; 464 427 465 - /* ppc -- see arch/powerpc/include/uapi/asm/kvm.h */ 428 + /* ppc -- see arch/powerpc/include/uapi/asm/kvm.h */ 466 429 467 430 interrupt_bitmap is a bitmap of pending external interrupts. At most 468 431 one bit may be set. This interrupt has been acknowledged by the APIC ··· 470 433 471 434 472 435 4.14 KVM_SET_SREGS 436 + ------------------ 473 437 474 - Capability: basic 475 - Architectures: x86, ppc 476 - Type: vcpu ioctl 477 - Parameters: struct kvm_sregs (in) 478 - Returns: 0 on success, -1 on error 438 + :Capability: basic 439 + :Architectures: x86, ppc 440 + :Type: vcpu ioctl 441 + :Parameters: struct kvm_sregs (in) 442 + :Returns: 0 on success, -1 on error 479 443 480 444 Writes special registers into the vcpu. See KVM_GET_SREGS for the 481 445 data structures. 482 446 483 447 484 448 4.15 KVM_TRANSLATE 449 + ------------------ 485 450 486 - Capability: basic 487 - Architectures: x86 488 - Type: vcpu ioctl 489 - Parameters: struct kvm_translation (in/out) 490 - Returns: 0 on success, -1 on error 451 + :Capability: basic 452 + :Architectures: x86 453 + :Type: vcpu ioctl 454 + :Parameters: struct kvm_translation (in/out) 455 + :Returns: 0 on success, -1 on error 491 456 492 457 Translates a virtual address according to the vcpu's current address 493 458 translation mode. 494 459 495 - struct kvm_translation { 460 + :: 461 + 462 + struct kvm_translation { 496 463 /* in */ 497 464 __u64 linear_address; 498 465 ··· 506 465 __u8 writeable; 507 466 __u8 usermode; 508 467 __u8 pad[5]; 509 - }; 468 + }; 510 469 511 470 512 471 4.16 KVM_INTERRUPT 472 + ------------------ 513 473 514 - Capability: basic 515 - Architectures: x86, ppc, mips 516 - Type: vcpu ioctl 517 - Parameters: struct kvm_interrupt (in) 518 - Returns: 0 on success, negative on failure. 474 + :Capability: basic 475 + :Architectures: x86, ppc, mips 476 + :Type: vcpu ioctl 477 + :Parameters: struct kvm_interrupt (in) 478 + :Returns: 0 on success, negative on failure. 519 479 520 480 Queues a hardware interrupt vector to be injected. 521 481 522 - /* for KVM_INTERRUPT */ 523 - struct kvm_interrupt { 482 + :: 483 + 484 + /* for KVM_INTERRUPT */ 485 + struct kvm_interrupt { 524 486 /* in */ 525 487 __u32 irq; 526 - }; 488 + }; 527 489 528 490 X86: 491 + ^^^^ 529 492 530 - Returns: 0 on success, 531 - -EEXIST if an interrupt is already enqueued 532 - -EINVAL the the irq number is invalid 533 - -ENXIO if the PIC is in the kernel 534 - -EFAULT if the pointer is invalid 493 + :Returns: 494 + 495 + ========= =================================== 496 + 0 on success, 497 + -EEXIST if an interrupt is already enqueued 498 + -EINVAL the the irq number is invalid 499 + -ENXIO if the PIC is in the kernel 500 + -EFAULT if the pointer is invalid 501 + ========= =================================== 535 502 536 503 Note 'irq' is an interrupt vector, not an interrupt pin or line. This 537 504 ioctl is useful if the in-kernel PIC is not used. 538 505 539 506 PPC: 507 + ^^^^ 540 508 541 509 Queues an external interrupt to be injected. This ioctl is overleaded 542 510 with 3 different irq values: 543 511 544 512 a) KVM_INTERRUPT_SET 545 513 546 - This injects an edge type external interrupt into the guest once it's ready 547 - to receive interrupts. When injected, the interrupt is done. 514 + This injects an edge type external interrupt into the guest once it's ready 515 + to receive interrupts. When injected, the interrupt is done. 548 516 549 517 b) KVM_INTERRUPT_UNSET 550 518 551 - This unsets any pending interrupt. 519 + This unsets any pending interrupt. 552 520 553 - Only available with KVM_CAP_PPC_UNSET_IRQ. 521 + Only available with KVM_CAP_PPC_UNSET_IRQ. 554 522 555 523 c) KVM_INTERRUPT_SET_LEVEL 556 524 557 - This injects a level type external interrupt into the guest context. The 558 - interrupt stays pending until a specific ioctl with KVM_INTERRUPT_UNSET 559 - is triggered. 525 + This injects a level type external interrupt into the guest context. The 526 + interrupt stays pending until a specific ioctl with KVM_INTERRUPT_UNSET 527 + is triggered. 560 528 561 - Only available with KVM_CAP_PPC_IRQ_LEVEL. 529 + Only available with KVM_CAP_PPC_IRQ_LEVEL. 562 530 563 531 Note that any value for 'irq' other than the ones stated above is invalid 564 532 and incurs unexpected behavior. ··· 575 525 This is an asynchronous vcpu ioctl and can be invoked from any thread. 576 526 577 527 MIPS: 528 + ^^^^^ 578 529 579 530 Queues an external interrupt to be injected into the virtual CPU. A negative 580 531 interrupt number dequeues the interrupt. ··· 584 533 585 534 586 535 4.17 KVM_DEBUG_GUEST 536 + -------------------- 587 537 588 - Capability: basic 589 - Architectures: none 590 - Type: vcpu ioctl 591 - Parameters: none) 592 - Returns: -1 on error 538 + :Capability: basic 539 + :Architectures: none 540 + :Type: vcpu ioctl 541 + :Parameters: none) 542 + :Returns: -1 on error 593 543 594 544 Support for this has been removed. Use KVM_SET_GUEST_DEBUG instead. 595 545 596 546 597 547 4.18 KVM_GET_MSRS 548 + ----------------- 598 549 599 - Capability: basic (vcpu), KVM_CAP_GET_MSR_FEATURES (system) 600 - Architectures: x86 601 - Type: system ioctl, vcpu ioctl 602 - Parameters: struct kvm_msrs (in/out) 603 - Returns: number of msrs successfully returned; 604 - -1 on error 550 + :Capability: basic (vcpu), KVM_CAP_GET_MSR_FEATURES (system) 551 + :Architectures: x86 552 + :Type: system ioctl, vcpu ioctl 553 + :Parameters: struct kvm_msrs (in/out) 554 + :Returns: number of msrs successfully returned; 555 + -1 on error 605 556 606 557 When used as a system ioctl: 607 558 Reads the values of MSR-based features that are available for the VM. This ··· 615 562 Reads model-specific registers from the vcpu. Supported msr indices can 616 563 be obtained using KVM_GET_MSR_INDEX_LIST in a system ioctl. 617 564 618 - struct kvm_msrs { 565 + :: 566 + 567 + struct kvm_msrs { 619 568 __u32 nmsrs; /* number of msrs in entries */ 620 569 __u32 pad; 621 570 622 571 struct kvm_msr_entry entries[0]; 623 - }; 572 + }; 624 573 625 - struct kvm_msr_entry { 574 + struct kvm_msr_entry { 626 575 __u32 index; 627 576 __u32 reserved; 628 577 __u64 data; 629 - }; 578 + }; 630 579 631 580 Application code should set the 'nmsrs' member (which indicates the 632 581 size of the entries array) and the 'index' member of each array entry. ··· 636 581 637 582 638 583 4.19 KVM_SET_MSRS 584 + ----------------- 639 585 640 - Capability: basic 641 - Architectures: x86 642 - Type: vcpu ioctl 643 - Parameters: struct kvm_msrs (in) 644 - Returns: number of msrs successfully set (see below), -1 on error 586 + :Capability: basic 587 + :Architectures: x86 588 + :Type: vcpu ioctl 589 + :Parameters: struct kvm_msrs (in) 590 + :Returns: number of msrs successfully set (see below), -1 on error 645 591 646 592 Writes model-specific registers to the vcpu. See KVM_GET_MSRS for the 647 593 data structures. ··· 658 602 659 603 660 604 4.20 KVM_SET_CPUID 605 + ------------------ 661 606 662 - Capability: basic 663 - Architectures: x86 664 - Type: vcpu ioctl 665 - Parameters: struct kvm_cpuid (in) 666 - Returns: 0 on success, -1 on error 607 + :Capability: basic 608 + :Architectures: x86 609 + :Type: vcpu ioctl 610 + :Parameters: struct kvm_cpuid (in) 611 + :Returns: 0 on success, -1 on error 667 612 668 613 Defines the vcpu responses to the cpuid instruction. Applications 669 614 should use the KVM_SET_CPUID2 ioctl if available. 670 615 616 + :: 671 617 672 - struct kvm_cpuid_entry { 618 + struct kvm_cpuid_entry { 673 619 __u32 function; 674 620 __u32 eax; 675 621 __u32 ebx; 676 622 __u32 ecx; 677 623 __u32 edx; 678 624 __u32 padding; 679 - }; 625 + }; 680 626 681 - /* for KVM_SET_CPUID */ 682 - struct kvm_cpuid { 627 + /* for KVM_SET_CPUID */ 628 + struct kvm_cpuid { 683 629 __u32 nent; 684 630 __u32 padding; 685 631 struct kvm_cpuid_entry entries[0]; 686 - }; 632 + }; 687 633 688 634 689 635 4.21 KVM_SET_SIGNAL_MASK 636 + ------------------------ 690 637 691 - Capability: basic 692 - Architectures: all 693 - Type: vcpu ioctl 694 - Parameters: struct kvm_signal_mask (in) 695 - Returns: 0 on success, -1 on error 638 + :Capability: basic 639 + :Architectures: all 640 + :Type: vcpu ioctl 641 + :Parameters: struct kvm_signal_mask (in) 642 + :Returns: 0 on success, -1 on error 696 643 697 644 Defines which signals are blocked during execution of KVM_RUN. This 698 645 signal mask temporarily overrides the threads signal mask. Any ··· 705 646 Note the signal will only be delivered if not blocked by the original 706 647 signal mask. 707 648 708 - /* for KVM_SET_SIGNAL_MASK */ 709 - struct kvm_signal_mask { 649 + :: 650 + 651 + /* for KVM_SET_SIGNAL_MASK */ 652 + struct kvm_signal_mask { 710 653 __u32 len; 711 654 __u8 sigset[0]; 712 - }; 655 + }; 713 656 714 657 715 658 4.22 KVM_GET_FPU 659 + ---------------- 716 660 717 - Capability: basic 718 - Architectures: x86 719 - Type: vcpu ioctl 720 - Parameters: struct kvm_fpu (out) 721 - Returns: 0 on success, -1 on error 661 + :Capability: basic 662 + :Architectures: x86 663 + :Type: vcpu ioctl 664 + :Parameters: struct kvm_fpu (out) 665 + :Returns: 0 on success, -1 on error 722 666 723 667 Reads the floating point state from the vcpu. 724 668 725 - /* for KVM_GET_FPU and KVM_SET_FPU */ 726 - struct kvm_fpu { 669 + :: 670 + 671 + /* for KVM_GET_FPU and KVM_SET_FPU */ 672 + struct kvm_fpu { 727 673 __u8 fpr[8][16]; 728 674 __u16 fcw; 729 675 __u16 fsw; ··· 740 676 __u8 xmm[16][16]; 741 677 __u32 mxcsr; 742 678 __u32 pad2; 743 - }; 679 + }; 744 680 745 681 746 682 4.23 KVM_SET_FPU 683 + ---------------- 747 684 748 - Capability: basic 749 - Architectures: x86 750 - Type: vcpu ioctl 751 - Parameters: struct kvm_fpu (in) 752 - Returns: 0 on success, -1 on error 685 + :Capability: basic 686 + :Architectures: x86 687 + :Type: vcpu ioctl 688 + :Parameters: struct kvm_fpu (in) 689 + :Returns: 0 on success, -1 on error 753 690 754 691 Writes the floating point state to the vcpu. 755 692 756 - /* for KVM_GET_FPU and KVM_SET_FPU */ 757 - struct kvm_fpu { 693 + :: 694 + 695 + /* for KVM_GET_FPU and KVM_SET_FPU */ 696 + struct kvm_fpu { 758 697 __u8 fpr[8][16]; 759 698 __u16 fcw; 760 699 __u16 fsw; ··· 769 702 __u8 xmm[16][16]; 770 703 __u32 mxcsr; 771 704 __u32 pad2; 772 - }; 705 + }; 773 706 774 707 775 708 4.24 KVM_CREATE_IRQCHIP 709 + ----------------------- 776 710 777 - Capability: KVM_CAP_IRQCHIP, KVM_CAP_S390_IRQCHIP (s390) 778 - Architectures: x86, ARM, arm64, s390 779 - Type: vm ioctl 780 - Parameters: none 781 - Returns: 0 on success, -1 on error 711 + :Capability: KVM_CAP_IRQCHIP, KVM_CAP_S390_IRQCHIP (s390) 712 + :Architectures: x86, ARM, arm64, s390 713 + :Type: vm ioctl 714 + :Parameters: none 715 + :Returns: 0 on success, -1 on error 782 716 783 717 Creates an interrupt controller model in the kernel. 784 718 On x86, creates a virtual ioapic, a virtual PIC (two PICs, nested), and sets up ··· 795 727 796 728 797 729 4.25 KVM_IRQ_LINE 730 + ----------------- 798 731 799 - Capability: KVM_CAP_IRQCHIP 800 - Architectures: x86, arm, arm64 801 - Type: vm ioctl 802 - Parameters: struct kvm_irq_level 803 - Returns: 0 on success, -1 on error 732 + :Capability: KVM_CAP_IRQCHIP 733 + :Architectures: x86, arm, arm64 734 + :Type: vm ioctl 735 + :Parameters: struct kvm_irq_level 736 + :Returns: 0 on success, -1 on error 804 737 805 738 Sets the level of a GSI input to the interrupt controller model in the kernel. 806 739 On some architectures it is required that an interrupt controller model has ··· 825 756 ARM/arm64 can signal an interrupt either at the CPU level, or at the 826 757 in-kernel irqchip (GIC), and for in-kernel irqchip can tell the GIC to 827 758 use PPIs designated for specific cpus. The irq field is interpreted 828 - like this: 759 + like this:: 829 760 830 761  bits: | 31 ... 28 | 27 ... 24 | 23 ... 16 | 15 ... 0 | 831 762 field: | vcpu2_index | irq_type | vcpu_index | irq_id | 832 763 833 764 The irq_type field has the following values: 834 - - irq_type[0]: out-of-kernel GIC: irq_id 0 is IRQ, irq_id 1 is FIQ 835 - - irq_type[1]: in-kernel GIC: SPI, irq_id between 32 and 1019 (incl.) 765 + 766 + - irq_type[0]: 767 + out-of-kernel GIC: irq_id 0 is IRQ, irq_id 1 is FIQ 768 + - irq_type[1]: 769 + in-kernel GIC: SPI, irq_id between 32 and 1019 (incl.) 836 770 (the vcpu_index field is ignored) 837 - - irq_type[2]: in-kernel GIC: PPI, irq_id between 16 and 31 (incl.) 771 + - irq_type[2]: 772 + in-kernel GIC: PPI, irq_id between 16 and 31 (incl.) 838 773 839 774 (The irq_id field thus corresponds nicely to the IRQ ID in the ARM GIC specs) 840 775 ··· 852 779 injection of interrupts for the in-kernel irqchip. KVM_IRQ_LINE can always 853 780 be used for a userspace interrupt controller. 854 781 855 - struct kvm_irq_level { 782 + :: 783 + 784 + struct kvm_irq_level { 856 785 union { 857 786 __u32 irq; /* GSI */ 858 787 __s32 status; /* not used for KVM_IRQ_LEVEL */ 859 788 }; 860 789 __u32 level; /* 0 or 1 */ 861 - }; 790 + }; 862 791 863 792 864 793 4.26 KVM_GET_IRQCHIP 794 + -------------------- 865 795 866 - Capability: KVM_CAP_IRQCHIP 867 - Architectures: x86 868 - Type: vm ioctl 869 - Parameters: struct kvm_irqchip (in/out) 870 - Returns: 0 on success, -1 on error 796 + :Capability: KVM_CAP_IRQCHIP 797 + :Architectures: x86 798 + :Type: vm ioctl 799 + :Parameters: struct kvm_irqchip (in/out) 800 + :Returns: 0 on success, -1 on error 871 801 872 802 Reads the state of a kernel interrupt controller created with 873 803 KVM_CREATE_IRQCHIP into a buffer provided by the caller. 874 804 875 - struct kvm_irqchip { 805 + :: 806 + 807 + struct kvm_irqchip { 876 808 __u32 chip_id; /* 0 = PIC1, 1 = PIC2, 2 = IOAPIC */ 877 809 __u32 pad; 878 810 union { ··· 885 807 struct kvm_pic_state pic; 886 808 struct kvm_ioapic_state ioapic; 887 809 } chip; 888 - }; 810 + }; 889 811 890 812 891 813 4.27 KVM_SET_IRQCHIP 814 + -------------------- 892 815 893 - Capability: KVM_CAP_IRQCHIP 894 - Architectures: x86 895 - Type: vm ioctl 896 - Parameters: struct kvm_irqchip (in) 897 - Returns: 0 on success, -1 on error 816 + :Capability: KVM_CAP_IRQCHIP 817 + :Architectures: x86 818 + :Type: vm ioctl 819 + :Parameters: struct kvm_irqchip (in) 820 + :Returns: 0 on success, -1 on error 898 821 899 822 Sets the state of a kernel interrupt controller created with 900 823 KVM_CREATE_IRQCHIP from a buffer provided by the caller. 901 824 902 - struct kvm_irqchip { 825 + :: 826 + 827 + struct kvm_irqchip { 903 828 __u32 chip_id; /* 0 = PIC1, 1 = PIC2, 2 = IOAPIC */ 904 829 __u32 pad; 905 830 union { ··· 910 829 struct kvm_pic_state pic; 911 830 struct kvm_ioapic_state ioapic; 912 831 } chip; 913 - }; 832 + }; 914 833 915 834 916 835 4.28 KVM_XEN_HVM_CONFIG 836 + ----------------------- 917 837 918 - Capability: KVM_CAP_XEN_HVM 919 - Architectures: x86 920 - Type: vm ioctl 921 - Parameters: struct kvm_xen_hvm_config (in) 922 - Returns: 0 on success, -1 on error 838 + :Capability: KVM_CAP_XEN_HVM 839 + :Architectures: x86 840 + :Type: vm ioctl 841 + :Parameters: struct kvm_xen_hvm_config (in) 842 + :Returns: 0 on success, -1 on error 923 843 924 844 Sets the MSR that the Xen HVM guest uses to initialize its hypercall 925 845 page, and provides the starting address and size of the hypercall ··· 928 846 page of a blob (32- or 64-bit, depending on the vcpu mode) to guest 929 847 memory. 930 848 931 - struct kvm_xen_hvm_config { 849 + :: 850 + 851 + struct kvm_xen_hvm_config { 932 852 __u32 flags; 933 853 __u32 msr; 934 854 __u64 blob_addr_32; ··· 938 854 __u8 blob_size_32; 939 855 __u8 blob_size_64; 940 856 __u8 pad2[30]; 941 - }; 857 + }; 942 858 943 859 944 860 4.29 KVM_GET_CLOCK 861 + ------------------ 945 862 946 - Capability: KVM_CAP_ADJUST_CLOCK 947 - Architectures: x86 948 - Type: vm ioctl 949 - Parameters: struct kvm_clock_data (out) 950 - Returns: 0 on success, -1 on error 863 + :Capability: KVM_CAP_ADJUST_CLOCK 864 + :Architectures: x86 865 + :Type: vm ioctl 866 + :Parameters: struct kvm_clock_data (out) 867 + :Returns: 0 on success, -1 on error 951 868 952 869 Gets the current timestamp of kvmclock as seen by the current guest. In 953 870 conjunction with KVM_SET_CLOCK, it is used to ensure monotonicity on scenarios ··· 965 880 but the exact value read by each VCPU could differ, because the host 966 881 TSC is not stable. 967 882 968 - struct kvm_clock_data { 883 + :: 884 + 885 + struct kvm_clock_data { 969 886 __u64 clock; /* kvmclock current value */ 970 887 __u32 flags; 971 888 __u32 pad[9]; 972 - }; 889 + }; 973 890 974 891 975 892 4.30 KVM_SET_CLOCK 893 + ------------------ 976 894 977 - Capability: KVM_CAP_ADJUST_CLOCK 978 - Architectures: x86 979 - Type: vm ioctl 980 - Parameters: struct kvm_clock_data (in) 981 - Returns: 0 on success, -1 on error 895 + :Capability: KVM_CAP_ADJUST_CLOCK 896 + :Architectures: x86 897 + :Type: vm ioctl 898 + :Parameters: struct kvm_clock_data (in) 899 + :Returns: 0 on success, -1 on error 982 900 983 901 Sets the current timestamp of kvmclock to the value specified in its parameter. 984 902 In conjunction with KVM_GET_CLOCK, it is used to ensure monotonicity on scenarios 985 903 such as migration. 986 904 987 - struct kvm_clock_data { 905 + :: 906 + 907 + struct kvm_clock_data { 988 908 __u64 clock; /* kvmclock current value */ 989 909 __u32 flags; 990 910 __u32 pad[9]; 991 - }; 911 + }; 992 912 993 913 994 914 4.31 KVM_GET_VCPU_EVENTS 915 + ------------------------ 995 916 996 - Capability: KVM_CAP_VCPU_EVENTS 997 - Extended by: KVM_CAP_INTR_SHADOW 998 - Architectures: x86, arm, arm64 999 - Type: vcpu ioctl 1000 - Parameters: struct kvm_vcpu_event (out) 1001 - Returns: 0 on success, -1 on error 917 + :Capability: KVM_CAP_VCPU_EVENTS 918 + :Extended by: KVM_CAP_INTR_SHADOW 919 + :Architectures: x86, arm, arm64 920 + :Type: vcpu ioctl 921 + :Parameters: struct kvm_vcpu_event (out) 922 + :Returns: 0 on success, -1 on error 1002 923 1003 924 X86: 925 + ^^^^ 1004 926 1005 927 Gets currently pending exceptions, interrupts, and NMIs as well as related 1006 928 states of the vcpu. 1007 929 1008 - struct kvm_vcpu_events { 930 + :: 931 + 932 + struct kvm_vcpu_events { 1009 933 struct { 1010 934 __u8 injected; 1011 935 __u8 nr; ··· 1045 951 __u8 reserved[27]; 1046 952 __u8 exception_has_payload; 1047 953 __u64 exception_payload; 1048 - }; 954 + }; 1049 955 1050 956 The following bits are defined in the flags field: 1051 957 ··· 1061 967 KVM_CAP_EXCEPTION_PAYLOAD is enabled. 1062 968 1063 969 ARM/ARM64: 970 + ^^^^^^^^^^ 1064 971 1065 972 If the guest accesses a device that is being emulated by the host kernel in 1066 973 such a way that a real device would generate a physical SError, KVM may make ··· 1101 1006 KVM_SET_VCPU_EVENTS or otherwise) because such an exception is always delivered 1102 1007 directly to the virtual CPU). 1103 1008 1009 + :: 1104 1010 1105 - struct kvm_vcpu_events { 1011 + struct kvm_vcpu_events { 1106 1012 struct { 1107 1013 __u8 serror_pending; 1108 1014 __u8 serror_has_esr; ··· 1113 1017 __u64 serror_esr; 1114 1018 } exception; 1115 1019 __u32 reserved[12]; 1116 - }; 1020 + }; 1117 1021 1118 1022 4.32 KVM_SET_VCPU_EVENTS 1023 + ------------------------ 1119 1024 1120 - Capability: KVM_CAP_VCPU_EVENTS 1121 - Extended by: KVM_CAP_INTR_SHADOW 1122 - Architectures: x86, arm, arm64 1123 - Type: vcpu ioctl 1124 - Parameters: struct kvm_vcpu_event (in) 1125 - Returns: 0 on success, -1 on error 1025 + :Capability: KVM_CAP_VCPU_EVENTS 1026 + :Extended by: KVM_CAP_INTR_SHADOW 1027 + :Architectures: x86, arm, arm64 1028 + :Type: vcpu ioctl 1029 + :Parameters: struct kvm_vcpu_event (in) 1030 + :Returns: 0 on success, -1 on error 1126 1031 1127 1032 X86: 1033 + ^^^^ 1128 1034 1129 1035 Set pending exceptions, interrupts, and NMIs as well as related states of the 1130 1036 vcpu. ··· 1138 1040 smi.pending. Keep the corresponding bits in the flags field cleared to 1139 1041 suppress overwriting the current in-kernel state. The bits are: 1140 1042 1141 - KVM_VCPUEVENT_VALID_NMI_PENDING - transfer nmi.pending to the kernel 1142 - KVM_VCPUEVENT_VALID_SIPI_VECTOR - transfer sipi_vector 1143 - KVM_VCPUEVENT_VALID_SMM - transfer the smi sub-struct. 1043 + =============================== ================================== 1044 + KVM_VCPUEVENT_VALID_NMI_PENDING transfer nmi.pending to the kernel 1045 + KVM_VCPUEVENT_VALID_SIPI_VECTOR transfer sipi_vector 1046 + KVM_VCPUEVENT_VALID_SMM transfer the smi sub-struct. 1047 + =============================== ================================== 1144 1048 1145 1049 If KVM_CAP_INTR_SHADOW is available, KVM_VCPUEVENT_VALID_SHADOW can be set in 1146 1050 the flags field to signal that interrupt.shadow contains a valid state and ··· 1156 1056 contain a valid state and shall be written into the VCPU. 1157 1057 1158 1058 ARM/ARM64: 1059 + ^^^^^^^^^^ 1159 1060 1160 1061 User space may need to inject several types of events to the guest. 1161 1062 ··· 1179 1078 1180 1079 1181 1080 4.33 KVM_GET_DEBUGREGS 1081 + ---------------------- 1182 1082 1183 - Capability: KVM_CAP_DEBUGREGS 1184 - Architectures: x86 1185 - Type: vm ioctl 1186 - Parameters: struct kvm_debugregs (out) 1187 - Returns: 0 on success, -1 on error 1083 + :Capability: KVM_CAP_DEBUGREGS 1084 + :Architectures: x86 1085 + :Type: vm ioctl 1086 + :Parameters: struct kvm_debugregs (out) 1087 + :Returns: 0 on success, -1 on error 1188 1088 1189 1089 Reads debug registers from the vcpu. 1190 1090 1191 - struct kvm_debugregs { 1091 + :: 1092 + 1093 + struct kvm_debugregs { 1192 1094 __u64 db[4]; 1193 1095 __u64 dr6; 1194 1096 __u64 dr7; 1195 1097 __u64 flags; 1196 1098 __u64 reserved[9]; 1197 - }; 1099 + }; 1198 1100 1199 1101 1200 1102 4.34 KVM_SET_DEBUGREGS 1103 + ---------------------- 1201 1104 1202 - Capability: KVM_CAP_DEBUGREGS 1203 - Architectures: x86 1204 - Type: vm ioctl 1205 - Parameters: struct kvm_debugregs (in) 1206 - Returns: 0 on success, -1 on error 1105 + :Capability: KVM_CAP_DEBUGREGS 1106 + :Architectures: x86 1107 + :Type: vm ioctl 1108 + :Parameters: struct kvm_debugregs (in) 1109 + :Returns: 0 on success, -1 on error 1207 1110 1208 1111 Writes debug registers into the vcpu. 1209 1112 ··· 1216 1111 1217 1112 1218 1113 4.35 KVM_SET_USER_MEMORY_REGION 1114 + ------------------------------- 1219 1115 1220 - Capability: KVM_CAP_USER_MEMORY 1221 - Architectures: all 1222 - Type: vm ioctl 1223 - Parameters: struct kvm_userspace_memory_region (in) 1224 - Returns: 0 on success, -1 on error 1116 + :Capability: KVM_CAP_USER_MEMORY 1117 + :Architectures: all 1118 + :Type: vm ioctl 1119 + :Parameters: struct kvm_userspace_memory_region (in) 1120 + :Returns: 0 on success, -1 on error 1225 1121 1226 - struct kvm_userspace_memory_region { 1122 + :: 1123 + 1124 + struct kvm_userspace_memory_region { 1227 1125 __u32 slot; 1228 1126 __u32 flags; 1229 1127 __u64 guest_phys_addr; 1230 1128 __u64 memory_size; /* bytes */ 1231 1129 __u64 userspace_addr; /* start of the userspace allocated memory */ 1232 - }; 1130 + }; 1233 1131 1234 - /* for kvm_memory_region::flags */ 1235 - #define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0) 1236 - #define KVM_MEM_READONLY (1UL << 1) 1132 + /* for kvm_memory_region::flags */ 1133 + #define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0) 1134 + #define KVM_MEM_READONLY (1UL << 1) 1237 1135 1238 1136 This ioctl allows the user to create, modify or delete a guest physical 1239 1137 memory slot. Bits 0-15 of "slot" specify the slot id and this value ··· 1282 1174 1283 1175 1284 1176 4.36 KVM_SET_TSS_ADDR 1177 + --------------------- 1285 1178 1286 - Capability: KVM_CAP_SET_TSS_ADDR 1287 - Architectures: x86 1288 - Type: vm ioctl 1289 - Parameters: unsigned long tss_address (in) 1290 - Returns: 0 on success, -1 on error 1179 + :Capability: KVM_CAP_SET_TSS_ADDR 1180 + :Architectures: x86 1181 + :Type: vm ioctl 1182 + :Parameters: unsigned long tss_address (in) 1183 + :Returns: 0 on success, -1 on error 1291 1184 1292 1185 This ioctl defines the physical address of a three-page region in the guest 1293 1186 physical address space. The region must be within the first 4GB of the ··· 1302 1193 1303 1194 1304 1195 4.37 KVM_ENABLE_CAP 1196 + ------------------- 1305 1197 1306 - Capability: KVM_CAP_ENABLE_CAP 1307 - Architectures: mips, ppc, s390 1308 - Type: vcpu ioctl 1309 - Parameters: struct kvm_enable_cap (in) 1310 - Returns: 0 on success; -1 on error 1198 + :Capability: KVM_CAP_ENABLE_CAP 1199 + :Architectures: mips, ppc, s390 1200 + :Type: vcpu ioctl 1201 + :Parameters: struct kvm_enable_cap (in) 1202 + :Returns: 0 on success; -1 on error 1311 1203 1312 - Capability: KVM_CAP_ENABLE_CAP_VM 1313 - Architectures: all 1314 - Type: vcpu ioctl 1315 - Parameters: struct kvm_enable_cap (in) 1316 - Returns: 0 on success; -1 on error 1204 + :Capability: KVM_CAP_ENABLE_CAP_VM 1205 + :Architectures: all 1206 + :Type: vcpu ioctl 1207 + :Parameters: struct kvm_enable_cap (in) 1208 + :Returns: 0 on success; -1 on error 1317 1209 1318 - +Not all extensions are enabled by default. Using this ioctl the application 1319 - can enable an extension, making it available to the guest. 1210 + .. note:: 1211 + 1212 + Not all extensions are enabled by default. Using this ioctl the application 1213 + can enable an extension, making it available to the guest. 1320 1214 1321 1215 On systems that do not support this ioctl, it always fails. On systems that 1322 1216 do support it, it only works for extensions that are supported for enablement. ··· 1327 1215 To check if a capability can be enabled, the KVM_CHECK_EXTENSION ioctl should 1328 1216 be used. 1329 1217 1330 - struct kvm_enable_cap { 1218 + :: 1219 + 1220 + struct kvm_enable_cap { 1331 1221 /* in */ 1332 1222 __u32 cap; 1333 1223 1334 1224 The capability that is supposed to get enabled. 1335 1225 1226 + :: 1227 + 1336 1228 __u32 flags; 1337 1229 1338 1230 A bitfield indicating future enhancements. Has to be 0 for now. 1231 + 1232 + :: 1339 1233 1340 1234 __u64 args[4]; 1341 1235 1342 1236 Arguments for enabling a feature. If a feature needs initial values to 1343 1237 function properly, this is the place to put them. 1344 1238 1239 + :: 1240 + 1345 1241 __u8 pad[64]; 1346 - }; 1242 + }; 1347 1243 1348 1244 The vcpu ioctl should be used for vcpu-specific capabilities, the vm ioctl 1349 1245 for vm-wide capabilities. 1350 1246 1351 1247 4.38 KVM_GET_MP_STATE 1248 + --------------------- 1352 1249 1353 - Capability: KVM_CAP_MP_STATE 1354 - Architectures: x86, s390, arm, arm64 1355 - Type: vcpu ioctl 1356 - Parameters: struct kvm_mp_state (out) 1357 - Returns: 0 on success; -1 on error 1250 + :Capability: KVM_CAP_MP_STATE 1251 + :Architectures: x86, s390, arm, arm64 1252 + :Type: vcpu ioctl 1253 + :Parameters: struct kvm_mp_state (out) 1254 + :Returns: 0 on success; -1 on error 1358 1255 1359 - struct kvm_mp_state { 1256 + :: 1257 + 1258 + struct kvm_mp_state { 1360 1259 __u32 mp_state; 1361 - }; 1260 + }; 1362 1261 1363 1262 Returns the vcpu's current "multiprocessing state" (though also valid on 1364 1263 uniprocessor guests). 1365 1264 1366 1265 Possible values are: 1367 1266 1368 - - KVM_MP_STATE_RUNNABLE: the vcpu is currently running [x86,arm/arm64] 1369 - - KVM_MP_STATE_UNINITIALIZED: the vcpu is an application processor (AP) 1267 + ========================== =============================================== 1268 + KVM_MP_STATE_RUNNABLE the vcpu is currently running [x86,arm/arm64] 1269 + KVM_MP_STATE_UNINITIALIZED the vcpu is an application processor (AP) 1370 1270 which has not yet received an INIT signal [x86] 1371 - - KVM_MP_STATE_INIT_RECEIVED: the vcpu has received an INIT signal, and is 1271 + KVM_MP_STATE_INIT_RECEIVED the vcpu has received an INIT signal, and is 1372 1272 now ready for a SIPI [x86] 1373 - - KVM_MP_STATE_HALTED: the vcpu has executed a HLT instruction and 1273 + KVM_MP_STATE_HALTED the vcpu has executed a HLT instruction and 1374 1274 is waiting for an interrupt [x86] 1375 - - KVM_MP_STATE_SIPI_RECEIVED: the vcpu has just received a SIPI (vector 1275 + KVM_MP_STATE_SIPI_RECEIVED the vcpu has just received a SIPI (vector 1376 1276 accessible via KVM_GET_VCPU_EVENTS) [x86] 1377 - - KVM_MP_STATE_STOPPED: the vcpu is stopped [s390,arm/arm64] 1378 - - KVM_MP_STATE_CHECK_STOP: the vcpu is in a special error state [s390] 1379 - - KVM_MP_STATE_OPERATING: the vcpu is operating (running or halted) 1277 + KVM_MP_STATE_STOPPED the vcpu is stopped [s390,arm/arm64] 1278 + KVM_MP_STATE_CHECK_STOP the vcpu is in a special error state [s390] 1279 + KVM_MP_STATE_OPERATING the vcpu is operating (running or halted) 1380 1280 [s390] 1381 - - KVM_MP_STATE_LOAD: the vcpu is in a special load/startup state 1281 + KVM_MP_STATE_LOAD the vcpu is in a special load/startup state 1382 1282 [s390] 1283 + ========================== =============================================== 1383 1284 1384 1285 On x86, this ioctl is only useful after KVM_CREATE_IRQCHIP. Without an 1385 1286 in-kernel irqchip, the multiprocessing state must be maintained by userspace on 1386 1287 these architectures. 1387 1288 1388 1289 For arm/arm64: 1290 + ^^^^^^^^^^^^^^ 1389 1291 1390 1292 The only states that are valid are KVM_MP_STATE_STOPPED and 1391 1293 KVM_MP_STATE_RUNNABLE which reflect if the vcpu is paused or not. 1392 1294 1393 1295 4.39 KVM_SET_MP_STATE 1296 + --------------------- 1394 1297 1395 - Capability: KVM_CAP_MP_STATE 1396 - Architectures: x86, s390, arm, arm64 1397 - Type: vcpu ioctl 1398 - Parameters: struct kvm_mp_state (in) 1399 - Returns: 0 on success; -1 on error 1298 + :Capability: KVM_CAP_MP_STATE 1299 + :Architectures: x86, s390, arm, arm64 1300 + :Type: vcpu ioctl 1301 + :Parameters: struct kvm_mp_state (in) 1302 + :Returns: 0 on success; -1 on error 1400 1303 1401 1304 Sets the vcpu's current "multiprocessing state"; see KVM_GET_MP_STATE for 1402 1305 arguments. ··· 1421 1294 these architectures. 1422 1295 1423 1296 For arm/arm64: 1297 + ^^^^^^^^^^^^^^ 1424 1298 1425 1299 The only states that are valid are KVM_MP_STATE_STOPPED and 1426 1300 KVM_MP_STATE_RUNNABLE which reflect if the vcpu should be paused or not. 1427 1301 1428 1302 4.40 KVM_SET_IDENTITY_MAP_ADDR 1303 + ------------------------------ 1429 1304 1430 - Capability: KVM_CAP_SET_IDENTITY_MAP_ADDR 1431 - Architectures: x86 1432 - Type: vm ioctl 1433 - Parameters: unsigned long identity (in) 1434 - Returns: 0 on success, -1 on error 1305 + :Capability: KVM_CAP_SET_IDENTITY_MAP_ADDR 1306 + :Architectures: x86 1307 + :Type: vm ioctl 1308 + :Parameters: unsigned long identity (in) 1309 + :Returns: 0 on success, -1 on error 1435 1310 1436 1311 This ioctl defines the physical address of a one-page region in the guest 1437 1312 physical address space. The region must be within the first 4GB of the ··· 1451 1322 Fails if any VCPU has already been created. 1452 1323 1453 1324 4.41 KVM_SET_BOOT_CPU_ID 1325 + ------------------------ 1454 1326 1455 - Capability: KVM_CAP_SET_BOOT_CPU_ID 1456 - Architectures: x86 1457 - Type: vm ioctl 1458 - Parameters: unsigned long vcpu_id 1459 - Returns: 0 on success, -1 on error 1327 + :Capability: KVM_CAP_SET_BOOT_CPU_ID 1328 + :Architectures: x86 1329 + :Type: vm ioctl 1330 + :Parameters: unsigned long vcpu_id 1331 + :Returns: 0 on success, -1 on error 1460 1332 1461 1333 Define which vcpu is the Bootstrap Processor (BSP). Values are the same 1462 1334 as the vcpu id in KVM_CREATE_VCPU. If this ioctl is not called, the default ··· 1465 1335 1466 1336 1467 1337 4.42 KVM_GET_XSAVE 1338 + ------------------ 1468 1339 1469 - Capability: KVM_CAP_XSAVE 1470 - Architectures: x86 1471 - Type: vcpu ioctl 1472 - Parameters: struct kvm_xsave (out) 1473 - Returns: 0 on success, -1 on error 1340 + :Capability: KVM_CAP_XSAVE 1341 + :Architectures: x86 1342 + :Type: vcpu ioctl 1343 + :Parameters: struct kvm_xsave (out) 1344 + :Returns: 0 on success, -1 on error 1474 1345 1475 - struct kvm_xsave { 1346 + 1347 + :: 1348 + 1349 + struct kvm_xsave { 1476 1350 __u32 region[1024]; 1477 - }; 1351 + }; 1478 1352 1479 1353 This ioctl would copy current vcpu's xsave struct to the userspace. 1480 1354 1481 1355 1482 1356 4.43 KVM_SET_XSAVE 1357 + ------------------ 1483 1358 1484 - Capability: KVM_CAP_XSAVE 1485 - Architectures: x86 1486 - Type: vcpu ioctl 1487 - Parameters: struct kvm_xsave (in) 1488 - Returns: 0 on success, -1 on error 1359 + :Capability: KVM_CAP_XSAVE 1360 + :Architectures: x86 1361 + :Type: vcpu ioctl 1362 + :Parameters: struct kvm_xsave (in) 1363 + :Returns: 0 on success, -1 on error 1489 1364 1490 - struct kvm_xsave { 1365 + :: 1366 + 1367 + 1368 + struct kvm_xsave { 1491 1369 __u32 region[1024]; 1492 - }; 1370 + }; 1493 1371 1494 1372 This ioctl would copy userspace's xsave struct to the kernel. 1495 1373 1496 1374 1497 1375 4.44 KVM_GET_XCRS 1376 + ----------------- 1498 1377 1499 - Capability: KVM_CAP_XCRS 1500 - Architectures: x86 1501 - Type: vcpu ioctl 1502 - Parameters: struct kvm_xcrs (out) 1503 - Returns: 0 on success, -1 on error 1378 + :Capability: KVM_CAP_XCRS 1379 + :Architectures: x86 1380 + :Type: vcpu ioctl 1381 + :Parameters: struct kvm_xcrs (out) 1382 + :Returns: 0 on success, -1 on error 1504 1383 1505 - struct kvm_xcr { 1384 + :: 1385 + 1386 + struct kvm_xcr { 1506 1387 __u32 xcr; 1507 1388 __u32 reserved; 1508 1389 __u64 value; 1509 - }; 1390 + }; 1510 1391 1511 - struct kvm_xcrs { 1392 + struct kvm_xcrs { 1512 1393 __u32 nr_xcrs; 1513 1394 __u32 flags; 1514 1395 struct kvm_xcr xcrs[KVM_MAX_XCRS]; 1515 1396 __u64 padding[16]; 1516 - }; 1397 + }; 1517 1398 1518 1399 This ioctl would copy current vcpu's xcrs to the userspace. 1519 1400 1520 1401 1521 1402 4.45 KVM_SET_XCRS 1403 + ----------------- 1522 1404 1523 - Capability: KVM_CAP_XCRS 1524 - Architectures: x86 1525 - Type: vcpu ioctl 1526 - Parameters: struct kvm_xcrs (in) 1527 - Returns: 0 on success, -1 on error 1405 + :Capability: KVM_CAP_XCRS 1406 + :Architectures: x86 1407 + :Type: vcpu ioctl 1408 + :Parameters: struct kvm_xcrs (in) 1409 + :Returns: 0 on success, -1 on error 1528 1410 1529 - struct kvm_xcr { 1411 + :: 1412 + 1413 + struct kvm_xcr { 1530 1414 __u32 xcr; 1531 1415 __u32 reserved; 1532 1416 __u64 value; 1533 - }; 1417 + }; 1534 1418 1535 - struct kvm_xcrs { 1419 + struct kvm_xcrs { 1536 1420 __u32 nr_xcrs; 1537 1421 __u32 flags; 1538 1422 struct kvm_xcr xcrs[KVM_MAX_XCRS]; 1539 1423 __u64 padding[16]; 1540 - }; 1424 + }; 1541 1425 1542 1426 This ioctl would set vcpu's xcr to the value userspace specified. 1543 1427 1544 1428 1545 1429 4.46 KVM_GET_SUPPORTED_CPUID 1430 + ---------------------------- 1546 1431 1547 - Capability: KVM_CAP_EXT_CPUID 1548 - Architectures: x86 1549 - Type: system ioctl 1550 - Parameters: struct kvm_cpuid2 (in/out) 1551 - Returns: 0 on success, -1 on error 1432 + :Capability: KVM_CAP_EXT_CPUID 1433 + :Architectures: x86 1434 + :Type: system ioctl 1435 + :Parameters: struct kvm_cpuid2 (in/out) 1436 + :Returns: 0 on success, -1 on error 1552 1437 1553 - struct kvm_cpuid2 { 1438 + :: 1439 + 1440 + struct kvm_cpuid2 { 1554 1441 __u32 nent; 1555 1442 __u32 padding; 1556 1443 struct kvm_cpuid_entry2 entries[0]; 1557 - }; 1444 + }; 1558 1445 1559 - #define KVM_CPUID_FLAG_SIGNIFCANT_INDEX BIT(0) 1560 - #define KVM_CPUID_FLAG_STATEFUL_FUNC BIT(1) 1561 - #define KVM_CPUID_FLAG_STATE_READ_NEXT BIT(2) 1446 + #define KVM_CPUID_FLAG_SIGNIFCANT_INDEX BIT(0) 1447 + #define KVM_CPUID_FLAG_STATEFUL_FUNC BIT(1) 1448 + #define KVM_CPUID_FLAG_STATE_READ_NEXT BIT(2) 1562 1449 1563 - struct kvm_cpuid_entry2 { 1450 + struct kvm_cpuid_entry2 { 1564 1451 __u32 function; 1565 1452 __u32 index; 1566 1453 __u32 flags; ··· 1586 1439 __u32 ecx; 1587 1440 __u32 edx; 1588 1441 __u32 padding[3]; 1589 - }; 1442 + }; 1590 1443 1591 1444 This ioctl returns x86 cpuid features which are supported by both the 1592 1445 hardware and kvm in its default configuration. Userspace can use the ··· 1614 1467 x2apic), may not be present in the host cpu, but are exposed by kvm if it can 1615 1468 emulate them efficiently. The fields in each entry are defined as follows: 1616 1469 1617 - function: the eax value used to obtain the entry 1618 - index: the ecx value used to obtain the entry (for entries that are 1470 + function: 1471 + the eax value used to obtain the entry 1472 + 1473 + index: 1474 + the ecx value used to obtain the entry (for entries that are 1619 1475 affected by ecx) 1620 - flags: an OR of zero or more of the following: 1476 + 1477 + flags: 1478 + an OR of zero or more of the following: 1479 + 1621 1480 KVM_CPUID_FLAG_SIGNIFCANT_INDEX: 1622 1481 if the index field is valid 1623 1482 KVM_CPUID_FLAG_STATEFUL_FUNC: ··· 1633 1480 KVM_CPUID_FLAG_STATE_READ_NEXT: 1634 1481 for KVM_CPUID_FLAG_STATEFUL_FUNC entries, set if this entry is 1635 1482 the first entry to be read by a cpu 1636 - eax, ebx, ecx, edx: the values returned by the cpuid instruction for 1483 + 1484 + eax, ebx, ecx, edx: 1485 + the values returned by the cpuid instruction for 1637 1486 this function/index combination 1638 1487 1639 1488 The TSC deadline timer feature (CPUID leaf 1, ecx[24]) is always returned 1640 1489 as false, since the feature depends on KVM_CREATE_IRQCHIP for local APIC 1641 - support. Instead it is reported via 1490 + support. Instead it is reported via:: 1642 1491 1643 1492 ioctl(KVM_CHECK_EXTENSION, KVM_CAP_TSC_DEADLINE_TIMER) 1644 1493 ··· 1649 1494 1650 1495 1651 1496 4.47 KVM_PPC_GET_PVINFO 1497 + ----------------------- 1652 1498 1653 - Capability: KVM_CAP_PPC_GET_PVINFO 1654 - Architectures: ppc 1655 - Type: vm ioctl 1656 - Parameters: struct kvm_ppc_pvinfo (out) 1657 - Returns: 0 on success, !0 on error 1499 + :Capability: KVM_CAP_PPC_GET_PVINFO 1500 + :Architectures: ppc 1501 + :Type: vm ioctl 1502 + :Parameters: struct kvm_ppc_pvinfo (out) 1503 + :Returns: 0 on success, !0 on error 1658 1504 1659 - struct kvm_ppc_pvinfo { 1505 + :: 1506 + 1507 + struct kvm_ppc_pvinfo { 1660 1508 __u32 flags; 1661 1509 __u32 hcall[4]; 1662 1510 __u8 pad[108]; 1663 - }; 1511 + }; 1664 1512 1665 1513 This ioctl fetches PV specific information that need to be passed to the guest 1666 1514 using the device tree or other means from vm context. ··· 1673 1515 If any additional field gets added to this structure later on, a bit for that 1674 1516 additional piece of information will be set in the flags bitmap. 1675 1517 1676 - The flags bitmap is defined as: 1518 + The flags bitmap is defined as:: 1677 1519 1678 1520 /* the host supports the ePAPR idle hcall 1679 1521 #define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1<<0) 1680 1522 1681 1523 4.52 KVM_SET_GSI_ROUTING 1524 + ------------------------ 1682 1525 1683 - Capability: KVM_CAP_IRQ_ROUTING 1684 - Architectures: x86 s390 arm arm64 1685 - Type: vm ioctl 1686 - Parameters: struct kvm_irq_routing (in) 1687 - Returns: 0 on success, -1 on error 1526 + :Capability: KVM_CAP_IRQ_ROUTING 1527 + :Architectures: x86 s390 arm arm64 1528 + :Type: vm ioctl 1529 + :Parameters: struct kvm_irq_routing (in) 1530 + :Returns: 0 on success, -1 on error 1688 1531 1689 1532 Sets the GSI routing table entries, overwriting any previously set entries. 1690 1533 1691 1534 On arm/arm64, GSI routing has the following limitation: 1535 + 1692 1536 - GSI routing does not apply to KVM_IRQ_LINE but only to KVM_IRQFD. 1693 1537 1694 - struct kvm_irq_routing { 1538 + :: 1539 + 1540 + struct kvm_irq_routing { 1695 1541 __u32 nr; 1696 1542 __u32 flags; 1697 1543 struct kvm_irq_routing_entry entries[0]; 1698 - }; 1544 + }; 1699 1545 1700 1546 No flags are specified so far, the corresponding field must be set to zero. 1701 1547 1702 - struct kvm_irq_routing_entry { 1548 + :: 1549 + 1550 + struct kvm_irq_routing_entry { 1703 1551 __u32 gsi; 1704 1552 __u32 type; 1705 1553 __u32 flags; ··· 1717 1553 struct kvm_irq_routing_hv_sint hv_sint; 1718 1554 __u32 pad[8]; 1719 1555 } u; 1720 - }; 1556 + }; 1721 1557 1722 - /* gsi routing entry types */ 1723 - #define KVM_IRQ_ROUTING_IRQCHIP 1 1724 - #define KVM_IRQ_ROUTING_MSI 2 1725 - #define KVM_IRQ_ROUTING_S390_ADAPTER 3 1726 - #define KVM_IRQ_ROUTING_HV_SINT 4 1558 + /* gsi routing entry types */ 1559 + #define KVM_IRQ_ROUTING_IRQCHIP 1 1560 + #define KVM_IRQ_ROUTING_MSI 2 1561 + #define KVM_IRQ_ROUTING_S390_ADAPTER 3 1562 + #define KVM_IRQ_ROUTING_HV_SINT 4 1727 1563 1728 1564 flags: 1565 + 1729 1566 - KVM_MSI_VALID_DEVID: used along with KVM_IRQ_ROUTING_MSI routing entry 1730 1567 type, specifies that the devid field contains a valid value. The per-VM 1731 1568 KVM_CAP_MSI_DEVID capability advertises the requirement to provide ··· 1734 1569 never set the KVM_MSI_VALID_DEVID flag as the ioctl might fail. 1735 1570 - zero otherwise 1736 1571 1737 - struct kvm_irq_routing_irqchip { 1572 + :: 1573 + 1574 + struct kvm_irq_routing_irqchip { 1738 1575 __u32 irqchip; 1739 1576 __u32 pin; 1740 - }; 1577 + }; 1741 1578 1742 - struct kvm_irq_routing_msi { 1579 + struct kvm_irq_routing_msi { 1743 1580 __u32 address_lo; 1744 1581 __u32 address_hi; 1745 1582 __u32 data; ··· 1749 1582 __u32 pad; 1750 1583 __u32 devid; 1751 1584 }; 1752 - }; 1585 + }; 1753 1586 1754 1587 If KVM_MSI_VALID_DEVID is set, devid contains a unique device identifier 1755 1588 for the device that wrote the MSI message. For PCI, this is usually a ··· 1760 1593 address_hi bits 31-8 provide bits 31-8 of the destination id. Bits 7-0 of 1761 1594 address_hi must be zero. 1762 1595 1763 - struct kvm_irq_routing_s390_adapter { 1596 + :: 1597 + 1598 + struct kvm_irq_routing_s390_adapter { 1764 1599 __u64 ind_addr; 1765 1600 __u64 summary_addr; 1766 1601 __u64 ind_offset; 1767 1602 __u32 summary_offset; 1768 1603 __u32 adapter_id; 1769 - }; 1604 + }; 1770 1605 1771 - struct kvm_irq_routing_hv_sint { 1606 + struct kvm_irq_routing_hv_sint { 1772 1607 __u32 vcpu; 1773 1608 __u32 sint; 1774 - }; 1609 + }; 1775 1610 1776 1611 1777 1612 4.55 KVM_SET_TSC_KHZ 1613 + -------------------- 1778 1614 1779 - Capability: KVM_CAP_TSC_CONTROL 1780 - Architectures: x86 1781 - Type: vcpu ioctl 1782 - Parameters: virtual tsc_khz 1783 - Returns: 0 on success, -1 on error 1615 + :Capability: KVM_CAP_TSC_CONTROL 1616 + :Architectures: x86 1617 + :Type: vcpu ioctl 1618 + :Parameters: virtual tsc_khz 1619 + :Returns: 0 on success, -1 on error 1784 1620 1785 1621 Specifies the tsc frequency for the virtual machine. The unit of the 1786 1622 frequency is KHz. 1787 1623 1788 1624 1789 1625 4.56 KVM_GET_TSC_KHZ 1626 + -------------------- 1790 1627 1791 - Capability: KVM_CAP_GET_TSC_KHZ 1792 - Architectures: x86 1793 - Type: vcpu ioctl 1794 - Parameters: none 1795 - Returns: virtual tsc-khz on success, negative value on error 1628 + :Capability: KVM_CAP_GET_TSC_KHZ 1629 + :Architectures: x86 1630 + :Type: vcpu ioctl 1631 + :Parameters: none 1632 + :Returns: virtual tsc-khz on success, negative value on error 1796 1633 1797 1634 Returns the tsc frequency of the guest. The unit of the return value is 1798 1635 KHz. If the host has unstable tsc this ioctl returns -EIO instead as an ··· 1804 1633 1805 1634 1806 1635 4.57 KVM_GET_LAPIC 1636 + ------------------ 1807 1637 1808 - Capability: KVM_CAP_IRQCHIP 1809 - Architectures: x86 1810 - Type: vcpu ioctl 1811 - Parameters: struct kvm_lapic_state (out) 1812 - Returns: 0 on success, -1 on error 1638 + :Capability: KVM_CAP_IRQCHIP 1639 + :Architectures: x86 1640 + :Type: vcpu ioctl 1641 + :Parameters: struct kvm_lapic_state (out) 1642 + :Returns: 0 on success, -1 on error 1813 1643 1814 - #define KVM_APIC_REG_SIZE 0x400 1815 - struct kvm_lapic_state { 1644 + :: 1645 + 1646 + #define KVM_APIC_REG_SIZE 0x400 1647 + struct kvm_lapic_state { 1816 1648 char regs[KVM_APIC_REG_SIZE]; 1817 - }; 1649 + }; 1818 1650 1819 1651 Reads the Local APIC registers and copies them into the input argument. The 1820 1652 data format and layout are the same as documented in the architecture manual. ··· 1835 1661 1836 1662 1837 1663 4.58 KVM_SET_LAPIC 1664 + ------------------ 1838 1665 1839 - Capability: KVM_CAP_IRQCHIP 1840 - Architectures: x86 1841 - Type: vcpu ioctl 1842 - Parameters: struct kvm_lapic_state (in) 1843 - Returns: 0 on success, -1 on error 1666 + :Capability: KVM_CAP_IRQCHIP 1667 + :Architectures: x86 1668 + :Type: vcpu ioctl 1669 + :Parameters: struct kvm_lapic_state (in) 1670 + :Returns: 0 on success, -1 on error 1844 1671 1845 - #define KVM_APIC_REG_SIZE 0x400 1846 - struct kvm_lapic_state { 1672 + :: 1673 + 1674 + #define KVM_APIC_REG_SIZE 0x400 1675 + struct kvm_lapic_state { 1847 1676 char regs[KVM_APIC_REG_SIZE]; 1848 - }; 1677 + }; 1849 1678 1850 1679 Copies the input argument into the Local APIC registers. The data format 1851 1680 and layout are the same as documented in the architecture manual. ··· 1859 1682 1860 1683 1861 1684 4.59 KVM_IOEVENTFD 1685 + ------------------ 1862 1686 1863 - Capability: KVM_CAP_IOEVENTFD 1864 - Architectures: all 1865 - Type: vm ioctl 1866 - Parameters: struct kvm_ioeventfd (in) 1867 - Returns: 0 on success, !0 on error 1687 + :Capability: KVM_CAP_IOEVENTFD 1688 + :Architectures: all 1689 + :Type: vm ioctl 1690 + :Parameters: struct kvm_ioeventfd (in) 1691 + :Returns: 0 on success, !0 on error 1868 1692 1869 1693 This ioctl attaches or detaches an ioeventfd to a legal pio/mmio address 1870 1694 within the guest. A guest write in the registered address will signal the 1871 1695 provided event instead of triggering an exit. 1872 1696 1873 - struct kvm_ioeventfd { 1697 + :: 1698 + 1699 + struct kvm_ioeventfd { 1874 1700 __u64 datamatch; 1875 1701 __u64 addr; /* legal pio/mmio address */ 1876 1702 __u32 len; /* 0, 1, 2, 4, or 8 bytes */ 1877 1703 __s32 fd; 1878 1704 __u32 flags; 1879 1705 __u8 pad[36]; 1880 - }; 1706 + }; 1881 1707 1882 1708 For the special case of virtio-ccw devices on s390, the ioevent is matched 1883 1709 to a subchannel/virtqueue tuple instead. 1884 1710 1885 - The following flags are defined: 1711 + The following flags are defined:: 1886 1712 1887 - #define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch) 1888 - #define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio) 1889 - #define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign) 1890 - #define KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY \ 1713 + #define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch) 1714 + #define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio) 1715 + #define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign) 1716 + #define KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY \ 1891 1717 (1 << kvm_ioeventfd_flag_nr_virtio_ccw_notify) 1892 1718 1893 1719 If datamatch flag is set, the event will be signaled only if the written value ··· 1905 1725 work anyway. 1906 1726 1907 1727 4.60 KVM_DIRTY_TLB 1728 + ------------------ 1908 1729 1909 - Capability: KVM_CAP_SW_TLB 1910 - Architectures: ppc 1911 - Type: vcpu ioctl 1912 - Parameters: struct kvm_dirty_tlb (in) 1913 - Returns: 0 on success, -1 on error 1730 + :Capability: KVM_CAP_SW_TLB 1731 + :Architectures: ppc 1732 + :Type: vcpu ioctl 1733 + :Parameters: struct kvm_dirty_tlb (in) 1734 + :Returns: 0 on success, -1 on error 1914 1735 1915 - struct kvm_dirty_tlb { 1736 + :: 1737 + 1738 + struct kvm_dirty_tlb { 1916 1739 __u64 bitmap; 1917 1740 __u32 num_dirty; 1918 - }; 1741 + }; 1919 1742 1920 1743 This must be called whenever userspace has changed an entry in the shared 1921 1744 TLB, prior to calling KVM_RUN on the associated vcpu. ··· 1941 1758 1942 1759 1943 1760 4.62 KVM_CREATE_SPAPR_TCE 1761 + ------------------------- 1944 1762 1945 - Capability: KVM_CAP_SPAPR_TCE 1946 - Architectures: powerpc 1947 - Type: vm ioctl 1948 - Parameters: struct kvm_create_spapr_tce (in) 1949 - Returns: file descriptor for manipulating the created TCE table 1763 + :Capability: KVM_CAP_SPAPR_TCE 1764 + :Architectures: powerpc 1765 + :Type: vm ioctl 1766 + :Parameters: struct kvm_create_spapr_tce (in) 1767 + :Returns: file descriptor for manipulating the created TCE table 1950 1768 1951 1769 This creates a virtual TCE (translation control entry) table, which 1952 1770 is an IOMMU for PAPR-style virtual I/O. It is used to translate 1953 1771 logical addresses used in virtual I/O into guest physical addresses, 1954 1772 and provides a scatter/gather capability for PAPR virtual I/O. 1955 1773 1956 - /* for KVM_CAP_SPAPR_TCE */ 1957 - struct kvm_create_spapr_tce { 1774 + :: 1775 + 1776 + /* for KVM_CAP_SPAPR_TCE */ 1777 + struct kvm_create_spapr_tce { 1958 1778 __u64 liobn; 1959 1779 __u32 window_size; 1960 - }; 1780 + }; 1961 1781 1962 1782 The liobn field gives the logical IO bus number for which to create a 1963 1783 TCE table. The window_size field specifies the size of the DMA window ··· 1980 1794 1981 1795 1982 1796 4.63 KVM_ALLOCATE_RMA 1797 + --------------------- 1983 1798 1984 - Capability: KVM_CAP_PPC_RMA 1985 - Architectures: powerpc 1986 - Type: vm ioctl 1987 - Parameters: struct kvm_allocate_rma (out) 1988 - Returns: file descriptor for mapping the allocated RMA 1799 + :Capability: KVM_CAP_PPC_RMA 1800 + :Architectures: powerpc 1801 + :Type: vm ioctl 1802 + :Parameters: struct kvm_allocate_rma (out) 1803 + :Returns: file descriptor for mapping the allocated RMA 1989 1804 1990 1805 This allocates a Real Mode Area (RMA) from the pool allocated at boot 1991 1806 time by the kernel. An RMA is a physically-contiguous, aligned region ··· 1995 1808 POWER processors support a set of sizes for the RMA that usually 1996 1809 includes 64MB, 128MB, 256MB and some larger powers of two. 1997 1810 1998 - /* for KVM_ALLOCATE_RMA */ 1999 - struct kvm_allocate_rma { 1811 + :: 1812 + 1813 + /* for KVM_ALLOCATE_RMA */ 1814 + struct kvm_allocate_rma { 2000 1815 __u64 rma_size; 2001 - }; 1816 + }; 2002 1817 2003 1818 The return value is a file descriptor which can be passed to mmap(2) 2004 1819 to map the allocated RMA into userspace. The mapped area can then be ··· 2016 1827 2017 1828 2018 1829 4.64 KVM_NMI 1830 + ------------ 2019 1831 2020 - Capability: KVM_CAP_USER_NMI 2021 - Architectures: x86 2022 - Type: vcpu ioctl 2023 - Parameters: none 2024 - Returns: 0 on success, -1 on error 1832 + :Capability: KVM_CAP_USER_NMI 1833 + :Architectures: x86 1834 + :Type: vcpu ioctl 1835 + :Parameters: none 1836 + :Returns: 0 on success, -1 on error 2025 1837 2026 1838 Queues an NMI on the thread's vcpu. Note this is well defined only 2027 1839 when KVM_CREATE_IRQCHIP has not been called, since this is an interface ··· 2043 1853 2044 1854 2045 1855 4.65 KVM_S390_UCAS_MAP 1856 + ---------------------- 2046 1857 2047 - Capability: KVM_CAP_S390_UCONTROL 2048 - Architectures: s390 2049 - Type: vcpu ioctl 2050 - Parameters: struct kvm_s390_ucas_mapping (in) 2051 - Returns: 0 in case of success 1858 + :Capability: KVM_CAP_S390_UCONTROL 1859 + :Architectures: s390 1860 + :Type: vcpu ioctl 1861 + :Parameters: struct kvm_s390_ucas_mapping (in) 1862 + :Returns: 0 in case of success 2052 1863 2053 - The parameter is defined like this: 1864 + The parameter is defined like this:: 1865 + 2054 1866 struct kvm_s390_ucas_mapping { 2055 1867 __u64 user_addr; 2056 1868 __u64 vcpu_addr; ··· 2065 1873 2066 1874 2067 1875 4.66 KVM_S390_UCAS_UNMAP 1876 + ------------------------ 2068 1877 2069 - Capability: KVM_CAP_S390_UCONTROL 2070 - Architectures: s390 2071 - Type: vcpu ioctl 2072 - Parameters: struct kvm_s390_ucas_mapping (in) 2073 - Returns: 0 in case of success 1878 + :Capability: KVM_CAP_S390_UCONTROL 1879 + :Architectures: s390 1880 + :Type: vcpu ioctl 1881 + :Parameters: struct kvm_s390_ucas_mapping (in) 1882 + :Returns: 0 in case of success 2074 1883 2075 - The parameter is defined like this: 1884 + The parameter is defined like this:: 1885 + 2076 1886 struct kvm_s390_ucas_mapping { 2077 1887 __u64 user_addr; 2078 1888 __u64 vcpu_addr; ··· 2087 1893 2088 1894 2089 1895 4.67 KVM_S390_VCPU_FAULT 1896 + ------------------------ 2090 1897 2091 - Capability: KVM_CAP_S390_UCONTROL 2092 - Architectures: s390 2093 - Type: vcpu ioctl 2094 - Parameters: vcpu absolute address (in) 2095 - Returns: 0 in case of success 1898 + :Capability: KVM_CAP_S390_UCONTROL 1899 + :Architectures: s390 1900 + :Type: vcpu ioctl 1901 + :Parameters: vcpu absolute address (in) 1902 + :Returns: 0 in case of success 2096 1903 2097 1904 This call creates a page table entry on the virtual cpu's address space 2098 1905 (for user controlled virtual machines) or the virtual machine's address ··· 2105 1910 2106 1911 2107 1912 4.68 KVM_SET_ONE_REG 1913 + -------------------- 2108 1914 2109 - Capability: KVM_CAP_ONE_REG 2110 - Architectures: all 2111 - Type: vcpu ioctl 2112 - Parameters: struct kvm_one_reg (in) 2113 - Returns: 0 on success, negative value on failure 1915 + :Capability: KVM_CAP_ONE_REG 1916 + :Architectures: all 1917 + :Type: vcpu ioctl 1918 + :Parameters: struct kvm_one_reg (in) 1919 + :Returns: 0 on success, negative value on failure 1920 + 2114 1921 Errors: 2115 -  ENOENT:   no such register 2116 -  EINVAL:   invalid register ID, or no such register 2117 -  EPERM:    (arm64) register access not allowed before vcpu finalization 1922 + 1923 + ====== ============================================================ 1924 +  ENOENT   no such register 1925 +  EINVAL   invalid register ID, or no such register 1926 +  EPERM    (arm64) register access not allowed before vcpu finalization 1927 + ====== ============================================================ 1928 + 2118 1929 (These error codes are indicative only: do not rely on a specific error 2119 1930 code being returned in a specific situation.) 2120 1931 2121 - struct kvm_one_reg { 1932 + :: 1933 + 1934 + struct kvm_one_reg { 2122 1935 __u64 id; 2123 1936 __u64 addr; 2124 - }; 1937 + }; 2125 1938 2126 1939 Using this ioctl, a single vcpu register can be set to a specific value 2127 1940 defined by user space with the passed in struct kvm_one_reg, where id ··· 2139 1936 and their own constants and width. To keep track of the implemented 2140 1937 registers, find a list below: 2141 1938 2142 - Arch | Register | Width (bits) 2143 - | | 2144 - PPC | KVM_REG_PPC_HIOR | 64 2145 - PPC | KVM_REG_PPC_IAC1 | 64 2146 - PPC | KVM_REG_PPC_IAC2 | 64 2147 - PPC | KVM_REG_PPC_IAC3 | 64 2148 - PPC | KVM_REG_PPC_IAC4 | 64 2149 - PPC | KVM_REG_PPC_DAC1 | 64 2150 - PPC | KVM_REG_PPC_DAC2 | 64 2151 - PPC | KVM_REG_PPC_DABR | 64 2152 - PPC | KVM_REG_PPC_DSCR | 64 2153 - PPC | KVM_REG_PPC_PURR | 64 2154 - PPC | KVM_REG_PPC_SPURR | 64 2155 - PPC | KVM_REG_PPC_DAR | 64 2156 - PPC | KVM_REG_PPC_DSISR | 32 2157 - PPC | KVM_REG_PPC_AMR | 64 2158 - PPC | KVM_REG_PPC_UAMOR | 64 2159 - PPC | KVM_REG_PPC_MMCR0 | 64 2160 - PPC | KVM_REG_PPC_MMCR1 | 64 2161 - PPC | KVM_REG_PPC_MMCRA | 64 2162 - PPC | KVM_REG_PPC_MMCR2 | 64 2163 - PPC | KVM_REG_PPC_MMCRS | 64 2164 - PPC | KVM_REG_PPC_SIAR | 64 2165 - PPC | KVM_REG_PPC_SDAR | 64 2166 - PPC | KVM_REG_PPC_SIER | 64 2167 - PPC | KVM_REG_PPC_PMC1 | 32 2168 - PPC | KVM_REG_PPC_PMC2 | 32 2169 - PPC | KVM_REG_PPC_PMC3 | 32 2170 - PPC | KVM_REG_PPC_PMC4 | 32 2171 - PPC | KVM_REG_PPC_PMC5 | 32 2172 - PPC | KVM_REG_PPC_PMC6 | 32 2173 - PPC | KVM_REG_PPC_PMC7 | 32 2174 - PPC | KVM_REG_PPC_PMC8 | 32 2175 - PPC | KVM_REG_PPC_FPR0 | 64 2176 - ... 2177 - PPC | KVM_REG_PPC_FPR31 | 64 2178 - PPC | KVM_REG_PPC_VR0 | 128 2179 - ... 2180 - PPC | KVM_REG_PPC_VR31 | 128 2181 - PPC | KVM_REG_PPC_VSR0 | 128 2182 - ... 2183 - PPC | KVM_REG_PPC_VSR31 | 128 2184 - PPC | KVM_REG_PPC_FPSCR | 64 2185 - PPC | KVM_REG_PPC_VSCR | 32 2186 - PPC | KVM_REG_PPC_VPA_ADDR | 64 2187 - PPC | KVM_REG_PPC_VPA_SLB | 128 2188 - PPC | KVM_REG_PPC_VPA_DTL | 128 2189 - PPC | KVM_REG_PPC_EPCR | 32 2190 - PPC | KVM_REG_PPC_EPR | 32 2191 - PPC | KVM_REG_PPC_TCR | 32 2192 - PPC | KVM_REG_PPC_TSR | 32 2193 - PPC | KVM_REG_PPC_OR_TSR | 32 2194 - PPC | KVM_REG_PPC_CLEAR_TSR | 32 2195 - PPC | KVM_REG_PPC_MAS0 | 32 2196 - PPC | KVM_REG_PPC_MAS1 | 32 2197 - PPC | KVM_REG_PPC_MAS2 | 64 2198 - PPC | KVM_REG_PPC_MAS7_3 | 64 2199 - PPC | KVM_REG_PPC_MAS4 | 32 2200 - PPC | KVM_REG_PPC_MAS6 | 32 2201 - PPC | KVM_REG_PPC_MMUCFG | 32 2202 - PPC | KVM_REG_PPC_TLB0CFG | 32 2203 - PPC | KVM_REG_PPC_TLB1CFG | 32 2204 - PPC | KVM_REG_PPC_TLB2CFG | 32 2205 - PPC | KVM_REG_PPC_TLB3CFG | 32 2206 - PPC | KVM_REG_PPC_TLB0PS | 32 2207 - PPC | KVM_REG_PPC_TLB1PS | 32 2208 - PPC | KVM_REG_PPC_TLB2PS | 32 2209 - PPC | KVM_REG_PPC_TLB3PS | 32 2210 - PPC | KVM_REG_PPC_EPTCFG | 32 2211 - PPC | KVM_REG_PPC_ICP_STATE | 64 2212 - PPC | KVM_REG_PPC_VP_STATE | 128 2213 - PPC | KVM_REG_PPC_TB_OFFSET | 64 2214 - PPC | KVM_REG_PPC_SPMC1 | 32 2215 - PPC | KVM_REG_PPC_SPMC2 | 32 2216 - PPC | KVM_REG_PPC_IAMR | 64 2217 - PPC | KVM_REG_PPC_TFHAR | 64 2218 - PPC | KVM_REG_PPC_TFIAR | 64 2219 - PPC | KVM_REG_PPC_TEXASR | 64 2220 - PPC | KVM_REG_PPC_FSCR | 64 2221 - PPC | KVM_REG_PPC_PSPB | 32 2222 - PPC | KVM_REG_PPC_EBBHR | 64 2223 - PPC | KVM_REG_PPC_EBBRR | 64 2224 - PPC | KVM_REG_PPC_BESCR | 64 2225 - PPC | KVM_REG_PPC_TAR | 64 2226 - PPC | KVM_REG_PPC_DPDES | 64 2227 - PPC | KVM_REG_PPC_DAWR | 64 2228 - PPC | KVM_REG_PPC_DAWRX | 64 2229 - PPC | KVM_REG_PPC_CIABR | 64 2230 - PPC | KVM_REG_PPC_IC | 64 2231 - PPC | KVM_REG_PPC_VTB | 64 2232 - PPC | KVM_REG_PPC_CSIGR | 64 2233 - PPC | KVM_REG_PPC_TACR | 64 2234 - PPC | KVM_REG_PPC_TCSCR | 64 2235 - PPC | KVM_REG_PPC_PID | 64 2236 - PPC | KVM_REG_PPC_ACOP | 64 2237 - PPC | KVM_REG_PPC_VRSAVE | 32 2238 - PPC | KVM_REG_PPC_LPCR | 32 2239 - PPC | KVM_REG_PPC_LPCR_64 | 64 2240 - PPC | KVM_REG_PPC_PPR | 64 2241 - PPC | KVM_REG_PPC_ARCH_COMPAT | 32 2242 - PPC | KVM_REG_PPC_DABRX | 32 2243 - PPC | KVM_REG_PPC_WORT | 64 2244 - PPC | KVM_REG_PPC_SPRG9 | 64 2245 - PPC | KVM_REG_PPC_DBSR | 32 2246 - PPC | KVM_REG_PPC_TIDR | 64 2247 - PPC | KVM_REG_PPC_PSSCR | 64 2248 - PPC | KVM_REG_PPC_DEC_EXPIRY | 64 2249 - PPC | KVM_REG_PPC_PTCR | 64 2250 - PPC | KVM_REG_PPC_TM_GPR0 | 64 2251 - ... 2252 - PPC | KVM_REG_PPC_TM_GPR31 | 64 2253 - PPC | KVM_REG_PPC_TM_VSR0 | 128 2254 - ... 2255 - PPC | KVM_REG_PPC_TM_VSR63 | 128 2256 - PPC | KVM_REG_PPC_TM_CR | 64 2257 - PPC | KVM_REG_PPC_TM_LR | 64 2258 - PPC | KVM_REG_PPC_TM_CTR | 64 2259 - PPC | KVM_REG_PPC_TM_FPSCR | 64 2260 - PPC | KVM_REG_PPC_TM_AMR | 64 2261 - PPC | KVM_REG_PPC_TM_PPR | 64 2262 - PPC | KVM_REG_PPC_TM_VRSAVE | 64 2263 - PPC | KVM_REG_PPC_TM_VSCR | 32 2264 - PPC | KVM_REG_PPC_TM_DSCR | 64 2265 - PPC | KVM_REG_PPC_TM_TAR | 64 2266 - PPC | KVM_REG_PPC_TM_XER | 64 2267 - | | 2268 - MIPS | KVM_REG_MIPS_R0 | 64 2269 - ... 2270 - MIPS | KVM_REG_MIPS_R31 | 64 2271 - MIPS | KVM_REG_MIPS_HI | 64 2272 - MIPS | KVM_REG_MIPS_LO | 64 2273 - MIPS | KVM_REG_MIPS_PC | 64 2274 - MIPS | KVM_REG_MIPS_CP0_INDEX | 32 2275 - MIPS | KVM_REG_MIPS_CP0_ENTRYLO0 | 64 2276 - MIPS | KVM_REG_MIPS_CP0_ENTRYLO1 | 64 2277 - MIPS | KVM_REG_MIPS_CP0_CONTEXT | 64 2278 - MIPS | KVM_REG_MIPS_CP0_CONTEXTCONFIG| 32 2279 - MIPS | KVM_REG_MIPS_CP0_USERLOCAL | 64 2280 - MIPS | KVM_REG_MIPS_CP0_XCONTEXTCONFIG| 64 2281 - MIPS | KVM_REG_MIPS_CP0_PAGEMASK | 32 2282 - MIPS | KVM_REG_MIPS_CP0_PAGEGRAIN | 32 2283 - MIPS | KVM_REG_MIPS_CP0_SEGCTL0 | 64 2284 - MIPS | KVM_REG_MIPS_CP0_SEGCTL1 | 64 2285 - MIPS | KVM_REG_MIPS_CP0_SEGCTL2 | 64 2286 - MIPS | KVM_REG_MIPS_CP0_PWBASE | 64 2287 - MIPS | KVM_REG_MIPS_CP0_PWFIELD | 64 2288 - MIPS | KVM_REG_MIPS_CP0_PWSIZE | 64 2289 - MIPS | KVM_REG_MIPS_CP0_WIRED | 32 2290 - MIPS | KVM_REG_MIPS_CP0_PWCTL | 32 2291 - MIPS | KVM_REG_MIPS_CP0_HWRENA | 32 2292 - MIPS | KVM_REG_MIPS_CP0_BADVADDR | 64 2293 - MIPS | KVM_REG_MIPS_CP0_BADINSTR | 32 2294 - MIPS | KVM_REG_MIPS_CP0_BADINSTRP | 32 2295 - MIPS | KVM_REG_MIPS_CP0_COUNT | 32 2296 - MIPS | KVM_REG_MIPS_CP0_ENTRYHI | 64 2297 - MIPS | KVM_REG_MIPS_CP0_COMPARE | 32 2298 - MIPS | KVM_REG_MIPS_CP0_STATUS | 32 2299 - MIPS | KVM_REG_MIPS_CP0_INTCTL | 32 2300 - MIPS | KVM_REG_MIPS_CP0_CAUSE | 32 2301 - MIPS | KVM_REG_MIPS_CP0_EPC | 64 2302 - MIPS | KVM_REG_MIPS_CP0_PRID | 32 2303 - MIPS | KVM_REG_MIPS_CP0_EBASE | 64 2304 - MIPS | KVM_REG_MIPS_CP0_CONFIG | 32 2305 - MIPS | KVM_REG_MIPS_CP0_CONFIG1 | 32 2306 - MIPS | KVM_REG_MIPS_CP0_CONFIG2 | 32 2307 - MIPS | KVM_REG_MIPS_CP0_CONFIG3 | 32 2308 - MIPS | KVM_REG_MIPS_CP0_CONFIG4 | 32 2309 - MIPS | KVM_REG_MIPS_CP0_CONFIG5 | 32 2310 - MIPS | KVM_REG_MIPS_CP0_CONFIG7 | 32 2311 - MIPS | KVM_REG_MIPS_CP0_XCONTEXT | 64 2312 - MIPS | KVM_REG_MIPS_CP0_ERROREPC | 64 2313 - MIPS | KVM_REG_MIPS_CP0_KSCRATCH1 | 64 2314 - MIPS | KVM_REG_MIPS_CP0_KSCRATCH2 | 64 2315 - MIPS | KVM_REG_MIPS_CP0_KSCRATCH3 | 64 2316 - MIPS | KVM_REG_MIPS_CP0_KSCRATCH4 | 64 2317 - MIPS | KVM_REG_MIPS_CP0_KSCRATCH5 | 64 2318 - MIPS | KVM_REG_MIPS_CP0_KSCRATCH6 | 64 2319 - MIPS | KVM_REG_MIPS_CP0_MAAR(0..63) | 64 2320 - MIPS | KVM_REG_MIPS_COUNT_CTL | 64 2321 - MIPS | KVM_REG_MIPS_COUNT_RESUME | 64 2322 - MIPS | KVM_REG_MIPS_COUNT_HZ | 64 2323 - MIPS | KVM_REG_MIPS_FPR_32(0..31) | 32 2324 - MIPS | KVM_REG_MIPS_FPR_64(0..31) | 64 2325 - MIPS | KVM_REG_MIPS_VEC_128(0..31) | 128 2326 - MIPS | KVM_REG_MIPS_FCR_IR | 32 2327 - MIPS | KVM_REG_MIPS_FCR_CSR | 32 2328 - MIPS | KVM_REG_MIPS_MSA_IR | 32 2329 - MIPS | KVM_REG_MIPS_MSA_CSR | 32 1939 + ======= =============================== ============ 1940 + Arch Register Width (bits) 1941 + ======= =============================== ============ 1942 + PPC KVM_REG_PPC_HIOR 64 1943 + PPC KVM_REG_PPC_IAC1 64 1944 + PPC KVM_REG_PPC_IAC2 64 1945 + PPC KVM_REG_PPC_IAC3 64 1946 + PPC KVM_REG_PPC_IAC4 64 1947 + PPC KVM_REG_PPC_DAC1 64 1948 + PPC KVM_REG_PPC_DAC2 64 1949 + PPC KVM_REG_PPC_DABR 64 1950 + PPC KVM_REG_PPC_DSCR 64 1951 + PPC KVM_REG_PPC_PURR 64 1952 + PPC KVM_REG_PPC_SPURR 64 1953 + PPC KVM_REG_PPC_DAR 64 1954 + PPC KVM_REG_PPC_DSISR 32 1955 + PPC KVM_REG_PPC_AMR 64 1956 + PPC KVM_REG_PPC_UAMOR 64 1957 + PPC KVM_REG_PPC_MMCR0 64 1958 + PPC KVM_REG_PPC_MMCR1 64 1959 + PPC KVM_REG_PPC_MMCRA 64 1960 + PPC KVM_REG_PPC_MMCR2 64 1961 + PPC KVM_REG_PPC_MMCRS 64 1962 + PPC KVM_REG_PPC_SIAR 64 1963 + PPC KVM_REG_PPC_SDAR 64 1964 + PPC KVM_REG_PPC_SIER 64 1965 + PPC KVM_REG_PPC_PMC1 32 1966 + PPC KVM_REG_PPC_PMC2 32 1967 + PPC KVM_REG_PPC_PMC3 32 1968 + PPC KVM_REG_PPC_PMC4 32 1969 + PPC KVM_REG_PPC_PMC5 32 1970 + PPC KVM_REG_PPC_PMC6 32 1971 + PPC KVM_REG_PPC_PMC7 32 1972 + PPC KVM_REG_PPC_PMC8 32 1973 + PPC KVM_REG_PPC_FPR0 64 1974 + ... 1975 + PPC KVM_REG_PPC_FPR31 64 1976 + PPC KVM_REG_PPC_VR0 128 1977 + ... 1978 + PPC KVM_REG_PPC_VR31 128 1979 + PPC KVM_REG_PPC_VSR0 128 1980 + ... 1981 + PPC KVM_REG_PPC_VSR31 128 1982 + PPC KVM_REG_PPC_FPSCR 64 1983 + PPC KVM_REG_PPC_VSCR 32 1984 + PPC KVM_REG_PPC_VPA_ADDR 64 1985 + PPC KVM_REG_PPC_VPA_SLB 128 1986 + PPC KVM_REG_PPC_VPA_DTL 128 1987 + PPC KVM_REG_PPC_EPCR 32 1988 + PPC KVM_REG_PPC_EPR 32 1989 + PPC KVM_REG_PPC_TCR 32 1990 + PPC KVM_REG_PPC_TSR 32 1991 + PPC KVM_REG_PPC_OR_TSR 32 1992 + PPC KVM_REG_PPC_CLEAR_TSR 32 1993 + PPC KVM_REG_PPC_MAS0 32 1994 + PPC KVM_REG_PPC_MAS1 32 1995 + PPC KVM_REG_PPC_MAS2 64 1996 + PPC KVM_REG_PPC_MAS7_3 64 1997 + PPC KVM_REG_PPC_MAS4 32 1998 + PPC KVM_REG_PPC_MAS6 32 1999 + PPC KVM_REG_PPC_MMUCFG 32 2000 + PPC KVM_REG_PPC_TLB0CFG 32 2001 + PPC KVM_REG_PPC_TLB1CFG 32 2002 + PPC KVM_REG_PPC_TLB2CFG 32 2003 + PPC KVM_REG_PPC_TLB3CFG 32 2004 + PPC KVM_REG_PPC_TLB0PS 32 2005 + PPC KVM_REG_PPC_TLB1PS 32 2006 + PPC KVM_REG_PPC_TLB2PS 32 2007 + PPC KVM_REG_PPC_TLB3PS 32 2008 + PPC KVM_REG_PPC_EPTCFG 32 2009 + PPC KVM_REG_PPC_ICP_STATE 64 2010 + PPC KVM_REG_PPC_VP_STATE 128 2011 + PPC KVM_REG_PPC_TB_OFFSET 64 2012 + PPC KVM_REG_PPC_SPMC1 32 2013 + PPC KVM_REG_PPC_SPMC2 32 2014 + PPC KVM_REG_PPC_IAMR 64 2015 + PPC KVM_REG_PPC_TFHAR 64 2016 + PPC KVM_REG_PPC_TFIAR 64 2017 + PPC KVM_REG_PPC_TEXASR 64 2018 + PPC KVM_REG_PPC_FSCR 64 2019 + PPC KVM_REG_PPC_PSPB 32 2020 + PPC KVM_REG_PPC_EBBHR 64 2021 + PPC KVM_REG_PPC_EBBRR 64 2022 + PPC KVM_REG_PPC_BESCR 64 2023 + PPC KVM_REG_PPC_TAR 64 2024 + PPC KVM_REG_PPC_DPDES 64 2025 + PPC KVM_REG_PPC_DAWR 64 2026 + PPC KVM_REG_PPC_DAWRX 64 2027 + PPC KVM_REG_PPC_CIABR 64 2028 + PPC KVM_REG_PPC_IC 64 2029 + PPC KVM_REG_PPC_VTB 64 2030 + PPC KVM_REG_PPC_CSIGR 64 2031 + PPC KVM_REG_PPC_TACR 64 2032 + PPC KVM_REG_PPC_TCSCR 64 2033 + PPC KVM_REG_PPC_PID 64 2034 + PPC KVM_REG_PPC_ACOP 64 2035 + PPC KVM_REG_PPC_VRSAVE 32 2036 + PPC KVM_REG_PPC_LPCR 32 2037 + PPC KVM_REG_PPC_LPCR_64 64 2038 + PPC KVM_REG_PPC_PPR 64 2039 + PPC KVM_REG_PPC_ARCH_COMPAT 32 2040 + PPC KVM_REG_PPC_DABRX 32 2041 + PPC KVM_REG_PPC_WORT 64 2042 + PPC KVM_REG_PPC_SPRG9 64 2043 + PPC KVM_REG_PPC_DBSR 32 2044 + PPC KVM_REG_PPC_TIDR 64 2045 + PPC KVM_REG_PPC_PSSCR 64 2046 + PPC KVM_REG_PPC_DEC_EXPIRY 64 2047 + PPC KVM_REG_PPC_PTCR 64 2048 + PPC KVM_REG_PPC_TM_GPR0 64 2049 + ... 2050 + PPC KVM_REG_PPC_TM_GPR31 64 2051 + PPC KVM_REG_PPC_TM_VSR0 128 2052 + ... 2053 + PPC KVM_REG_PPC_TM_VSR63 128 2054 + PPC KVM_REG_PPC_TM_CR 64 2055 + PPC KVM_REG_PPC_TM_LR 64 2056 + PPC KVM_REG_PPC_TM_CTR 64 2057 + PPC KVM_REG_PPC_TM_FPSCR 64 2058 + PPC KVM_REG_PPC_TM_AMR 64 2059 + PPC KVM_REG_PPC_TM_PPR 64 2060 + PPC KVM_REG_PPC_TM_VRSAVE 64 2061 + PPC KVM_REG_PPC_TM_VSCR 32 2062 + PPC KVM_REG_PPC_TM_DSCR 64 2063 + PPC KVM_REG_PPC_TM_TAR 64 2064 + PPC KVM_REG_PPC_TM_XER 64 2065 + 2066 + MIPS KVM_REG_MIPS_R0 64 2067 + ... 2068 + MIPS KVM_REG_MIPS_R31 64 2069 + MIPS KVM_REG_MIPS_HI 64 2070 + MIPS KVM_REG_MIPS_LO 64 2071 + MIPS KVM_REG_MIPS_PC 64 2072 + MIPS KVM_REG_MIPS_CP0_INDEX 32 2073 + MIPS KVM_REG_MIPS_CP0_ENTRYLO0 64 2074 + MIPS KVM_REG_MIPS_CP0_ENTRYLO1 64 2075 + MIPS KVM_REG_MIPS_CP0_CONTEXT 64 2076 + MIPS KVM_REG_MIPS_CP0_CONTEXTCONFIG 32 2077 + MIPS KVM_REG_MIPS_CP0_USERLOCAL 64 2078 + MIPS KVM_REG_MIPS_CP0_XCONTEXTCONFIG 64 2079 + MIPS KVM_REG_MIPS_CP0_PAGEMASK 32 2080 + MIPS KVM_REG_MIPS_CP0_PAGEGRAIN 32 2081 + MIPS KVM_REG_MIPS_CP0_SEGCTL0 64 2082 + MIPS KVM_REG_MIPS_CP0_SEGCTL1 64 2083 + MIPS KVM_REG_MIPS_CP0_SEGCTL2 64 2084 + MIPS KVM_REG_MIPS_CP0_PWBASE 64 2085 + MIPS KVM_REG_MIPS_CP0_PWFIELD 64 2086 + MIPS KVM_REG_MIPS_CP0_PWSIZE 64 2087 + MIPS KVM_REG_MIPS_CP0_WIRED 32 2088 + MIPS KVM_REG_MIPS_CP0_PWCTL 32 2089 + MIPS KVM_REG_MIPS_CP0_HWRENA 32 2090 + MIPS KVM_REG_MIPS_CP0_BADVADDR 64 2091 + MIPS KVM_REG_MIPS_CP0_BADINSTR 32 2092 + MIPS KVM_REG_MIPS_CP0_BADINSTRP 32 2093 + MIPS KVM_REG_MIPS_CP0_COUNT 32 2094 + MIPS KVM_REG_MIPS_CP0_ENTRYHI 64 2095 + MIPS KVM_REG_MIPS_CP0_COMPARE 32 2096 + MIPS KVM_REG_MIPS_CP0_STATUS 32 2097 + MIPS KVM_REG_MIPS_CP0_INTCTL 32 2098 + MIPS KVM_REG_MIPS_CP0_CAUSE 32 2099 + MIPS KVM_REG_MIPS_CP0_EPC 64 2100 + MIPS KVM_REG_MIPS_CP0_PRID 32 2101 + MIPS KVM_REG_MIPS_CP0_EBASE 64 2102 + MIPS KVM_REG_MIPS_CP0_CONFIG 32 2103 + MIPS KVM_REG_MIPS_CP0_CONFIG1 32 2104 + MIPS KVM_REG_MIPS_CP0_CONFIG2 32 2105 + MIPS KVM_REG_MIPS_CP0_CONFIG3 32 2106 + MIPS KVM_REG_MIPS_CP0_CONFIG4 32 2107 + MIPS KVM_REG_MIPS_CP0_CONFIG5 32 2108 + MIPS KVM_REG_MIPS_CP0_CONFIG7 32 2109 + MIPS KVM_REG_MIPS_CP0_XCONTEXT 64 2110 + MIPS KVM_REG_MIPS_CP0_ERROREPC 64 2111 + MIPS KVM_REG_MIPS_CP0_KSCRATCH1 64 2112 + MIPS KVM_REG_MIPS_CP0_KSCRATCH2 64 2113 + MIPS KVM_REG_MIPS_CP0_KSCRATCH3 64 2114 + MIPS KVM_REG_MIPS_CP0_KSCRATCH4 64 2115 + MIPS KVM_REG_MIPS_CP0_KSCRATCH5 64 2116 + MIPS KVM_REG_MIPS_CP0_KSCRATCH6 64 2117 + MIPS KVM_REG_MIPS_CP0_MAAR(0..63) 64 2118 + MIPS KVM_REG_MIPS_COUNT_CTL 64 2119 + MIPS KVM_REG_MIPS_COUNT_RESUME 64 2120 + MIPS KVM_REG_MIPS_COUNT_HZ 64 2121 + MIPS KVM_REG_MIPS_FPR_32(0..31) 32 2122 + MIPS KVM_REG_MIPS_FPR_64(0..31) 64 2123 + MIPS KVM_REG_MIPS_VEC_128(0..31) 128 2124 + MIPS KVM_REG_MIPS_FCR_IR 32 2125 + MIPS KVM_REG_MIPS_FCR_CSR 32 2126 + MIPS KVM_REG_MIPS_MSA_IR 32 2127 + MIPS KVM_REG_MIPS_MSA_CSR 32 2128 + ======= =============================== ============ 2330 2129 2331 2130 ARM registers are mapped using the lower 32 bits. The upper 16 of that 2332 2131 is the register group type, or coprocessor number: 2333 2132 2334 - ARM core registers have the following id bit patterns: 2133 + ARM core registers have the following id bit patterns:: 2134 + 2335 2135 0x4020 0000 0010 <index into the kvm_regs struct:16> 2336 2136 2337 - ARM 32-bit CP15 registers have the following id bit patterns: 2137 + ARM 32-bit CP15 registers have the following id bit patterns:: 2138 + 2338 2139 0x4020 0000 000F <zero:1> <crn:4> <crm:4> <opc1:4> <opc2:3> 2339 2140 2340 - ARM 64-bit CP15 registers have the following id bit patterns: 2141 + ARM 64-bit CP15 registers have the following id bit patterns:: 2142 + 2341 2143 0x4030 0000 000F <zero:1> <zero:4> <crm:4> <opc1:4> <zero:3> 2342 2144 2343 - ARM CCSIDR registers are demultiplexed by CSSELR value: 2145 + ARM CCSIDR registers are demultiplexed by CSSELR value:: 2146 + 2344 2147 0x4020 0000 0011 00 <csselr:8> 2345 2148 2346 - ARM 32-bit VFP control registers have the following id bit patterns: 2149 + ARM 32-bit VFP control registers have the following id bit patterns:: 2150 + 2347 2151 0x4020 0000 0012 1 <regno:12> 2348 2152 2349 - ARM 64-bit FP registers have the following id bit patterns: 2153 + ARM 64-bit FP registers have the following id bit patterns:: 2154 + 2350 2155 0x4030 0000 0012 0 <regno:12> 2351 2156 2352 - ARM firmware pseudo-registers have the following bit pattern: 2157 + ARM firmware pseudo-registers have the following bit pattern:: 2158 + 2353 2159 0x4030 0000 0014 <regno:16> 2354 2160 2355 2161 ··· 2368 2156 arm64 core/FP-SIMD registers have the following id bit patterns. Note 2369 2157 that the size of the access is variable, as the kvm_regs structure 2370 2158 contains elements ranging from 32 to 128 bits. The index is a 32bit 2371 - value in the kvm_regs structure seen as a 32bit array. 2159 + value in the kvm_regs structure seen as a 32bit array:: 2160 + 2372 2161 0x60x0 0000 0010 <index into the kvm_regs struct:16> 2373 2162 2374 2163 Specifically: 2164 + 2165 + ======================= ========= ===== ======================================= 2375 2166 Encoding Register Bits kvm_regs member 2376 - ---------------------------------------------------------------- 2167 + ======================= ========= ===== ======================================= 2377 2168 0x6030 0000 0010 0000 X0 64 regs.regs[0] 2378 2169 0x6030 0000 0010 0002 X1 64 regs.regs[1] 2379 - ... 2170 + ... 2380 2171 0x6030 0000 0010 003c X30 64 regs.regs[30] 2381 2172 0x6030 0000 0010 003e SP 64 regs.sp 2382 2173 0x6030 0000 0010 0040 PC 64 regs.pc ··· 2391 2176 0x6030 0000 0010 004c SPSR_UND 64 spsr[KVM_SPSR_UND] 2392 2177 0x6030 0000 0010 004e SPSR_IRQ 64 spsr[KVM_SPSR_IRQ] 2393 2178 0x6060 0000 0010 0050 SPSR_FIQ 64 spsr[KVM_SPSR_FIQ] 2394 - 0x6040 0000 0010 0054 V0 128 fp_regs.vregs[0] (*) 2395 - 0x6040 0000 0010 0058 V1 128 fp_regs.vregs[1] (*) 2396 - ... 2397 - 0x6040 0000 0010 00d0 V31 128 fp_regs.vregs[31] (*) 2179 + 0x6040 0000 0010 0054 V0 128 fp_regs.vregs[0] [1]_ 2180 + 0x6040 0000 0010 0058 V1 128 fp_regs.vregs[1] [1]_ 2181 + ... 2182 + 0x6040 0000 0010 00d0 V31 128 fp_regs.vregs[31] [1]_ 2398 2183 0x6020 0000 0010 00d4 FPSR 32 fp_regs.fpsr 2399 2184 0x6020 0000 0010 00d5 FPCR 32 fp_regs.fpcr 2185 + ======================= ========= ===== ======================================= 2400 2186 2401 - (*) These encodings are not accepted for SVE-enabled vcpus. See 2402 - KVM_ARM_VCPU_INIT. 2187 + .. [1] These encodings are not accepted for SVE-enabled vcpus. See 2188 + KVM_ARM_VCPU_INIT. 2403 2189 2404 - The equivalent register content can be accessed via bits [127:0] of 2405 - the corresponding SVE Zn registers instead for vcpus that have SVE 2406 - enabled (see below). 2190 + The equivalent register content can be accessed via bits [127:0] of 2191 + the corresponding SVE Zn registers instead for vcpus that have SVE 2192 + enabled (see below). 2407 2193 2408 - arm64 CCSIDR registers are demultiplexed by CSSELR value: 2194 + arm64 CCSIDR registers are demultiplexed by CSSELR value:: 2195 + 2409 2196 0x6020 0000 0011 00 <csselr:8> 2410 2197 2411 - arm64 system registers have the following id bit patterns: 2198 + arm64 system registers have the following id bit patterns:: 2199 + 2412 2200 0x6030 0000 0013 <op0:2> <op1:3> <crn:4> <crm:4> <op2:3> 2413 2201 2414 - WARNING: 2202 + .. warning:: 2203 + 2415 2204 Two system register IDs do not follow the specified pattern. These 2416 2205 are KVM_REG_ARM_TIMER_CVAL and KVM_REG_ARM_TIMER_CNT, which map to 2417 2206 system registers CNTV_CVAL_EL0 and CNTVCT_EL0 respectively. These ··· 2424 2205 derived from the register encoding for CNTV_CVAL_EL0. As this is 2425 2206 API, it must remain this way. 2426 2207 2427 - arm64 firmware pseudo-registers have the following bit pattern: 2208 + arm64 firmware pseudo-registers have the following bit pattern:: 2209 + 2428 2210 0x6030 0000 0014 <regno:16> 2429 2211 2430 - arm64 SVE registers have the following bit patterns: 2212 + arm64 SVE registers have the following bit patterns:: 2213 + 2431 2214 0x6080 0000 0015 00 <n:5> <slice:5> Zn bits[2048*slice + 2047 : 2048*slice] 2432 2215 0x6050 0000 0015 04 <n:4> <slice:5> Pn bits[256*slice + 255 : 256*slice] 2433 2216 0x6050 0000 0015 060 <slice:5> FFR bits[256*slice + 255 : 256*slice] ··· 2437 2216 2438 2217 Access to register IDs where 2048 * slice >= 128 * max_vq will fail with 2439 2218 ENOENT. max_vq is the vcpu's maximum supported vector length in 128-bit 2440 - quadwords: see (**) below. 2219 + quadwords: see [2]_ below. 2441 2220 2442 2221 These registers are only accessible on vcpus for which SVE is enabled. 2443 2222 See KVM_ARM_VCPU_INIT for details. ··· 2452 2231 userspace. When transferred to or from user memory via KVM_GET_ONE_REG 2453 2232 or KVM_SET_ONE_REG, the value of this register is of type 2454 2233 __u64[KVM_ARM64_SVE_VLS_WORDS], and encodes the set of vector lengths as 2455 - follows: 2234 + follows:: 2456 2235 2457 - __u64 vector_lengths[KVM_ARM64_SVE_VLS_WORDS]; 2236 + __u64 vector_lengths[KVM_ARM64_SVE_VLS_WORDS]; 2458 2237 2459 - if (vq >= SVE_VQ_MIN && vq <= SVE_VQ_MAX && 2460 - ((vector_lengths[(vq - KVM_ARM64_SVE_VQ_MIN) / 64] >> 2238 + if (vq >= SVE_VQ_MIN && vq <= SVE_VQ_MAX && 2239 + ((vector_lengths[(vq - KVM_ARM64_SVE_VQ_MIN) / 64] >> 2461 2240 ((vq - KVM_ARM64_SVE_VQ_MIN) % 64)) & 1)) 2462 2241 /* Vector length vq * 16 bytes supported */ 2463 - else 2242 + else 2464 2243 /* Vector length vq * 16 bytes not supported */ 2465 2244 2466 - (**) The maximum value vq for which the above condition is true is 2467 - max_vq. This is the maximum vector length available to the guest on 2468 - this vcpu, and determines which register slices are visible through 2469 - this ioctl interface. 2245 + .. [2] The maximum value vq for which the above condition is true is 2246 + max_vq. This is the maximum vector length available to the guest on 2247 + this vcpu, and determines which register slices are visible through 2248 + this ioctl interface. 2470 2249 2471 2250 (See Documentation/arm64/sve.rst for an explanation of the "vq" 2472 2251 nomenclature.) ··· 2491 2270 MIPS registers are mapped using the lower 32 bits. The upper 16 of that is 2492 2271 the register group type: 2493 2272 2494 - MIPS core registers (see above) have the following id bit patterns: 2273 + MIPS core registers (see above) have the following id bit patterns:: 2274 + 2495 2275 0x7030 0000 0000 <reg:16> 2496 2276 2497 2277 MIPS CP0 registers (see KVM_REG_MIPS_CP0_* above) have the following id bit 2498 - patterns depending on whether they're 32-bit or 64-bit registers: 2278 + patterns depending on whether they're 32-bit or 64-bit registers:: 2279 + 2499 2280 0x7020 0000 0001 00 <reg:5> <sel:3> (32-bit) 2500 2281 0x7030 0000 0001 00 <reg:5> <sel:3> (64-bit) 2501 2282 ··· 2508 2285 the PFNX field starting at bit 30. 2509 2286 2510 2287 MIPS MAARs (see KVM_REG_MIPS_CP0_MAAR(*) above) have the following id bit 2511 - patterns: 2288 + patterns:: 2289 + 2512 2290 0x7030 0000 0001 01 <reg:8> 2513 2291 2514 - MIPS KVM control registers (see above) have the following id bit patterns: 2292 + MIPS KVM control registers (see above) have the following id bit patterns:: 2293 + 2515 2294 0x7030 0000 0002 <reg:16> 2516 2295 2517 2296 MIPS FPU registers (see KVM_REG_MIPS_FPR_{32,64}() above) have the following ··· 2522 2297 Config5.FRE), i.e. as the guest would see them, and they become unpredictable 2523 2298 if the guest FPU mode is changed. MIPS SIMD Architecture (MSA) vector 2524 2299 registers (see KVM_REG_MIPS_VEC_128() above) have similar patterns as they 2525 - overlap the FPU registers: 2300 + overlap the FPU registers:: 2301 + 2526 2302 0x7020 0000 0003 00 <0:3> <reg:5> (32-bit FPU registers) 2527 2303 0x7030 0000 0003 00 <0:3> <reg:5> (64-bit FPU registers) 2528 2304 0x7040 0000 0003 00 <0:3> <reg:5> (128-bit MSA vector registers) 2529 2305 2530 2306 MIPS FPU control registers (see KVM_REG_MIPS_FCR_{IR,CSR} above) have the 2531 - following id bit patterns: 2307 + following id bit patterns:: 2308 + 2532 2309 0x7020 0000 0003 01 <0:3> <reg:5> 2533 2310 2534 2311 MIPS MSA control registers (see KVM_REG_MIPS_MSA_{IR,CSR} above) have the 2535 - following id bit patterns: 2312 + following id bit patterns:: 2313 + 2536 2314 0x7020 0000 0003 02 <0:3> <reg:5> 2537 2315 2538 2316 2539 2317 4.69 KVM_GET_ONE_REG 2318 + -------------------- 2540 2319 2541 - Capability: KVM_CAP_ONE_REG 2542 - Architectures: all 2543 - Type: vcpu ioctl 2544 - Parameters: struct kvm_one_reg (in and out) 2545 - Returns: 0 on success, negative value on failure 2320 + :Capability: KVM_CAP_ONE_REG 2321 + :Architectures: all 2322 + :Type: vcpu ioctl 2323 + :Parameters: struct kvm_one_reg (in and out) 2324 + :Returns: 0 on success, negative value on failure 2325 + 2546 2326 Errors include: 2547 -  ENOENT:   no such register 2548 -  EINVAL:   invalid register ID, or no such register 2549 -  EPERM:    (arm64) register access not allowed before vcpu finalization 2327 + 2328 + ======== ============================================================ 2329 +  ENOENT   no such register 2330 +  EINVAL   invalid register ID, or no such register 2331 +  EPERM    (arm64) register access not allowed before vcpu finalization 2332 + ======== ============================================================ 2333 + 2550 2334 (These error codes are indicative only: do not rely on a specific error 2551 2335 code being returned in a specific situation.) 2552 2336 ··· 2569 2335 2570 2336 2571 2337 4.70 KVM_KVMCLOCK_CTRL 2338 + ---------------------- 2572 2339 2573 - Capability: KVM_CAP_KVMCLOCK_CTRL 2574 - Architectures: Any that implement pvclocks (currently x86 only) 2575 - Type: vcpu ioctl 2576 - Parameters: None 2577 - Returns: 0 on success, -1 on error 2340 + :Capability: KVM_CAP_KVMCLOCK_CTRL 2341 + :Architectures: Any that implement pvclocks (currently x86 only) 2342 + :Type: vcpu ioctl 2343 + :Parameters: None 2344 + :Returns: 0 on success, -1 on error 2578 2345 2579 2346 This signals to the host kernel that the specified guest is being paused by 2580 2347 userspace. The host will set a flag in the pvclock structure that is checked ··· 2591 2356 2592 2357 2593 2358 4.71 KVM_SIGNAL_MSI 2359 + ------------------- 2594 2360 2595 - Capability: KVM_CAP_SIGNAL_MSI 2596 - Architectures: x86 arm arm64 2597 - Type: vm ioctl 2598 - Parameters: struct kvm_msi (in) 2599 - Returns: >0 on delivery, 0 if guest blocked the MSI, and -1 on error 2361 + :Capability: KVM_CAP_SIGNAL_MSI 2362 + :Architectures: x86 arm arm64 2363 + :Type: vm ioctl 2364 + :Parameters: struct kvm_msi (in) 2365 + :Returns: >0 on delivery, 0 if guest blocked the MSI, and -1 on error 2600 2366 2601 2367 Directly inject a MSI message. Only valid with in-kernel irqchip that handles 2602 2368 MSI messages. 2603 2369 2604 - struct kvm_msi { 2370 + :: 2371 + 2372 + struct kvm_msi { 2605 2373 __u32 address_lo; 2606 2374 __u32 address_hi; 2607 2375 __u32 data; 2608 2376 __u32 flags; 2609 2377 __u32 devid; 2610 2378 __u8 pad[12]; 2611 - }; 2379 + }; 2612 2380 2613 - flags: KVM_MSI_VALID_DEVID: devid contains a valid value. The per-VM 2381 + flags: 2382 + KVM_MSI_VALID_DEVID: devid contains a valid value. The per-VM 2614 2383 KVM_CAP_MSI_DEVID capability advertises the requirement to provide 2615 2384 the device ID. If this capability is not available, userspace 2616 2385 should never set the KVM_MSI_VALID_DEVID flag as the ioctl might fail. ··· 2630 2391 2631 2392 2632 2393 4.71 KVM_CREATE_PIT2 2394 + -------------------- 2633 2395 2634 - Capability: KVM_CAP_PIT2 2635 - Architectures: x86 2636 - Type: vm ioctl 2637 - Parameters: struct kvm_pit_config (in) 2638 - Returns: 0 on success, -1 on error 2396 + :Capability: KVM_CAP_PIT2 2397 + :Architectures: x86 2398 + :Type: vm ioctl 2399 + :Parameters: struct kvm_pit_config (in) 2400 + :Returns: 0 on success, -1 on error 2639 2401 2640 2402 Creates an in-kernel device model for the i8254 PIT. This call is only valid 2641 2403 after enabling in-kernel irqchip support via KVM_CREATE_IRQCHIP. The following 2642 - parameters have to be passed: 2404 + parameters have to be passed:: 2643 2405 2644 - struct kvm_pit_config { 2406 + struct kvm_pit_config { 2645 2407 __u32 flags; 2646 2408 __u32 pad[15]; 2647 - }; 2409 + }; 2648 2410 2649 - Valid flags are: 2411 + Valid flags are:: 2650 2412 2651 - #define KVM_PIT_SPEAKER_DUMMY 1 /* emulate speaker port stub */ 2413 + #define KVM_PIT_SPEAKER_DUMMY 1 /* emulate speaker port stub */ 2652 2414 2653 2415 PIT timer interrupts may use a per-VM kernel thread for injection. If it 2654 - exists, this thread will have a name of the following pattern: 2416 + exists, this thread will have a name of the following pattern:: 2655 2417 2656 - kvm-pit/<owner-process-pid> 2418 + kvm-pit/<owner-process-pid> 2657 2419 2658 2420 When running a guest with elevated priorities, the scheduling parameters of 2659 2421 this thread may have to be adjusted accordingly. ··· 2663 2423 2664 2424 2665 2425 4.72 KVM_GET_PIT2 2426 + ----------------- 2666 2427 2667 - Capability: KVM_CAP_PIT_STATE2 2668 - Architectures: x86 2669 - Type: vm ioctl 2670 - Parameters: struct kvm_pit_state2 (out) 2671 - Returns: 0 on success, -1 on error 2428 + :Capability: KVM_CAP_PIT_STATE2 2429 + :Architectures: x86 2430 + :Type: vm ioctl 2431 + :Parameters: struct kvm_pit_state2 (out) 2432 + :Returns: 0 on success, -1 on error 2672 2433 2673 2434 Retrieves the state of the in-kernel PIT model. Only valid after 2674 - KVM_CREATE_PIT2. The state is returned in the following structure: 2435 + KVM_CREATE_PIT2. The state is returned in the following structure:: 2675 2436 2676 - struct kvm_pit_state2 { 2437 + struct kvm_pit_state2 { 2677 2438 struct kvm_pit_channel_state channels[3]; 2678 2439 __u32 flags; 2679 2440 __u32 reserved[9]; 2680 - }; 2441 + }; 2681 2442 2682 - Valid flags are: 2443 + Valid flags are:: 2683 2444 2684 - /* disable PIT in HPET legacy mode */ 2685 - #define KVM_PIT_FLAGS_HPET_LEGACY 0x00000001 2445 + /* disable PIT in HPET legacy mode */ 2446 + #define KVM_PIT_FLAGS_HPET_LEGACY 0x00000001 2686 2447 2687 2448 This IOCTL replaces the obsolete KVM_GET_PIT. 2688 2449 2689 2450 2690 2451 4.73 KVM_SET_PIT2 2452 + ----------------- 2691 2453 2692 - Capability: KVM_CAP_PIT_STATE2 2693 - Architectures: x86 2694 - Type: vm ioctl 2695 - Parameters: struct kvm_pit_state2 (in) 2696 - Returns: 0 on success, -1 on error 2454 + :Capability: KVM_CAP_PIT_STATE2 2455 + :Architectures: x86 2456 + :Type: vm ioctl 2457 + :Parameters: struct kvm_pit_state2 (in) 2458 + :Returns: 0 on success, -1 on error 2697 2459 2698 2460 Sets the state of the in-kernel PIT model. Only valid after KVM_CREATE_PIT2. 2699 2461 See KVM_GET_PIT2 for details on struct kvm_pit_state2. ··· 2704 2462 2705 2463 2706 2464 4.74 KVM_PPC_GET_SMMU_INFO 2465 + -------------------------- 2707 2466 2708 - Capability: KVM_CAP_PPC_GET_SMMU_INFO 2709 - Architectures: powerpc 2710 - Type: vm ioctl 2711 - Parameters: None 2712 - Returns: 0 on success, -1 on error 2467 + :Capability: KVM_CAP_PPC_GET_SMMU_INFO 2468 + :Architectures: powerpc 2469 + :Type: vm ioctl 2470 + :Parameters: None 2471 + :Returns: 0 on success, -1 on error 2713 2472 2714 2473 This populates and returns a structure describing the features of 2715 2474 the "Server" class MMU emulation supported by KVM. ··· 2718 2475 device-tree properties for the guest operating system. 2719 2476 2720 2477 The structure contains some global information, followed by an 2721 - array of supported segment page sizes: 2478 + array of supported segment page sizes:: 2722 2479 2723 2480 struct kvm_ppc_smmu_info { 2724 2481 __u64 flags; ··· 2746 2503 2747 2504 The "sps" array contains 8 entries indicating the supported base 2748 2505 page sizes for a segment in increasing order. Each entry is defined 2749 - as follow: 2506 + as follow:: 2750 2507 2751 2508 struct kvm_ppc_one_seg_page_size { 2752 2509 __u32 page_shift; /* Base page shift of segment (or 0) */ ··· 2767 2524 only larger or equal to the base page size), along with the 2768 2525 corresponding encoding in the hash PTE. Similarly, the array is 2769 2526 8 entries sorted by increasing sizes and an entry with a "0" shift 2770 - is an empty entry and a terminator: 2527 + is an empty entry and a terminator:: 2771 2528 2772 2529 struct kvm_ppc_one_page_size { 2773 2530 __u32 page_shift; /* Page shift (or 0) */ ··· 2779 2536 into the hash PTE second double word). 2780 2537 2781 2538 4.75 KVM_IRQFD 2539 + -------------- 2782 2540 2783 - Capability: KVM_CAP_IRQFD 2784 - Architectures: x86 s390 arm arm64 2785 - Type: vm ioctl 2786 - Parameters: struct kvm_irqfd (in) 2787 - Returns: 0 on success, -1 on error 2541 + :Capability: KVM_CAP_IRQFD 2542 + :Architectures: x86 s390 arm arm64 2543 + :Type: vm ioctl 2544 + :Parameters: struct kvm_irqfd (in) 2545 + :Returns: 0 on success, -1 on error 2788 2546 2789 2547 Allows setting an eventfd to directly trigger a guest interrupt. 2790 2548 kvm_irqfd.fd specifies the file descriptor to use as the eventfd and ··· 2809 2565 and need not be specified with KVM_IRQFD_FLAG_DEASSIGN. 2810 2566 2811 2567 On arm/arm64, gsi routing being supported, the following can happen: 2568 + 2812 2569 - in case no routing entry is associated to this gsi, injection fails 2813 2570 - in case the gsi is associated to an irqchip routing entry, 2814 2571 irqchip.pin + 32 corresponds to the injected SPI ID. ··· 2818 2573 to GICv3 ITS in-kernel emulation). 2819 2574 2820 2575 4.76 KVM_PPC_ALLOCATE_HTAB 2576 + -------------------------- 2821 2577 2822 - Capability: KVM_CAP_PPC_ALLOC_HTAB 2823 - Architectures: powerpc 2824 - Type: vm ioctl 2825 - Parameters: Pointer to u32 containing hash table order (in/out) 2826 - Returns: 0 on success, -1 on error 2578 + :Capability: KVM_CAP_PPC_ALLOC_HTAB 2579 + :Architectures: powerpc 2580 + :Type: vm ioctl 2581 + :Parameters: Pointer to u32 containing hash table order (in/out) 2582 + :Returns: 0 on success, -1 on error 2827 2583 2828 2584 This requests the host kernel to allocate an MMU hash table for a 2829 2585 guest using the PAPR paravirtualization interface. This only does ··· 2855 2609 HPTEs on the next KVM_RUN of any vcpu. 2856 2610 2857 2611 4.77 KVM_S390_INTERRUPT 2612 + ----------------------- 2858 2613 2859 - Capability: basic 2860 - Architectures: s390 2861 - Type: vm ioctl, vcpu ioctl 2862 - Parameters: struct kvm_s390_interrupt (in) 2863 - Returns: 0 on success, -1 on error 2614 + :Capability: basic 2615 + :Architectures: s390 2616 + :Type: vm ioctl, vcpu ioctl 2617 + :Parameters: struct kvm_s390_interrupt (in) 2618 + :Returns: 0 on success, -1 on error 2864 2619 2865 2620 Allows to inject an interrupt to the guest. Interrupts can be floating 2866 2621 (vm ioctl) or per cpu (vcpu ioctl), depending on the interrupt type. 2867 2622 2868 - Interrupt parameters are passed via kvm_s390_interrupt: 2623 + Interrupt parameters are passed via kvm_s390_interrupt:: 2869 2624 2870 - struct kvm_s390_interrupt { 2625 + struct kvm_s390_interrupt { 2871 2626 __u32 type; 2872 2627 __u32 parm; 2873 2628 __u64 parm64; 2874 - }; 2629 + }; 2875 2630 2876 2631 type can be one of the following: 2877 2632 2878 - KVM_S390_SIGP_STOP (vcpu) - sigp stop; optional flags in parm 2879 - KVM_S390_PROGRAM_INT (vcpu) - program check; code in parm 2880 - KVM_S390_SIGP_SET_PREFIX (vcpu) - sigp set prefix; prefix address in parm 2881 - KVM_S390_RESTART (vcpu) - restart 2882 - KVM_S390_INT_CLOCK_COMP (vcpu) - clock comparator interrupt 2883 - KVM_S390_INT_CPU_TIMER (vcpu) - CPU timer interrupt 2884 - KVM_S390_INT_VIRTIO (vm) - virtio external interrupt; external interrupt 2885 - parameters in parm and parm64 2886 - KVM_S390_INT_SERVICE (vm) - sclp external interrupt; sclp parameter in parm 2887 - KVM_S390_INT_EMERGENCY (vcpu) - sigp emergency; source cpu in parm 2888 - KVM_S390_INT_EXTERNAL_CALL (vcpu) - sigp external call; source cpu in parm 2889 - KVM_S390_INT_IO(ai,cssid,ssid,schid) (vm) - compound value to indicate an 2890 - I/O interrupt (ai - adapter interrupt; cssid,ssid,schid - subchannel); 2891 - I/O interruption parameters in parm (subchannel) and parm64 (intparm, 2892 - interruption subclass) 2893 - KVM_S390_MCHK (vm, vcpu) - machine check interrupt; cr 14 bits in parm, 2894 - machine check interrupt code in parm64 (note that 2895 - machine checks needing further payload are not 2896 - supported by this ioctl) 2633 + KVM_S390_SIGP_STOP (vcpu) 2634 + - sigp stop; optional flags in parm 2635 + KVM_S390_PROGRAM_INT (vcpu) 2636 + - program check; code in parm 2637 + KVM_S390_SIGP_SET_PREFIX (vcpu) 2638 + - sigp set prefix; prefix address in parm 2639 + KVM_S390_RESTART (vcpu) 2640 + - restart 2641 + KVM_S390_INT_CLOCK_COMP (vcpu) 2642 + - clock comparator interrupt 2643 + KVM_S390_INT_CPU_TIMER (vcpu) 2644 + - CPU timer interrupt 2645 + KVM_S390_INT_VIRTIO (vm) 2646 + - virtio external interrupt; external interrupt 2647 + parameters in parm and parm64 2648 + KVM_S390_INT_SERVICE (vm) 2649 + - sclp external interrupt; sclp parameter in parm 2650 + KVM_S390_INT_EMERGENCY (vcpu) 2651 + - sigp emergency; source cpu in parm 2652 + KVM_S390_INT_EXTERNAL_CALL (vcpu) 2653 + - sigp external call; source cpu in parm 2654 + KVM_S390_INT_IO(ai,cssid,ssid,schid) (vm) 2655 + - compound value to indicate an 2656 + I/O interrupt (ai - adapter interrupt; cssid,ssid,schid - subchannel); 2657 + I/O interruption parameters in parm (subchannel) and parm64 (intparm, 2658 + interruption subclass) 2659 + KVM_S390_MCHK (vm, vcpu) 2660 + - machine check interrupt; cr 14 bits in parm, machine check interrupt 2661 + code in parm64 (note that machine checks needing further payload are not 2662 + supported by this ioctl) 2897 2663 2898 2664 This is an asynchronous vcpu ioctl and can be invoked from any thread. 2899 2665 2900 2666 4.78 KVM_PPC_GET_HTAB_FD 2667 + ------------------------ 2901 2668 2902 - Capability: KVM_CAP_PPC_HTAB_FD 2903 - Architectures: powerpc 2904 - Type: vm ioctl 2905 - Parameters: Pointer to struct kvm_get_htab_fd (in) 2906 - Returns: file descriptor number (>= 0) on success, -1 on error 2669 + :Capability: KVM_CAP_PPC_HTAB_FD 2670 + :Architectures: powerpc 2671 + :Type: vm ioctl 2672 + :Parameters: Pointer to struct kvm_get_htab_fd (in) 2673 + :Returns: file descriptor number (>= 0) on success, -1 on error 2907 2674 2908 2675 This returns a file descriptor that can be used either to read out the 2909 2676 entries in the guest's hashed page table (HPT), or to write entries to 2910 2677 initialize the HPT. The returned fd can only be written to if the 2911 2678 KVM_GET_HTAB_WRITE bit is set in the flags field of the argument, and 2912 2679 can only be read if that bit is clear. The argument struct looks like 2913 - this: 2680 + this:: 2914 2681 2915 - /* For KVM_PPC_GET_HTAB_FD */ 2916 - struct kvm_get_htab_fd { 2682 + /* For KVM_PPC_GET_HTAB_FD */ 2683 + struct kvm_get_htab_fd { 2917 2684 __u64 flags; 2918 2685 __u64 start_index; 2919 2686 __u64 reserved[2]; 2920 - }; 2687 + }; 2921 2688 2922 - /* Values for kvm_get_htab_fd.flags */ 2923 - #define KVM_GET_HTAB_BOLTED_ONLY ((__u64)0x1) 2924 - #define KVM_GET_HTAB_WRITE ((__u64)0x2) 2689 + /* Values for kvm_get_htab_fd.flags */ 2690 + #define KVM_GET_HTAB_BOLTED_ONLY ((__u64)0x1) 2691 + #define KVM_GET_HTAB_WRITE ((__u64)0x2) 2925 2692 2926 - The `start_index' field gives the index in the HPT of the entry at 2693 + The 'start_index' field gives the index in the HPT of the entry at 2927 2694 which to start reading. It is ignored when writing. 2928 2695 2929 2696 Reads on the fd will initially supply information about all ··· 2951 2692 series of valid HPT entries (16 bytes) each. The header indicates how 2952 2693 many valid HPT entries there are and how many invalid entries follow 2953 2694 the valid entries. The invalid entries are not represented explicitly 2954 - in the stream. The header format is: 2695 + in the stream. The header format is:: 2955 2696 2956 - struct kvm_get_htab_header { 2697 + struct kvm_get_htab_header { 2957 2698 __u32 index; 2958 2699 __u16 n_valid; 2959 2700 __u16 n_invalid; 2960 - }; 2701 + }; 2961 2702 2962 2703 Writes to the fd create HPT entries starting at the index given in the 2963 - header; first `n_valid' valid entries with contents from the data 2964 - written, then `n_invalid' invalid entries, invalidating any previously 2704 + header; first 'n_valid' valid entries with contents from the data 2705 + written, then 'n_invalid' invalid entries, invalidating any previously 2965 2706 valid entries found. 2966 2707 2967 2708 4.79 KVM_CREATE_DEVICE 2709 + ---------------------- 2968 2710 2969 - Capability: KVM_CAP_DEVICE_CTRL 2970 - Type: vm ioctl 2971 - Parameters: struct kvm_create_device (in/out) 2972 - Returns: 0 on success, -1 on error 2711 + :Capability: KVM_CAP_DEVICE_CTRL 2712 + :Type: vm ioctl 2713 + :Parameters: struct kvm_create_device (in/out) 2714 + :Returns: 0 on success, -1 on error 2715 + 2973 2716 Errors: 2974 - ENODEV: The device type is unknown or unsupported 2975 - EEXIST: Device already created, and this type of device may not 2717 + 2718 + ====== ======================================================= 2719 + ENODEV The device type is unknown or unsupported 2720 + EEXIST Device already created, and this type of device may not 2976 2721 be instantiated multiple times 2722 + ====== ======================================================= 2977 2723 2978 2724 Other error conditions may be defined by individual device types or 2979 2725 have their standard meanings. ··· 2994 2730 for specifying any behavior that is not implied by the device type 2995 2731 number. 2996 2732 2997 - struct kvm_create_device { 2733 + :: 2734 + 2735 + struct kvm_create_device { 2998 2736 __u32 type; /* in: KVM_DEV_TYPE_xxx */ 2999 2737 __u32 fd; /* out: device handle */ 3000 2738 __u32 flags; /* in: KVM_CREATE_DEVICE_xxx */ 3001 - }; 2739 + }; 3002 2740 3003 2741 4.80 KVM_SET_DEVICE_ATTR/KVM_GET_DEVICE_ATTR 2742 + -------------------------------------------- 3004 2743 3005 - Capability: KVM_CAP_DEVICE_CTRL, KVM_CAP_VM_ATTRIBUTES for vm device, 3006 - KVM_CAP_VCPU_ATTRIBUTES for vcpu device 3007 - Type: device ioctl, vm ioctl, vcpu ioctl 3008 - Parameters: struct kvm_device_attr 3009 - Returns: 0 on success, -1 on error 2744 + :Capability: KVM_CAP_DEVICE_CTRL, KVM_CAP_VM_ATTRIBUTES for vm device, 2745 + KVM_CAP_VCPU_ATTRIBUTES for vcpu device 2746 + :Type: device ioctl, vm ioctl, vcpu ioctl 2747 + :Parameters: struct kvm_device_attr 2748 + :Returns: 0 on success, -1 on error 2749 + 3010 2750 Errors: 3011 - ENXIO: The group or attribute is unknown/unsupported for this device 2751 + 2752 + ===== ============================================================= 2753 + ENXIO The group or attribute is unknown/unsupported for this device 3012 2754 or hardware support is missing. 3013 - EPERM: The attribute cannot (currently) be accessed this way 2755 + EPERM The attribute cannot (currently) be accessed this way 3014 2756 (e.g. read-only attribute, or attribute that only makes 3015 2757 sense when the device is in a different state) 2758 + ===== ============================================================= 3016 2759 3017 2760 Other error conditions may be defined by individual device types. 3018 2761 ··· 3028 2757 the "devices" directory. As with ONE_REG, the size of the data 3029 2758 transferred is defined by the particular attribute. 3030 2759 3031 - struct kvm_device_attr { 2760 + :: 2761 + 2762 + struct kvm_device_attr { 3032 2763 __u32 flags; /* no flags currently defined */ 3033 2764 __u32 group; /* device-defined */ 3034 2765 __u64 attr; /* group-defined */ 3035 2766 __u64 addr; /* userspace address of attr data */ 3036 - }; 2767 + }; 3037 2768 3038 2769 4.81 KVM_HAS_DEVICE_ATTR 2770 + ------------------------ 3039 2771 3040 - Capability: KVM_CAP_DEVICE_CTRL, KVM_CAP_VM_ATTRIBUTES for vm device, 3041 - KVM_CAP_VCPU_ATTRIBUTES for vcpu device 3042 - Type: device ioctl, vm ioctl, vcpu ioctl 3043 - Parameters: struct kvm_device_attr 3044 - Returns: 0 on success, -1 on error 2772 + :Capability: KVM_CAP_DEVICE_CTRL, KVM_CAP_VM_ATTRIBUTES for vm device, 2773 + KVM_CAP_VCPU_ATTRIBUTES for vcpu device 2774 + :Type: device ioctl, vm ioctl, vcpu ioctl 2775 + :Parameters: struct kvm_device_attr 2776 + :Returns: 0 on success, -1 on error 2777 + 3045 2778 Errors: 3046 - ENXIO: The group or attribute is unknown/unsupported for this device 2779 + 2780 + ===== ============================================================= 2781 + ENXIO The group or attribute is unknown/unsupported for this device 3047 2782 or hardware support is missing. 2783 + ===== ============================================================= 3048 2784 3049 2785 Tests whether a device supports a particular attribute. A successful 3050 2786 return indicates the attribute is implemented. It does not necessarily ··· 3059 2781 current state. "addr" is ignored. 3060 2782 3061 2783 4.82 KVM_ARM_VCPU_INIT 2784 + ---------------------- 3062 2785 3063 - Capability: basic 3064 - Architectures: arm, arm64 3065 - Type: vcpu ioctl 3066 - Parameters: struct kvm_vcpu_init (in) 3067 - Returns: 0 on success; -1 on error 2786 + :Capability: basic 2787 + :Architectures: arm, arm64 2788 + :Type: vcpu ioctl 2789 + :Parameters: struct kvm_vcpu_init (in) 2790 + :Returns: 0 on success; -1 on error 2791 + 3068 2792 Errors: 3069 -  EINVAL:    the target is unknown, or the combination of features is invalid. 3070 -  ENOENT:    a features bit specified is unknown. 2793 + 2794 + ====== ================================================================= 2795 +  EINVAL    the target is unknown, or the combination of features is invalid. 2796 +  ENOENT    a features bit specified is unknown. 2797 + ====== ================================================================= 3071 2798 3072 2799 This tells KVM what type of CPU to present to the guest, and what 3073 2800 optional features it should have.  This will cause a reset of the cpu ··· 3088 2805 target and same set of feature flags, otherwise EINVAL will be returned. 3089 2806 3090 2807 Possible features: 2808 + 3091 2809 - KVM_ARM_VCPU_POWER_OFF: Starts the CPU in a power-off state. 3092 2810 Depends on KVM_CAP_ARM_PSCI. If not set, the CPU will be powered on 3093 2811 and execute guest code when KVM_RUN is called. ··· 3145 2861 no longer be written using KVM_SET_ONE_REG. 3146 2862 3147 2863 4.83 KVM_ARM_PREFERRED_TARGET 2864 + ----------------------------- 3148 2865 3149 - Capability: basic 3150 - Architectures: arm, arm64 3151 - Type: vm ioctl 3152 - Parameters: struct struct kvm_vcpu_init (out) 3153 - Returns: 0 on success; -1 on error 2866 + :Capability: basic 2867 + :Architectures: arm, arm64 2868 + :Type: vm ioctl 2869 + :Parameters: struct struct kvm_vcpu_init (out) 2870 + :Returns: 0 on success; -1 on error 2871 + 3154 2872 Errors: 3155 - ENODEV: no preferred target available for the host 2873 + 2874 + ====== ========================================== 2875 + ENODEV no preferred target available for the host 2876 + ====== ========================================== 3156 2877 3157 2878 This queries KVM for preferred CPU target type which can be emulated 3158 2879 by KVM on underlying host. ··· 3174 2885 3175 2886 3176 2887 4.84 KVM_GET_REG_LIST 2888 + --------------------- 3177 2889 3178 - Capability: basic 3179 - Architectures: arm, arm64, mips 3180 - Type: vcpu ioctl 3181 - Parameters: struct kvm_reg_list (in/out) 3182 - Returns: 0 on success; -1 on error 2890 + :Capability: basic 2891 + :Architectures: arm, arm64, mips 2892 + :Type: vcpu ioctl 2893 + :Parameters: struct kvm_reg_list (in/out) 2894 + :Returns: 0 on success; -1 on error 2895 + 3183 2896 Errors: 3184 -  E2BIG:     the reg index list is too big to fit in the array specified by 3185 -             the user (the number required will be written into n). 3186 2897 3187 - struct kvm_reg_list { 2898 + ===== ============================================================== 2899 +  E2BIG     the reg index list is too big to fit in the array specified by 2900 +             the user (the number required will be written into n). 2901 + ===== ============================================================== 2902 + 2903 + :: 2904 + 2905 + struct kvm_reg_list { 3188 2906 __u64 n; /* number of registers in reg[] */ 3189 2907 __u64 reg[0]; 3190 - }; 2908 + }; 3191 2909 3192 2910 This ioctl returns the guest registers that are supported for the 3193 2911 KVM_GET_ONE_REG/KVM_SET_ONE_REG calls. 3194 2912 3195 2913 3196 2914 4.85 KVM_ARM_SET_DEVICE_ADDR (deprecated) 2915 + ----------------------------------------- 3197 2916 3198 - Capability: KVM_CAP_ARM_SET_DEVICE_ADDR 3199 - Architectures: arm, arm64 3200 - Type: vm ioctl 3201 - Parameters: struct kvm_arm_device_address (in) 3202 - Returns: 0 on success, -1 on error 2917 + :Capability: KVM_CAP_ARM_SET_DEVICE_ADDR 2918 + :Architectures: arm, arm64 2919 + :Type: vm ioctl 2920 + :Parameters: struct kvm_arm_device_address (in) 2921 + :Returns: 0 on success, -1 on error 2922 + 3203 2923 Errors: 3204 - ENODEV: The device id is unknown 3205 - ENXIO: Device not supported on current system 3206 - EEXIST: Address already set 3207 - E2BIG: Address outside guest physical address space 3208 - EBUSY: Address overlaps with other device range 3209 2924 3210 - struct kvm_arm_device_addr { 2925 + ====== ============================================ 2926 + ENODEV The device id is unknown 2927 + ENXIO Device not supported on current system 2928 + EEXIST Address already set 2929 + E2BIG Address outside guest physical address space 2930 + EBUSY Address overlaps with other device range 2931 + ====== ============================================ 2932 + 2933 + :: 2934 + 2935 + struct kvm_arm_device_addr { 3211 2936 __u64 id; 3212 2937 __u64 addr; 3213 - }; 2938 + }; 3214 2939 3215 2940 Specify a device address in the guest's physical address space where guests 3216 2941 can access emulated or directly exposed devices, which the host kernel needs ··· 3232 2929 specific device. 3233 2930 3234 2931 ARM/arm64 divides the id field into two parts, a device id and an 3235 - address type id specific to the individual device. 2932 + address type id specific to the individual device:: 3236 2933 3237 2934  bits: | 63 ... 32 | 31 ... 16 | 15 ... 0 | 3238 2935 field: | 0x00000000 | device id | addr type id | ··· 3250 2947 3251 2948 3252 2949 4.86 KVM_PPC_RTAS_DEFINE_TOKEN 2950 + ------------------------------ 3253 2951 3254 - Capability: KVM_CAP_PPC_RTAS 3255 - Architectures: ppc 3256 - Type: vm ioctl 3257 - Parameters: struct kvm_rtas_token_args 3258 - Returns: 0 on success, -1 on error 2952 + :Capability: KVM_CAP_PPC_RTAS 2953 + :Architectures: ppc 2954 + :Type: vm ioctl 2955 + :Parameters: struct kvm_rtas_token_args 2956 + :Returns: 0 on success, -1 on error 3259 2957 3260 2958 Defines a token value for a RTAS (Run Time Abstraction Services) 3261 2959 service in order to allow it to be handled in the kernel. The ··· 3270 2966 handled. 3271 2967 3272 2968 4.87 KVM_SET_GUEST_DEBUG 2969 + ------------------------ 3273 2970 3274 - Capability: KVM_CAP_SET_GUEST_DEBUG 3275 - Architectures: x86, s390, ppc, arm64 3276 - Type: vcpu ioctl 3277 - Parameters: struct kvm_guest_debug (in) 3278 - Returns: 0 on success; -1 on error 2971 + :Capability: KVM_CAP_SET_GUEST_DEBUG 2972 + :Architectures: x86, s390, ppc, arm64 2973 + :Type: vcpu ioctl 2974 + :Parameters: struct kvm_guest_debug (in) 2975 + :Returns: 0 on success; -1 on error 3279 2976 3280 - struct kvm_guest_debug { 2977 + :: 2978 + 2979 + struct kvm_guest_debug { 3281 2980 __u32 control; 3282 2981 __u32 pad; 3283 2982 struct kvm_guest_debug_arch arch; 3284 - }; 2983 + }; 3285 2984 3286 2985 Set up the processor specific debug registers and configure vcpu for 3287 2986 handling guest debug events. There are two parts to the structure, the ··· 3326 3019 structure containing architecture specific debug information. 3327 3020 3328 3021 4.88 KVM_GET_EMULATED_CPUID 3022 + --------------------------- 3329 3023 3330 - Capability: KVM_CAP_EXT_EMUL_CPUID 3331 - Architectures: x86 3332 - Type: system ioctl 3333 - Parameters: struct kvm_cpuid2 (in/out) 3334 - Returns: 0 on success, -1 on error 3024 + :Capability: KVM_CAP_EXT_EMUL_CPUID 3025 + :Architectures: x86 3026 + :Type: system ioctl 3027 + :Parameters: struct kvm_cpuid2 (in/out) 3028 + :Returns: 0 on success, -1 on error 3335 3029 3336 - struct kvm_cpuid2 { 3030 + :: 3031 + 3032 + struct kvm_cpuid2 { 3337 3033 __u32 nent; 3338 3034 __u32 flags; 3339 3035 struct kvm_cpuid_entry2 entries[0]; 3340 - }; 3036 + }; 3341 3037 3342 3038 The member 'flags' is used for passing flags from userspace. 3343 3039 3344 - #define KVM_CPUID_FLAG_SIGNIFCANT_INDEX BIT(0) 3345 - #define KVM_CPUID_FLAG_STATEFUL_FUNC BIT(1) 3346 - #define KVM_CPUID_FLAG_STATE_READ_NEXT BIT(2) 3040 + :: 3347 3041 3348 - struct kvm_cpuid_entry2 { 3042 + #define KVM_CPUID_FLAG_SIGNIFCANT_INDEX BIT(0) 3043 + #define KVM_CPUID_FLAG_STATEFUL_FUNC BIT(1) 3044 + #define KVM_CPUID_FLAG_STATE_READ_NEXT BIT(2) 3045 + 3046 + struct kvm_cpuid_entry2 { 3349 3047 __u32 function; 3350 3048 __u32 index; 3351 3049 __u32 flags; ··· 3359 3047 __u32 ecx; 3360 3048 __u32 edx; 3361 3049 __u32 padding[3]; 3362 - }; 3050 + }; 3363 3051 3364 3052 This ioctl returns x86 cpuid features which are emulated by 3365 3053 kvm.Userspace can use the information returned by this ioctl to query ··· 3384 3072 3385 3073 The fields in each entry are defined as follows: 3386 3074 3387 - function: the eax value used to obtain the entry 3388 - index: the ecx value used to obtain the entry (for entries that are 3075 + function: 3076 + the eax value used to obtain the entry 3077 + index: 3078 + the ecx value used to obtain the entry (for entries that are 3389 3079 affected by ecx) 3390 - flags: an OR of zero or more of the following: 3080 + flags: 3081 + an OR of zero or more of the following: 3082 + 3391 3083 KVM_CPUID_FLAG_SIGNIFCANT_INDEX: 3392 3084 if the index field is valid 3393 3085 KVM_CPUID_FLAG_STATEFUL_FUNC: ··· 3401 3085 KVM_CPUID_FLAG_STATE_READ_NEXT: 3402 3086 for KVM_CPUID_FLAG_STATEFUL_FUNC entries, set if this entry is 3403 3087 the first entry to be read by a cpu 3404 - eax, ebx, ecx, edx: the values returned by the cpuid instruction for 3088 + 3089 + eax, ebx, ecx, edx: 3090 + 3091 + the values returned by the cpuid instruction for 3405 3092 this function/index combination 3406 3093 3407 3094 4.89 KVM_S390_MEM_OP 3095 + -------------------- 3408 3096 3409 - Capability: KVM_CAP_S390_MEM_OP 3410 - Architectures: s390 3411 - Type: vcpu ioctl 3412 - Parameters: struct kvm_s390_mem_op (in) 3413 - Returns: = 0 on success, 3414 - < 0 on generic error (e.g. -EFAULT or -ENOMEM), 3415 - > 0 if an exception occurred while walking the page tables 3097 + :Capability: KVM_CAP_S390_MEM_OP 3098 + :Architectures: s390 3099 + :Type: vcpu ioctl 3100 + :Parameters: struct kvm_s390_mem_op (in) 3101 + :Returns: = 0 on success, 3102 + < 0 on generic error (e.g. -EFAULT or -ENOMEM), 3103 + > 0 if an exception occurred while walking the page tables 3416 3104 3417 3105 Read or write data from/to the logical (virtual) memory of a VCPU. 3418 3106 3419 - Parameters are specified via the following structure: 3107 + Parameters are specified via the following structure:: 3420 3108 3421 - struct kvm_s390_mem_op { 3109 + struct kvm_s390_mem_op { 3422 3110 __u64 gaddr; /* the guest address */ 3423 3111 __u64 flags; /* flags */ 3424 3112 __u32 size; /* amount of bytes */ ··· 3430 3110 __u64 buf; /* buffer in userspace */ 3431 3111 __u8 ar; /* the access register number */ 3432 3112 __u8 reserved[31]; /* should be set to 0 */ 3433 - }; 3113 + }; 3434 3114 3435 3115 The type of operation is specified in the "op" field. It is either 3436 3116 KVM_S390_MEMOP_LOGICAL_READ for reading from logical memory space or ··· 3457 3137 KVM with the currently defined set of flags. 3458 3138 3459 3139 4.90 KVM_S390_GET_SKEYS 3140 + ----------------------- 3460 3141 3461 - Capability: KVM_CAP_S390_SKEYS 3462 - Architectures: s390 3463 - Type: vm ioctl 3464 - Parameters: struct kvm_s390_skeys 3465 - Returns: 0 on success, KVM_S390_GET_KEYS_NONE if guest is not using storage 3466 - keys, negative value on error 3142 + :Capability: KVM_CAP_S390_SKEYS 3143 + :Architectures: s390 3144 + :Type: vm ioctl 3145 + :Parameters: struct kvm_s390_skeys 3146 + :Returns: 0 on success, KVM_S390_GET_KEYS_NONE if guest is not using storage 3147 + keys, negative value on error 3467 3148 3468 3149 This ioctl is used to get guest storage key values on the s390 3469 - architecture. The ioctl takes parameters via the kvm_s390_skeys struct. 3150 + architecture. The ioctl takes parameters via the kvm_s390_skeys struct:: 3470 3151 3471 - struct kvm_s390_skeys { 3152 + struct kvm_s390_skeys { 3472 3153 __u64 start_gfn; 3473 3154 __u64 count; 3474 3155 __u64 skeydata_addr; 3475 3156 __u32 flags; 3476 3157 __u32 reserved[9]; 3477 - }; 3158 + }; 3478 3159 3479 3160 The start_gfn field is the number of the first guest frame whose storage keys 3480 3161 you want to get. ··· 3489 3168 bytes. This buffer will be filled with storage key data by the ioctl. 3490 3169 3491 3170 4.91 KVM_S390_SET_SKEYS 3171 + ----------------------- 3492 3172 3493 - Capability: KVM_CAP_S390_SKEYS 3494 - Architectures: s390 3495 - Type: vm ioctl 3496 - Parameters: struct kvm_s390_skeys 3497 - Returns: 0 on success, negative value on error 3173 + :Capability: KVM_CAP_S390_SKEYS 3174 + :Architectures: s390 3175 + :Type: vm ioctl 3176 + :Parameters: struct kvm_s390_skeys 3177 + :Returns: 0 on success, negative value on error 3498 3178 3499 3179 This ioctl is used to set guest storage key values on the s390 3500 3180 architecture. The ioctl takes parameters via the kvm_s390_skeys struct. ··· 3517 3195 the ioctl will return -EINVAL. 3518 3196 3519 3197 4.92 KVM_S390_IRQ 3198 + ----------------- 3520 3199 3521 - Capability: KVM_CAP_S390_INJECT_IRQ 3522 - Architectures: s390 3523 - Type: vcpu ioctl 3524 - Parameters: struct kvm_s390_irq (in) 3525 - Returns: 0 on success, -1 on error 3200 + :Capability: KVM_CAP_S390_INJECT_IRQ 3201 + :Architectures: s390 3202 + :Type: vcpu ioctl 3203 + :Parameters: struct kvm_s390_irq (in) 3204 + :Returns: 0 on success, -1 on error 3205 + 3526 3206 Errors: 3527 - EINVAL: interrupt type is invalid 3528 - type is KVM_S390_SIGP_STOP and flag parameter is invalid value 3207 + 3208 + 3209 + ====== ================================================================= 3210 + EINVAL interrupt type is invalid 3211 + type is KVM_S390_SIGP_STOP and flag parameter is invalid value, 3529 3212 type is KVM_S390_INT_EXTERNAL_CALL and code is bigger 3530 - than the maximum of VCPUs 3531 - EBUSY: type is KVM_S390_SIGP_SET_PREFIX and vcpu is not stopped 3532 - type is KVM_S390_SIGP_STOP and a stop irq is already pending 3213 + than the maximum of VCPUs 3214 + EBUSY type is KVM_S390_SIGP_SET_PREFIX and vcpu is not stopped, 3215 + type is KVM_S390_SIGP_STOP and a stop irq is already pending, 3533 3216 type is KVM_S390_INT_EXTERNAL_CALL and an external call interrupt 3534 - is already pending 3217 + is already pending 3218 + ====== ================================================================= 3535 3219 3536 3220 Allows to inject an interrupt to the guest. 3537 3221 ··· 3545 3217 to inject additional payload which is not 3546 3218 possible via KVM_S390_INTERRUPT. 3547 3219 3548 - Interrupt parameters are passed via kvm_s390_irq: 3220 + Interrupt parameters are passed via kvm_s390_irq:: 3549 3221 3550 - struct kvm_s390_irq { 3222 + struct kvm_s390_irq { 3551 3223 __u64 type; 3552 3224 union { 3553 3225 struct kvm_s390_io_info io; ··· 3560 3232 struct kvm_s390_mchk_info mchk; 3561 3233 char reserved[64]; 3562 3234 } u; 3563 - }; 3235 + }; 3564 3236 3565 3237 type can be one of the following: 3566 3238 3567 - KVM_S390_SIGP_STOP - sigp stop; parameter in .stop 3568 - KVM_S390_PROGRAM_INT - program check; parameters in .pgm 3569 - KVM_S390_SIGP_SET_PREFIX - sigp set prefix; parameters in .prefix 3570 - KVM_S390_RESTART - restart; no parameters 3571 - KVM_S390_INT_CLOCK_COMP - clock comparator interrupt; no parameters 3572 - KVM_S390_INT_CPU_TIMER - CPU timer interrupt; no parameters 3573 - KVM_S390_INT_EMERGENCY - sigp emergency; parameters in .emerg 3574 - KVM_S390_INT_EXTERNAL_CALL - sigp external call; parameters in .extcall 3575 - KVM_S390_MCHK - machine check interrupt; parameters in .mchk 3239 + - KVM_S390_SIGP_STOP - sigp stop; parameter in .stop 3240 + - KVM_S390_PROGRAM_INT - program check; parameters in .pgm 3241 + - KVM_S390_SIGP_SET_PREFIX - sigp set prefix; parameters in .prefix 3242 + - KVM_S390_RESTART - restart; no parameters 3243 + - KVM_S390_INT_CLOCK_COMP - clock comparator interrupt; no parameters 3244 + - KVM_S390_INT_CPU_TIMER - CPU timer interrupt; no parameters 3245 + - KVM_S390_INT_EMERGENCY - sigp emergency; parameters in .emerg 3246 + - KVM_S390_INT_EXTERNAL_CALL - sigp external call; parameters in .extcall 3247 + - KVM_S390_MCHK - machine check interrupt; parameters in .mchk 3576 3248 3577 3249 This is an asynchronous vcpu ioctl and can be invoked from any thread. 3578 3250 3579 3251 4.94 KVM_S390_GET_IRQ_STATE 3252 + --------------------------- 3580 3253 3581 - Capability: KVM_CAP_S390_IRQ_STATE 3582 - Architectures: s390 3583 - Type: vcpu ioctl 3584 - Parameters: struct kvm_s390_irq_state (out) 3585 - Returns: >= number of bytes copied into buffer, 3586 - -EINVAL if buffer size is 0, 3587 - -ENOBUFS if buffer size is too small to fit all pending interrupts, 3588 - -EFAULT if the buffer address was invalid 3254 + :Capability: KVM_CAP_S390_IRQ_STATE 3255 + :Architectures: s390 3256 + :Type: vcpu ioctl 3257 + :Parameters: struct kvm_s390_irq_state (out) 3258 + :Returns: >= number of bytes copied into buffer, 3259 + -EINVAL if buffer size is 0, 3260 + -ENOBUFS if buffer size is too small to fit all pending interrupts, 3261 + -EFAULT if the buffer address was invalid 3589 3262 3590 3263 This ioctl allows userspace to retrieve the complete state of all currently 3591 3264 pending interrupts in a single buffer. Use cases include migration 3592 3265 and introspection. The parameter structure contains the address of a 3593 - userspace buffer and its length: 3266 + userspace buffer and its length:: 3594 3267 3595 - struct kvm_s390_irq_state { 3268 + struct kvm_s390_irq_state { 3596 3269 __u64 buf; 3597 3270 __u32 flags; /* will stay unused for compatibility reasons */ 3598 3271 __u32 len; 3599 3272 __u32 reserved[4]; /* will stay unused for compatibility reasons */ 3600 - }; 3273 + }; 3601 3274 3602 3275 Userspace passes in the above struct and for each pending interrupt a 3603 3276 struct kvm_s390_irq is copied to the provided buffer. ··· 3612 3283 may retry with a bigger buffer. 3613 3284 3614 3285 4.95 KVM_S390_SET_IRQ_STATE 3286 + --------------------------- 3615 3287 3616 - Capability: KVM_CAP_S390_IRQ_STATE 3617 - Architectures: s390 3618 - Type: vcpu ioctl 3619 - Parameters: struct kvm_s390_irq_state (in) 3620 - Returns: 0 on success, 3621 - -EFAULT if the buffer address was invalid, 3622 - -EINVAL for an invalid buffer length (see below), 3623 - -EBUSY if there were already interrupts pending, 3624 - errors occurring when actually injecting the 3288 + :Capability: KVM_CAP_S390_IRQ_STATE 3289 + :Architectures: s390 3290 + :Type: vcpu ioctl 3291 + :Parameters: struct kvm_s390_irq_state (in) 3292 + :Returns: 0 on success, 3293 + -EFAULT if the buffer address was invalid, 3294 + -EINVAL for an invalid buffer length (see below), 3295 + -EBUSY if there were already interrupts pending, 3296 + errors occurring when actually injecting the 3625 3297 interrupt. See KVM_S390_IRQ. 3626 3298 3627 3299 This ioctl allows userspace to set the complete state of all cpu-local 3628 3300 interrupts currently pending for the vcpu. It is intended for restoring 3629 3301 interrupt state after a migration. The input parameter is a userspace buffer 3630 - containing a struct kvm_s390_irq_state: 3302 + containing a struct kvm_s390_irq_state:: 3631 3303 3632 - struct kvm_s390_irq_state { 3304 + struct kvm_s390_irq_state { 3633 3305 __u64 buf; 3634 3306 __u32 flags; /* will stay unused for compatibility reasons */ 3635 3307 __u32 len; 3636 3308 __u32 reserved[4]; /* will stay unused for compatibility reasons */ 3637 - }; 3309 + }; 3638 3310 3639 3311 The restrictions for flags and reserved apply as well. 3640 3312 (see KVM_S390_GET_IRQ_STATE) ··· 3650 3320 which is the maximum number of possibly pending cpu-local interrupts. 3651 3321 3652 3322 4.96 KVM_SMI 3323 + ------------ 3653 3324 3654 - Capability: KVM_CAP_X86_SMM 3655 - Architectures: x86 3656 - Type: vcpu ioctl 3657 - Parameters: none 3658 - Returns: 0 on success, -1 on error 3325 + :Capability: KVM_CAP_X86_SMM 3326 + :Architectures: x86 3327 + :Type: vcpu ioctl 3328 + :Parameters: none 3329 + :Returns: 0 on success, -1 on error 3659 3330 3660 3331 Queues an SMI on the thread's vcpu. 3661 3332 3662 3333 4.97 KVM_CAP_PPC_MULTITCE 3334 + ------------------------- 3663 3335 3664 - Capability: KVM_CAP_PPC_MULTITCE 3665 - Architectures: ppc 3666 - Type: vm 3336 + :Capability: KVM_CAP_PPC_MULTITCE 3337 + :Architectures: ppc 3338 + :Type: vm 3667 3339 3668 3340 This capability means the kernel is capable of handling hypercalls 3669 3341 H_PUT_TCE_INDIRECT and H_STUFF_TCE without passing those into the user ··· 3687 3355 This capability is always enabled. 3688 3356 3689 3357 4.98 KVM_CREATE_SPAPR_TCE_64 3358 + ---------------------------- 3690 3359 3691 - Capability: KVM_CAP_SPAPR_TCE_64 3692 - Architectures: powerpc 3693 - Type: vm ioctl 3694 - Parameters: struct kvm_create_spapr_tce_64 (in) 3695 - Returns: file descriptor for manipulating the created TCE table 3360 + :Capability: KVM_CAP_SPAPR_TCE_64 3361 + :Architectures: powerpc 3362 + :Type: vm ioctl 3363 + :Parameters: struct kvm_create_spapr_tce_64 (in) 3364 + :Returns: file descriptor for manipulating the created TCE table 3696 3365 3697 3366 This is an extension for KVM_CAP_SPAPR_TCE which only supports 32bit 3698 3367 windows, described in 4.62 KVM_CREATE_SPAPR_TCE 3699 3368 3700 - This capability uses extended struct in ioctl interface: 3369 + This capability uses extended struct in ioctl interface:: 3701 3370 3702 - /* for KVM_CAP_SPAPR_TCE_64 */ 3703 - struct kvm_create_spapr_tce_64 { 3371 + /* for KVM_CAP_SPAPR_TCE_64 */ 3372 + struct kvm_create_spapr_tce_64 { 3704 3373 __u64 liobn; 3705 3374 __u32 page_shift; 3706 3375 __u32 flags; 3707 3376 __u64 offset; /* in pages */ 3708 3377 __u64 size; /* in pages */ 3709 - }; 3378 + }; 3710 3379 3711 3380 The aim of extension is to support an additional bigger DMA window with 3712 3381 a variable page size. ··· 3720 3387 The rest of functionality is identical to KVM_CREATE_SPAPR_TCE. 3721 3388 3722 3389 4.99 KVM_REINJECT_CONTROL 3390 + ------------------------- 3723 3391 3724 - Capability: KVM_CAP_REINJECT_CONTROL 3725 - Architectures: x86 3726 - Type: vm ioctl 3727 - Parameters: struct kvm_reinject_control (in) 3728 - Returns: 0 on success, 3392 + :Capability: KVM_CAP_REINJECT_CONTROL 3393 + :Architectures: x86 3394 + :Type: vm ioctl 3395 + :Parameters: struct kvm_reinject_control (in) 3396 + :Returns: 0 on success, 3729 3397 -EFAULT if struct kvm_reinject_control cannot be read, 3730 3398 -ENXIO if KVM_CREATE_PIT or KVM_CREATE_PIT2 didn't succeed earlier. 3731 3399 ··· 3736 3402 interrupt whenever there isn't a pending interrupt from i8254. 3737 3403 !reinject mode injects an interrupt as soon as a tick arrives. 3738 3404 3739 - struct kvm_reinject_control { 3405 + :: 3406 + 3407 + struct kvm_reinject_control { 3740 3408 __u8 pit_reinject; 3741 3409 __u8 reserved[31]; 3742 - }; 3410 + }; 3743 3411 3744 3412 pit_reinject = 0 (!reinject mode) is recommended, unless running an old 3745 3413 operating system that uses the PIT for timing (e.g. Linux 2.4.x). 3746 3414 3747 3415 4.100 KVM_PPC_CONFIGURE_V3_MMU 3416 + ------------------------------ 3748 3417 3749 - Capability: KVM_CAP_PPC_RADIX_MMU or KVM_CAP_PPC_HASH_MMU_V3 3750 - Architectures: ppc 3751 - Type: vm ioctl 3752 - Parameters: struct kvm_ppc_mmuv3_cfg (in) 3753 - Returns: 0 on success, 3418 + :Capability: KVM_CAP_PPC_RADIX_MMU or KVM_CAP_PPC_HASH_MMU_V3 3419 + :Architectures: ppc 3420 + :Type: vm ioctl 3421 + :Parameters: struct kvm_ppc_mmuv3_cfg (in) 3422 + :Returns: 0 on success, 3754 3423 -EFAULT if struct kvm_ppc_mmuv3_cfg cannot be read, 3755 3424 -EINVAL if the configuration is invalid 3756 3425 ··· 3761 3424 page table) translation, and sets the pointer to the process table for 3762 3425 the guest. 3763 3426 3764 - struct kvm_ppc_mmuv3_cfg { 3427 + :: 3428 + 3429 + struct kvm_ppc_mmuv3_cfg { 3765 3430 __u64 flags; 3766 3431 __u64 process_table; 3767 - }; 3432 + }; 3768 3433 3769 3434 There are two bits that can be set in flags; KVM_PPC_MMUV3_RADIX and 3770 3435 KVM_PPC_MMUV3_GTSE. KVM_PPC_MMUV3_RADIX, if set, configures the guest ··· 3781 3442 the Power ISA V3.00, Book III section 5.7.6.1. 3782 3443 3783 3444 4.101 KVM_PPC_GET_RMMU_INFO 3445 + --------------------------- 3784 3446 3785 - Capability: KVM_CAP_PPC_RADIX_MMU 3786 - Architectures: ppc 3787 - Type: vm ioctl 3788 - Parameters: struct kvm_ppc_rmmu_info (out) 3789 - Returns: 0 on success, 3447 + :Capability: KVM_CAP_PPC_RADIX_MMU 3448 + :Architectures: ppc 3449 + :Type: vm ioctl 3450 + :Parameters: struct kvm_ppc_rmmu_info (out) 3451 + :Returns: 0 on success, 3790 3452 -EFAULT if struct kvm_ppc_rmmu_info cannot be written, 3791 3453 -EINVAL if no useful information can be returned 3792 3454 ··· 3796 3456 page sizes to put in the "AP" (actual page size) field for the tlbie 3797 3457 (TLB invalidate entry) instruction. 3798 3458 3799 - struct kvm_ppc_rmmu_info { 3459 + :: 3460 + 3461 + struct kvm_ppc_rmmu_info { 3800 3462 struct kvm_ppc_radix_geom { 3801 3463 __u8 page_shift; 3802 3464 __u8 level_bits[4]; 3803 3465 __u8 pad[3]; 3804 3466 } geometries[8]; 3805 3467 __u32 ap_encodings[8]; 3806 - }; 3468 + }; 3807 3469 3808 3470 The geometries[] field gives up to 8 supported geometries for the 3809 3471 radix page table, in terms of the log base 2 of the smallest page ··· 3818 3476 base 2 of the page size in the bottom 6 bits. 3819 3477 3820 3478 4.102 KVM_PPC_RESIZE_HPT_PREPARE 3479 + -------------------------------- 3821 3480 3822 - Capability: KVM_CAP_SPAPR_RESIZE_HPT 3823 - Architectures: powerpc 3824 - Type: vm ioctl 3825 - Parameters: struct kvm_ppc_resize_hpt (in) 3826 - Returns: 0 on successful completion, 3481 + :Capability: KVM_CAP_SPAPR_RESIZE_HPT 3482 + :Architectures: powerpc 3483 + :Type: vm ioctl 3484 + :Parameters: struct kvm_ppc_resize_hpt (in) 3485 + :Returns: 0 on successful completion, 3827 3486 >0 if a new HPT is being prepared, the value is an estimated 3828 - number of milliseconds until preparation is complete 3487 + number of milliseconds until preparation is complete, 3829 3488 -EFAULT if struct kvm_reinject_control cannot be read, 3830 - -EINVAL if the supplied shift or flags are invalid 3831 - -ENOMEM if unable to allocate the new HPT 3832 - -ENOSPC if there was a hash collision when moving existing 3833 - HPT entries to the new HPT 3489 + -EINVAL if the supplied shift or flags are invalid, 3490 + -ENOMEM if unable to allocate the new HPT, 3491 + -ENOSPC if there was a hash collision 3492 + 3493 + :: 3494 + 3495 + struct kvm_ppc_rmmu_info { 3496 + struct kvm_ppc_radix_geom { 3497 + __u8 page_shift; 3498 + __u8 level_bits[4]; 3499 + __u8 pad[3]; 3500 + } geometries[8]; 3501 + __u32 ap_encodings[8]; 3502 + }; 3503 + 3504 + The geometries[] field gives up to 8 supported geometries for the 3505 + radix page table, in terms of the log base 2 of the smallest page 3506 + size, and the number of bits indexed at each level of the tree, from 3507 + the PTE level up to the PGD level in that order. Any unused entries 3508 + will have 0 in the page_shift field. 3509 + 3510 + The ap_encodings gives the supported page sizes and their AP field 3511 + encodings, encoded with the AP value in the top 3 bits and the log 3512 + base 2 of the page size in the bottom 6 bits. 3513 + 3514 + 4.102 KVM_PPC_RESIZE_HPT_PREPARE 3515 + -------------------------------- 3516 + 3517 + :Capability: KVM_CAP_SPAPR_RESIZE_HPT 3518 + :Architectures: powerpc 3519 + :Type: vm ioctl 3520 + :Parameters: struct kvm_ppc_resize_hpt (in) 3521 + :Returns: 0 on successful completion, 3522 + >0 if a new HPT is being prepared, the value is an estimated 3523 + number of milliseconds until preparation is complete, 3524 + -EFAULT if struct kvm_reinject_control cannot be read, 3525 + -EINVAL if the supplied shift or flags are invalid,when moving existing 3526 + HPT entries to the new HPT, 3834 3527 -EIO on other error conditions 3835 3528 3836 3529 Used to implement the PAPR extension for runtime resizing of a guest's ··· 3883 3506 creates a new one as above. 3884 3507 3885 3508 If called when there is a pending HPT of the size requested, will: 3509 + 3886 3510 * If preparation of the pending HPT is already complete, return 0 3887 3511 * If preparation of the pending HPT has failed, return an error 3888 3512 code, then discard the pending HPT. ··· 3900 3522 it returns <= 0. The first call will initiate preparation, subsequent 3901 3523 ones will monitor preparation until it completes or fails. 3902 3524 3903 - struct kvm_ppc_resize_hpt { 3525 + :: 3526 + 3527 + struct kvm_ppc_resize_hpt { 3904 3528 __u64 flags; 3905 3529 __u32 shift; 3906 3530 __u32 pad; 3907 - }; 3531 + }; 3908 3532 3909 3533 4.103 KVM_PPC_RESIZE_HPT_COMMIT 3534 + ------------------------------- 3910 3535 3911 - Capability: KVM_CAP_SPAPR_RESIZE_HPT 3912 - Architectures: powerpc 3913 - Type: vm ioctl 3914 - Parameters: struct kvm_ppc_resize_hpt (in) 3915 - Returns: 0 on successful completion, 3536 + :Capability: KVM_CAP_SPAPR_RESIZE_HPT 3537 + :Architectures: powerpc 3538 + :Type: vm ioctl 3539 + :Parameters: struct kvm_ppc_resize_hpt (in) 3540 + :Returns: 0 on successful completion, 3916 3541 -EFAULT if struct kvm_reinject_control cannot be read, 3917 - -EINVAL if the supplied shift or flags are invalid 3542 + -EINVAL if the supplied shift or flags are invalid, 3918 3543 -ENXIO is there is no pending HPT, or the pending HPT doesn't 3919 - have the requested size 3920 - -EBUSY if the pending HPT is not fully prepared 3544 + have the requested size, 3545 + -EBUSY if the pending HPT is not fully prepared, 3921 3546 -ENOSPC if there was a hash collision when moving existing 3922 - HPT entries to the new HPT 3547 + HPT entries to the new HPT, 3923 3548 -EIO on other error conditions 3924 3549 3925 3550 Used to implement the PAPR extension for runtime resizing of a guest's ··· 3945 3564 3946 3565 On failure, the guest will still be operating on its previous HPT. 3947 3566 3948 - struct kvm_ppc_resize_hpt { 3567 + :: 3568 + 3569 + struct kvm_ppc_resize_hpt { 3949 3570 __u64 flags; 3950 3571 __u32 shift; 3951 3572 __u32 pad; 3952 - }; 3573 + }; 3953 3574 3954 3575 4.104 KVM_X86_GET_MCE_CAP_SUPPORTED 3576 + ----------------------------------- 3955 3577 3956 - Capability: KVM_CAP_MCE 3957 - Architectures: x86 3958 - Type: system ioctl 3959 - Parameters: u64 mce_cap (out) 3960 - Returns: 0 on success, -1 on error 3578 + :Capability: KVM_CAP_MCE 3579 + :Architectures: x86 3580 + :Type: system ioctl 3581 + :Parameters: u64 mce_cap (out) 3582 + :Returns: 0 on success, -1 on error 3961 3583 3962 3584 Returns supported MCE capabilities. The u64 mce_cap parameter 3963 3585 has the same format as the MSR_IA32_MCG_CAP register. Supported 3964 3586 capabilities will have the corresponding bits set. 3965 3587 3966 3588 4.105 KVM_X86_SETUP_MCE 3589 + ----------------------- 3967 3590 3968 - Capability: KVM_CAP_MCE 3969 - Architectures: x86 3970 - Type: vcpu ioctl 3971 - Parameters: u64 mcg_cap (in) 3972 - Returns: 0 on success, 3591 + :Capability: KVM_CAP_MCE 3592 + :Architectures: x86 3593 + :Type: vcpu ioctl 3594 + :Parameters: u64 mcg_cap (in) 3595 + :Returns: 0 on success, 3973 3596 -EFAULT if u64 mcg_cap cannot be read, 3974 3597 -EINVAL if the requested number of banks is invalid, 3975 3598 -EINVAL if requested MCE capability is not supported. ··· 3986 3601 retrieved with KVM_X86_GET_MCE_CAP_SUPPORTED. 3987 3602 3988 3603 4.106 KVM_X86_SET_MCE 3604 + --------------------- 3989 3605 3990 - Capability: KVM_CAP_MCE 3991 - Architectures: x86 3992 - Type: vcpu ioctl 3993 - Parameters: struct kvm_x86_mce (in) 3994 - Returns: 0 on success, 3606 + :Capability: KVM_CAP_MCE 3607 + :Architectures: x86 3608 + :Type: vcpu ioctl 3609 + :Parameters: struct kvm_x86_mce (in) 3610 + :Returns: 0 on success, 3995 3611 -EFAULT if struct kvm_x86_mce cannot be read, 3996 3612 -EINVAL if the bank number is invalid, 3997 3613 -EINVAL if VAL bit is not set in status field. 3998 3614 3999 3615 Inject a machine check error (MCE) into the guest. The input 4000 - parameter is: 3616 + parameter is:: 4001 3617 4002 - struct kvm_x86_mce { 3618 + struct kvm_x86_mce { 4003 3619 __u64 status; 4004 3620 __u64 addr; 4005 3621 __u64 misc; ··· 4008 3622 __u8 bank; 4009 3623 __u8 pad1[7]; 4010 3624 __u64 pad2[3]; 4011 - }; 3625 + }; 4012 3626 4013 3627 If the MCE being reported is an uncorrected error, KVM will 4014 3628 inject it as an MCE exception into the guest. If the guest ··· 4020 3634 not holding a previously reported uncorrected error). 4021 3635 4022 3636 4.107 KVM_S390_GET_CMMA_BITS 3637 + ---------------------------- 4023 3638 4024 - Capability: KVM_CAP_S390_CMMA_MIGRATION 4025 - Architectures: s390 4026 - Type: vm ioctl 4027 - Parameters: struct kvm_s390_cmma_log (in, out) 4028 - Returns: 0 on success, a negative value on error 3639 + :Capability: KVM_CAP_S390_CMMA_MIGRATION 3640 + :Architectures: s390 3641 + :Type: vm ioctl 3642 + :Parameters: struct kvm_s390_cmma_log (in, out) 3643 + :Returns: 0 on success, a negative value on error 4029 3644 4030 3645 This ioctl is used to get the values of the CMMA bits on the s390 4031 3646 architecture. It is meant to be used in two scenarios: 3647 + 4032 3648 - During live migration to save the CMMA values. Live migration needs 4033 3649 to be enabled via the KVM_REQ_START_MIGRATION VM property. 4034 3650 - To non-destructively peek at the CMMA values, with the flag ··· 4040 3652 values are written to a buffer whose location is indicated via the "values" 4041 3653 member in the kvm_s390_cmma_log struct. The values in the input struct are 4042 3654 also updated as needed. 3655 + 4043 3656 Each CMMA value takes up one byte. 4044 3657 4045 - struct kvm_s390_cmma_log { 3658 + :: 3659 + 3660 + struct kvm_s390_cmma_log { 4046 3661 __u64 start_gfn; 4047 3662 __u32 count; 4048 3663 __u32 flags; ··· 4054 3663 __u64 mask; 4055 3664 }; 4056 3665 __u64 values; 4057 - }; 3666 + }; 4058 3667 4059 3668 start_gfn is the number of the first guest frame whose CMMA values are 4060 3669 to be retrieved, ··· 4115 3724 present for the addresses (e.g. when using hugepages). 4116 3725 4117 3726 4.108 KVM_S390_SET_CMMA_BITS 3727 + ---------------------------- 4118 3728 4119 - Capability: KVM_CAP_S390_CMMA_MIGRATION 4120 - Architectures: s390 4121 - Type: vm ioctl 4122 - Parameters: struct kvm_s390_cmma_log (in) 4123 - Returns: 0 on success, a negative value on error 3729 + :Capability: KVM_CAP_S390_CMMA_MIGRATION 3730 + :Architectures: s390 3731 + :Type: vm ioctl 3732 + :Parameters: struct kvm_s390_cmma_log (in) 3733 + :Returns: 0 on success, a negative value on error 4124 3734 4125 3735 This ioctl is used to set the values of the CMMA bits on the s390 4126 3736 architecture. It is meant to be used during live migration to restore ··· 4129 3737 The ioctl takes parameters via the kvm_s390_cmma_values struct. 4130 3738 Each CMMA value takes up one byte. 4131 3739 4132 - struct kvm_s390_cmma_log { 3740 + :: 3741 + 3742 + struct kvm_s390_cmma_log { 4133 3743 __u64 start_gfn; 4134 3744 __u32 count; 4135 3745 __u32 flags; 4136 3746 union { 4137 3747 __u64 remaining; 4138 3748 __u64 mask; 4139 - }; 3749 + }; 4140 3750 __u64 values; 4141 - }; 3751 + }; 4142 3752 4143 3753 start_gfn indicates the starting guest frame number, 4144 3754 ··· 4163 3769 hugepages). 4164 3770 4165 3771 4.109 KVM_PPC_GET_CPU_CHAR 3772 + -------------------------- 4166 3773 4167 - Capability: KVM_CAP_PPC_GET_CPU_CHAR 4168 - Architectures: powerpc 4169 - Type: vm ioctl 4170 - Parameters: struct kvm_ppc_cpu_char (out) 4171 - Returns: 0 on successful completion 3774 + :Capability: KVM_CAP_PPC_GET_CPU_CHAR 3775 + :Architectures: powerpc 3776 + :Type: vm ioctl 3777 + :Parameters: struct kvm_ppc_cpu_char (out) 3778 + :Returns: 0 on successful completion, 4172 3779 -EFAULT if struct kvm_ppc_cpu_char cannot be written 4173 3780 4174 3781 This ioctl gives userspace information about certain characteristics 4175 3782 of the CPU relating to speculative execution of instructions and 4176 3783 possible information leakage resulting from speculative execution (see 4177 3784 CVE-2017-5715, CVE-2017-5753 and CVE-2017-5754). The information is 4178 - returned in struct kvm_ppc_cpu_char, which looks like this: 3785 + returned in struct kvm_ppc_cpu_char, which looks like this:: 4179 3786 4180 - struct kvm_ppc_cpu_char { 3787 + struct kvm_ppc_cpu_char { 4181 3788 __u64 character; /* characteristics of the CPU */ 4182 3789 __u64 behaviour; /* recommended software behaviour */ 4183 3790 __u64 character_mask; /* valid bits in character */ 4184 3791 __u64 behaviour_mask; /* valid bits in behaviour */ 4185 - }; 3792 + }; 4186 3793 4187 3794 For extensibility, the character_mask and behaviour_mask fields 4188 3795 indicate which bits of character and behaviour have been filled in by ··· 4210 3815 H_GET_CPU_CHARACTERISTICS hypercall. 4211 3816 4212 3817 4.110 KVM_MEMORY_ENCRYPT_OP 3818 + --------------------------- 4213 3819 4214 - Capability: basic 4215 - Architectures: x86 4216 - Type: system 4217 - Parameters: an opaque platform specific structure (in/out) 4218 - Returns: 0 on success; -1 on error 3820 + :Capability: basic 3821 + :Architectures: x86 3822 + :Type: system 3823 + :Parameters: an opaque platform specific structure (in/out) 3824 + :Returns: 0 on success; -1 on error 4219 3825 4220 3826 If the platform supports creating encrypted VMs then this ioctl can be used 4221 3827 for issuing platform-specific memory encryption commands to manage those ··· 4227 3831 Documentation/virt/kvm/amd-memory-encryption.rst. 4228 3832 4229 3833 4.111 KVM_MEMORY_ENCRYPT_REG_REGION 3834 + ----------------------------------- 4230 3835 4231 - Capability: basic 4232 - Architectures: x86 4233 - Type: system 4234 - Parameters: struct kvm_enc_region (in) 4235 - Returns: 0 on success; -1 on error 3836 + :Capability: basic 3837 + :Architectures: x86 3838 + :Type: system 3839 + :Parameters: struct kvm_enc_region (in) 3840 + :Returns: 0 on success; -1 on error 4236 3841 4237 3842 This ioctl can be used to register a guest memory region which may 4238 3843 contain encrypted data (e.g. guest RAM, SMRAM etc). ··· 4251 3854 memory region registered with the ioctl. 4252 3855 4253 3856 4.112 KVM_MEMORY_ENCRYPT_UNREG_REGION 3857 + ------------------------------------- 4254 3858 4255 - Capability: basic 4256 - Architectures: x86 4257 - Type: system 4258 - Parameters: struct kvm_enc_region (in) 4259 - Returns: 0 on success; -1 on error 3859 + :Capability: basic 3860 + :Architectures: x86 3861 + :Type: system 3862 + :Parameters: struct kvm_enc_region (in) 3863 + :Returns: 0 on success; -1 on error 4260 3864 4261 3865 This ioctl can be used to unregister the guest memory region registered 4262 3866 with KVM_MEMORY_ENCRYPT_REG_REGION ioctl above. 4263 3867 4264 3868 4.113 KVM_HYPERV_EVENTFD 3869 + ------------------------ 4265 3870 4266 - Capability: KVM_CAP_HYPERV_EVENTFD 4267 - Architectures: x86 4268 - Type: vm ioctl 4269 - Parameters: struct kvm_hyperv_eventfd (in) 3871 + :Capability: KVM_CAP_HYPERV_EVENTFD 3872 + :Architectures: x86 3873 + :Type: vm ioctl 3874 + :Parameters: struct kvm_hyperv_eventfd (in) 4270 3875 4271 3876 This ioctl (un)registers an eventfd to receive notifications from the guest on 4272 3877 the specified Hyper-V connection id through the SIGNAL_EVENT hypercall, without 4273 3878 causing a user exit. SIGNAL_EVENT hypercall with non-zero event flag number 4274 3879 (bits 24-31) still triggers a KVM_EXIT_HYPERV_HCALL user exit. 4275 3880 4276 - struct kvm_hyperv_eventfd { 3881 + :: 3882 + 3883 + struct kvm_hyperv_eventfd { 4277 3884 __u32 conn_id; 4278 3885 __s32 fd; 4279 3886 __u32 flags; 4280 3887 __u32 padding[3]; 4281 - }; 3888 + }; 4282 3889 4283 - The conn_id field should fit within 24 bits: 3890 + The conn_id field should fit within 24 bits:: 4284 3891 4285 - #define KVM_HYPERV_CONN_ID_MASK 0x00ffffff 3892 + #define KVM_HYPERV_CONN_ID_MASK 0x00ffffff 4286 3893 4287 - The acceptable values for the flags field are: 3894 + The acceptable values for the flags field are:: 4288 3895 4289 - #define KVM_HYPERV_EVENTFD_DEASSIGN (1 << 0) 3896 + #define KVM_HYPERV_EVENTFD_DEASSIGN (1 << 0) 4290 3897 4291 - Returns: 0 on success, 4292 - -EINVAL if conn_id or flags is outside the allowed range 4293 - -ENOENT on deassign if the conn_id isn't registered 4294 - -EEXIST on assign if the conn_id is already registered 3898 + :Returns: 0 on success, 3899 + -EINVAL if conn_id or flags is outside the allowed range, 3900 + -ENOENT on deassign if the conn_id isn't registered, 3901 + -EEXIST on assign if the conn_id is already registered 4295 3902 4296 3903 4.114 KVM_GET_NESTED_STATE 3904 + -------------------------- 4297 3905 4298 - Capability: KVM_CAP_NESTED_STATE 4299 - Architectures: x86 4300 - Type: vcpu ioctl 4301 - Parameters: struct kvm_nested_state (in/out) 4302 - Returns: 0 on success, -1 on error 3906 + :Capability: KVM_CAP_NESTED_STATE 3907 + :Architectures: x86 3908 + :Type: vcpu ioctl 3909 + :Parameters: struct kvm_nested_state (in/out) 3910 + :Returns: 0 on success, -1 on error 3911 + 4303 3912 Errors: 4304 - E2BIG: the total state size exceeds the value of 'size' specified by 4305 - the user; the size required will be written into size. 4306 3913 4307 - struct kvm_nested_state { 3914 + ===== ============================================================= 3915 + E2BIG the total state size exceeds the value of 'size' specified by 3916 + the user; the size required will be written into size. 3917 + ===== ============================================================= 3918 + 3919 + :: 3920 + 3921 + struct kvm_nested_state { 4308 3922 __u16 flags; 4309 3923 __u16 format; 4310 3924 __u32 size; ··· 4332 3924 struct kvm_vmx_nested_state_data vmx[0]; 4333 3925 struct kvm_svm_nested_state_data svm[0]; 4334 3926 } data; 4335 - }; 3927 + }; 4336 3928 4337 - #define KVM_STATE_NESTED_GUEST_MODE 0x00000001 4338 - #define KVM_STATE_NESTED_RUN_PENDING 0x00000002 4339 - #define KVM_STATE_NESTED_EVMCS 0x00000004 3929 + #define KVM_STATE_NESTED_GUEST_MODE 0x00000001 3930 + #define KVM_STATE_NESTED_RUN_PENDING 0x00000002 3931 + #define KVM_STATE_NESTED_EVMCS 0x00000004 4340 3932 4341 - #define KVM_STATE_NESTED_FORMAT_VMX 0 4342 - #define KVM_STATE_NESTED_FORMAT_SVM 1 3933 + #define KVM_STATE_NESTED_FORMAT_VMX 0 3934 + #define KVM_STATE_NESTED_FORMAT_SVM 1 4343 3935 4344 - #define KVM_STATE_NESTED_VMX_VMCS_SIZE 0x1000 3936 + #define KVM_STATE_NESTED_VMX_VMCS_SIZE 0x1000 4345 3937 4346 - #define KVM_STATE_NESTED_VMX_SMM_GUEST_MODE 0x00000001 4347 - #define KVM_STATE_NESTED_VMX_SMM_VMXON 0x00000002 3938 + #define KVM_STATE_NESTED_VMX_SMM_GUEST_MODE 0x00000001 3939 + #define KVM_STATE_NESTED_VMX_SMM_VMXON 0x00000002 4348 3940 4349 - struct kvm_vmx_nested_state_hdr { 3941 + struct kvm_vmx_nested_state_hdr { 4350 3942 __u64 vmxon_pa; 4351 3943 __u64 vmcs12_pa; 4352 3944 4353 3945 struct { 4354 3946 __u16 flags; 4355 3947 } smm; 4356 - }; 3948 + }; 4357 3949 4358 - struct kvm_vmx_nested_state_data { 3950 + struct kvm_vmx_nested_state_data { 4359 3951 __u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; 4360 3952 __u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; 4361 - }; 3953 + }; 4362 3954 4363 3955 This ioctl copies the vcpu's nested virtualization state from the kernel to 4364 3956 userspace. ··· 4367 3959 to the KVM_CHECK_EXTENSION ioctl(). 4368 3960 4369 3961 4.115 KVM_SET_NESTED_STATE 3962 + -------------------------- 4370 3963 4371 - Capability: KVM_CAP_NESTED_STATE 4372 - Architectures: x86 4373 - Type: vcpu ioctl 4374 - Parameters: struct kvm_nested_state (in) 4375 - Returns: 0 on success, -1 on error 3964 + :Capability: KVM_CAP_NESTED_STATE 3965 + :Architectures: x86 3966 + :Type: vcpu ioctl 3967 + :Parameters: struct kvm_nested_state (in) 3968 + :Returns: 0 on success, -1 on error 4376 3969 4377 3970 This copies the vcpu's kvm_nested_state struct from userspace to the kernel. 4378 3971 For the definition of struct kvm_nested_state, see KVM_GET_NESTED_STATE. 4379 3972 4380 3973 4.116 KVM_(UN)REGISTER_COALESCED_MMIO 3974 + ------------------------------------- 4381 3975 4382 - Capability: KVM_CAP_COALESCED_MMIO (for coalesced mmio) 4383 - KVM_CAP_COALESCED_PIO (for coalesced pio) 4384 - Architectures: all 4385 - Type: vm ioctl 4386 - Parameters: struct kvm_coalesced_mmio_zone 4387 - Returns: 0 on success, < 0 on error 3976 + :Capability: KVM_CAP_COALESCED_MMIO (for coalesced mmio) 3977 + KVM_CAP_COALESCED_PIO (for coalesced pio) 3978 + :Architectures: all 3979 + :Type: vm ioctl 3980 + :Parameters: struct kvm_coalesced_mmio_zone 3981 + :Returns: 0 on success, < 0 on error 4388 3982 4389 3983 Coalesced I/O is a performance optimization that defers hardware 4390 3984 register write emulation so that userspace exits are avoided. It is ··· 4408 3998 to I/O ports. 4409 3999 4410 4000 4.117 KVM_CLEAR_DIRTY_LOG (vm ioctl) 4001 + ------------------------------------ 4411 4002 4412 - Capability: KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 4413 - Architectures: x86, arm, arm64, mips 4414 - Type: vm ioctl 4415 - Parameters: struct kvm_dirty_log (in) 4416 - Returns: 0 on success, -1 on error 4003 + :Capability: KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 4004 + :Architectures: x86, arm, arm64, mips 4005 + :Type: vm ioctl 4006 + :Parameters: struct kvm_dirty_log (in) 4007 + :Returns: 0 on success, -1 on error 4417 4008 4418 - /* for KVM_CLEAR_DIRTY_LOG */ 4419 - struct kvm_clear_dirty_log { 4009 + :: 4010 + 4011 + /* for KVM_CLEAR_DIRTY_LOG */ 4012 + struct kvm_clear_dirty_log { 4420 4013 __u32 slot; 4421 4014 __u32 num_pages; 4422 4015 __u64 first_page; ··· 4427 4014 void __user *dirty_bitmap; /* one bit per page */ 4428 4015 __u64 padding; 4429 4016 }; 4430 - }; 4017 + }; 4431 4018 4432 4019 The ioctl clears the dirty status of pages in a memory slot, according to 4433 4020 the bitmap that is passed in struct kvm_clear_dirty_log's dirty_bitmap ··· 4451 4038 that KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 is present. 4452 4039 4453 4040 4.118 KVM_GET_SUPPORTED_HV_CPUID 4041 + -------------------------------- 4454 4042 4455 - Capability: KVM_CAP_HYPERV_CPUID 4456 - Architectures: x86 4457 - Type: vcpu ioctl 4458 - Parameters: struct kvm_cpuid2 (in/out) 4459 - Returns: 0 on success, -1 on error 4043 + :Capability: KVM_CAP_HYPERV_CPUID 4044 + :Architectures: x86 4045 + :Type: vcpu ioctl 4046 + :Parameters: struct kvm_cpuid2 (in/out) 4047 + :Returns: 0 on success, -1 on error 4460 4048 4461 - struct kvm_cpuid2 { 4049 + :: 4050 + 4051 + struct kvm_cpuid2 { 4462 4052 __u32 nent; 4463 4053 __u32 padding; 4464 4054 struct kvm_cpuid_entry2 entries[0]; 4465 - }; 4055 + }; 4466 4056 4467 - struct kvm_cpuid_entry2 { 4057 + struct kvm_cpuid_entry2 { 4468 4058 __u32 function; 4469 4059 __u32 index; 4470 4060 __u32 flags; ··· 4476 4060 __u32 ecx; 4477 4061 __u32 edx; 4478 4062 __u32 padding[3]; 4479 - }; 4063 + }; 4480 4064 4481 4065 This ioctl returns x86 cpuid features leaves related to Hyper-V emulation in 4482 4066 KVM. Userspace can use the information returned by this ioctl to construct ··· 4489 4073 leaves (0x40000000, 0x40000001). 4490 4074 4491 4075 Currently, the following list of CPUID leaves are returned: 4492 - HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS 4493 - HYPERV_CPUID_INTERFACE 4494 - HYPERV_CPUID_VERSION 4495 - HYPERV_CPUID_FEATURES 4496 - HYPERV_CPUID_ENLIGHTMENT_INFO 4497 - HYPERV_CPUID_IMPLEMENT_LIMITS 4498 - HYPERV_CPUID_NESTED_FEATURES 4076 + - HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS 4077 + - HYPERV_CPUID_INTERFACE 4078 + - HYPERV_CPUID_VERSION 4079 + - HYPERV_CPUID_FEATURES 4080 + - HYPERV_CPUID_ENLIGHTMENT_INFO 4081 + - HYPERV_CPUID_IMPLEMENT_LIMITS 4082 + - HYPERV_CPUID_NESTED_FEATURES 4499 4083 4500 4084 HYPERV_CPUID_NESTED_FEATURES leaf is only exposed when Enlightened VMCS was 4501 4085 enabled on the corresponding vCPU (KVM_CAP_HYPERV_ENLIGHTENED_VMCS). ··· 4511 4095 userspace should not expect to get any particular value there. 4512 4096 4513 4097 4.119 KVM_ARM_VCPU_FINALIZE 4098 + --------------------------- 4514 4099 4515 - Architectures: arm, arm64 4516 - Type: vcpu ioctl 4517 - Parameters: int feature (in) 4518 - Returns: 0 on success, -1 on error 4100 + :Architectures: arm, arm64 4101 + :Type: vcpu ioctl 4102 + :Parameters: int feature (in) 4103 + :Returns: 0 on success, -1 on error 4104 + 4519 4105 Errors: 4520 - EPERM: feature not enabled, needs configuration, or already finalized 4521 - EINVAL: feature unknown or not present 4106 + 4107 + ====== ============================================================== 4108 + EPERM feature not enabled, needs configuration, or already finalized 4109 + EINVAL feature unknown or not present 4110 + ====== ============================================================== 4522 4111 4523 4112 Recognised values for feature: 4113 + 4114 + ===== =========================================== 4524 4115 arm64 KVM_ARM_VCPU_SVE (requires KVM_CAP_ARM_SVE) 4116 + ===== =========================================== 4525 4117 4526 4118 Finalizes the configuration of the specified vcpu feature. 4527 4119 ··· 4553 4129 using this ioctl. 4554 4130 4555 4131 4.120 KVM_SET_PMU_EVENT_FILTER 4132 + ------------------------------ 4556 4133 4557 - Capability: KVM_CAP_PMU_EVENT_FILTER 4558 - Architectures: x86 4559 - Type: vm ioctl 4560 - Parameters: struct kvm_pmu_event_filter (in) 4561 - Returns: 0 on success, -1 on error 4134 + :Capability: KVM_CAP_PMU_EVENT_FILTER 4135 + :Architectures: x86 4136 + :Type: vm ioctl 4137 + :Parameters: struct kvm_pmu_event_filter (in) 4138 + :Returns: 0 on success, -1 on error 4562 4139 4563 - struct kvm_pmu_event_filter { 4140 + :: 4141 + 4142 + struct kvm_pmu_event_filter { 4564 4143 __u32 action; 4565 4144 __u32 nevents; 4566 4145 __u32 fixed_counter_bitmap; 4567 4146 __u32 flags; 4568 4147 __u32 pad[4]; 4569 4148 __u64 events[0]; 4570 - }; 4149 + }; 4571 4150 4572 4151 This ioctl restricts the set of PMU events that the guest can program. 4573 4152 The argument holds a list of events which will be allowed or denied. ··· 4581 4154 4582 4155 No flags are defined yet, the field must be zero. 4583 4156 4584 - Valid values for 'action': 4585 - #define KVM_PMU_EVENT_ALLOW 0 4586 - #define KVM_PMU_EVENT_DENY 1 4157 + Valid values for 'action':: 4158 + 4159 + #define KVM_PMU_EVENT_ALLOW 0 4160 + #define KVM_PMU_EVENT_DENY 1 4587 4161 4588 4162 4.121 KVM_PPC_SVM_OFF 4163 + --------------------- 4589 4164 4590 - Capability: basic 4591 - Architectures: powerpc 4592 - Type: vm ioctl 4593 - Parameters: none 4594 - Returns: 0 on successful completion, 4165 + :Capability: basic 4166 + :Architectures: powerpc 4167 + :Type: vm ioctl 4168 + :Parameters: none 4169 + :Returns: 0 on successful completion, 4170 + 4595 4171 Errors: 4596 - EINVAL: if ultravisor failed to terminate the secure guest 4597 - ENOMEM: if hypervisor failed to allocate new radix page tables for guest 4172 + 4173 + ====== ================================================================ 4174 + EINVAL if ultravisor failed to terminate the secure guest 4175 + ENOMEM if hypervisor failed to allocate new radix page tables for guest 4176 + ====== ================================================================ 4598 4177 4599 4178 This ioctl is used to turn off the secure mode of the guest or transition 4600 4179 the guest from secure mode to normal mode. This is invoked when the guest ··· 4647 4214 4648 4215 4649 4216 5. The kvm_run structure 4650 - ------------------------ 4217 + ======================== 4651 4218 4652 4219 Application code obtains a pointer to the kvm_run structure by 4653 4220 mmap()ing a vcpu fd. From that point, application code can control ··· 4655 4222 ioctl, and obtain information about the reason KVM_RUN returned by 4656 4223 looking up structure members. 4657 4224 4658 - struct kvm_run { 4225 + :: 4226 + 4227 + struct kvm_run { 4659 4228 /* in */ 4660 4229 __u8 request_interrupt_window; 4661 4230 4662 4231 Request that KVM_RUN return when it becomes possible to inject external 4663 4232 interrupts into the guest. Useful in conjunction with KVM_INTERRUPT. 4233 + 4234 + :: 4664 4235 4665 4236 __u8 immediate_exit; 4666 4237 ··· 4677 4240 4678 4241 This field is ignored if KVM_CAP_IMMEDIATE_EXIT is not available. 4679 4242 4243 + :: 4244 + 4680 4245 __u8 padding1[6]; 4681 4246 4682 4247 /* out */ ··· 4688 4249 application code why KVM_RUN has returned. Allowable values for this 4689 4250 field are detailed below. 4690 4251 4252 + :: 4253 + 4691 4254 __u8 ready_for_interrupt_injection; 4692 4255 4693 4256 If request_interrupt_window has been specified, this field indicates 4694 4257 an interrupt can be injected now with KVM_INTERRUPT. 4695 4258 4259 + :: 4260 + 4696 4261 __u8 if_flag; 4697 4262 4698 4263 The value of the current interrupt flag. Only valid if in-kernel 4699 4264 local APIC is not used. 4265 + 4266 + :: 4700 4267 4701 4268 __u16 flags; 4702 4269 ··· 4711 4266 KVM_RUN_X86_SMM, which is valid on x86 machines and is set if the 4712 4267 VCPU is in system management mode. 4713 4268 4269 + :: 4270 + 4714 4271 /* in (pre_kvm_run), out (post_kvm_run) */ 4715 4272 __u64 cr8; 4716 4273 4717 4274 The value of the cr8 register. Only valid if in-kernel local APIC is 4718 4275 not used. Both input and output. 4719 4276 4277 + :: 4278 + 4720 4279 __u64 apic_base; 4721 4280 4722 4281 The value of the APIC BASE msr. Only valid if in-kernel local 4723 4282 APIC is not used. Both input and output. 4283 + 4284 + :: 4724 4285 4725 4286 union { 4726 4287 /* KVM_EXIT_UNKNOWN */ ··· 4738 4287 reasons. Further architecture-specific information is available in 4739 4288 hardware_exit_reason. 4740 4289 4290 + :: 4291 + 4741 4292 /* KVM_EXIT_FAIL_ENTRY */ 4742 4293 struct { 4743 4294 __u64 hardware_entry_failure_reason; ··· 4749 4296 to unknown reasons. Further architecture-specific information is 4750 4297 available in hardware_entry_failure_reason. 4751 4298 4299 + :: 4300 + 4752 4301 /* KVM_EXIT_EXCEPTION */ 4753 4302 struct { 4754 4303 __u32 exception; ··· 4759 4304 4760 4305 Unused. 4761 4306 4307 + :: 4308 + 4762 4309 /* KVM_EXIT_IO */ 4763 4310 struct { 4764 - #define KVM_EXIT_IO_IN 0 4765 - #define KVM_EXIT_IO_OUT 1 4311 + #define KVM_EXIT_IO_IN 0 4312 + #define KVM_EXIT_IO_OUT 1 4766 4313 __u8 direction; 4767 4314 __u8 size; /* bytes */ 4768 4315 __u16 port; ··· 4778 4321 where kvm expects application code to place the data for the next 4779 4322 KVM_RUN invocation (KVM_EXIT_IO_IN). Data format is a packed array. 4780 4323 4324 + :: 4325 + 4781 4326 /* KVM_EXIT_DEBUG */ 4782 4327 struct { 4783 4328 struct kvm_debug_exit_arch arch; ··· 4787 4328 4788 4329 If the exit_reason is KVM_EXIT_DEBUG, then a vcpu is processing a debug event 4789 4330 for which architecture specific information is returned. 4331 + 4332 + :: 4790 4333 4791 4334 /* KVM_EXIT_MMIO */ 4792 4335 struct { ··· 4807 4346 appear if the VCPU performed a load or store of the appropriate width directly 4808 4347 to the byte array. 4809 4348 4810 - NOTE: For KVM_EXIT_IO, KVM_EXIT_MMIO, KVM_EXIT_OSI, KVM_EXIT_PAPR and 4349 + .. note:: 4350 + 4351 + For KVM_EXIT_IO, KVM_EXIT_MMIO, KVM_EXIT_OSI, KVM_EXIT_PAPR and 4811 4352 KVM_EXIT_EPR the corresponding 4353 + 4812 4354 operations are complete (and guest state is consistent) only after userspace 4813 4355 has re-entered the kernel with KVM_RUN. The kernel side will first finish 4814 4356 incomplete operations and then check for pending signals. Userspace 4815 4357 can re-enter the guest with an unmasked signal pending to complete 4816 4358 pending operations. 4359 + 4360 + :: 4817 4361 4818 4362 /* KVM_EXIT_HYPERCALL */ 4819 4363 struct { ··· 4831 4365 4832 4366 Unused. This was once used for 'hypercall to userspace'. To implement 4833 4367 such functionality, use KVM_EXIT_IO (x86) or KVM_EXIT_MMIO (all except s390). 4834 - Note KVM_EXIT_IO is significantly faster than KVM_EXIT_MMIO. 4368 + 4369 + .. note:: KVM_EXIT_IO is significantly faster than KVM_EXIT_MMIO. 4370 + 4371 + :: 4835 4372 4836 4373 /* KVM_EXIT_TPR_ACCESS */ 4837 4374 struct { ··· 4844 4375 } tpr_access; 4845 4376 4846 4377 To be documented (KVM_TPR_ACCESS_REPORTING). 4378 + 4379 + :: 4847 4380 4848 4381 /* KVM_EXIT_S390_SIEIC */ 4849 4382 struct { ··· 4858 4387 4859 4388 s390 specific. 4860 4389 4390 + :: 4391 + 4861 4392 /* KVM_EXIT_S390_RESET */ 4862 - #define KVM_S390_RESET_POR 1 4863 - #define KVM_S390_RESET_CLEAR 2 4864 - #define KVM_S390_RESET_SUBSYSTEM 4 4865 - #define KVM_S390_RESET_CPU_INIT 8 4866 - #define KVM_S390_RESET_IPL 16 4393 + #define KVM_S390_RESET_POR 1 4394 + #define KVM_S390_RESET_CLEAR 2 4395 + #define KVM_S390_RESET_SUBSYSTEM 4 4396 + #define KVM_S390_RESET_CPU_INIT 8 4397 + #define KVM_S390_RESET_IPL 16 4867 4398 __u64 s390_reset_flags; 4868 4399 4869 4400 s390 specific. 4401 + 4402 + :: 4870 4403 4871 4404 /* KVM_EXIT_S390_UCONTROL */ 4872 4405 struct { ··· 4886 4411 Principles of Operation Book in the Chapter for Dynamic Address Translation 4887 4412 (DAT) 4888 4413 4414 + :: 4415 + 4889 4416 /* KVM_EXIT_DCR */ 4890 4417 struct { 4891 4418 __u32 dcrn; ··· 4896 4419 } dcr; 4897 4420 4898 4421 Deprecated - was used for 440 KVM. 4422 + 4423 + :: 4899 4424 4900 4425 /* KVM_EXIT_OSI */ 4901 4426 struct { ··· 4911 4432 Userspace can now handle the hypercall and when it's done modify the gprs as 4912 4433 necessary. Upon guest entry all guest GPRs will then be replaced by the values 4913 4434 in this struct. 4435 + 4436 + :: 4914 4437 4915 4438 /* KVM_EXIT_PAPR_HCALL */ 4916 4439 struct { ··· 4931 4450 Requirements (PAPR) document available from www.power.org (free 4932 4451 developer registration required to access it). 4933 4452 4453 + :: 4454 + 4934 4455 /* KVM_EXIT_S390_TSCH */ 4935 4456 struct { 4936 4457 __u16 subchannel_id; ··· 4948 4465 interrupt for the target subchannel has been dequeued and subchannel_id, 4949 4466 subchannel_nr, io_int_parm and io_int_word contain the parameters for that 4950 4467 interrupt. ipb is needed for instruction parameter decoding. 4468 + 4469 + :: 4951 4470 4952 4471 /* KVM_EXIT_EPR */ 4953 4472 struct { ··· 4970 4485 external interrupt has just been delivered into the guest. User space 4971 4486 should put the acknowledged interrupt vector into the 'epr' field. 4972 4487 4488 + :: 4489 + 4973 4490 /* KVM_EXIT_SYSTEM_EVENT */ 4974 4491 struct { 4975 - #define KVM_SYSTEM_EVENT_SHUTDOWN 1 4976 - #define KVM_SYSTEM_EVENT_RESET 2 4977 - #define KVM_SYSTEM_EVENT_CRASH 3 4492 + #define KVM_SYSTEM_EVENT_SHUTDOWN 1 4493 + #define KVM_SYSTEM_EVENT_RESET 2 4494 + #define KVM_SYSTEM_EVENT_CRASH 3 4978 4495 __u32 type; 4979 4496 __u64 flags; 4980 4497 } system_event; ··· 4989 4502 specific flags for the system-level event. 4990 4503 4991 4504 Valid values for 'type' are: 4992 - KVM_SYSTEM_EVENT_SHUTDOWN -- the guest has requested a shutdown of the 4505 + 4506 + - KVM_SYSTEM_EVENT_SHUTDOWN -- the guest has requested a shutdown of the 4993 4507 VM. Userspace is not obliged to honour this, and if it does honour 4994 4508 this does not need to destroy the VM synchronously (ie it may call 4995 4509 KVM_RUN again before shutdown finally occurs). 4996 - KVM_SYSTEM_EVENT_RESET -- the guest has requested a reset of the VM. 4510 + - KVM_SYSTEM_EVENT_RESET -- the guest has requested a reset of the VM. 4997 4511 As with SHUTDOWN, userspace can choose to ignore the request, or 4998 4512 to schedule the reset to occur in the future and may call KVM_RUN again. 4999 - KVM_SYSTEM_EVENT_CRASH -- the guest crash occurred and the guest 4513 + - KVM_SYSTEM_EVENT_CRASH -- the guest crash occurred and the guest 5000 4514 has requested a crash condition maintenance. Userspace can choose 5001 4515 to ignore the request, or to gather VM memory core dump and/or 5002 4516 reset/shutdown of the VM. 4517 + 4518 + :: 5003 4519 5004 4520 /* KVM_EXIT_IOAPIC_EOI */ 5005 4521 struct { ··· 5016 4526 it is still asserted. Vector is the LAPIC interrupt vector for which the 5017 4527 EOI was received. 5018 4528 4529 + :: 4530 + 5019 4531 struct kvm_hyperv_exit { 5020 - #define KVM_EXIT_HYPERV_SYNIC 1 5021 - #define KVM_EXIT_HYPERV_HCALL 2 4532 + #define KVM_EXIT_HYPERV_SYNIC 1 4533 + #define KVM_EXIT_HYPERV_HCALL 2 5022 4534 __u32 type; 5023 4535 union { 5024 4536 struct { ··· 5038 4546 }; 5039 4547 /* KVM_EXIT_HYPERV */ 5040 4548 struct kvm_hyperv_exit hyperv; 4549 + 5041 4550 Indicates that the VCPU exits into userspace to process some tasks 5042 4551 related to Hyper-V emulation. 4552 + 5043 4553 Valid values for 'type' are: 5044 - KVM_EXIT_HYPERV_SYNIC -- synchronously notify user-space about 4554 + 4555 + - KVM_EXIT_HYPERV_SYNIC -- synchronously notify user-space about 4556 + 5045 4557 Hyper-V SynIC state change. Notification is used to remap SynIC 5046 4558 event/message pages and to enable/disable SynIC messages/events processing 5047 4559 in userspace. 4560 + 4561 + :: 5048 4562 5049 4563 /* KVM_EXIT_ARM_NISV */ 5050 4564 struct { ··· 5085 4587 KVM_EXIT_MMIO, but userspace has to emulate any change to the processing state 5086 4588 if it decides to decode and emulate the instruction. 5087 4589 4590 + :: 4591 + 5088 4592 /* Fix the size of the union. */ 5089 4593 char padding[256]; 5090 4594 }; ··· 5111 4611 Userspace can query the validity of the structure by checking 5112 4612 kvm_valid_regs for specific bits. These bits are architecture specific 5113 4613 and usually define the validity of a groups of registers. (e.g. one bit 5114 - for general purpose registers) 4614 + for general purpose registers) 5115 4615 5116 4616 Please note that the kernel is allowed to use the kvm_run structure as the 5117 4617 primary storage for certain register types. Therefore, the kernel may use the 5118 4618 values in kvm_run even if the corresponding bit in kvm_dirty_regs is not set. 5119 4619 5120 - }; 4620 + :: 4621 + 4622 + }; 5121 4623 5122 4624 5123 4625 5124 4626 6. Capabilities that can be enabled on vCPUs 5125 - -------------------------------------------- 4627 + ============================================ 5126 4628 5127 4629 There are certain capabilities that change the behavior of the virtual CPU or 5128 4630 the virtual machine when enabled. To enable them, please see section 4.37. ··· 5133 4631 5134 4632 The following information is provided along with the description: 5135 4633 5136 - Architectures: which instruction set architectures provide this ioctl. 4634 + Architectures: 4635 + which instruction set architectures provide this ioctl. 5137 4636 x86 includes both i386 and x86_64. 5138 4637 5139 - Target: whether this is a per-vcpu or per-vm capability. 4638 + Target: 4639 + whether this is a per-vcpu or per-vm capability. 5140 4640 5141 - Parameters: what parameters are accepted by the capability. 4641 + Parameters: 4642 + what parameters are accepted by the capability. 5142 4643 5143 - Returns: the return value. General error numbers (EBADF, ENOMEM, EINVAL) 4644 + Returns: 4645 + the return value. General error numbers (EBADF, ENOMEM, EINVAL) 5144 4646 are not detailed, but errors with specific meanings are. 5145 4647 5146 4648 5147 4649 6.1 KVM_CAP_PPC_OSI 4650 + ------------------- 5148 4651 5149 - Architectures: ppc 5150 - Target: vcpu 5151 - Parameters: none 5152 - Returns: 0 on success; -1 on error 4652 + :Architectures: ppc 4653 + :Target: vcpu 4654 + :Parameters: none 4655 + :Returns: 0 on success; -1 on error 5153 4656 5154 4657 This capability enables interception of OSI hypercalls that otherwise would 5155 4658 be treated as normal system calls to be injected into the guest. OSI hypercalls ··· 5165 4658 5166 4659 5167 4660 6.2 KVM_CAP_PPC_PAPR 4661 + -------------------- 5168 4662 5169 - Architectures: ppc 5170 - Target: vcpu 5171 - Parameters: none 5172 - Returns: 0 on success; -1 on error 4663 + :Architectures: ppc 4664 + :Target: vcpu 4665 + :Parameters: none 4666 + :Returns: 0 on success; -1 on error 5173 4667 5174 4668 This capability enables interception of PAPR hypercalls. PAPR hypercalls are 5175 4669 done using the hypercall instruction "sc 1". ··· 5186 4678 5187 4679 5188 4680 6.3 KVM_CAP_SW_TLB 4681 + ------------------ 5189 4682 5190 - Architectures: ppc 5191 - Target: vcpu 5192 - Parameters: args[0] is the address of a struct kvm_config_tlb 5193 - Returns: 0 on success; -1 on error 4683 + :Architectures: ppc 4684 + :Target: vcpu 4685 + :Parameters: args[0] is the address of a struct kvm_config_tlb 4686 + :Returns: 0 on success; -1 on error 5194 4687 5195 - struct kvm_config_tlb { 4688 + :: 4689 + 4690 + struct kvm_config_tlb { 5196 4691 __u64 params; 5197 4692 __u64 array; 5198 4693 __u32 mmu_type; 5199 4694 __u32 array_len; 5200 - }; 4695 + }; 5201 4696 5202 4697 Configures the virtual CPU's TLB array, establishing a shared memory area 5203 4698 between userspace and KVM. The "params" and "array" fields are userspace ··· 5219 4708 on this vcpu. 5220 4709 5221 4710 For mmu types KVM_MMU_FSL_BOOKE_NOHV and KVM_MMU_FSL_BOOKE_HV: 4711 + 5222 4712 - The "params" field is of type "struct kvm_book3e_206_tlb_params". 5223 4713 - The "array" field points to an array of type "struct 5224 4714 kvm_book3e_206_tlb_entry". ··· 5233 4721 hardware ignores this value for TLB0. 5234 4722 5235 4723 6.4 KVM_CAP_S390_CSS_SUPPORT 4724 + ---------------------------- 5236 4725 5237 - Architectures: s390 5238 - Target: vcpu 5239 - Parameters: none 5240 - Returns: 0 on success; -1 on error 4726 + :Architectures: s390 4727 + :Target: vcpu 4728 + :Parameters: none 4729 + :Returns: 0 on success; -1 on error 5241 4730 5242 4731 This capability enables support for handling of channel I/O instructions. 5243 4732 ··· 5252 4739 virtual machine is affected. 5253 4740 5254 4741 6.5 KVM_CAP_PPC_EPR 4742 + ------------------- 5255 4743 5256 - Architectures: ppc 5257 - Target: vcpu 5258 - Parameters: args[0] defines whether the proxy facility is active 5259 - Returns: 0 on success; -1 on error 4744 + :Architectures: ppc 4745 + :Target: vcpu 4746 + :Parameters: args[0] defines whether the proxy facility is active 4747 + :Returns: 0 on success; -1 on error 5260 4748 5261 4749 This capability enables or disables the delivery of interrupts through the 5262 4750 external proxy facility. ··· 5271 4757 When this capability is enabled, KVM_EXIT_EPR can occur. 5272 4758 5273 4759 6.6 KVM_CAP_IRQ_MPIC 4760 + -------------------- 5274 4761 5275 - Architectures: ppc 5276 - Parameters: args[0] is the MPIC device fd 5277 - args[1] is the MPIC CPU number for this vcpu 4762 + :Architectures: ppc 4763 + :Parameters: args[0] is the MPIC device fd; 4764 + args[1] is the MPIC CPU number for this vcpu 5278 4765 5279 4766 This capability connects the vcpu to an in-kernel MPIC device. 5280 4767 5281 4768 6.7 KVM_CAP_IRQ_XICS 4769 + -------------------- 5282 4770 5283 - Architectures: ppc 5284 - Target: vcpu 5285 - Parameters: args[0] is the XICS device fd 5286 - args[1] is the XICS CPU number (server ID) for this vcpu 4771 + :Architectures: ppc 4772 + :Target: vcpu 4773 + :Parameters: args[0] is the XICS device fd; 4774 + args[1] is the XICS CPU number (server ID) for this vcpu 5287 4775 5288 4776 This capability connects the vcpu to an in-kernel XICS device. 5289 4777 5290 4778 6.8 KVM_CAP_S390_IRQCHIP 4779 + ------------------------ 5291 4780 5292 - Architectures: s390 5293 - Target: vm 5294 - Parameters: none 4781 + :Architectures: s390 4782 + :Target: vm 4783 + :Parameters: none 5295 4784 5296 4785 This capability enables the in-kernel irqchip for s390. Please refer to 5297 4786 "4.24 KVM_CREATE_IRQCHIP" for details. 5298 4787 5299 4788 6.9 KVM_CAP_MIPS_FPU 4789 + -------------------- 5300 4790 5301 - Architectures: mips 5302 - Target: vcpu 5303 - Parameters: args[0] is reserved for future use (should be 0). 4791 + :Architectures: mips 4792 + :Target: vcpu 4793 + :Parameters: args[0] is reserved for future use (should be 0). 5304 4794 5305 4795 This capability allows the use of the host Floating Point Unit by the guest. It 5306 4796 allows the Config1.FP bit to be set to enable the FPU in the guest. Once this is 5307 - done the KVM_REG_MIPS_FPR_* and KVM_REG_MIPS_FCR_* registers can be accessed 5308 - (depending on the current guest FPU register mode), and the Status.FR, 4797 + done the ``KVM_REG_MIPS_FPR_*`` and ``KVM_REG_MIPS_FCR_*`` registers can be 4798 + accessed (depending on the current guest FPU register mode), and the Status.FR, 5309 4799 Config5.FRE bits are accessible via the KVM API and also from the guest, 5310 4800 depending on them being supported by the FPU. 5311 4801 5312 4802 6.10 KVM_CAP_MIPS_MSA 4803 + --------------------- 5313 4804 5314 - Architectures: mips 5315 - Target: vcpu 5316 - Parameters: args[0] is reserved for future use (should be 0). 4805 + :Architectures: mips 4806 + :Target: vcpu 4807 + :Parameters: args[0] is reserved for future use (should be 0). 5317 4808 5318 4809 This capability allows the use of the MIPS SIMD Architecture (MSA) by the guest. 5319 4810 It allows the Config3.MSAP bit to be set to enable the use of MSA by the guest. 5320 - Once this is done the KVM_REG_MIPS_VEC_* and KVM_REG_MIPS_MSA_* registers can be 5321 - accessed, and the Config5.MSAEn bit is accessible via the KVM API and also from 5322 - the guest. 4811 + Once this is done the ``KVM_REG_MIPS_VEC_*`` and ``KVM_REG_MIPS_MSA_*`` 4812 + registers can be accessed, and the Config5.MSAEn bit is accessible via the 4813 + KVM API and also from the guest. 5323 4814 5324 4815 6.74 KVM_CAP_SYNC_REGS 5325 - Architectures: s390, x86 5326 - Target: s390: always enabled, x86: vcpu 5327 - Parameters: none 5328 - Returns: x86: KVM_CHECK_EXTENSION returns a bit-array indicating which register 5329 - sets are supported (bitfields defined in arch/x86/include/uapi/asm/kvm.h). 4816 + ---------------------- 4817 + 4818 + :Architectures: s390, x86 4819 + :Target: s390: always enabled, x86: vcpu 4820 + :Parameters: none 4821 + :Returns: x86: KVM_CHECK_EXTENSION returns a bit-array indicating which register 4822 + sets are supported 4823 + (bitfields defined in arch/x86/include/uapi/asm/kvm.h). 5330 4824 5331 4825 As described above in the kvm_sync_regs struct info in section 5 (kvm_run): 5332 4826 KVM_CAP_SYNC_REGS "allow[s] userspace to access certain guest registers ··· 5347 4825 For s390 specifics, please refer to the source code. 5348 4826 5349 4827 For x86: 4828 + 5350 4829 - the register sets to be copied out to kvm_run are selectable 5351 4830 by userspace (rather that all sets being copied out for every exit). 5352 4831 - vcpu_events are available in addition to regs and sregs. ··· 5364 4841 5365 4842 Unused bitfields in the bitarrays must be set to zero. 5366 4843 5367 - struct kvm_sync_regs { 4844 + :: 4845 + 4846 + struct kvm_sync_regs { 5368 4847 struct kvm_regs regs; 5369 4848 struct kvm_sregs sregs; 5370 4849 struct kvm_vcpu_events events; 5371 - }; 4850 + }; 5372 4851 5373 4852 6.75 KVM_CAP_PPC_IRQ_XIVE 4853 + ------------------------- 5374 4854 5375 - Architectures: ppc 5376 - Target: vcpu 5377 - Parameters: args[0] is the XIVE device fd 5378 - args[1] is the XIVE CPU number (server ID) for this vcpu 4855 + :Architectures: ppc 4856 + :Target: vcpu 4857 + :Parameters: args[0] is the XIVE device fd; 4858 + args[1] is the XIVE CPU number (server ID) for this vcpu 5379 4859 5380 4860 This capability connects the vcpu to an in-kernel XIVE device. 5381 4861 5382 4862 7. Capabilities that can be enabled on VMs 5383 - ------------------------------------------ 4863 + ========================================== 5384 4864 5385 4865 There are certain capabilities that change the behavior of the virtual 5386 4866 machine when enabled. To enable them, please see section 4.37. Below ··· 5392 4866 5393 4867 The following information is provided along with the description: 5394 4868 5395 - Architectures: which instruction set architectures provide this ioctl. 4869 + Architectures: 4870 + which instruction set architectures provide this ioctl. 5396 4871 x86 includes both i386 and x86_64. 5397 4872 5398 - Parameters: what parameters are accepted by the capability. 4873 + Parameters: 4874 + what parameters are accepted by the capability. 5399 4875 5400 - Returns: the return value. General error numbers (EBADF, ENOMEM, EINVAL) 4876 + Returns: 4877 + the return value. General error numbers (EBADF, ENOMEM, EINVAL) 5401 4878 are not detailed, but errors with specific meanings are. 5402 4879 5403 4880 5404 4881 7.1 KVM_CAP_PPC_ENABLE_HCALL 4882 + ---------------------------- 5405 4883 5406 - Architectures: ppc 5407 - Parameters: args[0] is the sPAPR hcall number 5408 - args[1] is 0 to disable, 1 to enable in-kernel handling 4884 + :Architectures: ppc 4885 + :Parameters: args[0] is the sPAPR hcall number; 4886 + args[1] is 0 to disable, 1 to enable in-kernel handling 5409 4887 5410 4888 This capability controls whether individual sPAPR hypercalls (hcalls) 5411 4889 get handled by the kernel or not. Enabling or disabling in-kernel ··· 5427 4897 error. 5428 4898 5429 4899 7.2 KVM_CAP_S390_USER_SIGP 4900 + -------------------------- 5430 4901 5431 - Architectures: s390 5432 - Parameters: none 4902 + :Architectures: s390 4903 + :Parameters: none 5433 4904 5434 4905 This capability controls which SIGP orders will be handled completely in user 5435 4906 space. With this capability enabled, all fast orders will be handled completely 5436 4907 in the kernel: 4908 + 5437 4909 - SENSE 5438 4910 - SENSE RUNNING 5439 4911 - EXTERNAL CALL ··· 5449 4917 old way of handling SIGP orders is used (partially in kernel and user space). 5450 4918 5451 4919 7.3 KVM_CAP_S390_VECTOR_REGISTERS 4920 + --------------------------------- 5452 4921 5453 - Architectures: s390 5454 - Parameters: none 5455 - Returns: 0 on success, negative value on error 4922 + :Architectures: s390 4923 + :Parameters: none 4924 + :Returns: 0 on success, negative value on error 5456 4925 5457 4926 Allows use of the vector registers introduced with z13 processor, and 5458 4927 provides for the synchronization between host and user space. Will 5459 4928 return -EINVAL if the machine does not support vectors. 5460 4929 5461 4930 7.4 KVM_CAP_S390_USER_STSI 4931 + -------------------------- 5462 4932 5463 - Architectures: s390 5464 - Parameters: none 4933 + :Architectures: s390 4934 + :Parameters: none 5465 4935 5466 4936 This capability allows post-handlers for the STSI instruction. After 5467 4937 initial handling in the kernel, KVM exits to user space with 5468 4938 KVM_EXIT_S390_STSI to allow user space to insert further data. 5469 4939 5470 4940 Before exiting to userspace, kvm handlers should fill in s390_stsi field of 5471 - vcpu->run: 5472 - struct { 4941 + vcpu->run:: 4942 + 4943 + struct { 5473 4944 __u64 addr; 5474 4945 __u8 ar; 5475 4946 __u8 reserved; 5476 4947 __u8 fc; 5477 4948 __u8 sel1; 5478 4949 __u16 sel2; 5479 - } s390_stsi; 4950 + } s390_stsi; 5480 4951 5481 - @addr - guest address of STSI SYSIB 5482 - @fc - function code 5483 - @sel1 - selector 1 5484 - @sel2 - selector 2 5485 - @ar - access register number 4952 + @addr - guest address of STSI SYSIB 4953 + @fc - function code 4954 + @sel1 - selector 1 4955 + @sel2 - selector 2 4956 + @ar - access register number 5486 4957 5487 4958 KVM handlers should exit to userspace with rc = -EREMOTE. 5488 4959 5489 4960 7.5 KVM_CAP_SPLIT_IRQCHIP 4961 + ------------------------- 5490 4962 5491 - Architectures: x86 5492 - Parameters: args[0] - number of routes reserved for userspace IOAPICs 5493 - Returns: 0 on success, -1 on error 4963 + :Architectures: x86 4964 + :Parameters: args[0] - number of routes reserved for userspace IOAPICs 4965 + :Returns: 0 on success, -1 on error 5494 4966 5495 4967 Create a local apic for each processor in the kernel. This can be used 5496 4968 instead of KVM_CREATE_IRQCHIP if the userspace VMM wishes to emulate the ··· 5511 4975 kernel (i.e. KVM_CREATE_IRQCHIP has already been called). 5512 4976 5513 4977 7.6 KVM_CAP_S390_RI 4978 + ------------------- 5514 4979 5515 - Architectures: s390 5516 - Parameters: none 4980 + :Architectures: s390 4981 + :Parameters: none 5517 4982 5518 4983 Allows use of runtime-instrumentation introduced with zEC12 processor. 5519 4984 Will return -EINVAL if the machine does not support runtime-instrumentation. 5520 4985 Will return -EBUSY if a VCPU has already been created. 5521 4986 5522 4987 7.7 KVM_CAP_X2APIC_API 4988 + ---------------------- 5523 4989 5524 - Architectures: x86 5525 - Parameters: args[0] - features that should be enabled 5526 - Returns: 0 on success, -EINVAL when args[0] contains invalid features 4990 + :Architectures: x86 4991 + :Parameters: args[0] - features that should be enabled 4992 + :Returns: 0 on success, -EINVAL when args[0] contains invalid features 5527 4993 5528 - Valid feature flags in args[0] are 4994 + Valid feature flags in args[0] are:: 5529 4995 5530 - #define KVM_X2APIC_API_USE_32BIT_IDS (1ULL << 0) 5531 - #define KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK (1ULL << 1) 4996 + #define KVM_X2APIC_API_USE_32BIT_IDS (1ULL << 0) 4997 + #define KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK (1ULL << 1) 5532 4998 5533 4999 Enabling KVM_X2APIC_API_USE_32BIT_IDS changes the behavior of 5534 5000 KVM_SET_GSI_ROUTING, KVM_SIGNAL_MSI, KVM_SET_LAPIC, and KVM_GET_LAPIC, ··· 5544 5006 where 0xff represents CPUs 0-7 in cluster 0. 5545 5007 5546 5008 7.8 KVM_CAP_S390_USER_INSTR0 5009 + ---------------------------- 5547 5010 5548 - Architectures: s390 5549 - Parameters: none 5011 + :Architectures: s390 5012 + :Parameters: none 5550 5013 5551 5014 With this capability enabled, all illegal instructions 0x0000 (2 bytes) will 5552 5015 be intercepted and forwarded to user space. User space can use this ··· 5559 5020 created and are running. 5560 5021 5561 5022 7.9 KVM_CAP_S390_GS 5023 + ------------------- 5562 5024 5563 - Architectures: s390 5564 - Parameters: none 5565 - Returns: 0 on success; -EINVAL if the machine does not support 5566 - guarded storage; -EBUSY if a VCPU has already been created. 5025 + :Architectures: s390 5026 + :Parameters: none 5027 + :Returns: 0 on success; -EINVAL if the machine does not support 5028 + guarded storage; -EBUSY if a VCPU has already been created. 5567 5029 5568 5030 Allows use of guarded storage for the KVM guest. 5569 5031 5570 5032 7.10 KVM_CAP_S390_AIS 5033 + --------------------- 5571 5034 5572 - Architectures: s390 5573 - Parameters: none 5035 + :Architectures: s390 5036 + :Parameters: none 5574 5037 5575 5038 Allow use of adapter-interruption suppression. 5576 - Returns: 0 on success; -EBUSY if a VCPU has already been created. 5039 + :Returns: 0 on success; -EBUSY if a VCPU has already been created. 5577 5040 5578 5041 7.11 KVM_CAP_PPC_SMT 5042 + -------------------- 5579 5043 5580 - Architectures: ppc 5581 - Parameters: vsmt_mode, flags 5044 + :Architectures: ppc 5045 + :Parameters: vsmt_mode, flags 5582 5046 5583 5047 Enabling this capability on a VM provides userspace with a way to set 5584 5048 the desired virtual SMT mode (i.e. the number of virtual CPUs per ··· 5596 5054 modes are available. 5597 5055 5598 5056 7.12 KVM_CAP_PPC_FWNMI 5057 + ---------------------- 5599 5058 5600 - Architectures: ppc 5601 - Parameters: none 5059 + :Architectures: ppc 5060 + :Parameters: none 5602 5061 5603 5062 With this capability a machine check exception in the guest address 5604 5063 space will cause KVM to exit the guest with NMI exit reason. This ··· 5608 5065 branch to guests' 0x200 interrupt vector. 5609 5066 5610 5067 7.13 KVM_CAP_X86_DISABLE_EXITS 5068 + ------------------------------ 5611 5069 5612 - Architectures: x86 5613 - Parameters: args[0] defines which exits are disabled 5614 - Returns: 0 on success, -EINVAL when args[0] contains invalid exits 5070 + :Architectures: x86 5071 + :Parameters: args[0] defines which exits are disabled 5072 + :Returns: 0 on success, -EINVAL when args[0] contains invalid exits 5615 5073 5616 - Valid bits in args[0] are 5074 + Valid bits in args[0] are:: 5617 5075 5618 - #define KVM_X86_DISABLE_EXITS_MWAIT (1 << 0) 5619 - #define KVM_X86_DISABLE_EXITS_HLT (1 << 1) 5620 - #define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2) 5621 - #define KVM_X86_DISABLE_EXITS_CSTATE (1 << 3) 5076 + #define KVM_X86_DISABLE_EXITS_MWAIT (1 << 0) 5077 + #define KVM_X86_DISABLE_EXITS_HLT (1 << 1) 5078 + #define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2) 5079 + #define KVM_X86_DISABLE_EXITS_CSTATE (1 << 3) 5622 5080 5623 5081 Enabling this capability on a VM provides userspace with a way to no 5624 5082 longer intercept some instructions for improved latency in some ··· 5631 5087 Do not enable KVM_FEATURE_PV_UNHALT if you disable HLT exits. 5632 5088 5633 5089 7.14 KVM_CAP_S390_HPAGE_1M 5090 + -------------------------- 5634 5091 5635 - Architectures: s390 5636 - Parameters: none 5637 - Returns: 0 on success, -EINVAL if hpage module parameter was not set 5638 - or cmma is enabled, or the VM has the KVM_VM_S390_UCONTROL 5639 - flag set 5092 + :Architectures: s390 5093 + :Parameters: none 5094 + :Returns: 0 on success, -EINVAL if hpage module parameter was not set 5095 + or cmma is enabled, or the VM has the KVM_VM_S390_UCONTROL 5096 + flag set 5640 5097 5641 5098 With this capability the KVM support for memory backing with 1m pages 5642 5099 through hugetlbfs can be enabled for a VM. After the capability is ··· 5649 5104 this capability, the VM will not be able to run. 5650 5105 5651 5106 7.15 KVM_CAP_MSR_PLATFORM_INFO 5107 + ------------------------------ 5652 5108 5653 - Architectures: x86 5654 - Parameters: args[0] whether feature should be enabled or not 5109 + :Architectures: x86 5110 + :Parameters: args[0] whether feature should be enabled or not 5655 5111 5656 5112 With this capability, a guest may read the MSR_PLATFORM_INFO MSR. Otherwise, 5657 5113 a #GP would be raised when the guest tries to access. Currently, this 5658 5114 capability does not enable write permissions of this MSR for the guest. 5659 5115 5660 5116 7.16 KVM_CAP_PPC_NESTED_HV 5117 + -------------------------- 5661 5118 5662 - Architectures: ppc 5663 - Parameters: none 5664 - Returns: 0 on success, -EINVAL when the implementation doesn't support 5665 - nested-HV virtualization. 5119 + :Architectures: ppc 5120 + :Parameters: none 5121 + :Returns: 0 on success, -EINVAL when the implementation doesn't support 5122 + nested-HV virtualization. 5666 5123 5667 5124 HV-KVM on POWER9 and later systems allows for "nested-HV" 5668 5125 virtualization, which provides a way for a guest VM to run guests that ··· 5674 5127 kvm-hv module parameter. 5675 5128 5676 5129 7.17 KVM_CAP_EXCEPTION_PAYLOAD 5130 + ------------------------------ 5677 5131 5678 - Architectures: x86 5679 - Parameters: args[0] whether feature should be enabled or not 5132 + :Architectures: x86 5133 + :Parameters: args[0] whether feature should be enabled or not 5680 5134 5681 5135 With this capability enabled, CR2 will not be modified prior to the 5682 5136 emulated VM-exit when L1 intercepts a #PF exception that occurs in ··· 5688 5140 faulting address (or the new DR6 bits*) will be reported in the 5689 5141 exception_payload field. Similarly, when userspace injects a #PF (or 5690 5142 #DB) into L2 using KVM_SET_VCPU_EVENTS, it is expected to set 5691 - exception.has_payload and to put the faulting address (or the new DR6 5692 - bits*) in the exception_payload field. 5143 + exception.has_payload and to put the faulting address - or the new DR6 5144 + bits\ [#]_ - in the exception_payload field. 5693 5145 5694 5146 This capability also enables exception.pending in struct 5695 5147 kvm_vcpu_events, which allows userspace to distinguish between pending 5696 5148 and injected exceptions. 5697 5149 5698 5150 5699 - * For the new DR6 bits, note that bit 16 is set iff the #DB exception 5700 - will clear DR6.RTM. 5151 + .. [#] For the new DR6 bits, note that bit 16 is set iff the #DB exception 5152 + will clear DR6.RTM. 5701 5153 5702 5154 7.18 KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 5703 5155 5704 - Architectures: x86, arm, arm64, mips 5705 - Parameters: args[0] whether feature should be enabled or not 5156 + :Architectures: x86, arm, arm64, mips 5157 + :Parameters: args[0] whether feature should be enabled or not 5706 5158 5707 5159 With this capability enabled, KVM_GET_DIRTY_LOG will not automatically 5708 5160 clear and write-protect all pages that are returned as dirty. ··· 5729 5181 Userspace should not try to use KVM_CAP_MANUAL_DIRTY_LOG_PROTECT. 5730 5182 5731 5183 8. Other capabilities. 5732 - ---------------------- 5184 + ====================== 5733 5185 5734 5186 This section lists capabilities that give information about other 5735 5187 features of the KVM implementation. 5736 5188 5737 5189 8.1 KVM_CAP_PPC_HWRNG 5190 + --------------------- 5738 5191 5739 - Architectures: ppc 5192 + :Architectures: ppc 5740 5193 5741 5194 This capability, if KVM_CHECK_EXTENSION indicates that it is 5742 5195 available, means that that the kernel has an implementation of the ··· 5746 5197 with the KVM_CAP_PPC_ENABLE_HCALL capability. 5747 5198 5748 5199 8.2 KVM_CAP_HYPERV_SYNIC 5200 + ------------------------ 5749 5201 5750 - Architectures: x86 5202 + :Architectures: x86 5203 + 5751 5204 This capability, if KVM_CHECK_EXTENSION indicates that it is 5752 5205 available, means that that the kernel has an implementation of the 5753 5206 Hyper-V Synthetic interrupt controller(SynIC). Hyper-V SynIC is ··· 5761 5210 by the CPU, as it's incompatible with SynIC auto-EOI behavior. 5762 5211 5763 5212 8.3 KVM_CAP_PPC_RADIX_MMU 5213 + ------------------------- 5764 5214 5765 - Architectures: ppc 5215 + :Architectures: ppc 5766 5216 5767 5217 This capability, if KVM_CHECK_EXTENSION indicates that it is 5768 5218 available, means that that the kernel can support guests using the ··· 5771 5219 processor). 5772 5220 5773 5221 8.4 KVM_CAP_PPC_HASH_MMU_V3 5222 + --------------------------- 5774 5223 5775 - Architectures: ppc 5224 + :Architectures: ppc 5776 5225 5777 5226 This capability, if KVM_CHECK_EXTENSION indicates that it is 5778 5227 available, means that that the kernel can support guests using the ··· 5781 5228 the POWER9 processor), including in-memory segment tables. 5782 5229 5783 5230 8.5 KVM_CAP_MIPS_VZ 5231 + ------------------- 5784 5232 5785 - Architectures: mips 5233 + :Architectures: mips 5786 5234 5787 5235 This capability, if KVM_CHECK_EXTENSION on the main kvm handle indicates that 5788 5236 it is available, means that full hardware assisted virtualization capabilities ··· 5801 5247 possibility of other hardware assisted virtualization implementations which 5802 5248 may be incompatible with the MIPS VZ ASE. 5803 5249 5804 - 0: The trap & emulate implementation is in use to run guest code in user 5250 + == ========================================================================== 5251 + 0 The trap & emulate implementation is in use to run guest code in user 5805 5252 mode. Guest virtual memory segments are rearranged to fit the guest in the 5806 5253 user mode address space. 5807 5254 5808 - 1: The MIPS VZ ASE is in use, providing full hardware assisted 5255 + 1 The MIPS VZ ASE is in use, providing full hardware assisted 5809 5256 virtualization, including standard guest virtual memory segments. 5257 + == ========================================================================== 5810 5258 5811 5259 8.6 KVM_CAP_MIPS_TE 5260 + ------------------- 5812 5261 5813 - Architectures: mips 5262 + :Architectures: mips 5814 5263 5815 5264 This capability, if KVM_CHECK_EXTENSION on the main kvm handle indicates that 5816 5265 it is available, means that the trap & emulate implementation is available to ··· 5825 5268 available, it means that the VM is using trap & emulate. 5826 5269 5827 5270 8.7 KVM_CAP_MIPS_64BIT 5271 + ---------------------- 5828 5272 5829 - Architectures: mips 5273 + :Architectures: mips 5830 5274 5831 5275 This capability indicates the supported architecture type of the guest, i.e. the 5832 5276 supported register and address width. ··· 5837 5279 be checked specifically against known values (see below). All other values are 5838 5280 reserved. 5839 5281 5840 - 0: MIPS32 or microMIPS32. 5282 + == ======================================================================== 5283 + 0 MIPS32 or microMIPS32. 5841 5284 Both registers and addresses are 32-bits wide. 5842 5285 It will only be possible to run 32-bit guest code. 5843 5286 5844 - 1: MIPS64 or microMIPS64 with access only to 32-bit compatibility segments. 5287 + 1 MIPS64 or microMIPS64 with access only to 32-bit compatibility segments. 5845 5288 Registers are 64-bits wide, but addresses are 32-bits wide. 5846 5289 64-bit guest code may run but cannot access MIPS64 memory segments. 5847 5290 It will also be possible to run 32-bit guest code. 5848 5291 5849 - 2: MIPS64 or microMIPS64 with access to all address segments. 5292 + 2 MIPS64 or microMIPS64 with access to all address segments. 5850 5293 Both registers and addresses are 64-bits wide. 5851 5294 It will be possible to run 64-bit or 32-bit guest code. 5295 + == ======================================================================== 5852 5296 5853 5297 8.9 KVM_CAP_ARM_USER_IRQ 5298 + ------------------------ 5854 5299 5855 - Architectures: arm, arm64 5300 + :Architectures: arm, arm64 5301 + 5856 5302 This capability, if KVM_CHECK_EXTENSION indicates that it is available, means 5857 5303 that if userspace creates a VM without an in-kernel interrupt controller, it 5858 5304 will be notified of changes to the output level of in-kernel emulated devices, ··· 5883 5321 number larger than 0 indicating the version of this capability is implemented 5884 5322 and thereby which bits in in run->s.regs.device_irq_level can signal values. 5885 5323 5886 - Currently the following bits are defined for the device_irq_level bitmap: 5324 + Currently the following bits are defined for the device_irq_level bitmap:: 5887 5325 5888 5326 KVM_CAP_ARM_USER_IRQ >= 1: 5889 5327 ··· 5896 5334 listed above. 5897 5335 5898 5336 8.10 KVM_CAP_PPC_SMT_POSSIBLE 5337 + ----------------------------- 5899 5338 5900 - Architectures: ppc 5339 + :Architectures: ppc 5901 5340 5902 5341 Querying this capability returns a bitmap indicating the possible 5903 5342 virtual SMT modes that can be set using KVM_CAP_PPC_SMT. If bit N ··· 5906 5343 available. 5907 5344 5908 5345 8.11 KVM_CAP_HYPERV_SYNIC2 5346 + -------------------------- 5909 5347 5910 - Architectures: x86 5348 + :Architectures: x86 5911 5349 5912 5350 This capability enables a newer version of Hyper-V Synthetic interrupt 5913 5351 controller (SynIC). The only difference with KVM_CAP_HYPERV_SYNIC is that KVM ··· 5916 5352 writing to the respective MSRs. 5917 5353 5918 5354 8.12 KVM_CAP_HYPERV_VP_INDEX 5355 + ---------------------------- 5919 5356 5920 - Architectures: x86 5357 + :Architectures: x86 5921 5358 5922 5359 This capability indicates that userspace can load HV_X64_MSR_VP_INDEX msr. Its 5923 5360 value is used to denote the target vcpu for a SynIC interrupt. For ··· 5926 5361 capability is absent, userspace can still query this msr's value. 5927 5362 5928 5363 8.13 KVM_CAP_S390_AIS_MIGRATION 5364 + ------------------------------- 5929 5365 5930 - Architectures: s390 5931 - Parameters: none 5366 + :Architectures: s390 5367 + :Parameters: none 5932 5368 5933 5369 This capability indicates if the flic device will be able to get/set the 5934 5370 AIS states for migration via the KVM_DEV_FLIC_AISM_ALL attribute and allows 5935 5371 to discover this without having to create a flic device. 5936 5372 5937 5373 8.14 KVM_CAP_S390_PSW 5374 + --------------------- 5938 5375 5939 - Architectures: s390 5376 + :Architectures: s390 5940 5377 5941 5378 This capability indicates that the PSW is exposed via the kvm_run structure. 5942 5379 5943 5380 8.15 KVM_CAP_S390_GMAP 5381 + ---------------------- 5944 5382 5945 - Architectures: s390 5383 + :Architectures: s390 5946 5384 5947 5385 This capability indicates that the user space memory used as guest mapping can 5948 5386 be anywhere in the user memory address space, as long as the memory slots are 5949 5387 aligned and sized to a segment (1MB) boundary. 5950 5388 5951 5389 8.16 KVM_CAP_S390_COW 5390 + --------------------- 5952 5391 5953 - Architectures: s390 5392 + :Architectures: s390 5954 5393 5955 5394 This capability indicates that the user space memory used as guest mapping can 5956 5395 use copy-on-write semantics as well as dirty pages tracking via read-only page 5957 5396 tables. 5958 5397 5959 5398 8.17 KVM_CAP_S390_BPB 5399 + --------------------- 5960 5400 5961 - Architectures: s390 5401 + :Architectures: s390 5962 5402 5963 5403 This capability indicates that kvm will implement the interfaces to handle 5964 5404 reset, migration and nested KVM for branch prediction blocking. The stfle 5965 5405 facility 82 should not be provided to the guest without this capability. 5966 5406 5967 5407 8.18 KVM_CAP_HYPERV_TLBFLUSH 5408 + ---------------------------- 5968 5409 5969 - Architectures: x86 5410 + :Architectures: x86 5970 5411 5971 5412 This capability indicates that KVM supports paravirtualized Hyper-V TLB Flush 5972 5413 hypercalls: ··· 5980 5409 HvFlushVirtualAddressList, HvFlushVirtualAddressListEx. 5981 5410 5982 5411 8.19 KVM_CAP_ARM_INJECT_SERROR_ESR 5412 + ---------------------------------- 5983 5413 5984 - Architectures: arm, arm64 5414 + :Architectures: arm, arm64 5985 5415 5986 5416 This capability indicates that userspace can specify (via the 5987 5417 KVM_SET_VCPU_EVENTS ioctl) the syndrome value reported to the guest when it ··· 5993 5421 AArch64, this value will be reported in the ISS field of ESR_ELx. 5994 5422 5995 5423 See KVM_CAP_VCPU_EVENTS for more details. 5996 - 8.20 KVM_CAP_HYPERV_SEND_IPI 5997 5424 5998 - Architectures: x86 5425 + 8.20 KVM_CAP_HYPERV_SEND_IPI 5426 + ---------------------------- 5427 + 5428 + :Architectures: x86 5999 5429 6000 5430 This capability indicates that KVM supports paravirtualized Hyper-V IPI send 6001 5431 hypercalls: 6002 5432 HvCallSendSyntheticClusterIpi, HvCallSendSyntheticClusterIpiEx. 6003 - 8.21 KVM_CAP_HYPERV_DIRECT_TLBFLUSH 6004 5433 6005 - Architecture: x86 5434 + 8.21 KVM_CAP_HYPERV_DIRECT_TLBFLUSH 5435 + ----------------------------------- 5436 + 5437 + :Architecture: x86 6006 5438 6007 5439 This capability indicates that KVM running on top of Hyper-V hypervisor 6008 5440 enables Direct TLB flush for its guests meaning that TLB flush
+1
Documentation/virt/kvm/index.rst
··· 7 7 .. toctree:: 8 8 :maxdepth: 2 9 9 10 + api 10 11 amd-memory-encryption 11 12 cpuid 12 13 halt-polling