From: Havard Skinnemoen <hskinnemoen@google.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
qemu-arm <qemu-arm@nongnu.org>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"IS20 Avi Fishman" <Avi.Fishman@nuvoton.com>,
"CS20 KFTing" <kfting@nuvoton.com>,
"Joel Stanley" <joel@jms.id.au>,
"Cédric Le Goater" <clg@kaod.org>
Subject: Re: [PATCH v8 02/14] hw/misc: Add NPCM7xx Clock Controller device model
Date: Mon, 7 Sep 2020 10:58:41 -0700 [thread overview]
Message-ID: <CAFQmdRZSP8F1=pLEdt5CM-qVvUWMo+Ap4yWGN96WzUshxikBqQ@mail.gmail.com> (raw)
In-Reply-To: <8bd0d21c-d511-d814-da27-92114c47cfcc@amsat.org>
On Mon, Sep 7, 2020 at 6:40 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> On 9/5/20 12:38 AM, Havard Skinnemoen wrote:
> > On Fri, Sep 4, 2020 at 3:02 PM Havard Skinnemoen <hskinnemoen@google.com> wrote:
> >>
> >> On Fri, Sep 4, 2020 at 2:32 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> >>>
> >>> On 8/25/20 2:16 AM, Havard Skinnemoen via wrote:
> >>>> Enough functionality to boot the Linux kernel has been implemented. This
> >>>> includes:
> >>>>
> >>>> - Correct power-on reset values so the various clock rates can be
> >>>> accurately calculated.
> >>>> - Clock enables stick around when written.
> >>>>
> >>>> In addition, a best effort attempt to implement SECCNT and CNTR25M was
> >>>> made even though I don't think the kernel needs them.
> >>>>
> >>>> Reviewed-by: Tyrone Ting <kfting@nuvoton.com>
> >>>> Reviewed-by: Joel Stanley <joel@jms.id.au>
> >>>> Reviewed-by: Cédric Le Goater <clg@kaod.org>
> >>>> Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com>
> >>>> ---
> [...]
> >>>> +static void npcm7xx_clk_write(void *opaque, hwaddr offset,
> >>>> + uint64_t v, unsigned size)
> >>>> +{
> >>>> + uint32_t reg = offset / sizeof(uint32_t);
> >>>> + NPCM7xxCLKState *s = opaque;
> >>>> + uint32_t value = v;
> >>>> +
> >>>> + trace_npcm7xx_clk_write(offset, value);
> >>>> +
> >>>> + if (reg >= NPCM7XX_CLK_NR_REGS) {
> >>>> + qemu_log_mask(LOG_GUEST_ERROR,
> >>>> + "%s: offset 0x%04" HWADDR_PRIx " out of range\n",
> >>>> + __func__, offset);
> >>>> + return;
> >>>> + }
> >>>> +
> >>>> + switch (reg) {
> >>>> + case NPCM7XX_CLK_SWRSTR:
> >>>> + qemu_log_mask(LOG_UNIMP, "%s: SW reset not implemented: 0x%02x\n",
> >>>> + __func__, value);
> >>>
> >>> Isn't this sufficient?
> >>>
> >>> qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
> >>
> >> It's not quite that easy; this register holds 4 bits, each of which
> >> maps to a separate register which defines the modules to reset. It's
> >> not that hard, but a little more than I'd like to add to the series at
> >> this point. I'll send a followup patch once the initial series is in.
> >
> > Actually, I'm not sure if this would have any effect on being able to
> > reboot. Running with -d unimp shows:
> >
> > reboot: Restarting system
> > npcm7xx_timer_write: WTCR write not implemented: 0x00000083
> > Reboot failed -- System halted
> >
> > So we need to implement watchdog support, which is something we were
> > planning to do fairly soon.
>
> Well this seems a guest implementation decision to prefer
> wait the watchdog to kick (hard reset?) rather than doing
> a soft reset.
>
> Two different issues IMO. Anyway this is certainly not
> blocking your series to get merged.
I agree, we need to implement both. I just wanted to note that
implementing SWRST alone may not be enough to make reboots work with
the current image. The SW reset registers are actually very similar to
the WD reset registers, so implementing WD reset should make it almost
trivial to add SW reset as well.
It looks like the kernel has a driver that can use SW reset to reboot,
but the DT is missing a property needed to set up the restart handler.
https://elixir.bootlin.com/linux/v5.8.7/source/drivers/reset/reset-npcm.c#L269
Havard
next prev parent reply other threads:[~2020-09-07 17:59 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-25 0:16 [PATCH v8 00/14] Add Nuvoton NPCM730/NPCM750 SoCs and two BMC machines Havard Skinnemoen via
2020-08-25 0:16 ` [PATCH v8 01/14] hw/misc: Add NPCM7xx System Global Control Registers device model Havard Skinnemoen via
2020-08-25 0:16 ` [PATCH v8 02/14] hw/misc: Add NPCM7xx Clock Controller " Havard Skinnemoen via
2020-09-04 9:32 ` Philippe Mathieu-Daudé
2020-09-04 22:02 ` Havard Skinnemoen
2020-09-04 22:38 ` Havard Skinnemoen
2020-09-07 13:40 ` Philippe Mathieu-Daudé
2020-09-07 17:58 ` Havard Skinnemoen [this message]
2020-08-25 0:17 ` [PATCH v8 03/14] hw/timer: Add NPCM7xx Timer " Havard Skinnemoen via
2020-08-25 0:17 ` [PATCH v8 04/14] hw/arm: Add NPCM730 and NPCM750 SoC models Havard Skinnemoen via
2020-08-25 0:17 ` [PATCH v8 05/14] hw/arm: Add two NPCM7xx-based machines Havard Skinnemoen via
2020-08-25 0:17 ` [PATCH v8 06/14] roms: Add virtual Boot ROM for NPCM7xx SoCs Havard Skinnemoen via
2020-09-04 9:24 ` Philippe Mathieu-Daudé
2020-08-25 0:17 ` [PATCH v8 07/14] hw/arm: Load -bios image as a boot ROM for npcm7xx Havard Skinnemoen via
2020-09-03 18:59 ` Philippe Mathieu-Daudé
2020-09-10 23:52 ` Havard Skinnemoen
2020-08-25 0:17 ` [PATCH v8 08/14] hw/nvram: NPCM7xx OTP device model Havard Skinnemoen via
2020-09-07 19:47 ` Alexander Bulekov
2020-09-07 19:57 ` Alexander Bulekov
2020-09-07 21:52 ` Havard Skinnemoen
2020-08-25 0:17 ` [PATCH v8 09/14] hw/mem: Stubbed out NPCM7xx Memory Controller model Havard Skinnemoen via
2020-08-25 0:17 ` [PATCH v8 10/14] hw/ssi: NPCM7xx Flash Interface Unit device model Havard Skinnemoen via
2020-08-25 0:17 ` [PATCH v8 11/14] hw/arm: Wire up BMC boot flash for npcm750-evb and quanta-gsj Havard Skinnemoen via
2020-08-25 0:17 ` [PATCH v8 12/14] hw/arm/npcm7xx: add board setup stub for CPU and UART clocks Havard Skinnemoen via
2020-09-04 9:34 ` Philippe Mathieu-Daudé
2020-08-25 0:17 ` [PATCH v8 13/14] docs/system: Add Nuvoton machine documentation Havard Skinnemoen via
2020-09-03 19:11 ` Philippe Mathieu-Daudé
2020-08-25 0:17 ` [PATCH v8 14/14] tests/acceptance: console boot tests for quanta-gsj Havard Skinnemoen via
2020-09-03 18:20 ` [PATCH v8 00/14] Add Nuvoton NPCM730/NPCM750 SoCs and two BMC machines Philippe Mathieu-Daudé
2020-09-08 15:02 ` Alexander Bulekov
2020-09-08 15:52 ` Philippe Mathieu-Daudé
2020-09-08 16:58 ` Philippe Mathieu-Daudé
2020-09-08 19:52 ` Havard Skinnemoen
2020-09-09 1:32 ` Havard Skinnemoen
2020-09-11 0:03 ` Havard Skinnemoen
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='CAFQmdRZSP8F1=pLEdt5CM-qVvUWMo+Ap4yWGN96WzUshxikBqQ@mail.gmail.com' \
--to=hskinnemoen@google.com \
--cc=Avi.Fishman@nuvoton.com \
--cc=clg@kaod.org \
--cc=f4bug@amsat.org \
--cc=joel@jms.id.au \
--cc=kfting@nuvoton.com \
--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).