summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChristoffer Dall <christoffer.dall@linaro.org>2014-02-26 17:20:00 +0000
committerPeter Maydell <peter.maydell@linaro.org>2014-02-26 17:20:00 +0000
commit0a6a7ccaae4015aa02bdbce75bafb9d868636655 (patch)
treed3d2f835e20b7f573867ad4c64fbca2825a6beaf /include
parentd6032e06d10d20e91729816a8c9c6792e5774ab1 (diff)
downloadqemu-0a6a7ccaae4015aa02bdbce75bafb9d868636655.tar.gz
qemu-0a6a7ccaae4015aa02bdbce75bafb9d868636655.tar.bz2
qemu-0a6a7ccaae4015aa02bdbce75bafb9d868636655.zip
kvm: Common device control API functions
Introduces two simple functions: int kvm_device_ioctl(int fd, int type, ...); int kvm_create_device(KVMState *s, uint64_t type, bool test); These functions wrap the basic ioctl-based interactions with KVM in a way similar to other KVM ioctl wrappers. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org> Message-id: 1392687720-26806-4-git-send-email-christoffer.dall@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/sysemu/kvm.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index e4e43b8829..a02d67cd5a 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -194,6 +194,28 @@ int kvm_vm_ioctl(KVMState *s, int type, ...);
int kvm_vcpu_ioctl(CPUState *cpu, int type, ...);
+/**
+ * kvm_device_ioctl - call an ioctl on a kvm device
+ * @fd: The KVM device file descriptor as returned from KVM_CREATE_DEVICE
+ * @type: The device-ctrl ioctl number
+ *
+ * Returns: -errno on error, nonnegative on success
+ */
+int kvm_device_ioctl(int fd, int type, ...);
+
+/**
+ * kvm_create_device - create a KVM device for the device control API
+ * @KVMState: The KVMState pointer
+ * @type: The KVM device type (see Documentation/virtual/kvm/devices in the
+ * kernel source)
+ * @test: If true, only test if device can be created, but don't actually
+ * create the device.
+ *
+ * Returns: -errno on error, nonnegative on success: @test ? 0 : device fd;
+ */
+int kvm_create_device(KVMState *s, uint64_t type, bool test);
+
+
/* Arch specific hooks */
extern const KVMCapabilityInfo kvm_arch_required_capabilities[];