From: Alistair Francis <alistair.francis@wdc.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, alistair23@gmail.com,
Alistair Francis <alistair.francis@wdc.com>
Subject: [Qemu-devel] [PULL 4/5] riscv_hart: Fix crash when introspecting the device
Date: Wed, 18 Jul 2018 15:27:54 -0700 [thread overview]
Message-ID: <20180718222755.9014-5-alistair.francis@wdc.com> (raw)
In-Reply-To: <20180718222755.9014-1-alistair.francis@wdc.com>
Use the new object_initialize_child() and sysbus_init_child_obj() to
fix the issue.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Suggested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/riscv/riscv_hart.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/hw/riscv/riscv_hart.c b/hw/riscv/riscv_hart.c
index 75ba7ed579..e34a26a0ef 100644
--- a/hw/riscv/riscv_hart.c
+++ b/hw/riscv/riscv_hart.c
@@ -45,11 +45,10 @@ static void riscv_harts_realize(DeviceState *dev, Error **errp)
s->harts = g_new0(RISCVCPU, s->num_harts);
for (n = 0; n < s->num_harts; n++) {
-
- object_initialize(&s->harts[n], sizeof(RISCVCPU), s->cpu_type);
+ object_initialize_child(OBJECT(s), "harts[*]", &s->harts[n],
+ sizeof(RISCVCPU), s->cpu_type,
+ &error_abort, NULL);
s->harts[n].env.mhartid = n;
- object_property_add_child(OBJECT(s), "harts[*]", OBJECT(&s->harts[n]),
- &error_abort);
qemu_register_reset(riscv_harts_cpu_reset, &s->harts[n]);
object_property_set_bool(OBJECT(&s->harts[n]), true,
"realized", &err);
--
2.17.1
next prev parent reply other threads:[~2018-07-18 22:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 22:27 [Qemu-devel] [PULL 0/5] riscv-pull queue Alistair Francis
2018-07-18 22:27 ` [Qemu-devel] [PULL 1/5] sifive_e: Fix crash when introspecting the device Alistair Francis
2018-07-18 22:27 ` [Qemu-devel] [PULL 2/5] sifive_u: " Alistair Francis
2018-07-18 22:27 ` [Qemu-devel] [PULL 3/5] virt: " Alistair Francis
2018-07-18 22:27 ` Alistair Francis [this message]
2018-07-18 22:27 ` [Qemu-devel] [PULL 5/5] spike: " Alistair Francis
2018-07-18 22:31 ` [Qemu-devel] [PULL 0/5] riscv-pull queue Alistair Francis
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=20180718222755.9014-5-alistair.francis@wdc.com \
--to=alistair.francis@wdc.com \
--cc=alistair23@gmail.com \
--cc=peter.maydell@linaro.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).