aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/hvm/intercept.c
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2006-12-20 10:37:23 +0000
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2006-12-20 10:37:23 +0000
commitddc35d1cc994bde1c3560c5dc30a4adc944ef4ac (patch)
tree70de5fedc1a3be62d38992962caac2b15647da6d /xen/arch/x86/hvm/intercept.c
parent625141e5d7a0076eddf421cd7afccefce9cb000e (diff)
downloadxen-ddc35d1cc994bde1c3560c5dc30a4adc944ef4ac.tar.gz
xen-ddc35d1cc994bde1c3560c5dc30a4adc944ef4ac.tar.bz2
xen-ddc35d1cc994bde1c3560c5dc30a4adc944ef4ac.zip
[HVM] Enable more than one platform timer (PIT/RTC/HPET)
programmed as periodic timer and adds them to abstract layer, which keeps track of pending_intr_nr to avoid time interrupt lost and sync'ed timer with TSC. It also makes some cleanup to the time related code. Signed-off-by: Xiaowei Yang <xiaowei.yang@intel.com> Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Diffstat (limited to 'xen/arch/x86/hvm/intercept.c')
-rw-r--r--xen/arch/x86/hvm/intercept.c92
1 files changed, 0 insertions, 92 deletions
diff --git a/xen/arch/x86/hvm/intercept.c b/xen/arch/x86/hvm/intercept.c
index ea93a59f8e..c5d0e0ac56 100644
--- a/xen/arch/x86/hvm/intercept.c
+++ b/xen/arch/x86/hvm/intercept.c
@@ -263,98 +263,6 @@ int register_io_handler(
return 1;
}
-
-static __inline__ void missed_ticks(struct periodic_time *pt)
-{
- s_time_t missed_ticks;
-
- missed_ticks = NOW() - pt->scheduled;
- if ( missed_ticks > 0 ) {
- missed_ticks = missed_ticks / (s_time_t) pt->period + 1;
- if ( missed_ticks > 1000 ) {
- /* TODO: Adjust guest time togther */
- pt->pending_intr_nr++;
- }
- else {
- pt->pending_intr_nr += missed_ticks;
- }
- pt->scheduled += missed_ticks * pt->period;
- }
-}
-
-/* hook function for the platform periodic time */
-void pt_timer_fn(void *data)
-{
- struct vcpu *v = data;
- struct periodic_time *pt = &v->domain->arch.hvm_domain.pl_time.periodic_tm;
-
- pt->pending_intr_nr++;
- pt->scheduled += pt->period;
-
- /* Pick up missed timer ticks. */
- missed_ticks(pt);
-
- /* No need to run the timer while a VCPU is descheduled. */
- if ( test_bit(_VCPUF_running, &v->vcpu_flags) )
- set_timer(&pt->timer, pt->scheduled);
-
- vcpu_kick(v);
-}
-
-/* pick up missed timer ticks at deactive time */
-void pickup_deactive_ticks(struct periodic_time *pt)
-{
- if ( !active_timer(&(pt->timer)) ) {
- missed_ticks(pt);
- set_timer(&pt->timer, pt->scheduled);
- }
-}
-
-/*
- * period: fire frequency in ns.
- */
-struct periodic_time * create_periodic_time(
- u32 period,
- char irq,
- char one_shot,
- time_cb *cb,
- void *data)
-{
- struct periodic_time *pt = &(current->domain->arch.hvm_domain.pl_time.periodic_tm);
- if ( pt->enabled ) {
- stop_timer (&pt->timer);
- pt->enabled = 0;
- }
- pt->bind_vcpu = 0; /* timer interrupt delivered to BSP by default */
- pt->pending_intr_nr = 0;
- pt->first_injected = 0;
- if (period < 900000) { /* < 0.9 ms */
- printk("HVM_PlatformTime: program too small period %u\n",period);
- period = 900000; /* force to 0.9ms */
- }
- pt->period = period;
- pt->irq = irq;
- pt->period_cycles = (u64)period * cpu_khz / 1000000L;
- pt->one_shot = one_shot;
- if ( one_shot ) {
- printk("HVM_PL: No support for one shot platform time yet\n");
- }
- pt->scheduled = NOW() + period;
- set_timer (&pt->timer,pt->scheduled);
- pt->enabled = 1;
- pt->cb = cb;
- pt->priv = data;
- return pt;
-}
-
-void destroy_periodic_time(struct periodic_time *pt)
-{
- if ( pt->enabled ) {
- stop_timer(&pt->timer);
- pt->enabled = 0;
- }
-}
-
/*
* Local variables:
* mode: C