aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2013-02-15 13:32:26 +0000
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>2013-02-15 13:32:26 +0000
commit174adc2c43293029c15ea043cf124722f37f51f7 (patch)
treefbb24903ef3affc468a90cf1a6acda82212347e9
parentc91b12a8e768a31d1cf64f1628be610e98828270 (diff)
downloadxen-174adc2c43293029c15ea043cf124722f37f51f7.tar.gz
xen-174adc2c43293029c15ea043cf124722f37f51f7.tar.bz2
xen-174adc2c43293029c15ea043cf124722f37f51f7.zip
xen/vtimer: fixes and improvements
Do not try to save and restore the vtimer for the idle domain. Inject the vtimer interrupt from the Xen timer handler, taking care of setting the timer as masked in the ctl field, so that at restore time it is not going to fire the interrupt again. No need to disable the vtimer before writing the new offset on restore: the vtimer is already disabled. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
-rw-r--r--xen/arch/arm/vtimer.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c
index 85201b5b05..f4326f8ffd 100644
--- a/xen/arch/arm/vtimer.c
+++ b/xen/arch/arm/vtimer.c
@@ -40,7 +40,8 @@ static void phys_timer_expired(void *data)
static void virt_timer_expired(void *data)
{
struct vtimer *t = data;
- vcpu_wake(t->v);
+ t->ctl |= CNTx_CTL_MASK;
+ vgic_vcpu_inject_irq(t->v, 27, 1);
}
int vcpu_vtimer_init(struct vcpu *v)
@@ -73,6 +74,9 @@ void vcpu_timer_destroy(struct vcpu *v)
int virt_timer_save(struct vcpu *v)
{
+ if ( is_idle_domain(v->domain) )
+ return 0;
+
v->arch.virt_timer.ctl = READ_CP32(CNTV_CTL);
WRITE_CP32(v->arch.virt_timer.ctl & ~CNTx_CTL_ENABLE, CNTV_CTL);
v->arch.virt_timer.cval = READ_CP64(CNTV_CVAL);
@@ -86,9 +90,11 @@ int virt_timer_save(struct vcpu *v)
int virt_timer_restore(struct vcpu *v)
{
+ if ( is_idle_domain(v->domain) )
+ return 0;
+
stop_timer(&v->arch.virt_timer.timer);
- WRITE_CP32(v->arch.virt_timer.ctl & ~CNTx_CTL_ENABLE, CNTV_CTL);
WRITE_CP64(v->arch.virt_timer.offset, CNTVOFF);
WRITE_CP64(v->arch.virt_timer.cval, CNTV_CVAL);
WRITE_CP32(v->arch.virt_timer.ctl, CNTV_CTL);