qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Peter Crosthwaite <crosthwaitepeter@gmail.com>,
	QEMU Developers <qemu-devel@nongnu.org>
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	[thread overview]
Message-ID: <562A6937.1060605@gmail.com> (raw)
In-Reply-To: <56254C0E.8050909@gmail.com>

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

      parent reply	other threads:[~2015-10-23 17:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13 23:30 [Qemu-devel] [PATCH v5 1/2] hw/ptimer: Set delta to the original limit on reload in ptimer_set_limit() Dmitry Osipenko
2015-10-13 23:30 ` [Qemu-devel] [PATCH v5 2/2] arm_mptimer: Convert to use ptimer Dmitry Osipenko
2015-10-19 17:06 ` [Qemu-devel] [PATCH v5 1/2] hw/ptimer: Set delta to the original limit on reload in ptimer_set_limit() Peter Maydell
2015-10-19 20:01   ` Dmitry Osipenko
2015-10-23 14:07     ` Peter Maydell
2015-10-23 17:07     ` Dmitry Osipenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=562A6937.1060605@gmail.com \
    --to=digetx@gmail.com \
    --cc=crosthwaitepeter@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).