aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2013-01-07 16:20:42 -0200
committerAndreas Färber <afaerber@suse.de>2013-01-15 04:09:14 +0100
commit9ca5892328a40bfa9c24c847441761c4729ae3f3 (patch)
tree86e41db348304cc5824d5012b81fafdf85415b39
parent38d8f5c84e7c02f2523005dddc31939ca18232dd (diff)
kvm: Add fake KVM constants to avoid #ifdefs on KVM-specific code
Any KVM-specific code that use these constants must check if kvm_enabled() is true before using them. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
-rw-r--r--include/sysemu/kvm.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 2fe8f8a44b..6bdd51373e 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -22,6 +22,20 @@
#ifdef CONFIG_KVM
#include <linux/kvm.h>
#include <linux/kvm_para.h>
+#else
+/* These constants must never be used at runtime if kvm_enabled() is false.
+ * They exist so we don't need #ifdefs around KVM-specific code that already
+ * checks kvm_enabled() properly.
+ */
+#define KVM_CPUID_SIGNATURE 0
+#define KVM_CPUID_FEATURES 0
+#define KVM_FEATURE_CLOCKSOURCE 0
+#define KVM_FEATURE_NOP_IO_DELAY 0
+#define KVM_FEATURE_MMU_OP 0
+#define KVM_FEATURE_CLOCKSOURCE2 0
+#define KVM_FEATURE_ASYNC_PF 0
+#define KVM_FEATURE_STEAL_TIME 0
+#define KVM_FEATURE_PV_EOI 0
#endif
extern int kvm_allowed;