Signed-off-by: Roger Pau Monné <roger....@citrix.com> Acked-by: Andrew Cooper <andrew.coop...@citrix.com> Cc: Jan Beulich <jbeul...@suse.com> Cc: Andrew Cooper <andrew.coop...@citrix.com> --- Changes since v4: - Add Andrew Cooper Acked-by. --- xen/arch/x86/hvm/pmtimer.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/xen/arch/x86/hvm/pmtimer.c b/xen/arch/x86/hvm/pmtimer.c index 07594e1..199a15e 100644 --- a/xen/arch/x86/hvm/pmtimer.c +++ b/xen/arch/x86/hvm/pmtimer.c @@ -247,6 +247,9 @@ static int pmtimer_save(struct domain *d, hvm_domain_context_t *h) uint32_t x, msb = s->pm.tmr_val & TMR_VAL_MSB; int rc; + if ( !has_vpmtimer(d) ) + return 0; + spin_lock(&s->lock); /* Update the counter to the guest's current time. We always save @@ -271,6 +274,9 @@ static int pmtimer_load(struct domain *d, hvm_domain_context_t *h) { PMTState *s = &d->arch.hvm_domain.pl_time.vpmt; + if ( !has_vpmtimer(d) ) + return 0; + spin_lock(&s->lock); /* Reload the registers */ @@ -328,6 +334,9 @@ void pmtimer_init(struct vcpu *v) { PMTState *s = &v->domain->arch.hvm_domain.pl_time.vpmt; + if ( !has_vpmtimer(v->domain) ) + return; + spin_lock_init(&s->lock); s->scale = ((uint64_t)FREQUENCE_PMTIMER << 32) / SYSTEM_TIME_HZ; @@ -348,6 +357,10 @@ void pmtimer_init(struct vcpu *v) void pmtimer_deinit(struct domain *d) { PMTState *s = &d->arch.hvm_domain.pl_time.vpmt; + + if ( !has_vpmtimer(d) ) + return; + kill_timer(&s->timer); } -- 1.9.5 (Apple Git-50.3) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel