qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Hao Wu <wuhaotsh@google.com>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org,
	Avi.Fishman@nuvoton.com,  kfting@nuvoton.com, titusr@google.com,
	hskinnemoen@google.com,  venture@google.com, pbonzini@redhat.com,
	jasowang@redhat.com,  alistair@alistair23.me
Subject: Re: [PATCH v2 07/17] hw/misc: Add nr_regs and cold_reset_values to NPCM GCR
Date: Tue, 4 Feb 2025 15:48:35 +0000	[thread overview]
Message-ID: <CAFEAcA82ZPPPBFxJ1QzmnVPs96U5uTYQrdkkw3db=R7gQD_FcQ@mail.gmail.com> (raw)
In-Reply-To: <20241226082800.2887689-8-wuhaotsh@google.com>

On Thu, 26 Dec 2024 at 08:28, Hao Wu <wuhaotsh@google.com> wrote:
>
> These 2 values are different between NPCM7XX and NPCM8XX
> GCRs. So we add them to the class and assign different values
> to them.
>
> Signed-off-by: Hao Wu <wuhaotsh@google.com>
> ---
>  hw/misc/npcm_gcr.c         | 24 +++++++++++++++---------
>  include/hw/misc/npcm_gcr.h | 13 +++++++++++--
>  2 files changed, 26 insertions(+), 11 deletions(-)
>



> @@ -156,10 +158,10 @@ static const struct MemoryRegionOps npcm_gcr_ops = {
>  static void npcm7xx_gcr_enter_reset(Object *obj, ResetType type)
>  {
>      NPCMGCRState *s = NPCM_GCR(obj);
> +    NPCMGCRClass *c = NPCM_GCR_GET_CLASS(obj);
>
> -    QEMU_BUILD_BUG_ON(sizeof(s->regs) != sizeof(cold_reset_values));
> -
> -    memcpy(s->regs, cold_reset_values, sizeof(s->regs));
> +    memcpy(s->regs, c->cold_reset_values, c->nr_regs * sizeof(uint32_t));

Previously we had a compile-time assert that we were copying
the right amount of data. Making this a class-specific
thing means we can't assert at compile time any more, but
I think it's still worth a runtime assert that we aren't
copying more data than will fit into s->regs.

Otherwise
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


  reply	other threads:[~2025-02-04 15:49 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-26  8:27 [PATCH v2 00/17] hw/arm: Add NPCM8XX Support Hao Wu
2024-12-26  8:27 ` [PATCH v2 01/17] docs/system/arm: Add Description for NPCM8XX SoC Hao Wu
2025-02-04 16:16   ` Peter Maydell
2024-12-26  8:27 ` [PATCH v2 02/17] roms: Update vbootrom to 1287b6e Hao Wu
2025-02-04 16:30   ` Peter Maydell
2024-12-26  8:27 ` [PATCH v2 03/17] pc-bios: Add NPCM8XX vBootrom Hao Wu
2025-02-04 16:31   ` Peter Maydell
2024-12-26  8:27 ` [PATCH v2 04/17] hw/ssi: Make flash size a property in NPCM7XX FIU Hao Wu
2025-02-04 15:42   ` Peter Maydell
2024-12-26  8:27 ` [PATCH v2 05/17] hw/misc: Rename npcm7xx_gcr to npcm_gcr Hao Wu
2025-02-04 15:43   ` Peter Maydell
2024-12-26  8:27 ` [PATCH v2 06/17] hw/misc: Move NPCM7XX GCR to NPCM GCR Hao Wu
2025-02-04 15:45   ` Peter Maydell
2024-12-26  8:27 ` [PATCH v2 07/17] hw/misc: Add nr_regs and cold_reset_values " Hao Wu
2025-02-04 15:48   ` Peter Maydell [this message]
2024-12-26  8:27 ` [PATCH v2 08/17] hw/misc: Add support for NPCM8XX GCR Hao Wu
2025-02-04 15:49   ` Peter Maydell
2024-12-26  8:27 ` [PATCH v2 09/17] hw/misc: Store DRAM size in NPCM8XX GCR Module Hao Wu
2025-02-04 15:51   ` Peter Maydell
2024-12-26  8:27 ` [PATCH v2 10/17] hw/misc: Support 8-bytes memop in NPCM GCR module Hao Wu
2025-02-04 15:55   ` Peter Maydell
2024-12-26  8:27 ` [PATCH v2 11/17] hw/misc: Rename npcm7xx_clk to npcm_clk Hao Wu
2025-02-04 15:56   ` Peter Maydell
2024-12-26  8:27 ` [PATCH v2 12/17] hw/misc: Move NPCM7XX CLK to NPCM CLK Hao Wu
2025-02-04 16:03   ` Peter Maydell
2024-12-26  8:27 ` [PATCH v2 13/17] hw/misc: Add nr_regs and cold_reset_values " Hao Wu
2025-02-04 16:04   ` Peter Maydell
2024-12-26  8:27 ` [PATCH v2 14/17] hw/misc: Support NPCM8XX CLK Module Registers Hao Wu
2025-02-04 16:05   ` Peter Maydell
2024-12-26  8:27 ` [PATCH v2 15/17] hw/net: Add NPCM8XX PCS Module Hao Wu
2025-02-04 16:19   ` Peter Maydell
2024-12-26  8:27 ` [PATCH v2 16/17] hw/arm: Add NPCM8XX SoC Hao Wu
2025-02-04 16:28   ` Peter Maydell
2024-12-26  8:28 ` [PATCH v2 17/17] hw/arm: Add NPCM845 Evaluation board Hao Wu
2025-02-04 16:08   ` Peter Maydell

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='CAFEAcA82ZPPPBFxJ1QzmnVPs96U5uTYQrdkkw3db=R7gQD_FcQ@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=Avi.Fishman@nuvoton.com \
    --cc=alistair@alistair23.me \
    --cc=hskinnemoen@google.com \
    --cc=jasowang@redhat.com \
    --cc=kfting@nuvoton.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=titusr@google.com \
    --cc=venture@google.com \
    --cc=wuhaotsh@google.com \
    /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).