aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2013-04-12 10:08:42 -0400
committerAlexander Graf <agraf@suse.de>2013-04-26 14:27:20 -0400
commit852b6d57dc7fa378019786fa84727036e56839ea (patch)
tree4d617ba91f6fc5de3fddac349e695d914e626a49 /include/uapi
parent7df35f549606e8a9004a77ef31dc80dfa893a590 (diff)
kvm: add device control API
Currently, devices that are emulated inside KVM are configured in a hardcoded manner based on an assumption that any given architecture only has one way to do it. If there's any need to access device state, it is done through inflexible one-purpose-only IOCTLs (e.g. KVM_GET/SET_LAPIC). Defining new IOCTLs for every little thing is cumbersome and depletes a limited numberspace. This API provides a mechanism to instantiate a device of a certain type, returning an ID that can be used to set/get attributes of the device. Attributes may include configuration parameters (e.g. register base address), device state, operational commands, etc. It is similar to the ONE_REG API, except that it acts on devices rather than vcpus. Both device types and individual attributes can be tested without having to create the device or get/set the attribute, without the need for separately managing enumerated capabilities. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'include/uapi')
-rw-r--r--include/uapi/linux/kvm.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index c741902c9e0b..38a0be0c199f 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -666,6 +666,7 @@ struct kvm_ppc_smmu_info {
666#define KVM_CAP_PPC_EPR 86 666#define KVM_CAP_PPC_EPR 86
667#define KVM_CAP_ARM_PSCI 87 667#define KVM_CAP_ARM_PSCI 87
668#define KVM_CAP_ARM_SET_DEVICE_ADDR 88 668#define KVM_CAP_ARM_SET_DEVICE_ADDR 88
669#define KVM_CAP_DEVICE_CTRL 89
669 670
670#ifdef KVM_CAP_IRQ_ROUTING 671#ifdef KVM_CAP_IRQ_ROUTING
671 672
@@ -819,6 +820,24 @@ struct kvm_arm_device_addr {
819}; 820};
820 821
821/* 822/*
823 * Device control API, available with KVM_CAP_DEVICE_CTRL
824 */
825#define KVM_CREATE_DEVICE_TEST 1
826
827struct kvm_create_device {
828 __u32 type; /* in: KVM_DEV_TYPE_xxx */
829 __u32 fd; /* out: device handle */
830 __u32 flags; /* in: KVM_CREATE_DEVICE_xxx */
831};
832
833struct kvm_device_attr {
834 __u32 flags; /* no flags currently defined */
835 __u32 group; /* device-defined */
836 __u64 attr; /* group-defined */
837 __u64 addr; /* userspace address of attr data */
838};
839
840/*
822 * ioctls for VM fds 841 * ioctls for VM fds
823 */ 842 */
824#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region) 843#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region)
@@ -906,6 +925,14 @@ struct kvm_s390_ucas_mapping {
906/* Available with KVM_CAP_ARM_SET_DEVICE_ADDR */ 925/* Available with KVM_CAP_ARM_SET_DEVICE_ADDR */
907#define KVM_ARM_SET_DEVICE_ADDR _IOW(KVMIO, 0xab, struct kvm_arm_device_addr) 926#define KVM_ARM_SET_DEVICE_ADDR _IOW(KVMIO, 0xab, struct kvm_arm_device_addr)
908 927
928/* ioctl for vm fd */
929#define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)
930
931/* ioctls for fds returned by KVM_CREATE_DEVICE */
932#define KVM_SET_DEVICE_ATTR _IOW(KVMIO, 0xe1, struct kvm_device_attr)
933#define KVM_GET_DEVICE_ATTR _IOW(KVMIO, 0xe2, struct kvm_device_attr)
934#define KVM_HAS_DEVICE_ATTR _IOW(KVMIO, 0xe3, struct kvm_device_attr)
935
909/* 936/*
910 * ioctls for vcpu fds 937 * ioctls for vcpu fds
911 */ 938 */