aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/virtual/kvm/api.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/virtual/kvm/api.txt')
-rw-r--r--Documentation/virtual/kvm/api.txt102
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 {
6044.24 KVM_CREATE_IRQCHIP 6074.24 KVM_CREATE_IRQCHIP
605 608
606Capability: KVM_CAP_IRQCHIP, KVM_CAP_S390_IRQCHIP (s390) 609Capability: KVM_CAP_IRQCHIP, KVM_CAP_S390_IRQCHIP (s390)
607Architectures: x86, ia64, ARM, arm64, s390 610Architectures: x86, ARM, arm64, s390
608Type: vm ioctl 611Type: vm ioctl
609Parameters: none 612Parameters: none
610Returns: 0 on success, -1 on error 613Returns: 0 on success, -1 on error
@@ -612,7 +615,7 @@ Returns: 0 on success, -1 on error
612Creates an interrupt controller model in the kernel. On x86, creates a virtual 615Creates an interrupt controller model in the kernel. On x86, creates a virtual
613ioapic, a virtual PIC (two PICs, nested), and sets up future vcpus to have a 616ioapic, a virtual PIC (two PICs, nested), and sets up future vcpus to have a
614local APIC. IRQ routing for GSIs 0-15 is set to both PIC and IOAPIC; GSI 16-23 617local APIC. IRQ routing for GSIs 0-15 is set to both PIC and IOAPIC; GSI 16-23
615only go to the IOAPIC. On ia64, a IOSAPIC is created. On ARM/arm64, a GIC is 618only go to the IOAPIC. On ARM/arm64, a GIC is
616created. On s390, a dummy irq routing table is created. 619created. On s390, a dummy irq routing table is created.
617 620
618Note that on s390 the KVM_CAP_S390_IRQCHIP vm capability needs to be enabled 621Note 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.
6224.25 KVM_IRQ_LINE 6254.25 KVM_IRQ_LINE
623 626
624Capability: KVM_CAP_IRQCHIP 627Capability: KVM_CAP_IRQCHIP
625Architectures: x86, ia64, arm, arm64 628Architectures: x86, arm, arm64
626Type: vm ioctl 629Type: vm ioctl
627Parameters: struct kvm_irq_level 630Parameters: struct kvm_irq_level
628Returns: 0 on success, -1 on error 631Returns: 0 on success, -1 on error
@@ -676,7 +679,7 @@ struct kvm_irq_level {
6764.26 KVM_GET_IRQCHIP 6794.26 KVM_GET_IRQCHIP
677 680
678Capability: KVM_CAP_IRQCHIP 681Capability: KVM_CAP_IRQCHIP
679Architectures: x86, ia64 682Architectures: x86
680Type: vm ioctl 683Type: vm ioctl
681Parameters: struct kvm_irqchip (in/out) 684Parameters: struct kvm_irqchip (in/out)
682Returns: 0 on success, -1 on error 685Returns: 0 on success, -1 on error
@@ -698,7 +701,7 @@ struct kvm_irqchip {
6984.27 KVM_SET_IRQCHIP 7014.27 KVM_SET_IRQCHIP
699 702
700Capability: KVM_CAP_IRQCHIP 703Capability: KVM_CAP_IRQCHIP
701Architectures: x86, ia64 704Architectures: x86
702Type: vm ioctl 705Type: vm ioctl
703Parameters: struct kvm_irqchip (in) 706Parameters: struct kvm_irqchip (in)
704Returns: 0 on success, -1 on error 707Returns: 0 on success, -1 on error
@@ -991,7 +994,7 @@ for vm-wide capabilities.
9914.38 KVM_GET_MP_STATE 9944.38 KVM_GET_MP_STATE
992 995
993Capability: KVM_CAP_MP_STATE 996Capability: KVM_CAP_MP_STATE
994Architectures: x86, ia64, s390 997Architectures: x86, s390
995Type: vcpu ioctl 998Type: vcpu ioctl
996Parameters: struct kvm_mp_state (out) 999Parameters: struct kvm_mp_state (out)
997Returns: 0 on success; -1 on error 1000Returns: 0 on success; -1 on error
@@ -1005,16 +1008,15 @@ uniprocessor guests).
1005 1008
1006Possible values are: 1009Possible 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
1025On x86 and ia64, this ioctl is only useful after KVM_CREATE_IRQCHIP. Without an 1027On x86, this ioctl is only useful after KVM_CREATE_IRQCHIP. Without an
1026in-kernel irqchip, the multiprocessing state must be maintained by userspace on 1028in-kernel irqchip, the multiprocessing state must be maintained by userspace on
1027these architectures. 1029these architectures.
1028 1030
@@ -1030,7 +1032,7 @@ these architectures.
10304.39 KVM_SET_MP_STATE 10324.39 KVM_SET_MP_STATE
1031 1033
1032Capability: KVM_CAP_MP_STATE 1034Capability: KVM_CAP_MP_STATE
1033Architectures: x86, ia64, s390 1035Architectures: x86, s390
1034Type: vcpu ioctl 1036Type: vcpu ioctl
1035Parameters: struct kvm_mp_state (in) 1037Parameters: struct kvm_mp_state (in)
1036Returns: 0 on success; -1 on error 1038Returns: 0 on success; -1 on error
@@ -1038,7 +1040,7 @@ Returns: 0 on success; -1 on error
1038Sets the vcpu's current "multiprocessing state"; see KVM_GET_MP_STATE for 1040Sets the vcpu's current "multiprocessing state"; see KVM_GET_MP_STATE for
1039arguments. 1041arguments.
1040 1042
1041On x86 and ia64, this ioctl is only useful after KVM_CREATE_IRQCHIP. Without an 1043On x86, this ioctl is only useful after KVM_CREATE_IRQCHIP. Without an
1042in-kernel irqchip, the multiprocessing state must be maintained by userspace on 1044in-kernel irqchip, the multiprocessing state must be maintained by userspace on
1043these architectures. 1045these architectures.
1044 1046
@@ -1065,7 +1067,7 @@ documentation when it pops into existence).
10654.41 KVM_SET_BOOT_CPU_ID 10674.41 KVM_SET_BOOT_CPU_ID
1066 1068
1067Capability: KVM_CAP_SET_BOOT_CPU_ID 1069Capability: KVM_CAP_SET_BOOT_CPU_ID
1068Architectures: x86, ia64 1070Architectures: x86
1069Type: vm ioctl 1071Type: vm ioctl
1070Parameters: unsigned long vcpu_id 1072Parameters: unsigned long vcpu_id
1071Returns: 0 on success, -1 on error 1073Returns: 0 on success, -1 on error
@@ -1257,8 +1259,8 @@ The flags bitmap is defined as:
1257 1259
12584.48 KVM_ASSIGN_PCI_DEVICE 12604.48 KVM_ASSIGN_PCI_DEVICE
1259 1261
1260Capability: KVM_CAP_DEVICE_ASSIGNMENT 1262Capability: none
1261Architectures: x86 ia64 1263Architectures: x86
1262Type: vm ioctl 1264Type: vm ioctl
1263Parameters: struct kvm_assigned_pci_dev (in) 1265Parameters: struct kvm_assigned_pci_dev (in)
1264Returns: 0 on success, -1 on error 1266Returns: 0 on success, -1 on error
@@ -1298,25 +1300,36 @@ Only PCI header type 0 devices with PCI BAR resources are supported by
1298device assignment. The user requesting this ioctl must have read/write 1300device assignment. The user requesting this ioctl must have read/write
1299access to the PCI sysfs resource files associated with the device. 1301access to the PCI sysfs resource files associated with the device.
1300 1302
1303Errors:
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
13024.49 KVM_DEASSIGN_PCI_DEVICE 13104.49 KVM_DEASSIGN_PCI_DEVICE
1303 1311
1304Capability: KVM_CAP_DEVICE_DEASSIGNMENT 1312Capability: none
1305Architectures: x86 ia64 1313Architectures: x86
1306Type: vm ioctl 1314Type: vm ioctl
1307Parameters: struct kvm_assigned_pci_dev (in) 1315Parameters: struct kvm_assigned_pci_dev (in)
1308Returns: 0 on success, -1 on error 1316Returns: 0 on success, -1 on error
1309 1317
1310Ends PCI device assignment, releasing all associated resources. 1318Ends PCI device assignment, releasing all associated resources.
1311 1319
1312See KVM_CAP_DEVICE_ASSIGNMENT for the data structure. Only assigned_dev_id is 1320See KVM_ASSIGN_PCI_DEVICE for the data structure. Only assigned_dev_id is
1313used in kvm_assigned_pci_dev to identify the device. 1321used in kvm_assigned_pci_dev to identify the device.
1314 1322
1323Errors:
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
13164.50 KVM_ASSIGN_DEV_IRQ 13294.50 KVM_ASSIGN_DEV_IRQ
1317 1330
1318Capability: KVM_CAP_ASSIGN_DEV_IRQ 1331Capability: KVM_CAP_ASSIGN_DEV_IRQ
1319Architectures: x86 ia64 1332Architectures: x86
1320Type: vm ioctl 1333Type: vm ioctl
1321Parameters: struct kvm_assigned_irq (in) 1334Parameters: struct kvm_assigned_irq (in)
1322Returns: 0 on success, -1 on error 1335Returns: 0 on success, -1 on error
@@ -1346,11 +1359,17 @@ The following flags are defined:
1346It is not valid to specify multiple types per host or guest IRQ. However, the 1359It is not valid to specify multiple types per host or guest IRQ. However, the
1347IRQ type of host and guest can differ or can even be null. 1360IRQ type of host and guest can differ or can even be null.
1348 1361
1362Errors:
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
13504.51 KVM_DEASSIGN_DEV_IRQ 13694.51 KVM_DEASSIGN_DEV_IRQ
1351 1370
1352Capability: KVM_CAP_ASSIGN_DEV_IRQ 1371Capability: KVM_CAP_ASSIGN_DEV_IRQ
1353Architectures: x86 ia64 1372Architectures: x86
1354Type: vm ioctl 1373Type: vm ioctl
1355Parameters: struct kvm_assigned_irq (in) 1374Parameters: struct kvm_assigned_irq (in)
1356Returns: 0 on success, -1 on error 1375Returns: 0 on success, -1 on error
@@ -1365,7 +1384,7 @@ KVM_ASSIGN_DEV_IRQ. Partial deassignment of host or guest IRQ is allowed.
13654.52 KVM_SET_GSI_ROUTING 13844.52 KVM_SET_GSI_ROUTING
1366 1385
1367Capability: KVM_CAP_IRQ_ROUTING 1386Capability: KVM_CAP_IRQ_ROUTING
1368Architectures: x86 ia64 s390 1387Architectures: x86 s390
1369Type: vm ioctl 1388Type: vm ioctl
1370Parameters: struct kvm_irq_routing (in) 1389Parameters: struct kvm_irq_routing (in)
1371Returns: 0 on success, -1 on error 1390Returns: 0 on success, -1 on error
@@ -1423,8 +1442,8 @@ struct kvm_irq_routing_s390_adapter {
1423 1442
14244.53 KVM_ASSIGN_SET_MSIX_NR 14434.53 KVM_ASSIGN_SET_MSIX_NR
1425 1444
1426Capability: KVM_CAP_DEVICE_MSIX 1445Capability: none
1427Architectures: x86 ia64 1446Architectures: x86
1428Type: vm ioctl 1447Type: vm ioctl
1429Parameters: struct kvm_assigned_msix_nr (in) 1448Parameters: struct kvm_assigned_msix_nr (in)
1430Returns: 0 on success, -1 on error 1449Returns: 0 on success, -1 on error
@@ -1445,8 +1464,8 @@ struct kvm_assigned_msix_nr {
1445 1464
14464.54 KVM_ASSIGN_SET_MSIX_ENTRY 14654.54 KVM_ASSIGN_SET_MSIX_ENTRY
1447 1466
1448Capability: KVM_CAP_DEVICE_MSIX 1467Capability: none
1449Architectures: x86 ia64 1468Architectures: x86
1450Type: vm ioctl 1469Type: vm ioctl
1451Parameters: struct kvm_assigned_msix_entry (in) 1470Parameters: struct kvm_assigned_msix_entry (in)
1452Returns: 0 on success, -1 on error 1471Returns: 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
1483Errors:
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
14654.55 KVM_SET_TSC_KHZ 14904.55 KVM_SET_TSC_KHZ
1466 1491
@@ -2453,9 +2478,15 @@ return ENOEXEC for that vcpu.
2453Note that because some registers reflect machine topology, all vcpus 2478Note that because some registers reflect machine topology, all vcpus
2454should be created before this ioctl is invoked. 2479should be created before this ioctl is invoked.
2455 2480
2481Userspace can call this function multiple times for a given vcpu, including
2482after the vcpu has been run. This will reset the vcpu to its initial
2483state. All calls to this function after the initial call must use the same
2484target and same set of feature flags, otherwise EINVAL will be returned.
2485
2456Possible features: 2486Possible 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
2951the system-level event type. The 'flags' field describes architecture 2982the system-level event type. The 'flags' field describes architecture
2952specific flags for the system-level event. 2983specific flags for the system-level event.
2953 2984
2985Valid 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 };