From: Glenn Miles <milesg@linux.ibm.com>
To: qemu-devel@nongnu.org
Cc: Glenn Miles <milesg@linux.ibm.com>,
qemu-ppc@nongnu.org, clg@redhat.com, npiggin@gmail.com,
harshpb@linux.ibm.com, thuth@redhat.com, rathc@linux.ibm.com,
richard.henderson@linaro.org
Subject: [PATCH v3 8/9] hw/ppc: Add a test machine for the IBM PPE42 CPU
Date: Mon, 8 Sep 2025 15:00:18 -0500 [thread overview]
Message-ID: <20250908200028.115789-9-milesg@linux.ibm.com> (raw)
In-Reply-To: <20250908200028.115789-1-milesg@linux.ibm.com>
Adds a test machine for the IBM PPE42 processor, including a
DEC, FIT, WDT and 512 KiB of ram.
The purpose of this machine is only to provide a generic platform
for testing instructions of the recently added PPE42 processor
model which is used extensively in the IBM Power9, Power10 and
future Power server processors.
Signed-off-by: Glenn Miles <milesg@linux.ibm.com>
---
Changes from v2:
- Moved decrementer changes to distinct commit
- Introduced a specific MachineState for the ppe42 Machine
- Use qdev_realize to create the machine
- Use valid_cpu_types to determine validity of CPU
- Changed machine ram limit from 2GB to 512KB
MAINTAINERS | 6 +++
hw/ppc/Kconfig | 9 ++++
hw/ppc/meson.build | 2 +
hw/ppc/ppe42_machine.c | 102 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 119 insertions(+)
create mode 100644 hw/ppc/ppe42_machine.c
diff --git a/MAINTAINERS b/MAINTAINERS
index a07086ed76..52fa303e0a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1531,6 +1531,12 @@ F: include/hw/pci-host/grackle.h
F: pc-bios/qemu_vga.ndrv
F: tests/functional/test_ppc_mac.py
+PPE42
+M: Glenn Miles <milesg@linux.ibm.com>
+L: qemu-ppc@nongnu.org
+S: Odd Fixes
+F: hw/ppc/ppe42_machine.c
+
PReP
M: Hervé Poussineau <hpoussin@reactos.org>
L: qemu-ppc@nongnu.org
diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig
index ced6bbc740..3fdea5919c 100644
--- a/hw/ppc/Kconfig
+++ b/hw/ppc/Kconfig
@@ -44,6 +44,15 @@ config POWERNV
select SSI_M25P80
select PNV_SPI
+config PPC405
+ bool
+ default y
+ depends on PPC
+ select M48T59
+ select PFLASH_CFI02
+ select PPC4XX
+ select SERIAL
+
config PPC440
bool
default y
diff --git a/hw/ppc/meson.build b/hw/ppc/meson.build
index 9893f8adeb..170b90ae7d 100644
--- a/hw/ppc/meson.build
+++ b/hw/ppc/meson.build
@@ -57,6 +57,8 @@ ppc_ss.add(when: 'CONFIG_POWERNV', if_true: files(
'pnv_n1_chiplet.c',
))
# PowerPC 4xx boards
+ppc_ss.add(when: 'CONFIG_PPC405', if_true: files(
+ 'ppe42_machine.c'))
ppc_ss.add(when: 'CONFIG_PPC440', if_true: files(
'ppc440_bamboo.c',
'ppc440_uc.c'))
diff --git a/hw/ppc/ppe42_machine.c b/hw/ppc/ppe42_machine.c
new file mode 100644
index 0000000000..2cfce2503f
--- /dev/null
+++ b/hw/ppc/ppe42_machine.c
@@ -0,0 +1,102 @@
+/*
+ * Test Machine for the IBM PPE42 processor
+ *
+ * Copyright (c) 2025, IBM Corporation.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/units.h"
+#include "qemu/error-report.h"
+#include "system/address-spaces.h"
+#include "hw/boards.h"
+#include "hw/ppc/ppc.h"
+#include "system/system.h"
+#include "system/reset.h"
+#include "system/kvm.h"
+#include "qapi/error.h"
+
+#define TYPE_PPE42_MACHINE MACHINE_TYPE_NAME("ppe42_machine")
+typedef MachineClass Ppe42MachineClass;
+typedef struct Ppe42MachineState Ppe42MachineState;
+DECLARE_OBJ_CHECKERS(Ppe42MachineState, Ppe42MachineClass,
+ PPE42_MACHINE, TYPE_PPE42_MACHINE)
+
+struct Ppe42MachineState {
+ MachineState parent_obj;
+
+ PowerPCCPU cpu;
+};
+
+static void main_cpu_reset(void *opaque)
+{
+ PowerPCCPU *cpu = opaque;
+
+ cpu_reset(CPU(cpu));
+}
+
+static void ppe42_machine_init(MachineState *machine)
+{
+ Ppe42MachineState *pms = PPE42_MACHINE(machine);
+ PowerPCCPU *cpu = &pms->cpu;
+
+ if (kvm_enabled()) {
+ error_report("machine %s does not support the KVM accelerator",
+ MACHINE_GET_CLASS(machine)->name);
+ exit(EXIT_FAILURE);
+ }
+
+ /* init CPU */
+ object_initialize_child(OBJECT(pms), "cpu", cpu, machine->cpu_type);
+ if (!qdev_realize(DEVICE(cpu), NULL, &error_fatal)) {
+ return;
+ }
+
+ qemu_register_reset(main_cpu_reset, cpu);
+
+ /* This sets the decrementer timebase */
+ ppc_booke_timers_init(cpu, 37500000, PPC_TIMER_PPE);
+
+ /* RAM */
+ if (machine->ram_size > 512 * KiB) {
+ error_report("RAM size more than 512 KiB is not supported");
+ exit(1);
+ }
+ memory_region_add_subregion(get_system_memory(), 0xfff80000, machine->ram);
+}
+
+
+static void ppe42_machine_class_init(ObjectClass *oc, const void *data)
+{
+ MachineClass *mc = MACHINE_CLASS(oc);
+ static const char * const valid_cpu_types[] = {
+ POWERPC_CPU_TYPE_NAME("PPE42"),
+ POWERPC_CPU_TYPE_NAME("PPE42X"),
+ POWERPC_CPU_TYPE_NAME("PPE42XM"),
+ NULL,
+ };
+
+ mc->desc = "PPE42 Test Machine";
+ mc->init = ppe42_machine_init;
+ mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("PPE42XM");
+ mc->valid_cpu_types = valid_cpu_types;
+ mc->default_ram_id = "ram";
+ mc->default_ram_size = 512 * KiB;
+}
+
+static const TypeInfo ppe42_machine_info = {
+ .name = TYPE_PPE42_MACHINE,
+ .parent = TYPE_MACHINE,
+ .instance_size = sizeof(Ppe42MachineState),
+ .class_init = ppe42_machine_class_init,
+ .class_size = sizeof(Ppe42MachineClass),
+};
+
+static void ppe42_machine_register_types(void)
+{
+ type_register_static(&ppe42_machine_info);
+}
+
+type_init(ppe42_machine_register_types);
+
--
2.43.0
next prev parent reply other threads:[~2025-09-08 20:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-08 20:00 [PATCH v3 0/9] Add IBM PPE42 CPU support Glenn Miles
2025-09-08 20:00 ` [PATCH v3 1/9] target/ppc: IBM PPE42 general regs and flags Glenn Miles
2025-09-08 20:00 ` [PATCH v3 2/9] target/ppc: Add IBM PPE42 family of processors Glenn Miles
2025-09-08 20:00 ` [PATCH v3 3/9] target/ppc: IBM PPE42 exception flags and regs Glenn Miles
2025-09-08 20:00 ` [PATCH v3 4/9] target/ppc: Add IBM PPE42 exception model Glenn Miles
2025-09-08 20:00 ` [PATCH v3 5/9] target/ppc: Support for IBM PPE42 MMU Glenn Miles
2025-09-08 20:00 ` [PATCH v3 6/9] target/ppc: Add IBM PPE42 special instructions Glenn Miles
2025-09-12 10:50 ` Chinmay Rath
2025-09-12 15:59 ` Miles Glenn
2025-09-08 20:00 ` [PATCH v3 7/9] hw/ppc: Support for an IBM PPE42 CPU decrementer Glenn Miles
2025-09-08 20:00 ` Glenn Miles [this message]
2025-09-10 7:10 ` [PATCH v3 8/9] hw/ppc: Add a test machine for the IBM PPE42 CPU Cédric Le Goater
2025-09-10 14:21 ` Miles Glenn
2025-09-08 20:00 ` [PATCH v3 9/9] tests/functional: Add test for IBM PPE42 instructions Glenn Miles
2025-09-08 21:17 ` Miles Glenn
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=20250908200028.115789-9-milesg@linux.ibm.com \
--to=milesg@linux.ibm.com \
--cc=clg@redhat.com \
--cc=harshpb@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=rathc@linux.ibm.com \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
/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 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.