* [PATCH 0/6] ppc: add QEMU ppce500 test in CI
@ 2026-02-09 9:10 Ahmad Fatoum
2026-02-09 9:10 ` [PATCH 1/6] include: array_size.h: make header self-contained Ahmad Fatoum
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Ahmad Fatoum @ 2026-02-09 9:10 UTC (permalink / raw)
To: barebox
Add support for running barebox on the QEMU ppce500 virtual machine.
This enables automated testing of PowerPC e500 support in CI.
The PowerPC support for this virtual machine has been AI generated.
I have no interest in learning the PowerPC ISA, but it's beneficial
to remaining users for CI to be able to catch some runtime regressions
as we only did compile tests so far.
With this, kvx is the only remaining architecture that is not tested in
CI, but that's on the TODO list as well.
Ahmad Fatoum (6):
include: array_size.h: make header self-contained
serial: ns16550: add "ns16550" compatible string
lib: stackprot: omit HAVE_STACKPROTECTOR for powerpc
gpio: mpc8xxx: allow build on MPC85xx platforms
mach-mpc85xx: speed: add fsl_set_timebase_clock() override
powerpc: add QEMU ppce500 board support with CI test infrastructure
.github/workflows/test-labgrid-pytest.yml | 4 +
arch/Kconfig | 6 +
arch/arm/Kconfig | 1 +
arch/kvx/Kconfig | 1 +
arch/mips/Kconfig | 1 +
arch/openrisc/Kconfig | 1 +
arch/powerpc/Makefile | 1 +
arch/powerpc/boards/qemu-e500/Makefile | 5 +
arch/powerpc/boards/qemu-e500/law.c | 17 ++
arch/powerpc/boards/qemu-e500/qemu-e500.c | 92 ++++++++
arch/powerpc/boards/qemu-e500/tlb.c | 17 ++
arch/powerpc/configs/qemu-ppce500_defconfig | 69 ++++++
arch/powerpc/cpu-85xx/Makefile | 3 +
arch/powerpc/cpu-85xx/start-qemu.S | 211 ++++++++++++++++++
arch/powerpc/include/asm/board-qemu-e500.h | 39 ++++
arch/powerpc/include/asm/config.h | 2 +
arch/powerpc/include/asm/debug_ll.h | 52 +++++
arch/powerpc/lib/board.c | 6 +
arch/powerpc/mach-mpc85xx/Kconfig | 13 ++
arch/powerpc/mach-mpc85xx/barebox.lds.S | 12 +
.../powerpc/mach-mpc85xx/include/mach/clock.h | 1 +
.../include/mach/config_mpc85xx.h | 6 +
arch/powerpc/mach-mpc85xx/speed.c | 10 +
arch/riscv/Kconfig | 1 +
arch/sandbox/Kconfig | 1 +
arch/x86/Kconfig | 1 +
common/Kconfig.debug_ll | 7 +-
drivers/gpio/Kconfig | 2 +-
drivers/serial/serial_ns16550.c | 2 +
include/linux/array_size.h | 3 +-
lib/Kconfig.hardening | 2 +
test/powerpc/qemu-ppce500_defconfig.yaml | 17 ++
32 files changed, 603 insertions(+), 3 deletions(-)
create mode 100644 arch/powerpc/boards/qemu-e500/Makefile
create mode 100644 arch/powerpc/boards/qemu-e500/law.c
create mode 100644 arch/powerpc/boards/qemu-e500/qemu-e500.c
create mode 100644 arch/powerpc/boards/qemu-e500/tlb.c
create mode 100644 arch/powerpc/configs/qemu-ppce500_defconfig
create mode 100644 arch/powerpc/cpu-85xx/start-qemu.S
create mode 100644 arch/powerpc/include/asm/board-qemu-e500.h
create mode 100644 arch/powerpc/include/asm/debug_ll.h
create mode 100644 test/powerpc/qemu-ppce500_defconfig.yaml
--
2.47.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/6] include: array_size.h: make header self-contained
2026-02-09 9:10 [PATCH 0/6] ppc: add QEMU ppce500 test in CI Ahmad Fatoum
@ 2026-02-09 9:10 ` Ahmad Fatoum
2026-02-09 9:10 ` [PATCH 2/6] serial: ns16550: add "ns16550" compatible string Ahmad Fatoum
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ahmad Fatoum @ 2026-02-09 9:10 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The definition of __must_be_array is a bit hairy as it's defined in
<linux/compiler-gcc.h>, which is included by <linux/compiler_types.h>,
but has an implicit dependency on <linux/build_bug.h> for BUILD_BUG_ON_ZERO
in the definition of __must_be_array, but <linux/build_bug.h> itself
already includes <linux/compiler_types.h>.
Let's put a bandaid on this for users of ARRAY_SIZE, by including
<linux/build_bug.h> explicitly for <linux/array_size.h>.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
include/linux/array_size.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/array_size.h b/include/linux/array_size.h
index 5411d730c819..d1ad53d950d4 100644
--- a/include/linux/array_size.h
+++ b/include/linux/array_size.h
@@ -2,7 +2,8 @@
#ifndef _LINUX_ARRAY_SIZE_H
#define _LINUX_ARRAY_SIZE_H
-#include <linux/compiler.h>
+#include <linux/compiler_types.h>
+#include <linux/build_bug.h>
/**
* ARRAY_SIZE - get the number of elements in array @arr
--
2.47.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/6] serial: ns16550: add "ns16550" compatible string
2026-02-09 9:10 [PATCH 0/6] ppc: add QEMU ppce500 test in CI Ahmad Fatoum
2026-02-09 9:10 ` [PATCH 1/6] include: array_size.h: make header self-contained Ahmad Fatoum
@ 2026-02-09 9:10 ` Ahmad Fatoum
2026-02-09 9:10 ` [PATCH 3/6] lib: stackprot: omit HAVE_STACKPROTECTOR for powerpc Ahmad Fatoum
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ahmad Fatoum @ 2026-02-09 9:10 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The QEMU ppce500 machine generates device tree nodes with "ns16550"
as the compatible string rather than "ns16550a".
Add it to the match table so the driver binds automatically on
QEMU platforms.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/serial/serial_ns16550.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index 1d0ee7dc08f8..61e294a38c4c 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -583,6 +583,8 @@ static struct of_device_id ns16550_serial_dt_ids[] = {
{
.compatible = "ns16450",
.data = &ns16450_drvdata,
+ }, {
+ .compatible = "ns16550",
}, {
.compatible = "ns16550a",
}, {
--
2.47.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/6] lib: stackprot: omit HAVE_STACKPROTECTOR for powerpc
2026-02-09 9:10 [PATCH 0/6] ppc: add QEMU ppce500 test in CI Ahmad Fatoum
2026-02-09 9:10 ` [PATCH 1/6] include: array_size.h: make header self-contained Ahmad Fatoum
2026-02-09 9:10 ` [PATCH 2/6] serial: ns16550: add "ns16550" compatible string Ahmad Fatoum
@ 2026-02-09 9:10 ` Ahmad Fatoum
2026-02-09 9:10 ` [PATCH 4/6] gpio: mpc8xxx: allow build on MPC85xx platforms Ahmad Fatoum
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ahmad Fatoum @ 2026-02-09 9:10 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
gcc for PowerPC generates references to __stack_chk_guard_local and
aliasing it to __stack_chk_guard doesn't lead to a bootable barebox, so
let's disable stack protector on that architecture.
The other architectures are assumed to work, but this should be verified
per CI test in future.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
arch/Kconfig | 6 ++++++
arch/arm/Kconfig | 1 +
arch/kvx/Kconfig | 1 +
arch/mips/Kconfig | 1 +
arch/openrisc/Kconfig | 1 +
arch/riscv/Kconfig | 1 +
arch/sandbox/Kconfig | 1 +
arch/x86/Kconfig | 1 +
lib/Kconfig.hardening | 2 ++
9 files changed, 15 insertions(+)
diff --git a/arch/Kconfig b/arch/Kconfig
index ca9aa25a9c4b..ba9dd0e6f4df 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -131,6 +131,12 @@ config HAVE_ARCH_KASAN
config ARCH_HAS_UBSAN_SANITIZE_ALL
bool
+config HAVE_STACKPROTECTOR
+ bool
+ help
+ An arch should select this symbol if:
+ - it has implemented a stack canary (e.g. __stack_chk_guard)
+
config ARCH_HAS_FORTIFY_SOURCE
bool
help
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 65856977ab41..c7514acb775f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -3,6 +3,7 @@
config ARM
bool
select HAS_KALLSYMS
+ select HAVE_STACKPROTECTOR
select HAVE_IMAGE_COMPRESSION
select HAVE_ARCH_KASAN
select ARCH_HAS_SJLJ
diff --git a/arch/kvx/Kconfig b/arch/kvx/Kconfig
index 987fdb2e1e89..bbbec6471f06 100644
--- a/arch/kvx/Kconfig
+++ b/arch/kvx/Kconfig
@@ -3,6 +3,7 @@
config KVX
bool
select 64BIT
+ select HAVE_STACKPROTECTOR
select BOOTM
select HAVE_ARCH_BOOTM_OFTREE
select BOOTM_OFTREE
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 44c4fc82ae5b..d34377a33d47 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -3,6 +3,7 @@
config MIPS
bool
select GENERIC_LIB_ASHLDI3
+ select HAVE_STACKPROTECTOR
select GENERIC_LIB_ASHRDI3
select GENERIC_LIB_LSHRDI3
select HAS_KALLSYMS
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 10cbfa1ffbce..f82d160a3a15 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -3,6 +3,7 @@
config OPENRISC
bool
select OFTREE
+ select HAVE_STACKPROTECTOR
select HAVE_CONFIGURABLE_MEMORY_LAYOUT
select GENERIC_FIND_NEXT_BIT
select ARCH_HAS_SJLJ
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index cc9b15ce6409..f1d98d1b33a5 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -3,6 +3,7 @@
config RISCV
def_bool y
select GENERIC_FIND_NEXT_BIT
+ select HAVE_STACKPROTECTOR
select GPIOLIB
select OFTREE
select OFDEVICE
diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig
index 5c7948b215cf..504171809193 100644
--- a/arch/sandbox/Kconfig
+++ b/arch/sandbox/Kconfig
@@ -5,6 +5,7 @@ source "scripts/Kconfig.include"
config SANDBOX
bool
select OFTREE
+ select HAVE_STACKPROTECTOR
select GPIOLIB
select ARCH_HAS_UBSAN_SANITIZE_ALL
select ARCH_HAS_FORTIFY_SOURCE
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index b453890f022b..3426392bc463 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -3,6 +3,7 @@
config X86
bool
select HAS_KALLSYMS
+ select HAVE_STACKPROTECTOR
select HAS_DMA
select GENERIC_FIND_NEXT_BIT
select ARCH_DMA_DEFAULT_COHERENT
diff --git a/lib/Kconfig.hardening b/lib/Kconfig.hardening
index 59dd02c9cfae..6374576f489c 100644
--- a/lib/Kconfig.hardening
+++ b/lib/Kconfig.hardening
@@ -162,6 +162,7 @@ config STACKPROTECTOR
choice
prompt "Stack Protector buffer overflow detection"
+ depends on HAVE_STACKPROTECTOR
config STACKPROTECTOR_NONE
bool "None"
@@ -211,6 +212,7 @@ endchoice
choice
prompt "Stack Protector buffer overflow detection for PBL" if PBL_IMAGE
+ depends on HAVE_STACKPROTECTOR
config PBL_STACKPROTECTOR_NONE
bool "None"
--
2.47.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 4/6] gpio: mpc8xxx: allow build on MPC85xx platforms
2026-02-09 9:10 [PATCH 0/6] ppc: add QEMU ppce500 test in CI Ahmad Fatoum
` (2 preceding siblings ...)
2026-02-09 9:10 ` [PATCH 3/6] lib: stackprot: omit HAVE_STACKPROTECTOR for powerpc Ahmad Fatoum
@ 2026-02-09 9:10 ` Ahmad Fatoum
2026-02-09 9:10 ` [PATCH 5/6] mach-mpc85xx: speed: add fsl_set_timebase_clock() override Ahmad Fatoum
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ahmad Fatoum @ 2026-02-09 9:10 UTC (permalink / raw)
To: barebox; +Cc: Claude Opus 4.6, Ahmad Fatoum
The fsl,qoriq-gpio controller is present on MPC85xx-based platforms
(including QEMU ppce500). Add ARCH_MPC85XX to the depends list so the
driver can be selected for these platforms.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/gpio/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 17d5587ea8cf..988d08cf143c 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -102,7 +102,7 @@ config GPIO_MALTA_FPGA_I2C
config GPIO_MPC8XXX
bool "MPC512x/MPC8xxx/QorIQ GPIO support"
- depends on ARCH_LAYERSCAPE || COMPILE_TEST
+ depends on ARCH_LAYERSCAPE || ARCH_MPC85XX || COMPILE_TEST
select GPIO_GENERIC
help
Say Y here if you're going to use hardware that connects to the
--
2.47.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 5/6] mach-mpc85xx: speed: add fsl_set_timebase_clock() override
2026-02-09 9:10 [PATCH 0/6] ppc: add QEMU ppce500 test in CI Ahmad Fatoum
` (3 preceding siblings ...)
2026-02-09 9:10 ` [PATCH 4/6] gpio: mpc8xxx: allow build on MPC85xx platforms Ahmad Fatoum
@ 2026-02-09 9:10 ` Ahmad Fatoum
2026-02-09 9:10 ` [PATCH 6/6] powerpc: add QEMU ppce500 board support with CI test infrastructure Ahmad Fatoum
2026-02-11 9:34 ` [PATCH 0/6] ppc: add QEMU ppce500 test in CI Sascha Hauer
6 siblings, 0 replies; 8+ messages in thread
From: Ahmad Fatoum @ 2026-02-09 9:10 UTC (permalink / raw)
To: barebox; +Cc: Claude Opus 4.6, Ahmad Fatoum
Some platforms (e.g. QEMU) don't implement the GUTS PORPLLSR register,
so the register-based timebase frequency calculation returns 0. Add
fsl_set_timebase_clock() that allows board code to provide the correct
timebase frequency before initcalls run, bypassing the register read.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
arch/powerpc/mach-mpc85xx/include/mach/clock.h | 1 +
arch/powerpc/mach-mpc85xx/speed.c | 10 ++++++++++
2 files changed, 11 insertions(+)
diff --git a/arch/powerpc/mach-mpc85xx/include/mach/clock.h b/arch/powerpc/mach-mpc85xx/include/mach/clock.h
index bfd9cf4d8ecd..2d0f079f5c68 100644
--- a/arch/powerpc/mach-mpc85xx/include/mach/clock.h
+++ b/arch/powerpc/mach-mpc85xx/include/mach/clock.h
@@ -14,6 +14,7 @@ struct sys_info {
unsigned long fsl_get_bus_freq(ulong dummy);
unsigned long fsl_get_ddr_freq(ulong dummy);
+void fsl_set_timebase_clock(unsigned long freq);
unsigned long fsl_get_timebase_clock(void);
unsigned long fsl_get_i2c_freq(void);
void fsl_get_sys_info(struct sys_info *sysInfo);
diff --git a/arch/powerpc/mach-mpc85xx/speed.c b/arch/powerpc/mach-mpc85xx/speed.c
index 4a69de3dc81a..8018132874ba 100644
--- a/arch/powerpc/mach-mpc85xx/speed.c
+++ b/arch/powerpc/mach-mpc85xx/speed.c
@@ -104,10 +104,20 @@ unsigned long fsl_get_ddr_freq(ulong dummy)
return sys_info.freqDDRBus;
}
+static unsigned long timebase_clock_override;
+
+void fsl_set_timebase_clock(unsigned long freq)
+{
+ timebase_clock_override = freq;
+}
+
unsigned long fsl_get_timebase_clock(void)
{
struct sys_info sysinfo;
+ if (timebase_clock_override)
+ return timebase_clock_override;
+
fsl_get_sys_info(&sysinfo);
return (sysinfo.freqSystemBus + 4UL)/8UL;
--
2.47.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 6/6] powerpc: add QEMU ppce500 board support with CI test infrastructure
2026-02-09 9:10 [PATCH 0/6] ppc: add QEMU ppce500 test in CI Ahmad Fatoum
` (4 preceding siblings ...)
2026-02-09 9:10 ` [PATCH 5/6] mach-mpc85xx: speed: add fsl_set_timebase_clock() override Ahmad Fatoum
@ 2026-02-09 9:10 ` Ahmad Fatoum
2026-02-11 9:34 ` [PATCH 0/6] ppc: add QEMU ppce500 test in CI Sascha Hauer
6 siblings, 0 replies; 8+ messages in thread
From: Ahmad Fatoum @ 2026-02-09 9:10 UTC (permalink / raw)
To: barebox; +Cc: Claude Opus 4.6, Ahmad Fatoum
Add support for running barebox on the QEMU ppce500 virtual machine.
This enables automated testing of PowerPC e500 support in CI.
The ppce500 machine places CCSRBAR at effective address 0xE0000000
(physical 0xF_E0000000 with 36-bit addressing). The assembly entry
sets up TLB entries for RAM, CCSRBAR MMIO, and the boot page, then
jumps to C code which parses the timebase-frequency from the QEMU-
provided device tree to configure the clocksource correctly (QEMU
does not implement the GUTS PORPLLSR register).
Poweroff is handled by the existing gpio-poweroff driver, which uses
the fsl,qoriq-gpio controller exposed in QEMU's device tree.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
.github/workflows/test-labgrid-pytest.yml | 4 +
arch/powerpc/Makefile | 1 +
arch/powerpc/boards/qemu-e500/Makefile | 5 +
arch/powerpc/boards/qemu-e500/law.c | 17 ++
arch/powerpc/boards/qemu-e500/qemu-e500.c | 92 ++++++++
arch/powerpc/boards/qemu-e500/tlb.c | 17 ++
arch/powerpc/configs/qemu-ppce500_defconfig | 69 ++++++
arch/powerpc/cpu-85xx/Makefile | 3 +
arch/powerpc/cpu-85xx/start-qemu.S | 211 ++++++++++++++++++
arch/powerpc/include/asm/board-qemu-e500.h | 39 ++++
arch/powerpc/include/asm/config.h | 2 +
arch/powerpc/include/asm/debug_ll.h | 52 +++++
arch/powerpc/lib/board.c | 6 +
arch/powerpc/mach-mpc85xx/Kconfig | 13 ++
arch/powerpc/mach-mpc85xx/barebox.lds.S | 12 +
.../include/mach/config_mpc85xx.h | 6 +
common/Kconfig.debug_ll | 7 +-
test/powerpc/qemu-ppce500_defconfig.yaml | 17 ++
18 files changed, 572 insertions(+), 1 deletion(-)
create mode 100644 arch/powerpc/boards/qemu-e500/Makefile
create mode 100644 arch/powerpc/boards/qemu-e500/law.c
create mode 100644 arch/powerpc/boards/qemu-e500/qemu-e500.c
create mode 100644 arch/powerpc/boards/qemu-e500/tlb.c
create mode 100644 arch/powerpc/configs/qemu-ppce500_defconfig
create mode 100644 arch/powerpc/cpu-85xx/start-qemu.S
create mode 100644 arch/powerpc/include/asm/board-qemu-e500.h
create mode 100644 arch/powerpc/include/asm/debug_ll.h
create mode 100644 test/powerpc/qemu-ppce500_defconfig.yaml
diff --git a/.github/workflows/test-labgrid-pytest.yml b/.github/workflows/test-labgrid-pytest.yml
index c06bc5f11faa..7e385af65245 100644
--- a/.github/workflows/test-labgrid-pytest.yml
+++ b/.github/workflows/test-labgrid-pytest.yml
@@ -49,6 +49,10 @@ jobs:
lgenv: test/openrisc/generic_defconfig.yaml
defconfig: generic_defconfig
+ - ARCH: powerpc
+ lgenv: test/powerpc/qemu-ppce500_defconfig.yaml
+ defconfig: qemu-ppce500_defconfig
+
- ARCH: x86
lgenv: test/x86/efi_defconfig.yaml
defconfig: efi_defconfig
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index ebd8fe60d3f1..fa511c6c1295 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -18,6 +18,7 @@ KBUILD_CPPFLAGS += -Wa,-me500x2 -msoft-float -mno-string
endif
board-$(CONFIG_MACH_PHYCORE_MPC5200B_TINY) := pcm030
+board-$(CONFIG_QEMU_PPCE500) := qemu-e500
board-$(CONFIG_P1010RDB) := freescale-p1010rdb
board-$(CONFIG_P2020RDB) := freescale-p2020rdb
board-$(CONFIG_P1022DS) := freescale-p1022ds
diff --git a/arch/powerpc/boards/qemu-e500/Makefile b/arch/powerpc/boards/qemu-e500/Makefile
new file mode 100644
index 000000000000..15add493eea8
--- /dev/null
+++ b/arch/powerpc/boards/qemu-e500/Makefile
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-y += qemu-e500.o
+obj-y += tlb.o
+obj-y += law.o
diff --git a/arch/powerpc/boards/qemu-e500/law.c b/arch/powerpc/boards/qemu-e500/law.c
new file mode 100644
index 000000000000..97683b01a573
--- /dev/null
+++ b/arch/powerpc/boards/qemu-e500/law.c
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * LAW configuration for QEMU ppce500
+ *
+ * QEMU virtual hardware doesn't require LAW (Local Access Window)
+ * configuration, so we provide an empty table.
+ */
+
+#include <linux/types.h>
+#include <linux/array_size.h>
+#include <asm/fsl_law.h>
+
+struct law_entry law_table[] = {
+ /* No LAW entries needed for QEMU virtual hardware */
+};
+
+int num_law_entries = ARRAY_SIZE(law_table);
diff --git a/arch/powerpc/boards/qemu-e500/qemu-e500.c b/arch/powerpc/boards/qemu-e500/qemu-e500.c
new file mode 100644
index 000000000000..70f22aa9b118
--- /dev/null
+++ b/arch/powerpc/boards/qemu-e500/qemu-e500.c
@@ -0,0 +1,92 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Board support for QEMU ppce500 virtual machine
+ */
+
+#include <barebox-info.h>
+#include <deep-probe.h>
+#include <init.h>
+#include <of.h>
+#include <linux/libfdt.h>
+#include <asm/processor.h>
+#include <asm/cache.h>
+#include <mach/mpc85xx.h>
+#include <mach/clock.h>
+#include <debug_ll.h>
+
+/* Global pointer to device tree */
+static void *fdt;
+
+/* Called from start-qemu.S assembly */
+void qemu_e500_entry(void *fdt_blob);
+
+/* Called from board initialization */
+extern void board_init_r(ulong end_of_ram);
+
+void qemu_e500_entry(void *fdt_blob)
+{
+ int cpus_off, cpu_off, len;
+ const fdt32_t *prop;
+
+ /* Initialize debug UART first */
+ debug_ll_init();
+
+ putc_ll('Q');
+ putc_ll('E');
+ putc_ll('M');
+ putc_ll('U');
+ putc_ll('\r');
+ putc_ll('\n');
+
+ /* Save FDT to global for later use */
+ fdt = fdt_blob;
+
+ /*
+ * Parse timebase-frequency from QEMU's FDT. The MPC85xx GUTS
+ * PORPLLSR register is unimplemented in QEMU and reads as zero,
+ * so the normal register-based clock calculation fails.
+ */
+ cpus_off = fdt_path_offset(fdt_blob, "/cpus");
+ if (cpus_off >= 0) {
+ cpu_off = fdt_first_subnode(fdt_blob, cpus_off);
+ if (cpu_off >= 0) {
+ prop = fdt_getprop(fdt_blob, cpu_off,
+ "timebase-frequency", &len);
+ if (prop && len == sizeof(*prop))
+ fsl_set_timebase_clock(fdt32_to_cpu(*prop));
+ }
+ }
+
+ putc_ll('F');
+ putc_ll('D');
+ putc_ll('T');
+ putc_ll(':');
+ puthex_ll((unsigned long)fdt_blob);
+ putc_ll('\r');
+ putc_ll('\n');
+
+ putc_ll('B');
+ putc_ll('R');
+ putc_ll('\r');
+ putc_ll('\n');
+
+ board_init_r(256 * 1024 * 1024);
+}
+
+static int qemu_e500_of_init(void)
+{
+ if (!fdt)
+ return 0;
+
+ barebox_set_model("QEMU ppce500");
+ barebox_set_hostname("qemu-e500");
+
+ return barebox_register_fdt(fdt);
+}
+core_initcall(qemu_e500_of_init);
+
+static const struct of_device_id qemu_e500_of_match[] = {
+ { .compatible = "fsl,qemu-e500" },
+ { /* sentinel */ },
+};
+BAREBOX_DEEP_PROBE_ENABLE(qemu_e500_of_match);
diff --git a/arch/powerpc/boards/qemu-e500/tlb.c b/arch/powerpc/boards/qemu-e500/tlb.c
new file mode 100644
index 000000000000..a0f31a6fa85d
--- /dev/null
+++ b/arch/powerpc/boards/qemu-e500/tlb.c
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * TLB configuration for QEMU ppce500
+ *
+ * QEMU sets up TLB entries before jumping to firmware, so we
+ * provide a minimal table here just for the API.
+ */
+
+#include <linux/types.h>
+#include <linux/array_size.h>
+#include <mach/mmu.h>
+
+struct fsl_e_tlb_entry tlb_table[] = {
+ /* QEMU already configured TLB - empty table */
+};
+
+int num_tlb_entries = ARRAY_SIZE(tlb_table);
diff --git a/arch/powerpc/configs/qemu-ppce500_defconfig b/arch/powerpc/configs/qemu-ppce500_defconfig
new file mode 100644
index 000000000000..6a0e070f4996
--- /dev/null
+++ b/arch/powerpc/configs/qemu-ppce500_defconfig
@@ -0,0 +1,69 @@
+CONFIG_ARCH_MPC85XX=y
+CONFIG_QEMU_PPCE500=y
+CONFIG_NAME="qemu-ppce500_defconfig"
+CONFIG_MALLOC_SIZE=0x100000
+CONFIG_RELOCATABLE=y
+CONFIG_CMDLINE_EDITING=y
+CONFIG_AUTO_COMPLETE=y
+CONFIG_BOOTM_VERBOSE=y
+CONFIG_DEBUG_LL=y
+CONFIG_CMD_DMESG=y
+CONFIG_LONGHELP=y
+CONFIG_CMD_IOMEM=y
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_NVMEM=y
+CONFIG_CMD_GO=y
+CONFIG_CMD_LOADY=y
+CONFIG_CMD_RESET=y
+CONFIG_CMD_PARTITION=y
+CONFIG_CMD_FINDMNT=y
+CONFIG_CMD_EXPORT=y
+CONFIG_CMD_DEFAULTENV=y
+CONFIG_CMD_LOADENV=y
+CONFIG_CMD_PRINTENV=y
+CONFIG_CMD_MAGICVAR=y
+CONFIG_CMD_MAGICVAR_HELP=y
+CONFIG_CMD_SAVEENV=y
+CONFIG_CMD_FILETYPE=y
+CONFIG_CMD_LN=y
+CONFIG_CMD_MD5SUM=y
+CONFIG_CMD_SHA1SUM=y
+CONFIG_CMD_SHA256SUM=y
+CONFIG_CMD_LET=y
+CONFIG_CMD_MSLEEP=y
+CONFIG_CMD_READF=y
+CONFIG_CMD_SLEEP=y
+CONFIG_CMD_ECHO_E=y
+CONFIG_CMD_EDIT=y
+CONFIG_CMD_READLINE=y
+CONFIG_CMD_TIMEOUT=y
+CONFIG_CMD_CRC=y
+CONFIG_CMD_CRC_CMP=y
+CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_DETECT=y
+CONFIG_CMD_FLASH=y
+CONFIG_CMD_POWEROFF=y
+CONFIG_CMD_OF_DIFF=y
+CONFIG_CMD_OF_NODE=y
+CONFIG_CMD_OF_PROPERTY=y
+CONFIG_CMD_OF_FIXUP_STATUS=y
+CONFIG_CMD_OFTREE=y
+CONFIG_CMD_TIME=y
+CONFIG_OFDEVICE=y
+CONFIG_OF_BAREBOX_DRIVERS=y
+CONFIG_DRIVER_SERIAL_NS16550=y
+CONFIG_GPIO_MPC8XXX=y
+CONFIG_NVMEM=y
+CONFIG_NVMEM_RMEM=y
+CONFIG_POWER_RESET_GPIO=y
+CONFIG_TEST=y
+CONFIG_SELFTEST=y
+CONFIG_SELFTEST_BASE64=y
+CONFIG_SELFTEST_RANGE=y
+CONFIG_SELFTEST_MALLOC=y
+CONFIG_SELFTEST_PRINTF=y
+CONFIG_SELFTEST_OF_MANIPULATION=y
+CONFIG_SELFTEST_PROGRESS_NOTIFIER=y
+CONFIG_SELFTEST_STRING=y
+CONFIG_SELFTEST_RESOURCE=y
+CONFIG_SELFTEST_IDR=y
diff --git a/arch/powerpc/cpu-85xx/Makefile b/arch/powerpc/cpu-85xx/Makefile
index cc85eb759472..a902ecb9c659 100644
--- a/arch/powerpc/cpu-85xx/Makefile
+++ b/arch/powerpc/cpu-85xx/Makefile
@@ -4,5 +4,8 @@ obj-y += traps.o
obj-y += tlb.o
obj-y += cache.o
obj-$(CONFIG_MMU) += mmu.o
+extra-$(CONFIG_QEMU_PPCE500) += start-qemu.o
+ifndef CONFIG_QEMU_PPCE500
extra-y += start.o
extra-y += resetvec.o
+endif
diff --git a/arch/powerpc/cpu-85xx/start-qemu.S b/arch/powerpc/cpu-85xx/start-qemu.S
new file mode 100644
index 000000000000..fd3a9aeec27e
--- /dev/null
+++ b/arch/powerpc/cpu-85xx/start-qemu.S
@@ -0,0 +1,211 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * ePAPR-compliant entry point for QEMU e500 platforms (mpc8544ds/ppce500)
+ *
+ * QEMU sets up the following CPU state before jumping to firmware:
+ * - r1 = 16MB - 8 (initial stack)
+ * - r3 = FDT physical address
+ * - r6 = EPAPR_MAGIC (0x45504150)
+ * - r7 = Initial TLB map size
+ * - TLB1[0] = Identity map covering RAM + FDT
+ */
+
+#include <asm/config.h>
+#include <asm/processor.h>
+#include <asm/ppc_asm.tmpl>
+#include <asm/ppc_defs.h>
+#include <asm/cache.h>
+#include <mach/mmu.h>
+
+#undef MSR_KERNEL
+#define MSR_KERNEL (MSR_ME) /* Machine Check */
+
+ .section .text_entry
+ .globl _start_qemu_e500
+ .globl _start
+
+_start:
+_start_qemu_e500:
+ /*
+ * Entry from QEMU with ePAPR boot convention:
+ * r3 = FDT pointer (must be preserved)
+ * r6 = EPAPR_MAGIC
+ * r1 = initial stack (16MB - 8)
+ * TLB already set up by QEMU for RAM
+ */
+
+ /* Save FDT pointer to r31 (callee-saved) */
+ mr r31, r3
+
+ /* Enable machine check exception */
+ li r0, MSR_KERNEL
+ mtmsr r0
+ isync
+
+ /* Invalidate L1 caches */
+ li r0, 2
+ mtspr L1CSR0, r0 /* invalidate d-cache */
+ mtspr L1CSR1, r0 /* invalidate i-cache */
+ isync
+
+ /* Clear debug status */
+ mfspr r0, DBSR
+ mtspr DBSR, r0
+ isync
+
+ /* Clear and set up timer/exception registers */
+ li r0, 0
+ lis r1, 0xffff
+ mtspr DEC, r0 /* prevent dec exceptions */
+ mttbl r0 /* prevent fit & wdt exceptions */
+ mttbu r0
+ mtspr TSR, r1 /* clear all timer exception status */
+ mtspr TCR, r0 /* disable all timers */
+ mtspr ESR, r0 /* clear exception syndrome register */
+ mtspr MCSR, r0 /* machine check syndrome register */
+ mtxer r0 /* clear integer exception register */
+
+ /* Enable machine check and timebase in HID0 */
+ lis r0, HID0_EMCP@h
+ ori r0, r0, HID0_TBEN@l
+ mtspr HID0, r0
+
+ /* Setup IVPR for exception vectors */
+ lis r0, TEXT_BASE@h
+ ori r0, r0, TEXT_BASE@l
+ mtspr IVPR, r0
+ isync
+
+ /*
+ * Set up TLB1[1]: Map CCSRBAR (16MB, cache-inhibited, guarded)
+ *
+ * mpc8544ds: CCSRBAR at 0x0_E0000000 (MAS7 = 0x0)
+ * ppce500: CCSRBAR at 0xF_E0000000 (MAS7 = 0xF)
+ */
+ lis r0, FSL_BOOKE_MAS0(1, 1, 0)@h
+ ori r0, r0, FSL_BOOKE_MAS0(1, 1, 0)@l
+ mtspr MAS0, r0
+ lis r0, FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_16M)@h
+ ori r0, r0, FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_16M)@l
+ mtspr MAS1, r0
+ lis r0, FSL_BOOKE_MAS2(CFG_CCSRBAR, (MAS2_I | MAS2_G))@h
+ ori r0, r0, FSL_BOOKE_MAS2(CFG_CCSRBAR, (MAS2_I | MAS2_G))@l
+ mtspr MAS2, r0
+ lis r0, FSL_BOOKE_MAS3(CFG_CCSRBAR, 0, (MAS3_SX | MAS3_SW | MAS3_SR))@h
+ ori r0, r0, FSL_BOOKE_MAS3(CFG_CCSRBAR, 0, (MAS3_SX | MAS3_SW | MAS3_SR))@l
+ mtspr MAS3, r0
+ li r0, CFG_CCSRBAR_PHYS_HIGH
+ mtspr MAS7, r0
+ isync
+ msync
+ tlbwe
+ isync
+
+ /*
+ * Clear BSS before calling C code.
+ */
+ lis r3, __bss_start@h
+ ori r3, r3, __bss_start@l
+ lis r4, __bss_stop@h
+ ori r4, r4, __bss_stop@l
+ li r0, 0
+ cmplw 0, r3, r4
+ beq 2f
+1: stw r0, 0(r3)
+ addi r3, r3, 4
+ cmplw 0, r3, r4
+ blt 1b
+2:
+
+ /* Restore stack pointer (was clobbered by timer setup above) */
+ lis r1, (16 * 1024 * 1024 - 8)@h
+ ori r1, r1, (16 * 1024 * 1024 - 8)@l
+
+ /* Clear LR for clean stack traces */
+ li r0, 0
+ mtlr r0
+
+ /* Jump to C entry with FDT pointer in r3 */
+ mr r3, r31
+ lis r4, qemu_e500_entry@h
+ ori r4, r4, qemu_e500_entry@l
+ mtctr r4
+ bctr
+
+ /* Should never return */
+ b .
+
+/*
+ * Low-level helper functions required by barebox
+ */
+
+/* get_svr: Return System Version Register */
+ .globl get_svr
+get_svr:
+ mfspr r3, SVR
+ blr
+
+/* invalidate_icache: Invalidate instruction cache */
+ .globl invalidate_icache
+invalidate_icache:
+ mfspr r0, L1CSR1
+ ori r0, r0, L1CSR1_ICFI
+ msync
+ isync
+ mtspr L1CSR1, r0
+ isync
+ blr
+
+/* flush_dcache: Flush data cache */
+ .globl flush_dcache
+flush_dcache:
+ mfspr r3, SPRN_L1CFG0
+ rlwinm r5, r3, 9, 3
+ li r4, 32
+ subfic r6, r5, 2
+ slw r5, r4, r5
+ rlwinm r7, r3, 0, 0xff
+ mulli r7, r7, 13
+ slw r7, r7, r6
+
+ mfspr r8, SPRN_HID0
+ ori r9, r8, HID0_DCFA@l
+ mtspr SPRN_HID0, r9
+ isync
+
+ lis r4, 0
+ mtctr r7
+
+1: lwz r3, 0(r4)
+ add r4, r4, r5
+ bdnz 1b
+
+ mtspr SPRN_HID0, r8
+ isync
+ blr
+
+/* trap_init: Initialize exception vectors - simplified for QEMU */
+ .globl trap_init
+trap_init:
+ blr
+
+/*
+ * void e500_write_tlb(mas0, mas1, mas2, mas3, mas7)
+ */
+ .globl e500_write_tlb
+e500_write_tlb:
+ mtspr MAS0, r3
+ mtspr MAS1, r4
+ mtspr MAS2, r5
+ mtspr MAS3, r6
+ mtspr MAS7, r7
+ isync
+ tlbwe
+ msync
+ isync
+ blr
+
+/* _text_base: Text base address variable */
+ .globl _text_base
+_text_base:
+ .long TEXT_BASE
diff --git a/arch/powerpc/include/asm/board-qemu-e500.h b/arch/powerpc/include/asm/board-qemu-e500.h
new file mode 100644
index 000000000000..625d27b5185d
--- /dev/null
+++ b/arch/powerpc/include/asm/board-qemu-e500.h
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * QEMU ppce500 virtual machine configuration
+ *
+ * CCSRBAR effective address is 0xE0000000, physical 0xF_E0000000
+ * (36-bit, MAS7 = 0xF).
+ */
+
+#ifndef __ASM_BOARD_QEMU_E500_H
+#define __ASM_BOARD_QEMU_E500_H
+
+/*
+ * Serial clock - QEMU's ns16550 baudbase is 399193, but we use
+ * 1843200 (standard 16550 crystal) so the divisor calculation
+ * produces a reasonable value. QEMU ignores the actual baud rate.
+ */
+#define CFG_SYS_CLK_FREQ 1843200
+
+/*
+ * DDR configuration - QEMU doesn't have a real DDR controller,
+ * but the define is needed for compilation.
+ */
+#define CFG_CHIP_SELECTS_PER_CTRL 1
+
+#define CFG_SDRAM_BASE 0x00000000
+
+/*
+ * CCSR (CCSRBAR) - SoC register space
+ *
+ * QEMU ppce500 maps CCSRBAR at effective address 0xE0000000,
+ * physical address 0xF_E0000000 (36-bit, MAS7 = 0xF).
+ */
+#define CFG_CCSRBAR_DEFAULT 0xE0000000
+#define CFG_CCSRBAR 0xE0000000
+#define CFG_CCSRBAR_PHYS CFG_CCSRBAR
+#define CFG_CCSRBAR_PHYS_HIGH 0xF
+#define CFG_IMMR CFG_CCSRBAR
+
+#endif /* __ASM_BOARD_QEMU_E500_H */
diff --git a/arch/powerpc/include/asm/config.h b/arch/powerpc/include/asm/config.h
index 727daa872f20..59965095b92e 100644
--- a/arch/powerpc/include/asm/config.h
+++ b/arch/powerpc/include/asm/config.h
@@ -39,6 +39,8 @@
#ifdef CONFIG_MACH_PHYCORE_MPC5200B_TINY
#include <asm/board-pcm030.h>
+#elif defined(CONFIG_QEMU_PPCE500)
+#include <asm/board-qemu-e500.h>
#elif defined(CONFIG_P1010RDB)
#include <asm/board-p1010rdb.h>
#elif defined(CONFIG_P2020RDB)
diff --git a/arch/powerpc/include/asm/debug_ll.h b/arch/powerpc/include/asm/debug_ll.h
new file mode 100644
index 000000000000..910db2808d81
--- /dev/null
+++ b/arch/powerpc/include/asm/debug_ll.h
@@ -0,0 +1,52 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __ASM_DEBUG_LL_H__
+#define __ASM_DEBUG_LL_H__
+
+#include <io.h>
+
+#ifdef CONFIG_DEBUG_QEMU_PPCE500
+
+#include <asm/board-qemu-e500.h>
+
+/*
+ * QEMU ppce500 NS16550 UART at CCSRBAR + 0x4500
+ * Clock is platform clock (400 MHz default)
+ */
+#define DEBUG_LL_UART_BASE IOMEM(CFG_CCSRBAR + 0x4500)
+#define DEBUG_LL_UART_CLK CFG_SYS_CLK_FREQ
+
+static inline uint8_t debug_ll_read_reg(void __iomem *base, int reg)
+{
+ return readb(base + reg);
+}
+
+static inline void debug_ll_write_reg(void __iomem *base, int reg, uint8_t val)
+{
+ writeb(val, base + reg);
+}
+
+#include <debug_ll/ns16550.h>
+
+static inline void debug_ll_init(void)
+{
+ uint16_t divisor;
+
+ divisor = debug_ll_ns16550_calc_divisor(DEBUG_LL_UART_CLK);
+ debug_ll_ns16550_init(DEBUG_LL_UART_BASE, divisor);
+}
+
+static inline void PUTC_LL(int c)
+{
+ debug_ll_ns16550_putc(DEBUG_LL_UART_BASE, c);
+}
+
+#else
+
+static inline void debug_ll_init(void)
+{
+}
+
+#endif /* CONFIG_DEBUG_QEMU_PPCE500 */
+
+#endif /* __ASM_DEBUG_LL_H__ */
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index a6111606b68c..3781345926a4 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -43,7 +43,13 @@ void board_init_r (ulong end_of_ram)
asm ("sync ; isync");
#ifdef CONFIG_MPC85xx
+#ifndef CONFIG_QEMU_PPCE500
+ /* Traditional boards relocate to end of RAM */
_text_base = end_of_ram;
+#else
+ /* QEMU: no relocation, stay at link address */
+ _text_base = TEXT_BASE;
+#endif
#endif
malloc_end = (_text_base - STACK_SIZE) & ~(4095);
diff --git a/arch/powerpc/mach-mpc85xx/Kconfig b/arch/powerpc/mach-mpc85xx/Kconfig
index 550c554286d7..7f184babbee1 100644
--- a/arch/powerpc/mach-mpc85xx/Kconfig
+++ b/arch/powerpc/mach-mpc85xx/Kconfig
@@ -11,11 +11,13 @@ config BTB
config TEXT_BASE
hex
+ default 0x00f00000 if QEMU_PPCE500
default 0xeff80000 if P1010RDB || P2020RDB || P1022DS
default 0xfff80000 if DA923RC
config RESET_VECTOR_ADDRESS
hex
+ default 0x00000000 if QEMU_PPCE500
default 0xfffffffc if DA923RC
default 0xeffffffc if P1010RDB || P2020RDB || P1022DS
@@ -33,6 +35,7 @@ config E500
choice
prompt "Select your board"
+
config P1010RDB
bool "P1010RDB"
select P1010
@@ -64,6 +67,16 @@ config DA923RC
select FSL_DDR2
help
Say Y here if you are using the GE Intelligent Platforms DA923RC
+
+config QEMU_PPCE500
+ bool "QEMU ppce500"
+ select HAS_DEBUG_LL
+ select LIBFDT
+ select GPIOLIB
+ help
+ Say Y here for QEMU ppce500 generic paravirt e500 support.
+ CCSRBAR is at 36-bit physical address 0xFE0000000.
+
endchoice
endif
diff --git a/arch/powerpc/mach-mpc85xx/barebox.lds.S b/arch/powerpc/mach-mpc85xx/barebox.lds.S
index 5407ecc7e295..989fec7f1def 100644
--- a/arch/powerpc/mach-mpc85xx/barebox.lds.S
+++ b/arch/powerpc/mach-mpc85xx/barebox.lds.S
@@ -22,7 +22,11 @@
#endif
OUTPUT_ARCH(BAREBOX_OUTPUT_ARCH)
+#ifdef CONFIG_QEMU_PPCE500
+ENTRY(_start_qemu_e500)
+#else
ENTRY(_start_e500)
+#endif
PHDRS
{
@@ -122,6 +126,8 @@ SECTIONS
__init_size = __init_end - _start;
+#ifndef CONFIG_QEMU_PPCE500
+ /* Boot page and reset vector for flash boot */
.bootpg RESET_VECTOR_ADDRESS - 0xffc :
{
_text = .;
@@ -140,6 +146,12 @@ SECTIONS
/* This avoids wrapping around to offset 0 */
. |= 0x10;
#endif
+#else
+ /* QEMU entry point: simpler, no boot page or reset vector needed */
+ .text_entry : {
+ arch/powerpc/cpu-85xx/start-qemu.o (.text_entry)
+ } :text
+#endif
__bss_start = .;
.bss :
diff --git a/arch/powerpc/mach-mpc85xx/include/mach/config_mpc85xx.h b/arch/powerpc/mach-mpc85xx/include/mach/config_mpc85xx.h
index fad2c47d110f..0a53282c623c 100644
--- a/arch/powerpc/mach-mpc85xx/include/mach/config_mpc85xx.h
+++ b/arch/powerpc/mach-mpc85xx/include/mach/config_mpc85xx.h
@@ -57,6 +57,12 @@
#define PPC_E500_DEBUG_TLB 2
#define FSL_TSECV2
+#elif defined(CONFIG_QEMU_PPCE500)
+#define MAX_CPUS 1
+#define FSL_NUM_LAWS 12
+#define PPC_E500_DEBUG_TLB 0
+/* QEMU e500: generic e500v2 platform, minimal configuration */
+
#else
#error Processor type not defined for this platform
#endif
diff --git a/common/Kconfig.debug_ll b/common/Kconfig.debug_ll
index a08d29859d27..b11df2b79925 100644
--- a/common/Kconfig.debug_ll
+++ b/common/Kconfig.debug_ll
@@ -311,6 +311,11 @@ config DEBUG_ZYNQMP_UART
Say Y here if you want kernel low-level debugging support
on Zynqmp.
+config DEBUG_QEMU_PPCE500
+ bool "Qemu ppce500 PowerPC ns16550 port"
+ depends on QEMU_PPCE500
+ select DEBUG_LL_NS16550
+
config DEBUG_ERIZO
bool "Erizo ns16550 port"
depends on SOC_ERIZO
@@ -382,7 +387,7 @@ endchoice
config DEBUG_LL_NS16550
bool
help
- Selected by RISC-V platforms that use ns16550 for debug_ll
+ Selected by RISC-V and PowerPC platforms that use ns16550 for debug_ll
config DEBUG_IMX_UART_PORT
int "i.MX Debug UART Port Selection" if DEBUG_IMX1_UART || \
diff --git a/test/powerpc/qemu-ppce500_defconfig.yaml b/test/powerpc/qemu-ppce500_defconfig.yaml
new file mode 100644
index 000000000000..d64f42fc6eca
--- /dev/null
+++ b/test/powerpc/qemu-ppce500_defconfig.yaml
@@ -0,0 +1,17 @@
+targets:
+ main:
+ drivers:
+ QEMUDriver:
+ qemu_bin: qemu-system-ppc
+ machine: ppce500
+ cpu: e500
+ memory: 256M
+ kernel: barebox
+ display: qemu-default
+ BareboxDriver:
+ prompt: 'barebox:[^ ]+ '
+ BareboxTestStrategy: {}
+images:
+ barebox: !template "$LG_BUILDDIR/barebox"
+imports:
+ - ../strategy.py
--
2.47.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/6] ppc: add QEMU ppce500 test in CI
2026-02-09 9:10 [PATCH 0/6] ppc: add QEMU ppce500 test in CI Ahmad Fatoum
` (5 preceding siblings ...)
2026-02-09 9:10 ` [PATCH 6/6] powerpc: add QEMU ppce500 board support with CI test infrastructure Ahmad Fatoum
@ 2026-02-11 9:34 ` Sascha Hauer
6 siblings, 0 replies; 8+ messages in thread
From: Sascha Hauer @ 2026-02-11 9:34 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Mon, 09 Feb 2026 10:10:25 +0100, Ahmad Fatoum wrote:
> Add support for running barebox on the QEMU ppce500 virtual machine.
> This enables automated testing of PowerPC e500 support in CI.
>
> The PowerPC support for this virtual machine has been AI generated.
> I have no interest in learning the PowerPC ISA, but it's beneficial
> to remaining users for CI to be able to catch some runtime regressions
> as we only did compile tests so far.
>
> [...]
Applied, thanks!
[1/6] include: array_size.h: make header self-contained
https://git.pengutronix.de/cgit/barebox/commit/?id=e15799eb76e1 (link may not be stable)
[2/6] serial: ns16550: add "ns16550" compatible string
https://git.pengutronix.de/cgit/barebox/commit/?id=330ebc95133f (link may not be stable)
[3/6] lib: stackprot: omit HAVE_STACKPROTECTOR for powerpc
https://git.pengutronix.de/cgit/barebox/commit/?id=03c499b5733e (link may not be stable)
[4/6] gpio: mpc8xxx: allow build on MPC85xx platforms
https://git.pengutronix.de/cgit/barebox/commit/?id=558b09065975 (link may not be stable)
[5/6] mach-mpc85xx: speed: add fsl_set_timebase_clock() override
https://git.pengutronix.de/cgit/barebox/commit/?id=1bb0e5326eed (link may not be stable)
[6/6] powerpc: add QEMU ppce500 board support with CI test infrastructure
https://git.pengutronix.de/cgit/barebox/commit/?id=91e209fa4e55 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-02-11 9:34 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-09 9:10 [PATCH 0/6] ppc: add QEMU ppce500 test in CI Ahmad Fatoum
2026-02-09 9:10 ` [PATCH 1/6] include: array_size.h: make header self-contained Ahmad Fatoum
2026-02-09 9:10 ` [PATCH 2/6] serial: ns16550: add "ns16550" compatible string Ahmad Fatoum
2026-02-09 9:10 ` [PATCH 3/6] lib: stackprot: omit HAVE_STACKPROTECTOR for powerpc Ahmad Fatoum
2026-02-09 9:10 ` [PATCH 4/6] gpio: mpc8xxx: allow build on MPC85xx platforms Ahmad Fatoum
2026-02-09 9:10 ` [PATCH 5/6] mach-mpc85xx: speed: add fsl_set_timebase_clock() override Ahmad Fatoum
2026-02-09 9:10 ` [PATCH 6/6] powerpc: add QEMU ppce500 board support with CI test infrastructure Ahmad Fatoum
2026-02-11 9:34 ` [PATCH 0/6] ppc: add QEMU ppce500 test in CI Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox