* [Qemu-devel] [PATCH v1 0/5] riscv: Fix introspection problems
@ 2018-07-17 20:27 Alistair Francis
2018-07-17 20:27 ` [Qemu-devel] [PATCH v1 1/5] sifive_e: Fix crash when introspecting the device Alistair Francis
` (6 more replies)
0 siblings, 7 replies; 17+ messages in thread
From: Alistair Francis @ 2018-07-17 20:27 UTC (permalink / raw)
To: qemu-devel; +Cc: alistair.francis, thuth, mjc
This is based on Thomas's work fixing introspection problems [1] and
applied to the RISC-V port.
1: https://lists.gnu.org/archive/html/qemu-devel/2018-07/msg03261.html
Alistair Francis (5):
sifive_e: Fix crash when introspecting the device
sifive_u: Fix crash when introspecting the device
virt: Fix crash when introspecting the device
riscv_hart: Fix crash when introspecting the device
spike: Fix crash when introspecting the device
hw/riscv/riscv_hart.c | 7 +++----
hw/riscv/sifive_e.c | 12 ++++++------
hw/riscv/sifive_u.c | 15 +++++++--------
hw/riscv/spike.c | 10 ++++------
hw/riscv/virt.c | 5 ++---
5 files changed, 22 insertions(+), 27 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Qemu-devel] [PATCH v1 1/5] sifive_e: Fix crash when introspecting the device
2018-07-17 20:27 [Qemu-devel] [PATCH v1 0/5] riscv: Fix introspection problems Alistair Francis
@ 2018-07-17 20:27 ` Alistair Francis
2018-07-17 21:03 ` Michael Clark
2018-07-17 20:28 ` [Qemu-devel] [PATCH v1 2/5] sifive_u: " Alistair Francis
` (5 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Alistair Francis @ 2018-07-17 20:27 UTC (permalink / raw)
To: qemu-devel; +Cc: alistair.francis, thuth, mjc
Use the new object_initialize_child() and sysbus_init_child_obj() to
fix the issue.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
hw/riscv/sifive_e.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c
index 8a8dbe1c00..4577d72037 100644
--- a/hw/riscv/sifive_e.c
+++ b/hw/riscv/sifive_e.c
@@ -105,9 +105,9 @@ static void riscv_sifive_e_init(MachineState *machine)
int i;
/* Initialize SoC */
- object_initialize(&s->soc, sizeof(s->soc), TYPE_RISCV_E_SOC);
- object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
- &error_abort);
+ object_initialize_child(OBJECT(machine), "soc", &s->soc,
+ sizeof(s->soc), TYPE_RISCV_E_SOC,
+ &error_abort, NULL);
object_property_set_bool(OBJECT(&s->soc), true, "realized",
&error_abort);
@@ -139,9 +139,9 @@ static void riscv_sifive_e_soc_init(Object *obj)
{
SiFiveESoCState *s = RISCV_E_SOC(obj);
- object_initialize(&s->cpus, sizeof(s->cpus), TYPE_RISCV_HART_ARRAY);
- object_property_add_child(obj, "cpus", OBJECT(&s->cpus),
- &error_abort);
+ object_initialize_child(obj, "cpus", &s->cpus,
+ sizeof(s->cpus), TYPE_RISCV_HART_ARRAY,
+ &error_abort, NULL);
object_property_set_str(OBJECT(&s->cpus), SIFIVE_E_CPU, "cpu-type",
&error_abort);
object_property_set_int(OBJECT(&s->cpus), smp_cpus, "num-harts",
--
2.17.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [Qemu-devel] [PATCH v1 2/5] sifive_u: Fix crash when introspecting the device
2018-07-17 20:27 [Qemu-devel] [PATCH v1 0/5] riscv: Fix introspection problems Alistair Francis
2018-07-17 20:27 ` [Qemu-devel] [PATCH v1 1/5] sifive_e: Fix crash when introspecting the device Alistair Francis
@ 2018-07-17 20:28 ` Alistair Francis
2018-07-17 21:03 ` Michael Clark
2018-07-18 14:11 ` Philippe Mathieu-Daudé
2018-07-17 20:28 ` [Qemu-devel] [PATCH v1 3/5] virt: " Alistair Francis
` (4 subsequent siblings)
6 siblings, 2 replies; 17+ messages in thread
From: Alistair Francis @ 2018-07-17 20:28 UTC (permalink / raw)
To: qemu-devel; +Cc: alistair.francis, thuth, mjc
Use the new object_initialize_child() and sysbus_init_child_obj() to
fix the issue.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
hw/riscv/sifive_u.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
index 3a6ffeb437..59ae1ce24a 100644
--- a/hw/riscv/sifive_u.c
+++ b/hw/riscv/sifive_u.c
@@ -244,9 +244,9 @@ static void riscv_sifive_u_init(MachineState *machine)
int i;
/* Initialize SoC */
- object_initialize(&s->soc, sizeof(s->soc), TYPE_RISCV_U_SOC);
- object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
- &error_abort);
+ object_initialize_child(OBJECT(machine), "soc", &s->soc,
+ sizeof(s->soc), TYPE_RISCV_U_SOC,
+ &error_abort, NULL);
object_property_set_bool(OBJECT(&s->soc), true, "realized",
&error_abort);
@@ -303,16 +303,15 @@ static void riscv_sifive_u_soc_init(Object *obj)
{
SiFiveUSoCState *s = RISCV_U_SOC(obj);
- object_initialize(&s->cpus, sizeof(s->cpus), TYPE_RISCV_HART_ARRAY);
- object_property_add_child(obj, "cpus", OBJECT(&s->cpus),
- &error_abort);
+ object_initialize_child(obj, "cpus", &s->cpus, sizeof(s->cpus),
+ TYPE_RISCV_HART_ARRAY, &error_abort, NULL);
object_property_set_str(OBJECT(&s->cpus), SIFIVE_U_CPU, "cpu-type",
&error_abort);
object_property_set_int(OBJECT(&s->cpus), smp_cpus, "num-harts",
&error_abort);
- object_initialize(&s->gem, sizeof(s->gem), TYPE_CADENCE_GEM);
- qdev_set_parent_bus(DEVICE(&s->gem), sysbus_get_default());
+ sysbus_init_child_obj(obj, "gem", &s->gem, sizeof(s->gem),
+ TYPE_CADENCE_GEM);
}
static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)
--
2.17.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [Qemu-devel] [PATCH v1 3/5] virt: Fix crash when introspecting the device
2018-07-17 20:27 [Qemu-devel] [PATCH v1 0/5] riscv: Fix introspection problems Alistair Francis
2018-07-17 20:27 ` [Qemu-devel] [PATCH v1 1/5] sifive_e: Fix crash when introspecting the device Alistair Francis
2018-07-17 20:28 ` [Qemu-devel] [PATCH v1 2/5] sifive_u: " Alistair Francis
@ 2018-07-17 20:28 ` Alistair Francis
2018-07-17 21:03 ` Michael Clark
2018-07-17 20:28 ` [Qemu-devel] [PATCH v1 4/5] riscv_hart: " Alistair Francis
` (3 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Alistair Francis @ 2018-07-17 20:28 UTC (permalink / raw)
To: qemu-devel; +Cc: alistair.francis, thuth, mjc
Use the new object_initialize_child() and sysbus_init_child_obj() to
fix the issue.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
hw/riscv/virt.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index aeada2498d..248bbdffd3 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -274,9 +274,8 @@ static void riscv_virt_board_init(MachineState *machine)
void *fdt;
/* Initialize SOC */
- object_initialize(&s->soc, sizeof(s->soc), TYPE_RISCV_HART_ARRAY);
- object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
- &error_abort);
+ object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc),
+ TYPE_RISCV_HART_ARRAY, &error_abort, NULL);
object_property_set_str(OBJECT(&s->soc), VIRT_CPU, "cpu-type",
&error_abort);
object_property_set_int(OBJECT(&s->soc), smp_cpus, "num-harts",
--
2.17.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [Qemu-devel] [PATCH v1 4/5] riscv_hart: Fix crash when introspecting the device
2018-07-17 20:27 [Qemu-devel] [PATCH v1 0/5] riscv: Fix introspection problems Alistair Francis
` (2 preceding siblings ...)
2018-07-17 20:28 ` [Qemu-devel] [PATCH v1 3/5] virt: " Alistair Francis
@ 2018-07-17 20:28 ` Alistair Francis
2018-07-17 21:04 ` Michael Clark
2018-07-17 20:28 ` [Qemu-devel] [PATCH v1 5/5] spike: " Alistair Francis
` (2 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Alistair Francis @ 2018-07-17 20:28 UTC (permalink / raw)
To: qemu-devel; +Cc: alistair.francis, thuth, mjc
Use the new object_initialize_child() and sysbus_init_child_obj() to
fix the issue.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
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
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [Qemu-devel] [PATCH v1 5/5] spike: Fix crash when introspecting the device
2018-07-17 20:27 [Qemu-devel] [PATCH v1 0/5] riscv: Fix introspection problems Alistair Francis
` (3 preceding siblings ...)
2018-07-17 20:28 ` [Qemu-devel] [PATCH v1 4/5] riscv_hart: " Alistair Francis
@ 2018-07-17 20:28 ` Alistair Francis
2018-07-17 21:04 ` Michael Clark
2018-07-18 7:22 ` [Qemu-devel] [PATCH v1 0/5] riscv: Fix introspection problems Thomas Huth
2018-07-18 7:23 ` Thomas Huth
6 siblings, 1 reply; 17+ messages in thread
From: Alistair Francis @ 2018-07-17 20:28 UTC (permalink / raw)
To: qemu-devel; +Cc: alistair.francis, thuth, mjc
Use the new object_initialize_child() and sysbus_init_child_obj() to
fix the issue.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
hw/riscv/spike.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
index f94e2b6707..c8c056c50b 100644
--- a/hw/riscv/spike.c
+++ b/hw/riscv/spike.c
@@ -171,9 +171,8 @@ static void spike_v1_10_0_board_init(MachineState *machine)
int i;
/* Initialize SOC */
- object_initialize(&s->soc, sizeof(s->soc), TYPE_RISCV_HART_ARRAY);
- object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
- &error_abort);
+ object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc),
+ TYPE_RISCV_HART_ARRAY, &error_abort, NULL);
object_property_set_str(OBJECT(&s->soc), SPIKE_V1_10_0_CPU, "cpu-type",
&error_abort);
object_property_set_int(OBJECT(&s->soc), smp_cpus, "num-harts",
@@ -254,9 +253,8 @@ static void spike_v1_09_1_board_init(MachineState *machine)
int i;
/* Initialize SOC */
- object_initialize(&s->soc, sizeof(s->soc), TYPE_RISCV_HART_ARRAY);
- object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
- &error_abort);
+ object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc),
+ TYPE_RISCV_HART_ARRAY, &error_abort, NULL);
object_property_set_str(OBJECT(&s->soc), SPIKE_V1_09_1_CPU, "cpu-type",
&error_abort);
object_property_set_int(OBJECT(&s->soc), smp_cpus, "num-harts",
--
2.17.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH v1 1/5] sifive_e: Fix crash when introspecting the device
2018-07-17 20:27 ` [Qemu-devel] [PATCH v1 1/5] sifive_e: Fix crash when introspecting the device Alistair Francis
@ 2018-07-17 21:03 ` Michael Clark
0 siblings, 0 replies; 17+ messages in thread
From: Michael Clark @ 2018-07-17 21:03 UTC (permalink / raw)
To: Alistair Francis; +Cc: QEMU Developers, Thomas Huth
On Wed, Jul 18, 2018 at 8:27 AM, Alistair Francis <alistair.francis@wdc.com>
wrote:
> Use the new object_initialize_child() and sysbus_init_child_obj() to
> fix the issue.
>
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
>
Reviewed-by: Michael Clark <mjc@sifive.com>
> ---
> hw/riscv/sifive_e.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c
> index 8a8dbe1c00..4577d72037 100644
> --- a/hw/riscv/sifive_e.c
> +++ b/hw/riscv/sifive_e.c
> @@ -105,9 +105,9 @@ static void riscv_sifive_e_init(MachineState *machine)
> int i;
>
> /* Initialize SoC */
> - object_initialize(&s->soc, sizeof(s->soc), TYPE_RISCV_E_SOC);
> - object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
> - &error_abort);
> + object_initialize_child(OBJECT(machine), "soc", &s->soc,
> + sizeof(s->soc), TYPE_RISCV_E_SOC,
> + &error_abort, NULL);
> object_property_set_bool(OBJECT(&s->soc), true, "realized",
> &error_abort);
>
> @@ -139,9 +139,9 @@ static void riscv_sifive_e_soc_init(Object *obj)
> {
> SiFiveESoCState *s = RISCV_E_SOC(obj);
>
> - object_initialize(&s->cpus, sizeof(s->cpus), TYPE_RISCV_HART_ARRAY);
> - object_property_add_child(obj, "cpus", OBJECT(&s->cpus),
> - &error_abort);
> + object_initialize_child(obj, "cpus", &s->cpus,
> + sizeof(s->cpus), TYPE_RISCV_HART_ARRAY,
> + &error_abort, NULL);
> object_property_set_str(OBJECT(&s->cpus), SIFIVE_E_CPU, "cpu-type",
> &error_abort);
> object_property_set_int(OBJECT(&s->cpus), smp_cpus, "num-harts",
> --
> 2.17.1
>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH v1 2/5] sifive_u: Fix crash when introspecting the device
2018-07-17 20:28 ` [Qemu-devel] [PATCH v1 2/5] sifive_u: " Alistair Francis
@ 2018-07-17 21:03 ` Michael Clark
2018-07-18 14:11 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 17+ messages in thread
From: Michael Clark @ 2018-07-17 21:03 UTC (permalink / raw)
To: Alistair Francis; +Cc: QEMU Developers, Thomas Huth
On Wed, Jul 18, 2018 at 8:28 AM, Alistair Francis <alistair.francis@wdc.com>
wrote:
> Use the new object_initialize_child() and sysbus_init_child_obj() to
> fix the issue.
>
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
>
Reviewed-by: Michael Clark <mjc@sifive.com>
> ---
> hw/riscv/sifive_u.c | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
> index 3a6ffeb437..59ae1ce24a 100644
> --- a/hw/riscv/sifive_u.c
> +++ b/hw/riscv/sifive_u.c
> @@ -244,9 +244,9 @@ static void riscv_sifive_u_init(MachineState *machine)
> int i;
>
> /* Initialize SoC */
> - object_initialize(&s->soc, sizeof(s->soc), TYPE_RISCV_U_SOC);
> - object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
> - &error_abort);
> + object_initialize_child(OBJECT(machine), "soc", &s->soc,
> + sizeof(s->soc), TYPE_RISCV_U_SOC,
> + &error_abort, NULL);
> object_property_set_bool(OBJECT(&s->soc), true, "realized",
> &error_abort);
>
> @@ -303,16 +303,15 @@ static void riscv_sifive_u_soc_init(Object *obj)
> {
> SiFiveUSoCState *s = RISCV_U_SOC(obj);
>
> - object_initialize(&s->cpus, sizeof(s->cpus), TYPE_RISCV_HART_ARRAY);
> - object_property_add_child(obj, "cpus", OBJECT(&s->cpus),
> - &error_abort);
> + object_initialize_child(obj, "cpus", &s->cpus, sizeof(s->cpus),
> + TYPE_RISCV_HART_ARRAY, &error_abort, NULL);
> object_property_set_str(OBJECT(&s->cpus), SIFIVE_U_CPU, "cpu-type",
> &error_abort);
> object_property_set_int(OBJECT(&s->cpus), smp_cpus, "num-harts",
> &error_abort);
>
> - object_initialize(&s->gem, sizeof(s->gem), TYPE_CADENCE_GEM);
> - qdev_set_parent_bus(DEVICE(&s->gem), sysbus_get_default());
> + sysbus_init_child_obj(obj, "gem", &s->gem, sizeof(s->gem),
> + TYPE_CADENCE_GEM);
> }
>
> static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)
> --
> 2.17.1
>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH v1 3/5] virt: Fix crash when introspecting the device
2018-07-17 20:28 ` [Qemu-devel] [PATCH v1 3/5] virt: " Alistair Francis
@ 2018-07-17 21:03 ` Michael Clark
0 siblings, 0 replies; 17+ messages in thread
From: Michael Clark @ 2018-07-17 21:03 UTC (permalink / raw)
To: Alistair Francis; +Cc: QEMU Developers, Thomas Huth
On Wed, Jul 18, 2018 at 8:28 AM, Alistair Francis <alistair.francis@wdc.com>
wrote:
> Use the new object_initialize_child() and sysbus_init_child_obj() to
> fix the issue.
>
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
>
Reviewed-by: Michael Clark <mjc@sifive.com>
> ---
> hw/riscv/virt.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index aeada2498d..248bbdffd3 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -274,9 +274,8 @@ static void riscv_virt_board_init(MachineState
> *machine)
> void *fdt;
>
> /* Initialize SOC */
> - object_initialize(&s->soc, sizeof(s->soc), TYPE_RISCV_HART_ARRAY);
> - object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
> - &error_abort);
> + object_initialize_child(OBJECT(machine), "soc", &s->soc,
> sizeof(s->soc),
> + TYPE_RISCV_HART_ARRAY, &error_abort, NULL);
> object_property_set_str(OBJECT(&s->soc), VIRT_CPU, "cpu-type",
> &error_abort);
> object_property_set_int(OBJECT(&s->soc), smp_cpus, "num-harts",
> --
> 2.17.1
>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH v1 4/5] riscv_hart: Fix crash when introspecting the device
2018-07-17 20:28 ` [Qemu-devel] [PATCH v1 4/5] riscv_hart: " Alistair Francis
@ 2018-07-17 21:04 ` Michael Clark
0 siblings, 0 replies; 17+ messages in thread
From: Michael Clark @ 2018-07-17 21:04 UTC (permalink / raw)
To: Alistair Francis; +Cc: QEMU Developers, Thomas Huth
On Wed, Jul 18, 2018 at 8:28 AM, Alistair Francis <alistair.francis@wdc.com>
wrote:
> Use the new object_initialize_child() and sysbus_init_child_obj() to
> fix the issue.
>
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
>
Reviewed-by: Michael Clark <mjc@sifive.com>
> ---
> 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
>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH v1 5/5] spike: Fix crash when introspecting the device
2018-07-17 20:28 ` [Qemu-devel] [PATCH v1 5/5] spike: " Alistair Francis
@ 2018-07-17 21:04 ` Michael Clark
0 siblings, 0 replies; 17+ messages in thread
From: Michael Clark @ 2018-07-17 21:04 UTC (permalink / raw)
To: Alistair Francis; +Cc: QEMU Developers, Thomas Huth
On Wed, Jul 18, 2018 at 8:28 AM, Alistair Francis <alistair.francis@wdc.com>
wrote:
> Use the new object_initialize_child() and sysbus_init_child_obj() to
> fix the issue.
>
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
>
Reviewed-by: Michael Clark <mjc@sifive.com>
> ---
> hw/riscv/spike.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
> index f94e2b6707..c8c056c50b 100644
> --- a/hw/riscv/spike.c
> +++ b/hw/riscv/spike.c
> @@ -171,9 +171,8 @@ static void spike_v1_10_0_board_init(MachineState
> *machine)
> int i;
>
> /* Initialize SOC */
> - object_initialize(&s->soc, sizeof(s->soc), TYPE_RISCV_HART_ARRAY);
> - object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
> - &error_abort);
> + object_initialize_child(OBJECT(machine), "soc", &s->soc,
> sizeof(s->soc),
> + TYPE_RISCV_HART_ARRAY, &error_abort, NULL);
> object_property_set_str(OBJECT(&s->soc), SPIKE_V1_10_0_CPU,
> "cpu-type",
> &error_abort);
> object_property_set_int(OBJECT(&s->soc), smp_cpus, "num-harts",
> @@ -254,9 +253,8 @@ static void spike_v1_09_1_board_init(MachineState
> *machine)
> int i;
>
> /* Initialize SOC */
> - object_initialize(&s->soc, sizeof(s->soc), TYPE_RISCV_HART_ARRAY);
> - object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
> - &error_abort);
> + object_initialize_child(OBJECT(machine), "soc", &s->soc,
> sizeof(s->soc),
> + TYPE_RISCV_HART_ARRAY, &error_abort, NULL);
> object_property_set_str(OBJECT(&s->soc), SPIKE_V1_09_1_CPU,
> "cpu-type",
> &error_abort);
> object_property_set_int(OBJECT(&s->soc), smp_cpus, "num-harts",
> --
> 2.17.1
>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH v1 0/5] riscv: Fix introspection problems
2018-07-17 20:27 [Qemu-devel] [PATCH v1 0/5] riscv: Fix introspection problems Alistair Francis
` (4 preceding siblings ...)
2018-07-17 20:28 ` [Qemu-devel] [PATCH v1 5/5] spike: " Alistair Francis
@ 2018-07-18 7:22 ` Thomas Huth
2018-07-18 21:31 ` Alistair Francis
2018-07-18 7:23 ` Thomas Huth
6 siblings, 1 reply; 17+ messages in thread
From: Thomas Huth @ 2018-07-18 7:22 UTC (permalink / raw)
To: Alistair Francis, qemu-devel; +Cc: mjc, Markus Armbruster
On 17.07.2018 22:27, Alistair Francis wrote:
> This is based on Thomas's work fixing introspection problems [1] and
> applied to the RISC-V port.
>
> 1: https://lists.gnu.org/archive/html/qemu-devel/2018-07/msg03261.html
>
> Alistair Francis (5):
> sifive_e: Fix crash when introspecting the device
> sifive_u: Fix crash when introspecting the device
> virt: Fix crash when introspecting the device
> riscv_hart: Fix crash when introspecting the device
> spike: Fix crash when introspecting the device
>
> hw/riscv/riscv_hart.c | 7 +++----
> hw/riscv/sifive_e.c | 12 ++++++------
> hw/riscv/sifive_u.c | 15 +++++++--------
> hw/riscv/spike.c | 10 ++++------
> hw/riscv/virt.c | 5 ++---
> 5 files changed, 22 insertions(+), 27 deletions(-)
That's interesting, these issues did not appear in my tests (modified
tests/device-introspect-test.c with hmp("info qtree")). Likely because
device-introspect-test only checks with the "none" machine ==> one more
reason to test here with all machines, too (I suggested such a patch a
couple of months ago) ...
Thomas
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH v1 0/5] riscv: Fix introspection problems
2018-07-17 20:27 [Qemu-devel] [PATCH v1 0/5] riscv: Fix introspection problems Alistair Francis
` (5 preceding siblings ...)
2018-07-18 7:22 ` [Qemu-devel] [PATCH v1 0/5] riscv: Fix introspection problems Thomas Huth
@ 2018-07-18 7:23 ` Thomas Huth
6 siblings, 0 replies; 17+ messages in thread
From: Thomas Huth @ 2018-07-18 7:23 UTC (permalink / raw)
To: Alistair Francis, qemu-devel; +Cc: mjc
On 17.07.2018 22:27, Alistair Francis wrote:
> This is based on Thomas's work fixing introspection problems [1] and
> applied to the RISC-V port.
>
> 1: https://lists.gnu.org/archive/html/qemu-devel/2018-07/msg03261.html
>
> Alistair Francis (5):
> sifive_e: Fix crash when introspecting the device
> sifive_u: Fix crash when introspecting the device
> virt: Fix crash when introspecting the device
> riscv_hart: Fix crash when introspecting the device
> spike: Fix crash when introspecting the device
>
> hw/riscv/riscv_hart.c | 7 +++----
> hw/riscv/sifive_e.c | 12 ++++++------
> hw/riscv/sifive_u.c | 15 +++++++--------
> hw/riscv/spike.c | 10 ++++------
> hw/riscv/virt.c | 5 ++---
> 5 files changed, 22 insertions(+), 27 deletions(-)
For the whole patch series:
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH v1 2/5] sifive_u: Fix crash when introspecting the device
2018-07-17 20:28 ` [Qemu-devel] [PATCH v1 2/5] sifive_u: " Alistair Francis
2018-07-17 21:03 ` Michael Clark
@ 2018-07-18 14:11 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-07-18 14:11 UTC (permalink / raw)
To: Alistair Francis, qemu-devel; +Cc: thuth, mjc
On 07/17/2018 05:28 PM, Alistair Francis wrote:
> Use the new object_initialize_child() and sysbus_init_child_obj() to
> fix the issue.
>
Suggested-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> hw/riscv/sifive_u.c | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
> index 3a6ffeb437..59ae1ce24a 100644
> --- a/hw/riscv/sifive_u.c
> +++ b/hw/riscv/sifive_u.c
> @@ -244,9 +244,9 @@ static void riscv_sifive_u_init(MachineState *machine)
> int i;
>
> /* Initialize SoC */
> - object_initialize(&s->soc, sizeof(s->soc), TYPE_RISCV_U_SOC);
> - object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
> - &error_abort);
> + object_initialize_child(OBJECT(machine), "soc", &s->soc,
> + sizeof(s->soc), TYPE_RISCV_U_SOC,
> + &error_abort, NULL);
> object_property_set_bool(OBJECT(&s->soc), true, "realized",
> &error_abort);
>
> @@ -303,16 +303,15 @@ static void riscv_sifive_u_soc_init(Object *obj)
> {
> SiFiveUSoCState *s = RISCV_U_SOC(obj);
>
> - object_initialize(&s->cpus, sizeof(s->cpus), TYPE_RISCV_HART_ARRAY);
> - object_property_add_child(obj, "cpus", OBJECT(&s->cpus),
> - &error_abort);
> + object_initialize_child(obj, "cpus", &s->cpus, sizeof(s->cpus),
> + TYPE_RISCV_HART_ARRAY, &error_abort, NULL);
> object_property_set_str(OBJECT(&s->cpus), SIFIVE_U_CPU, "cpu-type",
> &error_abort);
> object_property_set_int(OBJECT(&s->cpus), smp_cpus, "num-harts",
> &error_abort);
>
> - object_initialize(&s->gem, sizeof(s->gem), TYPE_CADENCE_GEM);
> - qdev_set_parent_bus(DEVICE(&s->gem), sysbus_get_default());
> + sysbus_init_child_obj(obj, "gem", &s->gem, sizeof(s->gem),
> + TYPE_CADENCE_GEM);
> }
>
> static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH v1 0/5] riscv: Fix introspection problems
2018-07-18 7:22 ` [Qemu-devel] [PATCH v1 0/5] riscv: Fix introspection problems Thomas Huth
@ 2018-07-18 21:31 ` Alistair Francis
2018-07-19 7:59 ` Thomas Huth
0 siblings, 1 reply; 17+ messages in thread
From: Alistair Francis @ 2018-07-18 21:31 UTC (permalink / raw)
To: Thomas Huth
Cc: Alistair Francis, qemu-devel@nongnu.org Developers,
Michael Clark, Markus Armbruster
On Wed, Jul 18, 2018 at 12:22 AM, Thomas Huth <thuth@redhat.com> wrote:
> On 17.07.2018 22:27, Alistair Francis wrote:
>> This is based on Thomas's work fixing introspection problems [1] and
>> applied to the RISC-V port.
>>
>> 1: https://lists.gnu.org/archive/html/qemu-devel/2018-07/msg03261.html
>>
>> Alistair Francis (5):
>> sifive_e: Fix crash when introspecting the device
>> sifive_u: Fix crash when introspecting the device
>> virt: Fix crash when introspecting the device
>> riscv_hart: Fix crash when introspecting the device
>> spike: Fix crash when introspecting the device
>>
>> hw/riscv/riscv_hart.c | 7 +++----
>> hw/riscv/sifive_e.c | 12 ++++++------
>> hw/riscv/sifive_u.c | 15 +++++++--------
>> hw/riscv/spike.c | 10 ++++------
>> hw/riscv/virt.c | 5 ++---
>> 5 files changed, 22 insertions(+), 27 deletions(-)
>
> That's interesting, these issues did not appear in my tests (modified
> tests/device-introspect-test.c with hmp("info qtree")). Likely because
> device-introspect-test only checks with the "none" machine ==> one more
> reason to test here with all machines, too (I suggested such a patch a
> couple of months ago) ...
What happened to the patch? More tests would be super handy.
Alistair
>
> Thomas
>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH v1 0/5] riscv: Fix introspection problems
2018-07-18 21:31 ` Alistair Francis
@ 2018-07-19 7:59 ` Thomas Huth
2018-07-23 23:13 ` Alistair Francis
0 siblings, 1 reply; 17+ messages in thread
From: Thomas Huth @ 2018-07-19 7:59 UTC (permalink / raw)
To: Alistair Francis
Cc: Alistair Francis, qemu-devel@nongnu.org Developers,
Michael Clark, Markus Armbruster
On 18.07.2018 23:31, Alistair Francis wrote:
> On Wed, Jul 18, 2018 at 12:22 AM, Thomas Huth <thuth@redhat.com> wrote:
>> On 17.07.2018 22:27, Alistair Francis wrote:
>>> This is based on Thomas's work fixing introspection problems [1] and
>>> applied to the RISC-V port.
>>>
>>> 1: https://lists.gnu.org/archive/html/qemu-devel/2018-07/msg03261.html
>>>
>>> Alistair Francis (5):
>>> sifive_e: Fix crash when introspecting the device
>>> sifive_u: Fix crash when introspecting the device
>>> virt: Fix crash when introspecting the device
>>> riscv_hart: Fix crash when introspecting the device
>>> spike: Fix crash when introspecting the device
>>>
>>> hw/riscv/riscv_hart.c | 7 +++----
>>> hw/riscv/sifive_e.c | 12 ++++++------
>>> hw/riscv/sifive_u.c | 15 +++++++--------
>>> hw/riscv/spike.c | 10 ++++------
>>> hw/riscv/virt.c | 5 ++---
>>> 5 files changed, 22 insertions(+), 27 deletions(-)
>>
>> That's interesting, these issues did not appear in my tests (modified
>> tests/device-introspect-test.c with hmp("info qtree")). Likely because
>> device-introspect-test only checks with the "none" machine ==> one more
>> reason to test here with all machines, too (I suggested such a patch a
>> couple of months ago) ...
>
> What happened to the patch? More tests would be super handy.
It was only a RFC since at that point in time, there were lots of other
crashes, so it could not be merged yet:
http://lists.gnu.org/archive/html/qemu-devel/2018-03/msg05033.html
I think the other crashes are now fixed, too, so we could consider this
again. I'll put it on my TODO list to respin it for 3.1 ...
Thomas
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH v1 0/5] riscv: Fix introspection problems
2018-07-19 7:59 ` Thomas Huth
@ 2018-07-23 23:13 ` Alistair Francis
0 siblings, 0 replies; 17+ messages in thread
From: Alistair Francis @ 2018-07-23 23:13 UTC (permalink / raw)
To: Thomas Huth
Cc: Alistair Francis, qemu-devel@nongnu.org Developers,
Michael Clark, Markus Armbruster
On Thu, Jul 19, 2018 at 12:59 AM, Thomas Huth <thuth@redhat.com> wrote:
> On 18.07.2018 23:31, Alistair Francis wrote:
>> On Wed, Jul 18, 2018 at 12:22 AM, Thomas Huth <thuth@redhat.com> wrote:
>>> On 17.07.2018 22:27, Alistair Francis wrote:
>>>> This is based on Thomas's work fixing introspection problems [1] and
>>>> applied to the RISC-V port.
>>>>
>>>> 1: https://lists.gnu.org/archive/html/qemu-devel/2018-07/msg03261.html
>>>>
>>>> Alistair Francis (5):
>>>> sifive_e: Fix crash when introspecting the device
>>>> sifive_u: Fix crash when introspecting the device
>>>> virt: Fix crash when introspecting the device
>>>> riscv_hart: Fix crash when introspecting the device
>>>> spike: Fix crash when introspecting the device
>>>>
>>>> hw/riscv/riscv_hart.c | 7 +++----
>>>> hw/riscv/sifive_e.c | 12 ++++++------
>>>> hw/riscv/sifive_u.c | 15 +++++++--------
>>>> hw/riscv/spike.c | 10 ++++------
>>>> hw/riscv/virt.c | 5 ++---
>>>> 5 files changed, 22 insertions(+), 27 deletions(-)
>>>
>>> That's interesting, these issues did not appear in my tests (modified
>>> tests/device-introspect-test.c with hmp("info qtree")). Likely because
>>> device-introspect-test only checks with the "none" machine ==> one more
>>> reason to test here with all machines, too (I suggested such a patch a
>>> couple of months ago) ...
>>
>> What happened to the patch? More tests would be super handy.
>
> It was only a RFC since at that point in time, there were lots of other
> crashes, so it could not be merged yet:
>
> http://lists.gnu.org/archive/html/qemu-devel/2018-03/msg05033.html
>
> I think the other crashes are now fixed, too, so we could consider this
> again. I'll put it on my TODO list to respin it for 3.1 ...
It looks super useful! I'll use this to test the RISC-V stuff a bit
more as well.
Alistair
>
> Thomas
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2018-07-23 23:13 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-17 20:27 [Qemu-devel] [PATCH v1 0/5] riscv: Fix introspection problems Alistair Francis
2018-07-17 20:27 ` [Qemu-devel] [PATCH v1 1/5] sifive_e: Fix crash when introspecting the device Alistair Francis
2018-07-17 21:03 ` Michael Clark
2018-07-17 20:28 ` [Qemu-devel] [PATCH v1 2/5] sifive_u: " Alistair Francis
2018-07-17 21:03 ` Michael Clark
2018-07-18 14:11 ` Philippe Mathieu-Daudé
2018-07-17 20:28 ` [Qemu-devel] [PATCH v1 3/5] virt: " Alistair Francis
2018-07-17 21:03 ` Michael Clark
2018-07-17 20:28 ` [Qemu-devel] [PATCH v1 4/5] riscv_hart: " Alistair Francis
2018-07-17 21:04 ` Michael Clark
2018-07-17 20:28 ` [Qemu-devel] [PATCH v1 5/5] spike: " Alistair Francis
2018-07-17 21:04 ` Michael Clark
2018-07-18 7:22 ` [Qemu-devel] [PATCH v1 0/5] riscv: Fix introspection problems Thomas Huth
2018-07-18 21:31 ` Alistair Francis
2018-07-19 7:59 ` Thomas Huth
2018-07-23 23:13 ` Alistair Francis
2018-07-18 7:23 ` Thomas Huth
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.