hw/ppc/e500: Check for compatible CPU type instead of aborting ungracefully
PATCH 1/1 hw/ppc/e500: Check for compatible CPU type instead of aborting ungracefully
From: Thomas Huth <[email protected]>
When using the ppce500 machine with an embedded CPU type that has the right MMU model, but is not part of the e500 CPU family, QEMU currently aborts ungracefully:
$ ./qemu-system-ppc -machine ppce500 -cpu e200z5 -nographic qemu-system-ppc: ../qemu/hw/core/gpio.c:108: qdev_get_gpio_in_named: Assertion `n >= 0 && n < gpio_list->num_in' failed. Aborted (core dumped)
The ppce500 machine expects a CPU with certain GPIO interrupt pins, so let's check for a compatible model before we try to wire some pins that don't exist.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3162
--- hw/ppc/e500.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/ppc/e500.c +5 -0
@@ -20,6 +20,7 @@#include "qemu/guest-random.h" #include "exec/target_page.h" #include "qapi/error.h" +#include "cpu-models.h" #include "e500.h" #include "e500-ccsr.h" #include "net/net.h"
@@ -947,6 +948,10 @@ void ppce500_init(MachineState *machine) env->mmu_model);exit (1 ); } +if (!(POWERPC_CPU_GET_CLASS (cpu)->svr &POWERPC_SVR_E500 )) { +error_report ("This machine needs a CPU from the e500 family" ); +exit (1 ); + }/* * Secondary CPU starts in halted state for now. Needs to change
Signature · 1 line
2.51.0
Quoted 34 lines · Thomas Huth
From: Thomas Huth <[email protected]>
When using the ppce500 machine with an embedded CPU type that has the right MMU model, but is not part of the e500 CPU family, QEMU currently aborts ungracefully:
$ ./qemu-system-ppc -machine ppce500 -cpu e200z5 -nographic qemu-system-ppc: ../qemu/hw/core/gpio.c:108: qdev_get_gpio_in_named: Assertion `n >= 0 && n < gpio_list->num_in' failed. Aborted (core dumped)The ppce500 machine expects a CPU with certain GPIO interrupt pins, so let's check for a compatible model before we try to wire some pins that don't exist.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3162
Signed-off-by Thomas Huth <[email protected]>---
hw/ppc/e500.c| 5 +++++1 file changed, 5 insertions(+)hw/ppc/e500.c +1
-0@@ -20,6 +20,7 @@#include "qemu/guest-random.h" #include "exec/target_page.h" #include "qapi/error.h" +#include "cpu-models.h" #include "e500.h" #include "e500-ccsr.h" #include "net/net.h"
hw/ppc/e500.c void ppce500_init(MachineState *machine) · line 950
Quoted 3 lines
hw/ppc/e500.c +0
-0@@ -947,6 +948,10 @@ void ppce500_init(MachineState *machine) env->mmu_model);exit (1 ); }
I think you can drop the mmu_model check above now becuase it's a no-op after the stricter check for e500 you added so no need to keep that separate error, the new check catches that too.
Regards,
BALATON Zoltan
Quoted 8 lines
hw/ppc/e500.c +4
-0+if (!(POWERPC_CPU_GET_CLASS (cpu)->svr &POWERPC_SVR_E500 )) { +error_report ("This machine needs a CPU from the e500 family" ); +exit (1 ); + }/* * Secondary CPU starts in halted state for now. Needs to change
Quoted 32 lines · BALATON Zoltan
Quoted 31 lines · Thomas Huth
From: Thomas Huth <[email protected]>
When using the ppce500 machine with an embedded CPU type that has the right MMU model, but is not part of the e500 CPU family, QEMU currently aborts ungracefully:
$ ./qemu-system-ppc -machine ppce500 -cpu e200z5 -nographic qemu-system-ppc: ../qemu/hw/core/gpio.c:108: qdev_get_gpio_in_named: Assertion `n >= 0 && n < gpio_list->num_in' failed. Aborted (core dumped)The ppce500 machine expects a CPU with certain GPIO interrupt pins, so let's check for a compatible model before we try to wire some pins that don't exist.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3162
Signed-off-by Thomas Huth <[email protected]>---
hw/ppc/e500.c| 5 +++++1 file changed, 5 insertions(+)hw/ppc/e500.c +1
-0@@ -20,6 +20,7 @@#include "qemu/guest-random.h" #include "exec/target_page.h" #include "qapi/error.h" +#include "cpu-models.h" #include "e500.h"
Quoted 8 lines
hw/ppc/e500.c void ppce500_init(MachineState *machine) · line 950
Quoted 6 lines
hw/ppc/e500.c +0
-0#include "e500-ccsr.h" #include "net/net.h" @@ -947,6 +948,10 @@ void ppce500_init(MachineState *machine) env->mmu_model); exit(1); }I think you can drop the
mmu_modelcheck above now becuase it's a no-op after the stricter check for e500 you added so no need to keep that separate error, the new check catches that too.
Right, good idea, I'll respin a v2...
Thomas