[RFC qemu legoater/aspeed-3.1 1/4] timer: aspeed: Fire interrupt on failure to meet deadline

Andrew Jeffery andrew at aj.id.au
Fri Jan 11 19:52:21 AEDT 2019



On Fri, 11 Jan 2019, at 19:14, Cédric Le Goater wrote:
> On 1/11/19 4:56 AM, Andrew Jeffery wrote:
> > Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
> > ---
> >  hw/timer/aspeed_timer.c | 14 ++++++++++----
> >  1 file changed, 10 insertions(+), 4 deletions(-)
> > 
> > diff --git a/hw/timer/aspeed_timer.c b/hw/timer/aspeed_timer.c
> > index 1a54d85e9d49..54c75bf4f322 100644
> > --- a/hw/timer/aspeed_timer.c
> > +++ b/hw/timer/aspeed_timer.c
> > @@ -128,10 +128,16 @@ static uint64_t calculate_next(struct AspeedTimer *t)
> >      if (now < next)
> >          return next;
> >  
> > -    /* We've missed all of the deadlines. Set a timer in the future to let
> > -     * execution catch up */
> > -    t->start = now;
> > -    return next + 10000;
> > +    /* We've missed all deadlines, fire interrupt and try again */
> > +    timer_del(&t->timer);
> > +
> > +    if (timer_overflow_interrupt(t)) {
> > +        t->level = !t->level;
> > +        qemu_set_irq(t->irq, t->level);
> > +    }
> > +
> > +    t->start = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
> > +    return calculate_time(t, MAX(MAX(t->match[0], t->match[1]), 0));
> 
> MAX(MAX()) ? 
> 
> Is that necessary ?

No, just my wip internal reasoning getting exposed externally :)

> 
> C.


More information about the openbmc mailing list