diff options
Diffstat (limited to 'Documentation/virtual/kvm/api.txt')
-rw-r--r-- | Documentation/virtual/kvm/api.txt | 102 |
1 files changed, 71 insertions, 31 deletions
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index 7610eaa4d491..0007fef4ed81 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt | |||
@@ -68,9 +68,12 @@ description: | |||
68 | 68 | ||
69 | Capability: which KVM extension provides this ioctl. Can be 'basic', | 69 | Capability: which KVM extension provides this ioctl. Can be 'basic', |
70 | which means that is will be provided by any kernel that supports | 70 | which means that is will be provided by any kernel that supports |
71 | API version 12 (see section 4.1), or a KVM_CAP_xyz constant, which | 71 | API version 12 (see section 4.1), a KVM_CAP_xyz constant, which |
72 | means availability needs to be checked with KVM_CHECK_EXTENSION | 72 | means availability needs to be checked with KVM_CHECK_EXTENSION |
73 | (see section 4.4). | 73 | (see section 4.4), or 'none' which means that while not all kernels |
74 | support this ioctl, there's no capability bit to check its | ||
75 | availability: for kernels that don't support the ioctl, | ||
76 | the ioctl returns -ENOTTY. | ||
74 | 77 | ||
75 | Architectures: which instruction set architectures provide this ioctl. | 78 | Architectures: which instruction set architectures provide this ioctl. |
76 | x86 includes both i386 and x86_64. | 79 | x86 includes both i386 and x86_64. |
@@ -604,7 +607,7 @@ struct kvm_fpu { | |||
604 | 4.24 KVM_CREATE_IRQCHIP | 607 | 4.24 KVM_CREATE_IRQCHIP |
605 | 608 | ||
606 | Capability: KVM_CAP_IRQCHIP, KVM_CAP_S390_IRQCHIP (s390) | 609 | Capability: KVM_CAP_IRQCHIP, KVM_CAP_S390_IRQCHIP (s390) |
607 | Architectures: x86, ia64, ARM, arm64, s390 | 610 | Architectures: x86, ARM, arm64, s390 |
608 | Type: vm ioctl | 611 | Type: vm ioctl |
609 | Parameters: none | 612 | Parameters: none |
610 | Returns: 0 on success, -1 on error | 613 | Returns: 0 on success, -1 on error |
@@ -612,7 +615,7 @@ Returns: 0 on success, -1 on error | |||
612 | Creates an interrupt controller model in the kernel. On x86, creates a virtual | 615 | Creates an interrupt controller model in the kernel. On x86, creates a virtual |
613 | ioapic, a virtual PIC (two PICs, nested), and sets up future vcpus to have a | 616 | ioapic, a virtual PIC (two PICs, nested), and sets up future vcpus to have a |
614 | local APIC. IRQ routing for GSIs 0-15 is set to both PIC and IOAPIC; GSI 16-23 | 617 | local APIC. IRQ routing for GSIs 0-15 is set to both PIC and IOAPIC; GSI 16-23 |
615 | only go to the IOAPIC. On ia64, a IOSAPIC is created. On ARM/arm64, a GIC is | 618 | only go to the IOAPIC. On ARM/arm64, a GIC is |
616 | created. On s390, a dummy irq routing table is created. | 619 | created. On s390, a dummy irq routing table is created. |
617 | 620 | ||
618 | Note that on s390 the KVM_CAP_S390_IRQCHIP vm capability needs to be enabled | 621 | Note that on s390 the KVM_CAP_S390_IRQCHIP vm capability needs to be enabled |
@@ -622,7 +625,7 @@ before KVM_CREATE_IRQCHIP can be used. | |||
622 | 4.25 KVM_IRQ_LINE | 625 | 4.25 KVM_IRQ_LINE |
623 | 626 | ||
624 | Capability: KVM_CAP_IRQCHIP | 627 | Capability: KVM_CAP_IRQCHIP |
625 | Architectures: x86, ia64, arm, arm64 | 628 | Architectures: x86, arm, arm64 |
626 | Type: vm ioctl | 629 | Type: vm ioctl |
627 | Parameters: struct kvm_irq_level | 630 | Parameters: struct kvm_irq_level |
628 | Returns: 0 on success, -1 on error | 631 | Returns: 0 on success, -1 on error |
@@ -676,7 +679,7 @@ struct kvm_irq_level { | |||
676 | 4.26 KVM_GET_IRQCHIP | 679 | 4.26 KVM_GET_IRQCHIP |
677 | 680 | ||
678 | Capability: KVM_CAP_IRQCHIP | 681 | Capability: KVM_CAP_IRQCHIP |
679 | Architectures: x86, ia64 | 682 | Architectures: x86 |
680 | Type: vm ioctl | 683 | Type: vm ioctl |
681 | Parameters: struct kvm_irqchip (in/out) | 684 | Parameters: struct kvm_irqchip (in/out) |
682 | Returns: 0 on success, -1 on error | 685 | Returns: 0 on success, -1 on error |
@@ -698,7 +701,7 @@ struct kvm_irqchip { | |||
698 | 4.27 KVM_SET_IRQCHIP | 701 | 4.27 KVM_SET_IRQCHIP |
699 | 702 | ||
700 | Capability: KVM_CAP_IRQCHIP | 703 | Capability: KVM_CAP_IRQCHIP |
701 | Architectures: x86, ia64 | 704 | Architectures: x86 |
702 | Type: vm ioctl | 705 | Type: vm ioctl |
703 | Parameters: struct kvm_irqchip (in) | 706 | Parameters: struct kvm_irqchip (in) |
704 | Returns: 0 on success, -1 on error | 707 | Returns: 0 on success, -1 on error |
@@ -991,7 +994,7 @@ for vm-wide capabilities. | |||
991 | 4.38 KVM_GET_MP_STATE | 994 | 4.38 KVM_GET_MP_STATE |
992 | 995 | ||
993 | Capability: KVM_CAP_MP_STATE | 996 | Capability: KVM_CAP_MP_STATE |
994 | Architectures: x86, ia64, s390 | 997 | Architectures: x86, s390 |
995 | Type: vcpu ioctl | 998 | Type: vcpu ioctl |
996 | Parameters: struct kvm_mp_state (out) | 999 | Parameters: struct kvm_mp_state (out) |
997 | Returns: 0 on success; -1 on error | 1000 | Returns: 0 on success; -1 on error |
@@ -1005,16 +1008,15 @@ uniprocessor guests). | |||
1005 | 1008 | ||
1006 | Possible values are: | 1009 | Possible values are: |
1007 | 1010 | ||
1008 | - KVM_MP_STATE_RUNNABLE: the vcpu is currently running [x86, ia64] | 1011 | - KVM_MP_STATE_RUNNABLE: the vcpu is currently running [x86] |
1009 | - KVM_MP_STATE_UNINITIALIZED: the vcpu is an application processor (AP) | 1012 | - KVM_MP_STATE_UNINITIALIZED: the vcpu is an application processor (AP) |
1010 | which has not yet received an INIT signal [x86, | 1013 | which has not yet received an INIT signal [x86] |
1011 | ia64] | ||
1012 | - KVM_MP_STATE_INIT_RECEIVED: the vcpu has received an INIT signal, and is | 1014 | - KVM_MP_STATE_INIT_RECEIVED: the vcpu has received an INIT signal, and is |
1013 | now ready for a SIPI [x86, ia64] | 1015 | now ready for a SIPI [x86] |
1014 | - KVM_MP_STATE_HALTED: the vcpu has executed a HLT instruction and | 1016 | - KVM_MP_STATE_HALTED: the vcpu has executed a HLT instruction and |
1015 | is waiting for an interrupt [x86, ia64] | 1017 | is waiting for an interrupt [x86] |
1016 | - KVM_MP_STATE_SIPI_RECEIVED: the vcpu has just received a SIPI (vector | 1018 | - KVM_MP_STATE_SIPI_RECEIVED: the vcpu has just received a SIPI (vector |
1017 | accessible via KVM_GET_VCPU_EVENTS) [x86, ia64] | 1019 | accessible via KVM_GET_VCPU_EVENTS) [x86] |
1018 | - KVM_MP_STATE_STOPPED: the vcpu is stopped [s390] | 1020 | - KVM_MP_STATE_STOPPED: the vcpu is stopped [s390] |
1019 | - KVM_MP_STATE_CHECK_STOP: the vcpu is in a special error state [s390] | 1021 | - KVM_MP_STATE_CHECK_STOP: the vcpu is in a special error state [s390] |
1020 | - KVM_MP_STATE_OPERATING: the vcpu is operating (running or halted) | 1022 | - KVM_MP_STATE_OPERATING: the vcpu is operating (running or halted) |
@@ -1022,7 +1024,7 @@ Possible values are: | |||
1022 | - KVM_MP_STATE_LOAD: the vcpu is in a special load/startup state | 1024 | - KVM_MP_STATE_LOAD: the vcpu is in a special load/startup state |
1023 | [s390] | 1025 | [s390] |
1024 | 1026 | ||
1025 | On x86 and ia64, this ioctl is only useful after KVM_CREATE_IRQCHIP. Without an | 1027 | On x86, this ioctl is only useful after KVM_CREATE_IRQCHIP. Without an |
1026 | in-kernel irqchip, the multiprocessing state must be maintained by userspace on | 1028 | in-kernel irqchip, the multiprocessing state must be maintained by userspace on |
1027 | these architectures. | 1029 | these architectures. |
1028 | 1030 | ||
@@ -1030,7 +1032,7 @@ these architectures. | |||
1030 | 4.39 KVM_SET_MP_STATE | 1032 | 4.39 KVM_SET_MP_STATE |
1031 | 1033 | ||
1032 | Capability: KVM_CAP_MP_STATE | 1034 | Capability: KVM_CAP_MP_STATE |
1033 | Architectures: x86, ia64, s390 | 1035 | Architectures: x86, s390 |
1034 | Type: vcpu ioctl | 1036 | Type: vcpu ioctl |
1035 | Parameters: struct kvm_mp_state (in) | 1037 | Parameters: struct kvm_mp_state (in) |
1036 | Returns: 0 on success; -1 on error | 1038 | Returns: 0 on success; -1 on error |
@@ -1038,7 +1040,7 @@ Returns: 0 on success; -1 on error | |||
1038 | Sets the vcpu's current "multiprocessing state"; see KVM_GET_MP_STATE for | 1040 | Sets the vcpu's current "multiprocessing state"; see KVM_GET_MP_STATE for |
1039 | arguments. | 1041 | arguments. |
1040 | 1042 | ||
1041 | On x86 and ia64, this ioctl is only useful after KVM_CREATE_IRQCHIP. Without an | 1043 | On x86, this ioctl is only useful after KVM_CREATE_IRQCHIP. Without an |
1042 | in-kernel irqchip, the multiprocessing state must be maintained by userspace on | 1044 | in-kernel irqchip, the multiprocessing state must be maintained by userspace on |
1043 | these architectures. | 1045 | these architectures. |
1044 | 1046 | ||
@@ -1065,7 +1067,7 @@ documentation when it pops into existence). | |||
1065 | 4.41 KVM_SET_BOOT_CPU_ID | 1067 | 4.41 KVM_SET_BOOT_CPU_ID |
1066 | 1068 | ||
1067 | Capability: KVM_CAP_SET_BOOT_CPU_ID | 1069 | Capability: KVM_CAP_SET_BOOT_CPU_ID |
1068 | Architectures: x86, ia64 | 1070 | Architectures: x86 |
1069 | Type: vm ioctl | 1071 | Type: vm ioctl |
1070 | Parameters: unsigned long vcpu_id | 1072 | Parameters: unsigned long vcpu_id |
1071 | Returns: 0 on success, -1 on error | 1073 | Returns: 0 on success, -1 on error |
@@ -1257,8 +1259,8 @@ The flags bitmap is defined as: | |||
1257 | 1259 | ||
1258 | 4.48 KVM_ASSIGN_PCI_DEVICE | 1260 | 4.48 KVM_ASSIGN_PCI_DEVICE |
1259 | 1261 | ||
1260 | Capability: KVM_CAP_DEVICE_ASSIGNMENT | 1262 | Capability: none |
1261 | Architectures: x86 ia64 | 1263 | Architectures: x86 |
1262 | Type: vm ioctl | 1264 | Type: vm ioctl |
1263 | Parameters: struct kvm_assigned_pci_dev (in) | 1265 | Parameters: struct kvm_assigned_pci_dev (in) |
1264 | Returns: 0 on success, -1 on error | 1266 | Returns: 0 on success, -1 on error |
@@ -1298,25 +1300,36 @@ Only PCI header type 0 devices with PCI BAR resources are supported by | |||
1298 | device assignment. The user requesting this ioctl must have read/write | 1300 | device assignment. The user requesting this ioctl must have read/write |
1299 | access to the PCI sysfs resource files associated with the device. | 1301 | access to the PCI sysfs resource files associated with the device. |
1300 | 1302 | ||
1303 | Errors: | ||
1304 | ENOTTY: kernel does not support this ioctl | ||
1305 | |||
1306 | Other error conditions may be defined by individual device types or | ||
1307 | have their standard meanings. | ||
1308 | |||
1301 | 1309 | ||
1302 | 4.49 KVM_DEASSIGN_PCI_DEVICE | 1310 | 4.49 KVM_DEASSIGN_PCI_DEVICE |
1303 | 1311 | ||
1304 | Capability: KVM_CAP_DEVICE_DEASSIGNMENT | 1312 | Capability: none |
1305 | Architectures: x86 ia64 | 1313 | Architectures: x86 |
1306 | Type: vm ioctl | 1314 | Type: vm ioctl |
1307 | Parameters: struct kvm_assigned_pci_dev (in) | 1315 | Parameters: struct kvm_assigned_pci_dev (in) |
1308 | Returns: 0 on success, -1 on error | 1316 | Returns: 0 on success, -1 on error |
1309 | 1317 | ||
1310 | Ends PCI device assignment, releasing all associated resources. | 1318 | Ends PCI device assignment, releasing all associated resources. |
1311 | 1319 | ||
1312 | See KVM_CAP_DEVICE_ASSIGNMENT for the data structure. Only assigned_dev_id is | 1320 | See KVM_ASSIGN_PCI_DEVICE for the data structure. Only assigned_dev_id is |
1313 | used in kvm_assigned_pci_dev to identify the device. | 1321 | used in kvm_assigned_pci_dev to identify the device. |
1314 | 1322 | ||
1323 | Errors: | ||
1324 | ENOTTY: kernel does not support this ioctl | ||
1325 | |||
1326 | Other error conditions may be defined by individual device types or | ||
1327 | have their standard meanings. | ||
1315 | 1328 | ||
1316 | 4.50 KVM_ASSIGN_DEV_IRQ | 1329 | 4.50 KVM_ASSIGN_DEV_IRQ |
1317 | 1330 | ||
1318 | Capability: KVM_CAP_ASSIGN_DEV_IRQ | 1331 | Capability: KVM_CAP_ASSIGN_DEV_IRQ |
1319 | Architectures: x86 ia64 | 1332 | Architectures: x86 |
1320 | Type: vm ioctl | 1333 | Type: vm ioctl |
1321 | Parameters: struct kvm_assigned_irq (in) | 1334 | Parameters: struct kvm_assigned_irq (in) |
1322 | Returns: 0 on success, -1 on error | 1335 | Returns: 0 on success, -1 on error |
@@ -1346,11 +1359,17 @@ The following flags are defined: | |||
1346 | It is not valid to specify multiple types per host or guest IRQ. However, the | 1359 | It is not valid to specify multiple types per host or guest IRQ. However, the |
1347 | IRQ type of host and guest can differ or can even be null. | 1360 | IRQ type of host and guest can differ or can even be null. |
1348 | 1361 | ||
1362 | Errors: | ||
1363 | ENOTTY: kernel does not support this ioctl | ||
1364 | |||
1365 | Other error conditions may be defined by individual device types or | ||
1366 | have their standard meanings. | ||
1367 | |||
1349 | 1368 | ||
1350 | 4.51 KVM_DEASSIGN_DEV_IRQ | 1369 | 4.51 KVM_DEASSIGN_DEV_IRQ |
1351 | 1370 | ||
1352 | Capability: KVM_CAP_ASSIGN_DEV_IRQ | 1371 | Capability: KVM_CAP_ASSIGN_DEV_IRQ |
1353 | Architectures: x86 ia64 | 1372 | Architectures: x86 |
1354 | Type: vm ioctl | 1373 | Type: vm ioctl |
1355 | Parameters: struct kvm_assigned_irq (in) | 1374 | Parameters: struct kvm_assigned_irq (in) |
1356 | Returns: 0 on success, -1 on error | 1375 | Returns: 0 on success, -1 on error |
@@ -1365,7 +1384,7 @@ KVM_ASSIGN_DEV_IRQ. Partial deassignment of host or guest IRQ is allowed. | |||
1365 | 4.52 KVM_SET_GSI_ROUTING | 1384 | 4.52 KVM_SET_GSI_ROUTING |
1366 | 1385 | ||
1367 | Capability: KVM_CAP_IRQ_ROUTING | 1386 | Capability: KVM_CAP_IRQ_ROUTING |
1368 | Architectures: x86 ia64 s390 | 1387 | Architectures: x86 s390 |
1369 | Type: vm ioctl | 1388 | Type: vm ioctl |
1370 | Parameters: struct kvm_irq_routing (in) | 1389 | Parameters: struct kvm_irq_routing (in) |
1371 | Returns: 0 on success, -1 on error | 1390 | Returns: 0 on success, -1 on error |
@@ -1423,8 +1442,8 @@ struct kvm_irq_routing_s390_adapter { | |||
1423 | 1442 | ||
1424 | 4.53 KVM_ASSIGN_SET_MSIX_NR | 1443 | 4.53 KVM_ASSIGN_SET_MSIX_NR |
1425 | 1444 | ||
1426 | Capability: KVM_CAP_DEVICE_MSIX | 1445 | Capability: none |
1427 | Architectures: x86 ia64 | 1446 | Architectures: x86 |
1428 | Type: vm ioctl | 1447 | Type: vm ioctl |
1429 | Parameters: struct kvm_assigned_msix_nr (in) | 1448 | Parameters: struct kvm_assigned_msix_nr (in) |
1430 | Returns: 0 on success, -1 on error | 1449 | Returns: 0 on success, -1 on error |
@@ -1445,8 +1464,8 @@ struct kvm_assigned_msix_nr { | |||
1445 | 1464 | ||
1446 | 4.54 KVM_ASSIGN_SET_MSIX_ENTRY | 1465 | 4.54 KVM_ASSIGN_SET_MSIX_ENTRY |
1447 | 1466 | ||
1448 | Capability: KVM_CAP_DEVICE_MSIX | 1467 | Capability: none |
1449 | Architectures: x86 ia64 | 1468 | Architectures: x86 |
1450 | Type: vm ioctl | 1469 | Type: vm ioctl |
1451 | Parameters: struct kvm_assigned_msix_entry (in) | 1470 | Parameters: struct kvm_assigned_msix_entry (in) |
1452 | Returns: 0 on success, -1 on error | 1471 | Returns: 0 on success, -1 on error |
@@ -1461,6 +1480,12 @@ struct kvm_assigned_msix_entry { | |||
1461 | __u16 padding[3]; | 1480 | __u16 padding[3]; |
1462 | }; | 1481 | }; |
1463 | 1482 | ||
1483 | Errors: | ||
1484 | ENOTTY: kernel does not support this ioctl | ||
1485 | |||
1486 | Other error conditions may be defined by individual device types or | ||
1487 | have their standard meanings. | ||
1488 | |||
1464 | 1489 | ||
1465 | 4.55 KVM_SET_TSC_KHZ | 1490 | 4.55 KVM_SET_TSC_KHZ |
1466 | 1491 | ||
@@ -2453,9 +2478,15 @@ return ENOEXEC for that vcpu. | |||
2453 | Note that because some registers reflect machine topology, all vcpus | 2478 | Note that because some registers reflect machine topology, all vcpus |
2454 | should be created before this ioctl is invoked. | 2479 | should be created before this ioctl is invoked. |
2455 | 2480 | ||
2481 | Userspace can call this function multiple times for a given vcpu, including | ||
2482 | after the vcpu has been run. This will reset the vcpu to its initial | ||
2483 | state. All calls to this function after the initial call must use the same | ||
2484 | target and same set of feature flags, otherwise EINVAL will be returned. | ||
2485 | |||
2456 | Possible features: | 2486 | Possible features: |
2457 | - KVM_ARM_VCPU_POWER_OFF: Starts the CPU in a power-off state. | 2487 | - KVM_ARM_VCPU_POWER_OFF: Starts the CPU in a power-off state. |
2458 | Depends on KVM_CAP_ARM_PSCI. | 2488 | Depends on KVM_CAP_ARM_PSCI. If not set, the CPU will be powered on |
2489 | and execute guest code when KVM_RUN is called. | ||
2459 | - KVM_ARM_VCPU_EL1_32BIT: Starts the CPU in a 32bit mode. | 2490 | - KVM_ARM_VCPU_EL1_32BIT: Starts the CPU in a 32bit mode. |
2460 | Depends on KVM_CAP_ARM_EL1_32BIT (arm64 only). | 2491 | Depends on KVM_CAP_ARM_EL1_32BIT (arm64 only). |
2461 | - KVM_ARM_VCPU_PSCI_0_2: Emulate PSCI v0.2 for the CPU. | 2492 | - KVM_ARM_VCPU_PSCI_0_2: Emulate PSCI v0.2 for the CPU. |
@@ -2951,6 +2982,15 @@ HVC instruction based PSCI call from the vcpu. The 'type' field describes | |||
2951 | the system-level event type. The 'flags' field describes architecture | 2982 | the system-level event type. The 'flags' field describes architecture |
2952 | specific flags for the system-level event. | 2983 | specific flags for the system-level event. |
2953 | 2984 | ||
2985 | Valid values for 'type' are: | ||
2986 | KVM_SYSTEM_EVENT_SHUTDOWN -- the guest has requested a shutdown of the | ||
2987 | VM. Userspace is not obliged to honour this, and if it does honour | ||
2988 | this does not need to destroy the VM synchronously (ie it may call | ||
2989 | KVM_RUN again before shutdown finally occurs). | ||
2990 | KVM_SYSTEM_EVENT_RESET -- the guest has requested a reset of the VM. | ||
2991 | As with SHUTDOWN, userspace can choose to ignore the request, or | ||
2992 | to schedule the reset to occur in the future and may call KVM_RUN again. | ||
2993 | |||
2954 | /* Fix the size of the union. */ | 2994 | /* Fix the size of the union. */ |
2955 | char padding[256]; | 2995 | char padding[256]; |
2956 | }; | 2996 | }; |