qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 1/2] hw/ptimer: Set delta to the original lim


From: Dmitry Osipenko
Subject: Re: [Qemu-devel] [PATCH v5 1/2] hw/ptimer: Set delta to the original limit on reload in ptimer_set_limit()
Date: Fri, 23 Oct 2015 20:07:03 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

19.10.2015 23:01, Dmitry Osipenko пишет:
What about the following:

Add additional ptimer struct member, say "limit_corrected", to check whether the
limit was corrected or not.

ptimer_set_limit(ptimer_state *s, uint64_t limit, int reload)
{
     .limit_corrected = 0;

     // on the limit correction:
     .limit_corrected = (limit == 0) ? 1 : 2;
     limit = 10000 / s->period;
}

ptimer_get_count()
{
     if (enabled) {
         if (expired || .limit_corrected == 1) {
             counter = 0;
         } else if (.limit_corrected == 2) {
             counter = 1;
         } else {
             // do the counter calculations ...
         }
     }
}

and clear .limit_corrected on the one-shot timer start. That would bump ptimer
VMSD version, but keep .minimum_version_id.


However, that would break set_counter(). Also limit should be corrected on period / freq change. I'll work more on it.

--
Dmitry



reply via email to

[Prev in Thread] Current Thread [Next in Thread]