qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Andrew Jeffery <andrew@aj.id.au>
Cc: "QEMU Developers" <qemu-devel@nongnu.org>,
	qemu-arm <qemu-arm@nongnu.org>, "Cédric Le Goater" <clg@kaod.org>,
	"Joel Stanley" <joel@jms.id.au>
Subject: Re: [PATCH 2/4] target/arm: Abstract the generic timer frequency
Date: Mon, 2 Dec 2019 18:12:49 +0000	[thread overview]
Message-ID: <CAFEAcA99yzysf0J=n1yYgtxBmBDvi8-=CrCO6kdymt8Woo9t1Q@mail.gmail.com> (raw)
In-Reply-To: <20191128054527.25450-3-andrew@aj.id.au>

On Thu, 28 Nov 2019 at 05:44, Andrew Jeffery <andrew@aj.id.au> wrote:
>
> Prepare for SoCs such as the ASPEED AST2600 whose firmware configures
> CNTFRQ to values significantly larger than the static 62.5MHz value
> currently derived from GTIMER_SCALE. As the OS potentially derives its
> timer periods from the CNTFRQ value the lack of support for running
> QEMUTimers at the appropriate rate leads to sticky behaviour in the
> guest.
>
> Substitute the GTIMER_SCALE constant with use of a helper to derive the
> period from gt_cntfrq stored in struct ARMCPU. Initially set gt_cntfrq
> to the frequency associated with GTIMER_SCALE so current behaviour is
> maintained.
>
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>

> +static inline unsigned int gt_cntfrq_period_ns(ARMCPU *cpu)
> +{
> +    /* XXX: Could include qemu/timer.h to get NANOSECONDS_PER_SECOND? */
> +    const unsigned int ns_per_s = 1000 * 1000 * 1000;
> +    return ns_per_s > cpu->gt_cntfrq ? ns_per_s / cpu->gt_cntfrq : 1;
> +}

This function is named gt_cntfrq_period_ns()...

>  static uint64_t gt_virt_cnt_read(CPUARMState *env, const ARMCPRegInfo *ri)
>  {
> +    ARMCPU *cpu = env_archcpu(env);
> +
>      /* Currently we have no support for QEMUTimer in linux-user so we
>       * can't call gt_get_countervalue(env), instead we directly
>       * call the lower level functions.
>       */
> -    return cpu_get_clock() / GTIMER_SCALE;
> +    return cpu_get_clock() / gt_cntfrq_period(cpu);
>  }

...but here we call gt_cntfrq_period(), which doesn't exist,
and indeed at least one of the patchew build systems reported
it as a compile failure.

thanks
-- PMM


  parent reply	other threads:[~2019-12-02 18:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-28  5:45 [PATCH 0/4] Expose GT CNTFRQ as a CPU property to support AST2600 Andrew Jeffery
2019-11-28  5:45 ` [PATCH 1/4] target/arm: Remove redundant scaling of nexttick Andrew Jeffery
2019-11-28  8:47   ` Cédric Le Goater
2019-11-28  5:45 ` [PATCH 2/4] target/arm: Abstract the generic timer frequency Andrew Jeffery
2019-11-28  8:46   ` Cédric Le Goater
2019-11-28 22:29     ` Andrew Jeffery
2019-12-02 18:12   ` Peter Maydell [this message]
2019-12-02 23:48     ` Andrew Jeffery
2019-11-28  5:45 ` [PATCH 3/4] target/arm: Prepare generic timer for per-platform CNTFRQ Andrew Jeffery
2019-11-28  5:45 ` [PATCH 4/4] ast2600: Configure CNTFRQ at 1125MHz Andrew Jeffery
2019-11-28  8:47   ` Cédric Le Goater
2019-12-02 18:09 ` [PATCH 0/4] Expose GT CNTFRQ as a CPU property to support AST2600 Richard Henderson

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='CAFEAcA99yzysf0J=n1yYgtxBmBDvi8-=CrCO6kdymt8Woo9t1Q@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=andrew@aj.id.au \
    --cc=clg@kaod.org \
    --cc=joel@jms.id.au \
    --cc=qemu-arm@nongnu.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).