ia64/xen-unstable

view xen/include/asm-x86/hvm/vpit.h @ 9334:56a775219c88

This patch fix HVM/VMX time resolution issue that cause IA32E complain
"loss tick" occationally and APIC time calibration issue.

Signed-off-by: Xiaowei Yang <xiaowei.yang@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Sun Mar 19 18:52:20 2006 +0100 (2006-03-19)
parents 503c4d8454e5
children 2a7a46dd3bd6
line source
1 /*
2 * vpit.h: Virtual PIT definitions
3 *
4 * Copyright (c) 2004, Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17 * Place - Suite 330, Boston, MA 02111-1307 USA.
18 */
20 #ifndef __ASM_X86_HVM_VPIT_H__
21 #define __ASM_X86_HVM_VPIT_H__
23 #include <xen/config.h>
24 #include <xen/init.h>
25 #include <xen/lib.h>
26 #include <xen/time.h>
27 #include <xen/errno.h>
28 #include <xen/timer.h>
29 #include <asm/hvm/vpic.h>
31 #define PIT_FREQ 1193181
33 #define LSByte 0
34 #define MSByte 1
35 #define LSByte_multiple 2
36 #define MSByte_multiple 3
38 struct hvm_virpit {
39 /* for simulation of counter 0 in mode 2 */
40 u64 period_cycles; /* pit frequency in cpu cycles */
41 s_time_t inject_point; /* the time inject virt intr */
42 s_time_t scheduled; /* scheduled timer interrupt */
43 struct timer pit_timer; /* periodic timer for mode 2*/
44 unsigned int channel; /* the pit channel, counter 0~2 */
45 unsigned int pending_intr_nr; /* the couner for pending timer interrupts */
46 u32 period; /* pit frequency in ns */
47 int first_injected; /* flag to prevent shadow window */
48 s64 cache_tsc_offset; /* cache of VMCS TSC_OFFSET offset */
49 u64 last_pit_gtime; /* guest time when last pit is injected */
51 /* virtual PIT state for handle related I/O */
52 int read_state;
53 int count_LSB_latched;
54 int count_MSB_latched;
56 unsigned int count; /* the 16 bit channel count */
57 unsigned int init_val; /* the init value for the counter */
58 };
60 static __inline__ s_time_t get_pit_scheduled(
61 struct vcpu *v,
62 struct hvm_virpit *vpit)
63 {
64 if ( is_irq_enabled(v, 0) ) {
65 return vpit->scheduled;
66 }
67 else
68 return -1;
69 }
71 /* to hook the ioreq packet to get the PIT initialization info */
72 extern void hvm_hooks_assist(struct vcpu *v);
73 void pickup_deactive_ticks(struct hvm_virpit *vpit);
75 #endif /* __ASM_X86_HVM_VPIT_H__ */