aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2012-03-02 20:28:48 +0100
committerAvi Kivity <avi@redhat.com>2012-03-07 12:27:42 +0200
commit8a7c73932e03f13f29dea8622e15f1ded478d407 (patch)
tree6d9778782b08b9e9b3ceaf422dc38beabceb6eec
parent3fbc1c0c1309a6cc2a0699fbf5e286d32250a0be (diff)
kvm: Add kvm_has_pit_state2 helper
To be used for in-kernel PIT emulation. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--kvm-all.c10
-rw-r--r--kvm-stub.c5
-rw-r--r--kvm.h1
3 files changed, 16 insertions, 0 deletions
diff --git a/kvm-all.c b/kvm-all.c
index 77eadf608f..278085fc2d 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -76,6 +76,7 @@ struct KVMState
struct kvm_sw_breakpoint_head kvm_sw_breakpoints;
#endif
int pit_in_kernel;
+ int pit_state2;
int xsave, xcrs;
int many_ioeventfds;
int irqchip_inject_ioctl;
@@ -1058,6 +1059,10 @@ int kvm_init(void)
s->xcrs = kvm_check_extension(s, KVM_CAP_XCRS);
#endif
+#ifdef KVM_CAP_PIT_STATE2
+ s->pit_state2 = kvm_check_extension(s, KVM_CAP_PIT_STATE2);
+#endif
+
ret = kvm_arch_init(s);
if (ret < 0) {
goto err;
@@ -1390,6 +1395,11 @@ int kvm_has_xcrs(void)
return kvm_state->xcrs;
}
+int kvm_has_pit_state2(void)
+{
+ return kvm_state->pit_state2;
+}
+
int kvm_has_many_ioeventfds(void)
{
if (!kvm_enabled()) {
diff --git a/kvm-stub.c b/kvm-stub.c
index f63a0d2c81..1f1c6861ed 100644
--- a/kvm-stub.c
+++ b/kvm-stub.c
@@ -78,6 +78,11 @@ int kvm_allows_irq0_override(void)
return 1;
}
+int kvm_has_pit_state2(void)
+{
+ return 0;
+}
+
void kvm_setup_guest_memory(void *start, size_t size)
{
}
diff --git a/kvm.h b/kvm.h
index f9f1dc86b3..8ef44767af 100644
--- a/kvm.h
+++ b/kvm.h
@@ -54,6 +54,7 @@ int kvm_has_robust_singlestep(void);
int kvm_has_debugregs(void);
int kvm_has_xsave(void);
int kvm_has_xcrs(void);
+int kvm_has_pit_state2(void);
int kvm_has_many_ioeventfds(void);
int kvm_has_gsi_routing(void);