aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/kvm.h
diff options
context:
space:
mode:
authorBeth Kon <eak@us.ibm.com>2009-07-07 11:50:38 -0400
committerAvi Kivity <avi@redhat.com>2009-09-10 01:33:12 -0400
commite9f4275732add046fed4a548b8dbb98dbe500d2f (patch)
tree8d9e22bbc6a9557f95712aaa98534d5983034252 /arch/x86/include/asm/kvm.h
parent0d1de2d901f4ba0972a3886496a44fb1d3300dbd (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 'arch/x86/include/asm/kvm.h')
-rw-r--r--arch/x86/include/asm/kvm.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/x86/include/asm/kvm.h b/arch/x86/include/asm/kvm.h
index 708b9c32a5da..4a5fe914dc59 100644
--- a/arch/x86/include/asm/kvm.h
+++ b/arch/x86/include/asm/kvm.h
@@ -18,6 +18,7 @@
18#define __KVM_HAVE_GUEST_DEBUG 18#define __KVM_HAVE_GUEST_DEBUG
19#define __KVM_HAVE_MSIX 19#define __KVM_HAVE_MSIX
20#define __KVM_HAVE_MCE 20#define __KVM_HAVE_MCE
21#define __KVM_HAVE_PIT_STATE2
21 22
22/* Architectural interrupt line count. */ 23/* Architectural interrupt line count. */
23#define KVM_NR_INTERRUPTS 256 24#define KVM_NR_INTERRUPTS 256
@@ -237,6 +238,14 @@ struct kvm_pit_state {
237 struct kvm_pit_channel_state channels[3]; 238 struct kvm_pit_channel_state channels[3];
238}; 239};
239 240
241#define KVM_PIT_FLAGS_HPET_LEGACY 0x00000001
242
243struct kvm_pit_state2 {
244 struct kvm_pit_channel_state channels[3];
245 __u32 flags;
246 __u32 reserved[9];
247};
248
240struct kvm_reinject_control { 249struct kvm_reinject_control {
241 __u8 pit_reinject; 250 __u8 pit_reinject;
242 __u8 reserved[31]; 251 __u8 reserved[31];