[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/9] kvm: add kvm_enable_cap_{vm,vcpu}
From: |
Cornelia Huck |
Subject: |
[Qemu-devel] [PATCH 2/9] kvm: add kvm_enable_cap_{vm,vcpu} |
Date: |
Mon, 14 Apr 2014 18:48:23 +0200 |
Provide helper functions for enabling capabilities (on a vcpu and on a vm).
Reviewed-by: Thomas Huth <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
---
include/sysemu/kvm.h | 4 ++++
kvm-all.c | 33 ++++++++++++++++++++++++++++++++-
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 0bee1e8..2ff5ad3 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -294,6 +294,10 @@ bool kvm_arch_stop_on_emulation_error(CPUState *cpu);
int kvm_check_extension(KVMState *s, unsigned int extension);
+int kvm_enable_cap_vm(KVMState *s, unsigned int capability, ...);
+
+int kvm_enable_cap_vcpu(CPUState *cpu, unsigned int capability, ...);
+
uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,
uint32_t index, int reg);
diff --git a/kvm-all.c b/kvm-all.c
index cd4111d..658e50c 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -501,7 +501,38 @@ int kvm_check_extension(KVMState *s, unsigned int
extension)
return ret;
}
-static int kvm_set_ioeventfd_mmio(int fd, hwaddr addr, uint32_t val,
+int kvm_enable_cap_vm(KVMState *s, unsigned int capability, ...)
+{
+ struct kvm_enable_cap cap = {};
+ va_list ap;
+ int i;
+
+ cap.cap = capability;
+ va_start(ap, capability);
+ for (i = 0; i < 4; i++) {
+ cap.args[i] = va_arg(ap, uint64_t);
+ }
+ va_end(ap);
+ return kvm_vm_ioctl(s, KVM_ENABLE_CAP, &cap);
+}
+
+int kvm_enable_cap_vcpu(CPUState *cpu, unsigned int capability, ...)
+{
+ struct kvm_enable_cap cap = {};
+ va_list ap;
+ int i;
+
+ cap.cap = capability;
+ va_start(ap, capability);
+ for (i = 0; i < 4; i++) {
+ cap.args[i] = va_arg(ap, uint64_t);
+ }
+ va_end(ap);
+ return kvm_vcpu_ioctl(cpu, KVM_ENABLE_CAP, &cap);
+}
+
+
+static int kvm_set_ioeventfd_mmio(int fd, uint32_t addr, uint32_t val,
bool assign, uint32_t size, bool datamatch)
{
int ret;
--
1.7.9.5
- [Qemu-devel] [PATCH 0/9] s390x: pending patches, Cornelia Huck, 2014/04/14
- [Qemu-devel] [PATCH 1/9] linux-headers: update, Cornelia Huck, 2014/04/14
- [Qemu-devel] [PATCH 8/9] s390x/kvm: rework KVM synchronize to tracing for some ONEREGS, Cornelia Huck, 2014/04/14
- [Qemu-devel] [PATCH 2/9] kvm: add kvm_enable_cap_{vm,vcpu},
Cornelia Huck <=
- Re: [Qemu-devel] [PATCH 2/9] kvm: add kvm_enable_cap_{vm,vcpu}, Alexander Graf, 2014/04/16
- Re: [Qemu-devel] [PATCH 2/9] kvm: add kvm_enable_cap_{vm,vcpu}, Alexander Graf, 2014/04/16
- Re: [Qemu-devel] [PATCH 2/9] kvm: add kvm_enable_cap_{vm,vcpu}, Cornelia Huck, 2014/04/16
- Re: [Qemu-devel] [PATCH 2/9] kvm: add kvm_enable_cap_{vm,vcpu}, Cornelia Huck, 2014/04/16
- Re: [Qemu-devel] [PATCH 2/9] kvm: add kvm_enable_cap_{vm,vcpu}, Alexander Graf, 2014/04/16
- Re: [Qemu-devel] [PATCH 2/9] kvm: add kvm_enable_cap_{vm,vcpu}, Cornelia Huck, 2014/04/16
[Qemu-devel] [PATCH 6/9] s390x/virtio-ccw: Wire up irq routing and irqfds., Cornelia Huck, 2014/04/14