From: "Andrew Jeffery" <andrew@aj.id.au>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Cameron Esfahani via" <qemu-devel@nongnu.org>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
qemu-arm@nongnu.org, "Cédric Le Goater" <clg@kaod.org>,
"Joel Stanley" <joel@jms.id.au>
Subject: Re: [PATCH 2/2] watchdog: aspeed: Fix sequential control writes
Date: Tue, 13 Jul 2021 12:11:13 +0930 [thread overview]
Message-ID: <b43af989-f4b9-4227-a84c-e0026a0f90bc@www.fastmail.com> (raw)
In-Reply-To: <d222c518-13de-f4c5-3eb6-2045d7a26fba@amsat.org>
On Fri, 9 Jul 2021, at 16:59, Philippe Mathieu-Daudé wrote:
> On 7/9/21 7:31 AM, Andrew Jeffery wrote:
> > The logic in the handling for the control register required toggling the
> > enable state for writes to stick. Rework the condition chain to allow
> > sequential writes that do not update the enable state.
> >
> > Fixes: 854123bf8d4b ("wdt: Add Aspeed watchdog device model")
> > Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> > ---
> > hw/watchdog/wdt_aspeed.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c
> > index faa3d35fdf21..69c37af9a6e9 100644
> > --- a/hw/watchdog/wdt_aspeed.c
> > +++ b/hw/watchdog/wdt_aspeed.c
> > @@ -166,6 +166,8 @@ static void aspeed_wdt_write(void *opaque, hwaddr offset, uint64_t data,
> > } else if (!enable && aspeed_wdt_is_enabled(s)) {
> > s->regs[WDT_CTRL] = data;
> > timer_del(s->timer);
> > + } else {
> > + s->regs[WDT_CTRL] = data;
>
> What about simplifying by moving here:
>
> if (!enable && aspeed_wdt_is_enabled(s)) {
> timer_del(s->timer);
> }
>
I don't think that works, as aspeed_wdt_is_enabled() tests the value of
s->regs[WDT_CTRL]. If you set it before you test then you end up in the
wrong state.
Andrew
next prev parent reply other threads:[~2021-07-13 2:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-09 5:31 [PATCH 0/2] wdt_aspeed: Fix behaviour of control register Andrew Jeffery
2021-07-09 5:31 ` [PATCH 1/2] watchdog: aspeed: Sanitize control register values Andrew Jeffery
2021-07-19 15:53 ` Cédric Le Goater
2021-07-09 5:31 ` [PATCH 2/2] watchdog: aspeed: Fix sequential control writes Andrew Jeffery
2021-07-09 7:29 ` Philippe Mathieu-Daudé
2021-07-13 2:41 ` Andrew Jeffery [this message]
2021-07-19 15:54 ` Cédric Le Goater
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=b43af989-f4b9-4227-a84c-e0026a0f90bc@www.fastmail.com \
--to=andrew@aj.id.au \
--cc=clg@kaod.org \
--cc=f4bug@amsat.org \
--cc=joel@jms.id.au \
--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).