ia64/xen-unstable

changeset 10709:a1c2cede77c7

[HVM] Fix "Many lost ticks" warning in ia32e guest
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Xiaowei Yang <xiaowei.yang@intel.com>
author kfraser@localhost.localdomain
date Mon Jul 10 15:01:49 2006 +0100 (2006-07-10)
parents f986ead202dc
children 800261a88275
files xen/arch/x86/hvm/i8254.c xen/arch/x86/hvm/intercept.c xen/arch/x86/hvm/vmx/io.c xen/include/asm-x86/hvm/vpit.h
line diff
     1.1 --- a/xen/arch/x86/hvm/i8254.c	Mon Jul 10 14:58:42 2006 +0100
     1.2 +++ b/xen/arch/x86/hvm/i8254.c	Mon Jul 10 15:01:49 2006 +0100
     1.3 @@ -188,6 +188,12 @@ int pit_get_gate(PITState *pit, int chan
     1.4      return s->gate;
     1.5  }
     1.6  
     1.7 +void pit_time_fired(struct vcpu *v, void *priv)
     1.8 +{
     1.9 +    PITChannelState *s = priv;
    1.10 +    s->count_load_time = hvm_get_clock(v);
    1.11 +}
    1.12 +
    1.13  static inline void pit_load_count(PITChannelState *s, int val)
    1.14  {
    1.15      u32   period;
    1.16 @@ -209,11 +215,11 @@ static inline void pit_load_count(PITCha
    1.17      switch (s->mode) {
    1.18          case 2:
    1.19              /* create periodic time */
    1.20 -            s->pt = create_periodic_time (s->vcpu, period, 0, 0);
    1.21 +            s->pt = create_periodic_time (s, period, 0, 0);
    1.22              break;
    1.23          case 1:
    1.24              /* create one shot time */
    1.25 -            s->pt = create_periodic_time (s->vcpu, period, 0, 1);
    1.26 +            s->pt = create_periodic_time (s, period, 0, 1);
    1.27  #ifdef DEBUG_PIT
    1.28              printk("HVM_PIT: create one shot time.\n");
    1.29  #endif
     2.1 --- a/xen/arch/x86/hvm/intercept.c	Mon Jul 10 14:58:42 2006 +0100
     2.2 +++ b/xen/arch/x86/hvm/intercept.c	Mon Jul 10 15:01:49 2006 +0100
     2.3 @@ -261,11 +261,12 @@ void pickup_deactive_ticks(struct period
     2.4   * period: fire frequency in ns.
     2.5   */
     2.6  struct periodic_time * create_periodic_time(
     2.7 -        struct vcpu *v, 
     2.8 +        PITChannelState *s,
     2.9          u32 period, 
    2.10          char irq,
    2.11          char one_shot)
    2.12  {
    2.13 +    struct vcpu *v = s->vcpu;
    2.14      struct periodic_time *pt = &(v->domain->arch.hvm_domain.pl_time.periodic_tm);
    2.15      if ( pt->enabled ) {
    2.16          if ( v->vcpu_id != 0 ) {
    2.17 @@ -290,6 +291,7 @@ struct periodic_time * create_periodic_t
    2.18      pt->scheduled = NOW() + period;
    2.19      set_timer (&pt->timer,pt->scheduled);
    2.20      pt->enabled = 1;
    2.21 +    pt->priv = s;
    2.22      return pt;
    2.23  }
    2.24  
     3.1 --- a/xen/arch/x86/hvm/vmx/io.c	Mon Jul 10 14:58:42 2006 +0100
     3.2 +++ b/xen/arch/x86/hvm/vmx/io.c	Mon Jul 10 15:01:49 2006 +0100
     3.3 @@ -75,6 +75,7 @@ interrupt_post_injection(struct vcpu * v
     3.4              pt->pending_intr_nr--;
     3.5              pt->last_plt_gtime += pt->period_cycles;
     3.6              set_guest_time(v, pt->last_plt_gtime);
     3.7 +            pit_time_fired(v, pt->priv);
     3.8          }
     3.9      }
    3.10  
     4.1 --- a/xen/include/asm-x86/hvm/vpit.h	Mon Jul 10 14:58:42 2006 +0100
     4.2 +++ b/xen/include/asm-x86/hvm/vpit.h	Mon Jul 10 15:01:49 2006 +0100
     4.3 @@ -64,6 +64,7 @@ struct periodic_time {
     4.4      s_time_t scheduled;         /* scheduled timer interrupt */
     4.5      u64 last_plt_gtime;         /* platform time when last IRQ is injected */
     4.6      struct timer timer;         /* ac_timer */
     4.7 +    void *priv;                 /* ponit back to platform time source */
     4.8  };
     4.9  
    4.10  typedef struct PITState {
    4.11 @@ -93,9 +94,10 @@ static __inline__ s_time_t get_scheduled
    4.12  extern void hvm_hooks_assist(struct vcpu *v);
    4.13  extern void pickup_deactive_ticks(struct periodic_time *vpit);
    4.14  extern u64 hvm_get_guest_time(struct vcpu *v);
    4.15 -extern struct periodic_time *create_periodic_time(struct vcpu *v, u32 period, char irq, char one_shot);
    4.16 +extern struct periodic_time *create_periodic_time(PITChannelState *v, u32 period, char irq, char one_shot);
    4.17  extern void destroy_periodic_time(struct periodic_time *pt);
    4.18  void pit_init(struct vcpu *v, unsigned long cpu_khz);
    4.19  void pt_timer_fn(void *data);
    4.20 +void pit_time_fired(struct vcpu *v, void *priv);
    4.21  
    4.22  #endif /* __ASM_X86_HVM_VPIT_H__ */