From: Dmitry Osipenko <digetx@gmail.com>
To: Andrew Jeffery <andrew@aj.id.au>,
Peter Maydell <peter.maydell@linaro.org>
Cc: "Alexey Kardashevskiy" <aik@ozlabs.ru>,
"Jeremy Kerr" <jk@ozlabs.org>,
qemu-arm@nongnu.org, qemu-devel@nongnu.org,
"Cédric Le Goater" <clg@kaod.org>
Subject: Re: [Qemu-devel] [PATCH v4 1/4] hw/timer: Add ASPEED timer device model
Date: Tue, 15 Mar 2016 21:14:17 +0300 [thread overview]
Message-ID: <56E850F9.5080307@gmail.com> (raw)
In-Reply-To: <1457928832-31026-2-git-send-email-andrew@aj.id.au>
Hello Andrew,
14.03.2016 07:13, Andrew Jeffery пишет:
> Implement basic ASPEED timer functionality for the AST2400 SoC[1]: Up to
> 8 timers can independently be configured, enabled, reset and disabled.
> Some hardware features are not implemented, namely clock value matching
> and pulse generation, but the implementation is enough to boot the Linux
> kernel configured with aspeed_defconfig.
>
[snip]
> +static void aspeed_timer_set_value(AspeedTimerCtrlState *s, int timer, int reg,
> + uint32_t value)
> +{
> + AspeedTimer *t;
> +
> + g_assert(timer >= 0 && timer < ASPEED_TIMER_NR_TIMERS);
This would never fail, wouldn't it?
[snip]
> +static void aspeed_timer_write(void *opaque, hwaddr offset, uint64_t value,
> + unsigned size)
> +{
> + const uint32_t tv = (uint32_t)(value & 0xFFFFFFFF);
> + const int reg = (offset & 0xf) / 4;
> + AspeedTimerCtrlState *s = opaque;
> +
> + switch (offset) {
> + /* Control Registers */
> + case 0x30:
> + aspeed_timer_set_ctrl(s, tv);
> + break;
> + case 0x34:
> + aspeed_timer_set_ctrl2(s, tv);
> + break;
> + /* Timer Registers */
> + case 0x00 ... 0x2c:
> + aspeed_timer_set_value(s, (offset >> TIMER_NR_REGS), reg, tv);
> + break;
> + case 0x40 ... 0x8c:
> + aspeed_timer_set_value(s, (offset >> TIMER_NR_REGS) - 1, reg, tv);
> + break;
[snip]
> +static void aspeed_init_one_timer(AspeedTimerCtrlState *s, uint8_t id)
> +{
> + QEMUBH *bh;
> + AspeedTimer *t = &s->timers[id];
> +
> + t->id = id;
> + bh = qemu_bh_new(aspeed_timer_expire, t);
> + assert(bh);
> + t->timer = ptimer_init(bh);
> + assert(t->timer);
> +}
I'm wondering why do you need those asserts, it's very unlikely that this code
would fail. Have you had any weird issues with it?
--
Dmitry
next prev parent reply other threads:[~2016-03-15 18:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-14 4:13 [Qemu-devel] [PATCH v4 0/4] Add ASPEED AST2400 SoC and OpenPower BMC machine Andrew Jeffery
2016-03-14 4:13 ` [Qemu-devel] [PATCH v4 1/4] hw/timer: Add ASPEED timer device model Andrew Jeffery
2016-03-15 13:14 ` Cédric Le Goater
2016-03-15 23:06 ` Andrew Jeffery
2016-03-15 18:14 ` Dmitry Osipenko [this message]
2016-03-15 22:48 ` Andrew Jeffery
2016-03-14 4:13 ` [Qemu-devel] [PATCH v4 2/4] hw/intc: Add (new) ASPEED VIC " Andrew Jeffery
2016-03-14 4:13 ` [Qemu-devel] [PATCH v4 3/4] hw/arm: Add ASPEED AST2400 SoC model Andrew Jeffery
2016-03-14 4:13 ` [Qemu-devel] [PATCH v4 4/4] hw/arm: Add opbmc2400, an AST2400 OpenPOWER BMC machine Andrew Jeffery
2016-03-15 4:34 ` [Qemu-devel] [PATCH v4 0/4] Add ASPEED AST2400 SoC and OpenPower " Jeremy Kerr
2016-03-15 5:01 ` Andrew Jeffery
2016-03-15 10:25 ` Cédric Le Goater
2016-03-15 23:09 ` Andrew Jeffery
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=56E850F9.5080307@gmail.com \
--to=digetx@gmail.com \
--cc=aik@ozlabs.ru \
--cc=andrew@aj.id.au \
--cc=clg@kaod.org \
--cc=jk@ozlabs.org \
--cc=peter.maydell@linaro.org \
--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).