Skip to content

Commit

Permalink
kvm: drop unsupported capabilities, fix documentation
Browse files Browse the repository at this point in the history
No kernel ever reported KVM_CAP_DEVICE_MSIX, KVM_CAP_DEVICE_MSI,
KVM_CAP_DEVICE_ASSIGNMENT, KVM_CAP_DEVICE_DEASSIGNMENT.

This makes the documentation wrong, and no application ever
written to use these capabilities has a chance to work correctly.
The only way to detect support is to try, and test errno for ENOTTY.
That's unfortunate, but we can't fix the past.

Document the actual semantics, and drop the definitions from
the exported header to make it easier for application
developers to note and fix the bug.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Michael S. Tsirkin authored and Paolo Bonzini committed Nov 3, 2014
1 parent 1e0ad70 commit 7f05db6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 15 deletions.
40 changes: 33 additions & 7 deletions Documentation/virtual/kvm/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ description:

Capability: which KVM extension provides this ioctl. Can be 'basic',
which means that is will be provided by any kernel that supports
API version 12 (see section 4.1), or a KVM_CAP_xyz constant, which
API version 12 (see section 4.1), a KVM_CAP_xyz constant, which
means availability needs to be checked with KVM_CHECK_EXTENSION
(see section 4.4).
(see section 4.4), or 'none' which means that while not all kernels
support this ioctl, there's no capability bit to check its
availability: for kernels that don't support the ioctl,
the ioctl returns -ENOTTY.

Architectures: which instruction set architectures provide this ioctl.
x86 includes both i386 and x86_64.
Expand Down Expand Up @@ -1257,7 +1260,7 @@ The flags bitmap is defined as:

4.48 KVM_ASSIGN_PCI_DEVICE

Capability: KVM_CAP_DEVICE_ASSIGNMENT
Capability: none
Architectures: x86 ia64
Type: vm ioctl
Parameters: struct kvm_assigned_pci_dev (in)
Expand Down Expand Up @@ -1298,20 +1301,31 @@ Only PCI header type 0 devices with PCI BAR resources are supported by
device assignment. The user requesting this ioctl must have read/write
access to the PCI sysfs resource files associated with the device.

Errors:
ENOTTY: kernel does not support this ioctl

Other error conditions may be defined by individual device types or
have their standard meanings.


4.49 KVM_DEASSIGN_PCI_DEVICE

Capability: KVM_CAP_DEVICE_DEASSIGNMENT
Capability: none
Architectures: x86 ia64
Type: vm ioctl
Parameters: struct kvm_assigned_pci_dev (in)
Returns: 0 on success, -1 on error

Ends PCI device assignment, releasing all associated resources.

See KVM_CAP_DEVICE_ASSIGNMENT for the data structure. Only assigned_dev_id is
See KVM_ASSIGN_PCI_DEVICE for the data structure. Only assigned_dev_id is
used in kvm_assigned_pci_dev to identify the device.

Errors:
ENOTTY: kernel does not support this ioctl

Other error conditions may be defined by individual device types or
have their standard meanings.

4.50 KVM_ASSIGN_DEV_IRQ

Expand Down Expand Up @@ -1346,6 +1360,12 @@ The following flags are defined:
It is not valid to specify multiple types per host or guest IRQ. However, the
IRQ type of host and guest can differ or can even be null.

Errors:
ENOTTY: kernel does not support this ioctl

Other error conditions may be defined by individual device types or
have their standard meanings.


4.51 KVM_DEASSIGN_DEV_IRQ

Expand Down Expand Up @@ -1423,7 +1443,7 @@ struct kvm_irq_routing_s390_adapter {

4.53 KVM_ASSIGN_SET_MSIX_NR

Capability: KVM_CAP_DEVICE_MSIX
Capability: none
Architectures: x86 ia64
Type: vm ioctl
Parameters: struct kvm_assigned_msix_nr (in)
Expand All @@ -1445,7 +1465,7 @@ struct kvm_assigned_msix_nr {

4.54 KVM_ASSIGN_SET_MSIX_ENTRY

Capability: KVM_CAP_DEVICE_MSIX
Capability: none
Architectures: x86 ia64
Type: vm ioctl
Parameters: struct kvm_assigned_msix_entry (in)
Expand All @@ -1461,6 +1481,12 @@ struct kvm_assigned_msix_entry {
__u16 padding[3];
};

Errors:
ENOTTY: kernel does not support this ioctl

Other error conditions may be defined by individual device types or
have their standard meanings.


4.55 KVM_SET_TSC_KHZ

Expand Down
8 changes: 0 additions & 8 deletions include/uapi/linux/kvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -647,11 +647,7 @@ struct kvm_ppc_smmu_info {
#define KVM_CAP_MP_STATE 14
#define KVM_CAP_COALESCED_MMIO 15
#define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */
#define KVM_CAP_DEVICE_ASSIGNMENT 17
#define KVM_CAP_IOMMU 18
#ifdef __KVM_HAVE_MSI
#define KVM_CAP_DEVICE_MSI 20
#endif
/* Bug in KVM_SET_USER_MEMORY_REGION fixed: */
#define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21
#define KVM_CAP_USER_NMI 22
Expand All @@ -663,10 +659,6 @@ struct kvm_ppc_smmu_info {
#endif
#define KVM_CAP_IRQ_ROUTING 25
#define KVM_CAP_IRQ_INJECT_STATUS 26
#define KVM_CAP_DEVICE_DEASSIGNMENT 27
#ifdef __KVM_HAVE_MSIX
#define KVM_CAP_DEVICE_MSIX 28
#endif
#define KVM_CAP_ASSIGN_DEV_IRQ 29
/* Another bug in KVM_SET_USER_MEMORY_REGION fixed: */
#define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30
Expand Down

0 comments on commit 7f05db6

Please sign in to comment.