From: Alistair Francis <alistair23@gmail.com>
To: Ivan Klokov <ivan.klokov@syntacore.com>
Cc: qemu-devel@nongnu.org, qemu-riscv@nongnu.org,
richard.henderson@linaro.org, anup@brainfault.org,
anup.patel@wdc.com, palmer@dabbelt.com,
alistair.francis@wdc.com
Subject: Re: [PATCH] hw/intc/riscv_aplic: Zero init APLIC internal state
Date: Mon, 17 Apr 2023 12:28:40 +1000 [thread overview]
Message-ID: <CAKmqyKO1ccb2MvHGr+oeJ27yCkCSTreP1A8MvUUGyRGa=jAVWw@mail.gmail.com> (raw)
In-Reply-To: <20230413133432.53771-1-ivan.klokov@syntacore.com>
On Thu, Apr 13, 2023 at 11:35 PM Ivan Klokov <ivan.klokov@syntacore.com> wrote:
>
> Since g_new is used to initialize the RISCVAPLICState->state structure,
> in some case we get behavior that is not as expected. This patch
> changes this to g_new0, which allows to initialize the APLIC in the correct state.
>
> Signed-off-by: Ivan Klokov <ivan.klokov@syntacore.com>
Thanks!
Applied to riscv-to-apply.next
Alistair
> ---
> hw/intc/riscv_aplic.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/intc/riscv_aplic.c b/hw/intc/riscv_aplic.c
> index cfd007e629..71591d44bf 100644
> --- a/hw/intc/riscv_aplic.c
> +++ b/hw/intc/riscv_aplic.c
> @@ -803,7 +803,7 @@ static void riscv_aplic_realize(DeviceState *dev, Error **errp)
>
> aplic->bitfield_words = (aplic->num_irqs + 31) >> 5;
> aplic->sourcecfg = g_new0(uint32_t, aplic->num_irqs);
> - aplic->state = g_new(uint32_t, aplic->num_irqs);
> + aplic->state = g_new0(uint32_t, aplic->num_irqs);
> aplic->target = g_new0(uint32_t, aplic->num_irqs);
> if (!aplic->msimode) {
> for (i = 0; i < aplic->num_irqs; i++) {
> --
> 2.34.1
>
>
prev parent reply other threads:[~2023-04-17 2:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-13 13:34 [PATCH] hw/intc/riscv_aplic: Zero init APLIC internal state Ivan Klokov
2023-04-13 16:02 ` Anup Patel
2023-04-17 2:28 ` Alistair Francis
2023-04-17 2:28 ` Alistair Francis [this message]
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='CAKmqyKO1ccb2MvHGr+oeJ27yCkCSTreP1A8MvUUGyRGa=jAVWw@mail.gmail.com' \
--to=alistair23@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=anup.patel@wdc.com \
--cc=anup@brainfault.org \
--cc=ivan.klokov@syntacore.com \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=richard.henderson@linaro.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).