aboutsummaryrefslogtreecommitdiff
path: root/include/sysemu
diff options
context:
space:
mode:
authorCornelia Huck <cornelia.huck@de.ibm.com>2013-10-23 18:19:26 +0200
committerCornelia Huck <cornelia.huck@de.ibm.com>2014-04-30 14:39:39 +0200
commit40f1ee27aa14494c155e4062afa83523e7817f40 (patch)
tree5fd01cff61e3e1c2324d7378eabae96e6cddaa55 /include/sysemu
parentb006f8162e11f0395689a684d6e871b047c23481 (diff)
downloadqemu-40f1ee27aa14494c155e4062afa83523e7817f40.zip
qemu-40f1ee27aa14494c155e4062afa83523e7817f40.tar.gz
qemu-40f1ee27aa14494c155e4062afa83523e7817f40.tar.bz2
kvm: add kvm_{vm,vcpu}_enable_cap
Provide helper functions for enabling capabilities (on a vcpu and on a vm). Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'include/sysemu')
-rw-r--r--include/sysemu/kvm.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 0bee1e8..192fe89 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -294,6 +294,36 @@ bool kvm_arch_stop_on_emulation_error(CPUState *cpu);
int kvm_check_extension(KVMState *s, unsigned int extension);
+#define kvm_vm_enable_cap(s, capability, cap_flags, ...) \
+ ({ \
+ struct kvm_enable_cap cap = { \
+ .cap = capability, \
+ .flags = cap_flags, \
+ }; \
+ uint64_t args_tmp[] = { __VA_ARGS__ }; \
+ int i; \
+ for (i = 0; i < ARRAY_SIZE(args_tmp) && \
+ i < ARRAY_SIZE(cap.args); i++) { \
+ cap.args[i] = args_tmp[i]; \
+ } \
+ kvm_vm_ioctl(s, KVM_ENABLE_CAP, &cap); \
+ })
+
+#define kvm_vcpu_enable_cap(cpu, capability, cap_flags, ...) \
+ ({ \
+ struct kvm_enable_cap cap = { \
+ .cap = capability, \
+ .flags = cap_flags, \
+ }; \
+ uint64_t args_tmp[] = { __VA_ARGS__ }; \
+ int i; \
+ for (i = 0; i < ARRAY_SIZE(args_tmp) && \
+ i < ARRAY_SIZE(cap.args); i++) { \
+ cap.args[i] = args_tmp[i]; \
+ } \
+ kvm_vcpu_ioctl(cpu, KVM_ENABLE_CAP, &cap); \
+ })
+
uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,
uint32_t index, int reg);