]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
pvh: call pit_init for pvh also
authorMukesh Rathor <mukesh.rathor@oracle.com>
Tue, 11 Mar 2014 12:56:50 +0000 (13:56 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 11 Mar 2014 12:56:50 +0000 (13:56 +0100)
During halt of a pvh guest, the guest may do speaker shutdown. This
results in call to handle_speaker_io in xen. It will hang on the vpit
spin lock because it has not been initialized.
Since, pit_init is also called for both pv and hvm, the call is
moved to a more generic place.

Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/domain.c
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/i8254.c
xen/include/asm-x86/hvm/vpt.h

index c42a079f1da48aa1d7d26fc2c2291c22d0bfd816..0d563de6b9e9ecae402990ec4a8eac60ccb0ca57 100644 (file)
@@ -422,10 +422,6 @@ int vcpu_initialise(struct vcpu *v)
 
         /* PV guests by default have a 100Hz ticker. */
         v->periodic_period = MILLISECS(10);
-
-        /* PV guests get an emulated PIT too for video BIOSes to use. */
-        if ( v->vcpu_id == 0 )
-            pit_init(v, cpu_khz);
     }
 
     v->arch.schedule_tail = continue_nonidle_domain;
@@ -579,6 +575,9 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags)
     tsc_set_info(d, TSC_MODE_DEFAULT, 0UL, 0, 0);
     spin_lock_init(&d->arch.vtsc_lock);
 
+    /* PV/PVH guests get an emulated PIT too for video BIOSes to use. */
+    pit_init(d, cpu_khz);
+
     return 0;
 
  fail:
@@ -1978,6 +1977,8 @@ int domain_relinquish_resources(struct domain *d)
         BUG();
     }
 
+    pit_deinit(d);
+
     if ( has_hvm_container_domain(d) )
         hvm_domain_relinquish_resources(d);
 
index b4677d4e66f8ff7bc707ee66773ecb9ae76ac0ee..9dd56f7fc8a237061a70e78da5abd504fe3d86d2 100644 (file)
@@ -650,7 +650,6 @@ void hvm_domain_relinquish_resources(struct domain *d)
     rtc_deinit(d);
     if ( d->vcpu != NULL && d->vcpu[0] != NULL )
     {
-        pit_deinit(d);
         pmtimer_deinit(d);
         hpet_deinit(d);
     }
@@ -1346,7 +1345,6 @@ int hvm_vcpu_initialise(struct vcpu *v)
     if ( v->vcpu_id == 0 )
     {
         /* NB. All these really belong in hvm_domain_initialise(). */
-        pit_init(v, cpu_khz);
         pmtimer_init(v);
         hpet_init(v);
  
index c0d6bc29b6ca985d8bb5d6e1339c10149f5a0b1a..f7493b8583f73178c12e6eab21346f549df061db 100644 (file)
@@ -447,9 +447,8 @@ void pit_reset(struct domain *d)
     spin_unlock(&pit->lock);
 }
 
-void pit_init(struct vcpu *v, unsigned long cpu_khz)
+void pit_init(struct domain *d, unsigned long cpu_khz)
 {
-    struct domain *d = v->domain;
     PITState *pit = domain_vpit(d);
 
     spin_lock_init(&pit->lock);
index 7d62653eb98474b1a6444286b16a0702066761b3..41159d83518532e6851ffad0469797e7ee67cc13 100644 (file)
@@ -176,7 +176,7 @@ void destroy_periodic_time(struct periodic_time *pt);
 int pv_pit_handler(int port, int data, int write);
 void pit_reset(struct domain *d);
 
-void pit_init(struct vcpu *v, unsigned long cpu_khz);
+void pit_init(struct domain *d, unsigned long cpu_khz);
 void pit_stop_channel0_irq(PITState * pit);
 void pit_deinit(struct domain *d);
 void rtc_init(struct domain *d);