diff options
author | Beth Kon <eak@us.ibm.com> | 2009-07-07 11:50:38 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-09-10 01:33:12 -0400 |
commit | e9f4275732add046fed4a548b8dbb98dbe500d2f (patch) | |
tree | 8d9e22bbc6a9557f95712aaa98534d5983034252 /include | |
parent | 0d1de2d901f4ba0972a3886496a44fb1d3300dbd (diff) |
KVM: PIT support for HPET legacy mode
When kvm is in hpet_legacy_mode, the hpet is providing the timer
interrupt and the pit should not be. So in legacy mode, the pit timer
is destroyed, but the *state* of the pit is maintained. So if kvm or
the guest tries to modify the state of the pit, this modification is
accepted, *except* that the timer isn't actually started. When we exit
hpet_legacy_mode, the current state of the pit (which is up to date
since we've been accepting modifications) is used to restart the pit
timer.
The saved_mode code in kvm_pit_load_count temporarily changes mode to
0xff in order to destroy the timer, but then restores the actual
value, again maintaining "current" state of the pit for possible later
reenablement.
[avi: add some reserved storage in the ioctl; make SET_PIT2 IOW]
[marcelo: fix memory corruption due to reserved storage]
Signed-off-by: Beth Kon <eak@us.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/kvm.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 76c640834ea6..a74a1fcc28e9 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -409,6 +409,9 @@ struct kvm_guest_debug { | |||
409 | #define KVM_CAP_PIT2 33 | 409 | #define KVM_CAP_PIT2 33 |
410 | #endif | 410 | #endif |
411 | #define KVM_CAP_SET_BOOT_CPU_ID 34 | 411 | #define KVM_CAP_SET_BOOT_CPU_ID 34 |
412 | #ifdef __KVM_HAVE_PIT_STATE2 | ||
413 | #define KVM_CAP_PIT_STATE2 35 | ||
414 | #endif | ||
412 | 415 | ||
413 | #ifdef KVM_CAP_IRQ_ROUTING | 416 | #ifdef KVM_CAP_IRQ_ROUTING |
414 | 417 | ||
@@ -586,6 +589,9 @@ struct kvm_debug_guest { | |||
586 | #define KVM_IA64_VCPU_GET_STACK _IOR(KVMIO, 0x9a, void *) | 589 | #define KVM_IA64_VCPU_GET_STACK _IOR(KVMIO, 0x9a, void *) |
587 | #define KVM_IA64_VCPU_SET_STACK _IOW(KVMIO, 0x9b, void *) | 590 | #define KVM_IA64_VCPU_SET_STACK _IOW(KVMIO, 0x9b, void *) |
588 | 591 | ||
592 | #define KVM_GET_PIT2 _IOR(KVMIO, 0x9f, struct kvm_pit_state2) | ||
593 | #define KVM_SET_PIT2 _IOW(KVMIO, 0xa0, struct kvm_pit_state2) | ||
594 | |||
589 | #define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02) | 595 | #define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02) |
590 | #define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03) | 596 | #define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03) |
591 | #define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04) | 597 | #define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04) |