qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/ppc/e500: Check for compatible CPU type instead of aborting ungracefully
@ 2025-10-15  6:57 Thomas Huth
  2025-10-15 10:17 ` BALATON Zoltan
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Huth @ 2025-10-15  6:57 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-ppc; +Cc: qemu-devel

From: Thomas Huth <thuth@redhat.com>

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 <thuth@redhat.com>
---
 hw/ppc/e500.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 723c97fad2e..d40b7a618db 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -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
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-10-15 10:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-15  6:57 [PATCH] hw/ppc/e500: Check for compatible CPU type instead of aborting ungracefully Thomas Huth
2025-10-15 10:17 ` BALATON Zoltan
2025-10-15 10:46   ` Thomas Huth

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).