mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
xen/arm: Don't hardcode virtual timer IRQs
Define virtual timer IRQs per VCPU Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
1 parent
699f48cd13
commit
95edff2323
3 files changed
+19
-6
No files matched your search
+8
-1
@@ -49,6 +49,13 @@ unsigned long __read_mostly cpu_khz; /* CPU clock frequency in kHz. */
|
||||
|
||||
static struct dt_irq timer_irq[MAX_TIMER_PPI];
|
||||
|
||||
const struct dt_irq *timer_dt_irq(enum timer_ppi ppi)
|
||||
{
|
||||
ASSERT(ppi >= TIMER_PHYS_SECURE_PPI && ppi < MAX_TIMER_PPI);
|
||||
|
||||
return &timer_irq[ppi];
|
||||
}
|
||||
|
||||
/*static inline*/ s_time_t ticks_to_ns(uint64_t ticks)
|
||||
{
|
||||
return muldiv64(ticks, SECONDS(1), 1000 * cpu_khz);
|
||||
@@ -192,7 +199,7 @@ static void vtimer_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs)
|
||||
{
|
||||
current->arch.virt_timer.ctl = READ_SYSREG32(CNTV_CTL_EL0);
|
||||
WRITE_SYSREG32(current->arch.virt_timer.ctl | CNTx_CTL_MASK, CNTV_CTL_EL0);
|
||||
vgic_vcpu_inject_irq(current, irq, 1);
|
||||
vgic_vcpu_inject_irq(current, current->arch.virt_timer.irq, 1);
|
||||
}
|
||||
|
||||
/* Route timer's IRQ on this CPU */
|
||||
|
||||
@@ -34,14 +34,14 @@ static void phys_timer_expired(void *data)
|
||||
struct vtimer *t = data;
|
||||
t->ctl |= CNTx_CTL_PENDING;
|
||||
if ( !(t->ctl & CNTx_CTL_MASK) )
|
||||
vgic_vcpu_inject_irq(t->v, 30, 1);
|
||||
vgic_vcpu_inject_irq(t->v, t->irq, 1);
|
||||
}
|
||||
|
||||
static void virt_timer_expired(void *data)
|
||||
{
|
||||
struct vtimer *t = data;
|
||||
t->ctl |= CNTx_CTL_MASK;
|
||||
vgic_vcpu_inject_irq(t->v, 27, 1);
|
||||
vgic_vcpu_inject_irq(t->v, t->irq, 1);
|
||||
}
|
||||
|
||||
int vcpu_domain_init(struct domain *d)
|
||||
@@ -55,17 +55,20 @@ int vcpu_vtimer_init(struct vcpu *v)
|
||||
{
|
||||
struct vtimer *t = &v->arch.phys_timer;
|
||||
|
||||
/* TODO: Retrieve physical and virtual timer IRQ from the guest
|
||||
* DT. For the moment we use dom0 DT
|
||||
*/
|
||||
|
||||
init_timer(&t->timer, phys_timer_expired, t, v->processor);
|
||||
t->ctl = 0;
|
||||
t->cval = NOW();
|
||||
t->irq = 30;
|
||||
t->irq = timer_dt_irq(TIMER_PHYS_NONSECURE_PPI)->irq;
|
||||
t->v = v;
|
||||
|
||||
t = &v->arch.virt_timer;
|
||||
init_timer(&t->timer, virt_timer_expired, t, v->processor);
|
||||
t->ctl = 0;
|
||||
t->cval = 0;
|
||||
t->irq = 27;
|
||||
t->irq = timer_dt_irq(TIMER_VIRT_PPI)->irq;
|
||||
t->v = v;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -21,6 +21,9 @@ enum timer_ppi
|
||||
MAX_TIMER_PPI = 4,
|
||||
};
|
||||
|
||||
/* Get one of the timer IRQ description */
|
||||
const struct dt_irq* timer_dt_irq(enum timer_ppi ppi);
|
||||
|
||||
/* Route timer's IRQ on this CPU */
|
||||
extern void __cpuinit route_timer_interrupt(void);
|
||||
|
||||
|
||||