powerpc improvements
cover powerpc improvements
This series aims to add a couple of new powerpc tests and improve the powerpc build structure.
This is originally Nick's work. The last version (v10) of which can be seen here :
https://lore.kernel.org/linuxppc-dev/[email protected]/
Couple of patches from the series are already merged.
Since it has been 2 years since this series was posted, I originally posted this as a RFC. This v1 series has changes accomodating the review comments received in the RFC :
https://lore.kernel.org/kvm/[email protected]/
I have rebased the patches to the upstream state.
For the patches which did not require any changes in the existing upstream code, I have retained the "Reviewed-by"s and "Acked-by" (patch 3,5 & 6) from Nick's series. I have also added Andrew's "Reviewed-by" received on patch 2 in the RFC. Nick had originally introduced powernv tests as well. Removed it for now since it was causing CI failure in the current upstream.
Link to Gitlab tree with patches :
https://gitlab.com/rathc/kvm-unit-tests/-/tree/ppc64
Link to Gitlab pipeline :
https://gitlab.com/rathc/kvm-unit-tests/-/pipelines/2661271889
Change log from RFC :
1. Patch 2: Added Andrew's "Reviewed-by".
2. Patch 4: Removed usage of gitlab-ci group to run test - Thomas It would be nice to make use of the gitlab-ci group, but doing the change of all archs would make sense in a separate series. I look forward to doing that.
3. Patch 6: Removed addition of panic test in gitlab-ci group - Thomas
There was a discussion on the build failing in Travis CI with Clang, in the RFC, which I have addressed there.
Nicholas Piggin (6):
powerpc: add pmu tests
configure: Make arch_libdir a first-class entity
powerpc: Remove remnants of ppc64 directory and build structure
powerpc: gitlab CI update
scripts/arch-run.bash: Fix run_panic() success exit status
powerpc: Add a panic test
.gitlab-ci.yml | 21 +-
MAINTAINERS | 1 -
Makefile | 2 +-
configure | 21 +-
lib/{ppc64 => powerpc}/asm-offsets.c | 0
lib/{ppc64 => powerpc}/asm/asm-offsets.h | 0
lib/{ppc64 => powerpc}/asm/atomic.h | 0
lib/{ppc64 => powerpc}/asm/barrier.h | 4 +-
lib/{ppc64 => powerpc}/asm/bitops.h | 4 +-
lib/{ppc64 => powerpc}/asm/io.h | 4 +-
lib/{ppc64 => powerpc}/asm/mmu.h | 0
lib/{ppc64 => powerpc}/asm/opal.h | 4 +-
lib/{ppc64 => powerpc}/asm/page.h | 6 +-
lib/{ppc64 => powerpc}/asm/pgtable-hwdef.h | 6 +-
lib/{ppc64 => powerpc}/asm/pgtable.h | 2 +-
lib/powerpc/asm/processor.h | 2 +
lib/{ppc64 => powerpc}/asm/ptrace.h | 6 +-
lib/powerpc/asm/reg.h | 9 +
lib/powerpc/asm/rtas.h | 1 +
lib/powerpc/asm/setup.h | 1 +
lib/powerpc/asm/spinlock.h | 6 +
lib/powerpc/asm/stack.h | 3 +
lib/{ppc64 => powerpc}/asm/vpa.h | 0
lib/{ppc64 => powerpc}/mmu.c | 0
lib/{ppc64 => powerpc}/opal-calls.S | 0
lib/{ppc64 => powerpc}/opal.c | 0
lib/powerpc/rtas.c | 16 +
lib/powerpc/setup.c | 20 +
lib/{ppc64 => powerpc}/stack.c | 0
lib/ppc64/.gitignore | 1 -
lib/ppc64/asm/handlers.h | 1 -
lib/ppc64/asm/hcall.h | 1 -
lib/ppc64/asm/memory_areas.h | 6 -
lib/ppc64/asm/ppc_asm.h | 1 -
lib/ppc64/asm/processor.h | 1 -
lib/ppc64/asm/reg.h | 1 -
lib/ppc64/asm/rtas.h | 1 -
lib/ppc64/asm/setup.h | 1 -
lib/ppc64/asm/smp.h | 1 -
lib/ppc64/asm/spinlock.h | 6 -
lib/ppc64/asm/stack.h | 11 -
lib/ppc64/asm/time.h | 1 -
powerpc/Makefile | 111 +++-
powerpc/Makefile.common | 94 ----
powerpc/Makefile.ppc64 | 31 --
powerpc/pmu.c | 567 +++++++++++++++++++++
powerpc/run | 2 +-
powerpc/selftest.c | 17 +-
powerpc/unittests.cfg | 17 +-
scripts/arch-run.bash | 1 +
50 files changed, 817 insertions(+), 195 deletions(-)
rename lib/{ppc64 => powerpc}/asm-offsets.c (100%)
rename lib/{ppc64 => powerpc}/asm/asm-offsets.h (100%)
rename lib/{ppc64 => powerpc}/asm/atomic.h (100%)
rename lib/{ppc64 => powerpc}/asm/barrier.h (83%)
rename lib/{ppc64 => powerpc}/asm/bitops.h (69%)
rename lib/{ppc64 => powerpc}/asm/io.h (50%)
rename lib/{ppc64 => powerpc}/asm/mmu.h (100%)
rename lib/{ppc64 => powerpc}/asm/opal.h (90%)
rename lib/{ppc64 => powerpc}/asm/page.h (94%)
rename lib/{ppc64 => powerpc}/asm/pgtable-hwdef.h (93%)
rename lib/{ppc64 => powerpc}/asm/pgtable.h (99%)
rename lib/{ppc64 => powerpc}/asm/ptrace.h (89%)
create mode 100644 lib/powerpc/asm/spinlock.h
rename lib/{ppc64 => powerpc}/asm/vpa.h (100%)
rename lib/{ppc64 => powerpc}/mmu.c (100%)
rename lib/{ppc64 => powerpc}/opal-calls.S (100%)
rename lib/{ppc64 => powerpc}/opal.c (100%)
rename lib/{ppc64 => powerpc}/stack.c (100%)
delete mode 100644 lib/ppc64/.gitignore
delete mode 100644 lib/ppc64/asm/handlers.h
delete mode 100644 lib/ppc64/asm/hcall.h
delete mode 100644 lib/ppc64/asm/memory_areas.h
delete mode 100644 lib/ppc64/asm/ppc_asm.h
delete mode 100644 lib/ppc64/asm/processor.h
delete mode 100644 lib/ppc64/asm/reg.h
delete mode 100644 lib/ppc64/asm/rtas.h
delete mode 100644 lib/ppc64/asm/setup.h
delete mode 100644 lib/ppc64/asm/smp.h
delete mode 100644 lib/ppc64/asm/spinlock.h
delete mode 100644 lib/ppc64/asm/stack.h
delete mode 100644 lib/ppc64/asm/time.h
delete mode 100644 powerpc/Makefile.common
delete mode 100644 powerpc/Makefile.ppc64
create mode 100644 powerpc/pmu.cSignature · 1 line
2.53.0
PATCH 1/6 powerpc: add pmu tests
From: Nicholas Piggin <[email protected]>
Add some initial PMU testing.
- PMC5/6 tests
- PMAE / PMI test
- BHRB basic tests
--- lib/powerpc/asm/processor.h | 2 + lib/powerpc/asm/reg.h | 9 + lib/powerpc/asm/setup.h | 1 + lib/powerpc/setup.c | 20 ++ powerpc/Makefile.common | 3 +- powerpc/pmu.c | 567 ++++++++++++++++++++++++++++++++++++ powerpc/unittests.cfg | 3 + 7 files changed, 604 insertions(+), 1 deletion(-) create mode 100644 powerpc/pmu.c
lib/powerpc/asm/processor.h +2 -0
@@ -17,6 +17,8 @@ extern bool cpu_has_hv;extern bool cpu_has_power_mce;extern bool cpu_has_siar;extern bool cpu_has_heai; +extern bool cpu_has_bhrb; +extern bool cpu_has_p10_bhrb;extern bool cpu_has_radix;extern bool cpu_has_prefix;extern bool cpu_has_sc_lev;
lib/powerpc/asm/reg.h +9 -0
@@ -40,10 +40,19 @@#define SPR_LPIDR 0x13f#define SPR_HEIR 0x153#define SPR_PTCR 0x1d0 +#define SPR_MMCRA 0x312 +#define MMCRA_BHRBRD UL(0x0000002000000000) +#define MMCRA_IFM_MASK UL(0x00000000c0000000) +#define SPR_PMC5 0x317 +#define SPR_PMC6 0x318#define SPR_MMCR0 0x31b#define MMCR0_FC UL(0x80000000) +#define MMCR0_FCP UL(0x20000000)#define MMCR0_PMAE UL(0x04000000) +#define MMCR0_BHRBA UL(0x00200000) +#define MMCR0_FCPC UL(0x00001000)#define MMCR0_PMAO UL(0x00000080) +#define MMCR0_FC56 UL(0x00000010)#define SPR_SIAR 0x31c/* Machine State Register definitions: */
lib/powerpc/asm/setup.h +1 -0
@@ -10,6 +10,7 @@#define NR_CPUS 8/* arbitrarily set for now */ extern uint64_t tb_hz; +extern uint64_t cpu_hz;#define NR_MEM_REGIONS 8#define MR_F_PRIMARY (1U << 0)
lib/powerpc/setup.c +20 -0
@@ -33,6 +33,7 @@ u32 initrd_size;u32 cpu_to_hwid[NR_CPUS ] = { [0 ...NR_CPUS -1 ] = (~0U ) };int nr_cpus_present;uint64_t tb_hz; +uint64_t cpu_hz;struct mem_region mem_regions[NR_MEM_REGIONS ];phys_addr_t __physical_start, __physical_end;
@@ -42,6 +43,7 @@ struct cpu_set_params {unsigned icache_bytes;unsigned dcache_bytes;uint64_t tb_hz; +uint64_t cpu_hz; };static void cpu_set (int fdtnode,u64 regval,void *info)
@@ -95,6 +97,19 @@ static void cpu_set(int fdtnode, u64 regval, void *info) data = (u32 *)prop->data; params->tb_hz =fdt32_to_cpu (*data); + prop =fdt_get_property (dt_fdt (), fdtnode, +"ibm,extended-clock-frequency" ,NULL ); +if (prop) { +u64 *data64 = (u64 *)prop->data; + params->cpu_hz =fdt64_to_cpu (*data64); + }else { + prop =fdt_get_property (dt_fdt (), fdtnode, +"clock-frequency" ,NULL ); +assert (prop !=NULL ); + data = (u32 *)prop->data; + params->cpu_hz =fdt32_to_cpu (*data); + } + read_common_info = true; } }
@@ -103,6 +118,8 @@ bool cpu_has_hv;bool cpu_has_power_mce;/* POWER CPU machine checks */ bool cpu_has_siar;bool cpu_has_heai; +bool cpu_has_bhrb; +bool cpu_has_p10_bhrb;bool cpu_has_radix;bool cpu_has_prefix;bool cpu_has_sc_lev;/* sc interrupt has LEV field in SRR1 */
@@ -119,12 +136,14 @@ static void cpu_init_params(void) __icache_bytes = params.icache_bytes; __dcache_bytes = params.dcache_bytes; tb_hz = params.tb_hz; + cpu_hz = params.cpu_hz;switch (mfspr (SPR_PVR ) &PVR_VERSION_MASK ) {case PVR_VER_POWER10 : cpu_has_prefix = true; cpu_has_sc_lev = true; cpu_has_pause_short = true; + cpu_has_p10_bhrb = true;case PVR_VER_POWER9 : cpu_has_radix = true;case PVR_VER_POWER8E :
@@ -133,6 +152,7 @@ static void cpu_init_params(void) cpu_has_power_mce = true; cpu_has_heai = true; cpu_has_siar = true; + cpu_has_bhrb = true;break ;default :break ;
powerpc/Makefile.common +2 -1
@@ -18,7 +18,8 @@ tests-common = \ $(TEST_DIR)/sprs.elf \ $(TEST_DIR)/timebase.elf \ $(TEST_DIR)/interrupts.elf \ - $(TEST_DIR)/mmu.elf + $(TEST_DIR)/mmu.elf \ + $(TEST_DIR)/pmu.elf tests-all = $(tests-common) $(tests) all: directories $(TEST_DIR)/boot_rom.bin $(tests-all)
powerpc/pmu.c new file +567 -0
567 lines not on this page · raw message
powerpc/unittests.cfg +3 -0
@@ -75,6 +75,9 @@ file = interrupts.elf file = mmu.elf smp = 2 +[pmu] +file = pmu.elf + [smp] file = smp.elf smp = 2
Signature · 1 line
2.53.0
PATCH 2/6 configure: Make arch_libdir a first-class entity
In reply to Chinmay RathFrom: Nicholas Piggin <[email protected]>
arch_libdir was brought in to improve the heuristic determination of the lib/ directory based on arch and testdir names, but it did not entirely clean that mess up.
Remove the arch_libdir->arch->testdir heuristic and just require everybody sets arch_libdir correctly. Fail if the lib/arch or lib/arch/asm directories can not be found.
--- Makefile | 2 +- configure | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-)
Makefile +1 -1
@@ -12,7 +12,7 @@ vpath %.s $(SRCDIR) vpath %.S $(SRCDIR) libdirs-get = $(shell [ -d "lib/$(1)" ] && echo "lib/$(1) lib/$(1)/asm") -ARCH_LIBDIRS := $(call libdirs-get,$(ARCH_LIBDIR)) $(call libdirs-get,$(TEST_DIR)) +ARCH_LIBDIRS := $(call libdirs-get,$(ARCH_LIBDIR)) OBJDIRS := $(ARCH_LIBDIRS) DESTDIR := $(PREFIX)/share/kvm-unit-tests/
configure +12 -8
@@ -274,7 +274,6 @@ fi arch_name=$arch [ "$arch" = "aarch64" ] && arch="arm64" [ "$arch_name" = "arm64" ] && arch_name="aarch64" -arch_libdir=$arch if [ "$arch" = "riscv" ]; then echo "riscv32 or riscv64 must be specified"
@@ -373,8 +372,10 @@ fi if [ "$arch" = "i386" ] || [ "$arch" = "x86_64" ]; then testdir=x86 + arch_libdir=x86 elif [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then testdir=arm + arch_libdir=$arch if [ "$target" = "qemu" ]; then : "${uart_early_addr:=0x9000000}" elif [ "$target" = "kvmtool" ]; then
@@ -385,6 +386,7 @@ elif [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then fi elif [ "$arch" = "ppc64" ]; then testdir=powerpc + arch_libdir=ppc64 firmware="$testdir/boot_rom.bin" if [ "$endian" != "little" ] && [ "$endian" != "big" ]; then echo "You must provide endianness (big or little)!"
@@ -400,6 +402,7 @@ elif [ "$arch" = "riscv32" ] || [ "$arch" = "riscv64" ]; then fi elif [ "$arch" = "s390x" ]; then testdir=s390x + arch_libdir=s390x else echo "arch $arch is not supported!" arch=
@@ -409,6 +412,10 @@ if [ ! -d "$srcdir/$testdir" ]; then echo "$srcdir/$testdir does not exist!" exit 1 fi +if [ ! -d "$srcdir/lib/$arch_libdir" ]; then + echo "$srcdir/lib/$arch_libdir does not exist!" + exit 1 +fi if [ "$efi" = "y" ] && [ -f "$srcdir/$testdir/efi/run" ]; then ln -fs "$srcdir/$testdir/efi/run" $testdir-run
@@ -471,15 +478,12 @@ fi # link lib/asm for the architecture rm -f lib/asm asm="asm-generic" -if [ -d "$srcdir/lib/$arch/asm" ]; then - asm="$srcdir/lib/$arch/asm" - mkdir -p "lib/$arch" -elif [ -d "$srcdir/lib/$arch_libdir/asm" ]; then +if [ -d "$srcdir/lib/$arch_libdir/asm" ]; then asm="$srcdir/lib/$arch_libdir/asm" mkdir -p "lib/$arch_libdir" -elif [ -d "$srcdir/lib/$testdir/asm" ]; then - asm="$srcdir/lib/$testdir/asm" - mkdir -p "lib/$testdir" +else + echo "$srcdir/lib/$arch_libdir/asm does not exist" + exit 1 fi ln -sf "$asm" lib/asm mkdir -p lib/generated lib/libfdt
Signature · 1 line
2.53.0
PATCH 3/6 powerpc: Remove remnants of ppc64 directory and build structure
In reply to Chinmay RathFrom: Nicholas Piggin <[email protected]>
This moves merges ppc64 directories and files into powerpc, and merges the 3 makefiles into one.
The configure --arch=powerpc option is aliased to ppc64 for good measure.
---
MAINTAINERS | 1 -
configure | 3 +-
lib/{ppc64 => powerpc}/asm-offsets.c | 0
lib/{ppc64 => powerpc}/asm/asm-offsets.h | 0
lib/{ppc64 => powerpc}/asm/atomic.h | 0
lib/{ppc64 => powerpc}/asm/barrier.h | 4 +-
lib/{ppc64 => powerpc}/asm/bitops.h | 4 +-
lib/{ppc64 => powerpc}/asm/io.h | 4 +-
lib/{ppc64 => powerpc}/asm/mmu.h | 0
lib/{ppc64 => powerpc}/asm/opal.h | 4 +-
lib/{ppc64 => powerpc}/asm/page.h | 6 +-
lib/{ppc64 => powerpc}/asm/pgtable-hwdef.h | 6 +-
lib/{ppc64 => powerpc}/asm/pgtable.h | 2 +-
lib/{ppc64 => powerpc}/asm/ptrace.h | 6 +-
lib/powerpc/asm/spinlock.h | 6 ++
lib/powerpc/asm/stack.h | 3 +
lib/{ppc64 => powerpc}/asm/vpa.h | 0
lib/{ppc64 => powerpc}/mmu.c | 0
lib/{ppc64 => powerpc}/opal-calls.S | 0
lib/{ppc64 => powerpc}/opal.c | 0
lib/{ppc64 => powerpc}/stack.c | 0
lib/ppc64/.gitignore | 1 -
lib/ppc64/asm/handlers.h | 1 -
lib/ppc64/asm/hcall.h | 1 -
lib/ppc64/asm/memory_areas.h | 6 --
lib/ppc64/asm/ppc_asm.h | 1 -
lib/ppc64/asm/processor.h | 1 -
lib/ppc64/asm/reg.h | 1 -
lib/ppc64/asm/rtas.h | 1 -
lib/ppc64/asm/setup.h | 1 -
lib/ppc64/asm/smp.h | 1 -
lib/ppc64/asm/spinlock.h | 6 --
lib/ppc64/asm/stack.h | 11 --
lib/ppc64/asm/time.h | 1 -
powerpc/Makefile | 111 ++++++++++++++++++++-
powerpc/Makefile.common | 95 ------------------
powerpc/Makefile.ppc64 | 31 ------
37 files changed, 139 insertions(+), 180 deletions(-)
rename lib/{ppc64 => powerpc}/asm-offsets.c (100%)
rename lib/{ppc64 => powerpc}/asm/asm-offsets.h (100%)
rename lib/{ppc64 => powerpc}/asm/atomic.h (100%)
rename lib/{ppc64 => powerpc}/asm/barrier.h (83%)
rename lib/{ppc64 => powerpc}/asm/bitops.h (69%)
rename lib/{ppc64 => powerpc}/asm/io.h (50%)
rename lib/{ppc64 => powerpc}/asm/mmu.h (100%)
rename lib/{ppc64 => powerpc}/asm/opal.h (90%)
rename lib/{ppc64 => powerpc}/asm/page.h (94%)
rename lib/{ppc64 => powerpc}/asm/pgtable-hwdef.h (93%)
rename lib/{ppc64 => powerpc}/asm/pgtable.h (99%)
rename lib/{ppc64 => powerpc}/asm/ptrace.h (89%)
create mode 100644 lib/powerpc/asm/spinlock.h
rename lib/{ppc64 => powerpc}/asm/vpa.h (100%)
rename lib/{ppc64 => powerpc}/mmu.c (100%)
rename lib/{ppc64 => powerpc}/opal-calls.S (100%)
rename lib/{ppc64 => powerpc}/opal.c (100%)
rename lib/{ppc64 => powerpc}/stack.c (100%)
delete mode 100644 lib/ppc64/.gitignore
delete mode 100644 lib/ppc64/asm/handlers.h
delete mode 100644 lib/ppc64/asm/hcall.h
delete mode 100644 lib/ppc64/asm/memory_areas.h
delete mode 100644 lib/ppc64/asm/ppc_asm.h
delete mode 100644 lib/ppc64/asm/processor.h
delete mode 100644 lib/ppc64/asm/reg.h
delete mode 100644 lib/ppc64/asm/rtas.h
delete mode 100644 lib/ppc64/asm/setup.h
delete mode 100644 lib/ppc64/asm/smp.h
delete mode 100644 lib/ppc64/asm/spinlock.h
delete mode 100644 lib/ppc64/asm/stack.h
delete mode 100644 lib/ppc64/asm/time.h
delete mode 100644 powerpc/Makefile.common
delete mode 100644 powerpc/Makefile.ppc64MAINTAINERS +0 -1
@@ -92,7 +92,6 @@ S: Maintained L: [email protected] F: powerpc/ F: lib/powerpc/ -F: lib/ppc64/ RISCV M: Andrew Jones <[email protected]>
configure +2 -1
@@ -273,6 +273,7 @@ fi arch_name=$arch [ "$arch" = "aarch64" ] && arch="arm64" +[ "$arch" = "powerpc" ] && arch="ppc64" [ "$arch_name" = "arm64" ] && arch_name="aarch64" if [ "$arch" = "riscv" ]; then
@@ -386,7 +387,7 @@ elif [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then fi elif [ "$arch" = "ppc64" ]; then testdir=powerpc - arch_libdir=ppc64 + arch_libdir=powerpc firmware="$testdir/boot_rom.bin" if [ "$endian" != "little" ] && [ "$endian" != "big" ]; then echo "You must provide endianness (big or little)!"
lib/powerpc/asm-offsets.c renamed from lib/ppc64/asm-offsets.c +0 -0
lib/powerpc/asm/asm-offsets.h renamed from lib/ppc64/asm/asm-offsets.h +0 -0
lib/powerpc/asm/atomic.h renamed from lib/ppc64/asm/atomic.h +0 -0
lib/powerpc/asm/barrier.h renamed from lib/ppc64/asm/barrier.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef _ASMPPC64_BARRIER_H_ -#define _ASMPPC64_BARRIER_H_ +#ifndef _ASMPOWERPC_BARRIER_H_ +#define _ASMPOWERPC_BARRIER_H_#define cpu_relax () asm volatile("or 1,1,1 ; or 2,2,2" ::: "memory")#define pause_short () asm volatile(".long 0x7c40003c" ::: "memory")
lib/powerpc/asm/bitops.h renamed from lib/ppc64/asm/bitops.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef _ASMPPC64_BITOPS_H_ -#define _ASMPPC64_BITOPS_H_ +#ifndef _ASMPOWERPC_BITOPS_H_ +#define _ASMPOWERPC_BITOPS_H_#ifndef _BITOPS_H_#error only <bitops.h> can be included directly
lib/powerpc/asm/io.h renamed from lib/ppc64/asm/io.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef _ASMPPC64_IO_H_ -#define _ASMPPC64_IO_H_ +#ifndef _ASMPOWERPC_IO_H_ +#define _ASMPOWERPC_IO_H_#define __iomem
lib/powerpc/asm/mmu.h renamed from lib/ppc64/asm/mmu.h +0 -0
lib/powerpc/asm/opal.h renamed from lib/ppc64/asm/opal.h +2 -2
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef _ASMPPC64_OPAL_H_ -#define _ASMPPC64_OPAL_H_ +#ifndef _ASMPOWERPC_OPAL_H_ +#define _ASMPOWERPC_OPAL_H_#include <stdint.h>
lib/powerpc/asm/page.h renamed from lib/ppc64/asm/page.h +3 -3
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef _ASMPPC64_PAGE_H_ -#define _ASMPPC64_PAGE_H_ +#ifndef _ASMPOWERPC_PAGE_H_ +#define _ASMPOWERPC_PAGE_H_/* * Adapted from * lib/arm64/asm/page.h and Linux kernel defines.
@@ -62,4 +62,4 @@ extern unsigned long __phys_to_virt(phys_addr_t addr);extern void *__ioremap (phys_addr_t phys_addr,size_t size);#endif /* !__ASSEMBLER__ */ -#endif /* _ASMPPC64_PAGE_H_ */ +#endif /* _ASMPOWERPC_PAGE_H_ */
lib/powerpc/asm/pgtable-hwdef.h renamed from lib/ppc64/asm/pgtable-hwdef.h +3 -3
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef _ASMPPC64_PGTABLE_HWDEF_H_ -#define _ASMPPC64_PGTABLE_HWDEF_H_ +#ifndef _ASMPOWERPC_PGTABLE_HWDEF_H_ +#define _ASMPOWERPC_PGTABLE_HWDEF_H_/* * Copyright (C) 2024, IBM Inc, Nicholas Piggin <[email protected]> *
@@ -63,4 +63,4 @@#define PHYS_MASK_SHIFT (48)#define PHYS_MASK ((UL(1) << PHYS_MASK_SHIFT) - 1) -#endif /* _ASMPPC64_PGTABLE_HWDEF_H_ */ +#endif /* _ASMPOWERPC_PGTABLE_HWDEF_H_ */
lib/powerpc/asm/pgtable.h renamed from lib/ppc64/asm/pgtable.h +1 -1
@@ -122,4 +122,4 @@ static inline pte_t *pte_alloc(pmd_t *pmd, unsigned long addr) return pte_offset(pmd, addr); } -#endif /* _ASMPPC64_PGTABLE_H_ */ +#endif /* _ASMPOWERPC_PGTABLE_H_ */
lib/powerpc/asm/ptrace.h renamed from lib/ppc64/asm/ptrace.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _ASMPPC64_PTRACE_H_ -#define _ASMPPC64_PTRACE_H_ +#ifndef _ASMPOWERPC_PTRACE_H_ +#define _ASMPOWERPC_PTRACE_H_#define KERNEL_REDZONE_SIZE 288#define STACK_FRAME_OVERHEAD 112/* size of minimum stack frame */
@@ -38,4 +38,4 @@ static inline void regs_advance_insn(struct pt_regs *regs)#endif /* __ASSEMBLER__ */ -#endif /* _ASMPPC64_PTRACE_H_ */ +#endif /* _ASMPOWERPC_PTRACE_H_ */
lib/powerpc/asm/spinlock.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef _ASMPOWERPC_SPINLOCK_H_ +#define _ASMPOWERPC_SPINLOCK_H_ + +#include <asm-generic/spinlock.h> + +#endif /* _ASMPOWERPC_SPINLOCK_H_ */
lib/powerpc/asm/stack.h +3 -0
@@ -5,4 +5,7 @@#error Do not directly include <asm/stack.h>. Just use <stack.h>.#endif +#define HAVE_ARCH_BACKTRACE +#define HAVE_ARCH_BACKTRACE_FRAME +#endif
lib/powerpc/asm/vpa.h renamed from lib/ppc64/asm/vpa.h +0 -0
lib/powerpc/mmu.c renamed from lib/ppc64/mmu.c +0 -0
lib/powerpc/opal-calls.S renamed from lib/ppc64/opal-calls.S +0 -0
lib/powerpc/opal.c renamed from lib/ppc64/opal.c +0 -0
lib/powerpc/stack.c renamed from lib/ppc64/stack.c +0 -0
lib/ppc64/.gitignore deleted +0 -1
@@ -1 +0,0 @@ -asm-offsets.[hs]
lib/ppc64/asm/handlers.h deleted +0 -1
@@ -1 +0,0 @@ -#include "../../powerpc/asm/handlers.h"
lib/ppc64/asm/hcall.h deleted +0 -1
@@ -1 +0,0 @@ -#include "../../powerpc/asm/hcall.h"
lib/ppc64/asm/memory_areas.h deleted +0 -6
@@ -1,6 +0,0 @@ -#ifndef _ASMPPC64_MEMORY_AREAS_H_ -#define _ASMPPC64_MEMORY_AREAS_H_ - -#include <asm-generic/memory_areas.h> - -#endif
lib/ppc64/asm/ppc_asm.h deleted +0 -1
@@ -1 +0,0 @@ -#include "../../powerpc/asm/ppc_asm.h"
lib/ppc64/asm/processor.h deleted +0 -1
@@ -1 +0,0 @@ -#include "../../powerpc/asm/processor.h"
lib/ppc64/asm/reg.h deleted +0 -1
@@ -1 +0,0 @@ -#include "../../powerpc/asm/reg.h"
lib/ppc64/asm/rtas.h deleted +0 -1
@@ -1 +0,0 @@ -#include "../../powerpc/asm/rtas.h"
lib/ppc64/asm/setup.h deleted +0 -1
@@ -1 +0,0 @@ -#include "../../powerpc/asm/setup.h"
lib/ppc64/asm/smp.h deleted +0 -1
@@ -1 +0,0 @@ -#include "../../powerpc/asm/smp.h"
lib/ppc64/asm/spinlock.h deleted +0 -6
@@ -1,6 +0,0 @@ -#ifndef _ASMPPC64_SPINLOCK_H_ -#define _ASMPPC64_SPINLOCK_H_ - -#include <asm-generic/spinlock.h> - -#endif /* _ASMPPC64_SPINLOCK_H_ */
lib/ppc64/asm/stack.h deleted +0 -11
@@ -1,11 +0,0 @@ -#ifndef _ASMPPC64_STACK_H_ -#define _ASMPPC64_STACK_H_ - -#ifndef _STACK_H_ -#error Do not directly include <asm/stack.h>. Just use <stack.h>. -#endif - -#define HAVE_ARCH_BACKTRACE -#define HAVE_ARCH_BACKTRACE_FRAME - -#endif
lib/ppc64/asm/time.h deleted +0 -1
@@ -1 +0,0 @@ -#include "../../powerpc/asm/time.h"
powerpc/Makefile +110 -1
111 lines not on this page · raw message
powerpc/Makefile.common deleted +0 -95
95 lines not on this page · raw message
powerpc/Makefile.ppc64 deleted +0 -31
@@ -1,31 +0,0 @@ -# -# ppc64 makefile -# -# Authors: Andrew Jones <[email protected]> -# -bits = 64 - -ifeq ($(ENDIAN),little) - arch_CFLAGS = -mlittle-endian - arch_LDFLAGS = -EL -else - arch_CFLAGS = -mbig-endian - arch_LDFLAGS = -EB -endif - -cstart.o = $(TEST_DIR)/cstart64.o -reloc.o = $(TEST_DIR)/reloc64.o - -OBJDIRS += lib/ppc64 -cflatobjs += lib/ppc64/stack.o -cflatobjs += lib/ppc64/mmu.o -cflatobjs += lib/ppc64/opal.o -cflatobjs += lib/ppc64/opal-calls.o - -# ppc64 specific tests -tests = $(TEST_DIR)/spapr_vpa.elf - -include $(SRCDIR)/$(TEST_DIR)/Makefile.common - -arch_clean: powerpc_clean - $(RM) lib/ppc64/.*.d
Signature · 1 line
2.53.0
PATCH 4/6 powerpc: gitlab CI update
In reply to Chinmay RathFrom: Nicholas Piggin <[email protected]>
Adds a few additional tests that are known to work in CI.
To control overhead, ppc64be is used to test 64k page size, ppc64le is used to test 4k page size.
--- .gitlab-ci.yml | 19 ++++++++++++++----- powerpc/unittests.cfg | 9 ++++++++- 2 files changed, 22 insertions(+), 6 deletions(-)
.gitlab-ci.yml +14 -5
@@ -190,18 +190,21 @@ build-ppc64be: - dnf install -y qemu-system-ppc gcc-powerpc64-linux-gnu nmap-ncat - mkdir build - cd build - - ../configure --arch=ppc64 --endian=big --cross-prefix=powerpc64-linux-gnu- + - ../configure --arch=ppc64 --endian=big --page-size=64k --cross-prefix=powerpc64-linux-gnu- - make -j2 - - ACCEL=tcg ./run_tests.sh + - ACCEL=tcg MAX_SMP=8 ./run_tests.sh atomics + atomics-migration emulator interrupts mmu + pmu rtas-get-time-of-day rtas-get-time-of-day-base rtas-set-time-of-day selftest-migration selftest-migration-skip + selftest-migration-ci selftest-setup sieve smp
@@ -209,10 +212,12 @@ build-ppc64be: spapr_hcall spapr_vpa sprs + sprs-migration timebase timebase-icount | tee results.txt - - if grep -q FAIL results.txt ; then exit 1 ; fi + - grep -q PASS results.txt && ! grep -q FAIL results.txt + build-ppc64le: extends: .intree_template
@@ -220,16 +225,19 @@ build-ppc64le: - dnf install -y qemu-system-ppc gcc-powerpc64-linux-gnu nmap-ncat - ./configure --arch=ppc64 --endian=little --cross-prefix=powerpc64-linux-gnu- - make -j2 - - ACCEL=tcg ./run_tests.sh + - ACCEL=tcg MAX_SMP=8 ./run_tests.sh atomics + atomics-migration emulator interrupts mmu + pmu rtas-get-time-of-day rtas-get-time-of-day-base rtas-set-time-of-day selftest-migration selftest-migration-skip + selftest-migration-ci selftest-setup sieve smp
@@ -237,10 +245,11 @@ build-ppc64le: spapr_hcall spapr_vpa sprs + sprs-migration timebase timebase-icount | tee results.txt - - if grep -q FAIL results.txt ; then exit 1 ; fi + - grep -q PASS results.txt && ! grep -q FAIL results.txt build-riscv32: extends: .outoftree_template
powerpc/unittests.cfg +8 -1
@@ -24,6 +24,14 @@ file = selftest-migration.elf machine = pseries groups = selftest migration +# make a kvm-only version for CI for now +# TCG accel support with Qemu and distro release used in gitlab CI needs to checked. +[selftest-migration-ci] +file = selftest-migration.elf +machine = pseries +groups = nodefault selftest migration +accel = kvm + [selftest-migration-skip] file = selftest-migration.elf machine = pseries
@@ -94,7 +102,6 @@ accel = tcg,thread=single [atomics] file = atomics.elf -smp = 2 [atomics-migration] file = atomics.elf
Signature · 1 line
2.53.0
Re: [kvm-unit-tests PATCH 4/6] powerpc: gitlab CI update
Quoted 43 lines · Chinmay Rath
From: Nicholas Piggin <[email protected]>
Adds a few additional tests that are known to work in CI.
To control overhead, ppc64be is used to test 64k page size, ppc64le is used to test 4k page size.
Signed-off-by Nicholas Piggin <[email protected]>Signed-off-by Chinmay Rath <[email protected]>--- .gitlab-ci.yml | 19 ++++++++++++++----- powerpc/unittests.cfg | 9 ++++++++- 2 files changed, 22 insertions(+), 6 deletions(-).gitlab-ci.yml +5
-2@@ -190,18 +190,21 @@ build-ppc64be: - dnf install -y qemu-system-ppc gcc-powerpc64-linux-gnu nmap-ncat - mkdir build - cd build - - ../configure --arch=ppc64 --endian=big --cross-prefix=powerpc64-linux-gnu- + - ../configure --arch=ppc64 --endian=big --page-size=64k --cross-prefix=powerpc64-linux-gnu- - make -j2 - - ACCEL=tcg ./run_tests.sh + - ACCEL=tcg MAX_SMP=8 ./run_tests.sh atomics + atomics-migration emulator interrupts mmu + pmu rtas-get-time-of-day rtas-get-time-of-day-base rtas-set-time-of-day selftest-migration selftest-migration-skip + selftest-migration-ci selftest-setup sieve smp
.gitlab-ci.yml build-ppc64be: · line 220
Quoted 10 lines
.gitlab-ci.yml +3
-1@@ -209,10 +212,12 @@ build-ppc64be: spapr_hcall spapr_vpa sprs + sprs-migration timebase timebase-icount | tee results.txt - - if grep -q FAIL results.txt ; then exit 1 ; fi + - grep -q PASS results.txt && ! grep -q FAIL results.txt +
Remove the superfluous empty line, please. We don't do this in other spots between the jobs in this file, so let's stay consistent here, too.
Quoted 42 lines
.gitlab-ci.yml +6
-2build-ppc64le: extends: .intree_template@@ -220,16 +225,19 @@ build-ppc64le: - dnf install -y qemu-system-ppc gcc-powerpc64-linux-gnu nmap-ncat - ./configure --arch=ppc64 --endian=little --cross-prefix=powerpc64-linux-gnu- - make -j2 - - ACCEL=tcg ./run_tests.sh + - ACCEL=tcg MAX_SMP=8 ./run_tests.sh atomics + atomics-migration emulator interrupts mmu + pmu rtas-get-time-of-day rtas-get-time-of-day-base rtas-set-time-of-day selftest-migration selftest-migration-skip + selftest-migration-ci selftest-setup sieve smp@@ -237,10 +245,11 @@ build-ppc64le: spapr_hcall spapr_vpa sprs + sprs-migration timebase timebase-icount | tee results.txt - - if grep -q FAIL results.txt ; then exit 1 ; fi + - grep -q PASS results.txt && ! grep -q FAIL results.txt build-riscv32: extends: .outoftree_templatepowerpc/unittests.cfg +0
-0
powerpc/unittests.cfg file = selftest-migration.elf · line 33
Quoted 10 lines
powerpc/unittests.cfg +7
-0@@ -24,6 +24,14 @@ file = selftest-migration.elf machine = pseries groups = selftest migration +# make a kvm-only version for CI for now +# TCG accel support with Qemu and distro release used in gitlab CI needs to checked. +[selftest-migration-ci] +file = selftest-migration.elf +machine = pseries +groups = nodefault selftest migration +accel = kvm
This does not make sense (or I don't understand it) - gitlab-CI currently only runs with TCG for the ppc64 jobs, so adding a separate test for this with "accel = kvm" just adds a job there that will always be skipped. What should this be good for?
powerpc/unittests.cfg accel = tcg,thread=single · line 97
Quoted 8 lines
powerpc/unittests.cfg +0
-1[selftest-migration-skip] file = selftest-migration.elf machine = pseries@@ -94,7 +102,6 @@ accel = tcg,thread=single [atomics] file = atomics.elf -smp = 2
Why are you removing the smp = 2 here? As far as I can see, the atomics test uses multiple CPUs, so this looks wrong?
Thomas
Re: [kvm-unit-tests PATCH 4/6] powerpc: gitlab CI update
+ folks who might be interested.
Hi Thomas,
Quoted 6 lines · Thomas Huth
Quoted 6 lines
+++ b/powerpc/unittests.cfg
(quoted diff) +0
-0@@ -24,6 +24,14 @@ file = selftest-migration.elfmachine = pseries
groups = selftest migration(quoted diff) +2
-0+# make a kvm-only version for CI for now +# TCG accel support with Qemu and distro release used in gitlab CI
Quoted 8 lines
powerpc/unittests.cfg file = selftest-migration.elf · line 33
Quoted 6 lines
needs to checked.
+[selftest-migration-ci]powerpc/unittests.cfg +4
-0+file = selftest-migration.elf +machine = pseries +groups = nodefault selftest migration +accel = kvmThis does not make sense (or I don't understand it) - gitlab-CI currently only runs with TCG for the ppc64 jobs, so adding a separate test for this with "accel = kvm" just adds a job there that will always be skipped. What should this be good for?
I understand it may get skipped in gitlab CI for kvm-unit-tests, but it might be helpful to those who can run it on their Power HW. If the job can safely skip on non-ppc HW, I hope it's fine? We would like to get it integrated in IBM's internal CI with Power HW.
Chinmay,
Could you please share logs of running these tests with kvm accel on Power HW? Thanks!
regards,
Harsh
Re: [kvm-unit-tests PATCH 4/6] powerpc: gitlab CI update
Quoted 20 lines · Harsh Prateek Bora
+ folks who might be interested.
Hi Thomas,
Quoted 6 lines · Thomas Huth
Quoted 6 lines
+++ b/powerpc/unittests.cfg
(quoted diff) +0
-0@@ -24,6 +24,14 @@ file = selftest-migration.elfmachine = pseries
groups = selftest migration(quoted diff) +2
-0+# make a kvm-only version for CI for now +# TCG accel support with Qemu and distro release used in gitlab CI needsQuoted 8 lines
powerpc/unittests.cfg file = selftest-migration.elf · line 33
Quoted 6 lines
to checked.
+[selftest-migration-ci]powerpc/unittests.cfg +4
-0+file = selftest-migration.elf +machine = pseries +groups = nodefault selftest migration +accel = kvmThis does not make sense (or I don't understand it) - gitlab-CI currently only runs with TCG for the ppc64 jobs, so adding a separate test for this with "accel = kvm" just adds a job there that will always be skipped. What should this be good for?
Quoted 4 lines
I understand it may get skipped in gitlab CI for kvm-unit-tests, but it might be helpful to those who can run it on their Power HW. If the job can safely skip on non-ppc HW, I hope it's fine? We would like to get it integrated in IBM's internal CI with Power HW.
You mean you also use a gitlab instance internally within IBM? ... otherwise it does not make sense to add this to the .gitlab-ci.yml file (which you did earlier in this patch).
Thomas
Re: [kvm-unit-tests PATCH 4/6] powerpc: gitlab CI update
Quoted 21 lines · Thomas Huth
Quoted 20 lines · Harsh Prateek Bora
+ folks who might be interested.
Hi Thomas,
Quoted 14 lines · Thomas Huth
powerpc/unittests.cfg file = selftest-migration.elf · line 33
Quoted 12 lines
+++ b/powerpc/unittests.cfg
(quoted diff) +0
-0@@ -24,6 +24,14 @@ file = selftest-migration.elfmachine = pseries
groups = selftest migration(quoted diff) +2
-0+# make a kvm-only version for CI for now +# TCG accel support with Qemu and distro release used in gitlab CIneeds to checked.
+[selftest-migration-ci]powerpc/unittests.cfg +4
-0+file = selftest-migration.elf +machine = pseries +groups = nodefault selftest migration +accel = kvmThis does not make sense (or I don't understand it) - gitlab-CI currently only runs with TCG for the ppc64 jobs, so adding a separate test for this with "accel = kvm" just adds a job there that will always be skipped. What should this be good for?
Quoted 5 lines
Quoted 4 lines
I understand it may get skipped in gitlab CI for kvm-unit-tests, but it might be helpful to those who can run it on their Power HW. If the job can safely skip on non-ppc HW, I hope it's fine? We would like to get it integrated in IBM's internal CI with Power HW.
You mean you also use a gitlab instance internally within IBM? ... otherwise it does not make sense to add this to the .gitlab-ci.yml file (which you did earlier in this patch).
I do not think we currently use a gitlab runner as of now, but that's a future possibility.
Chinmay,
My understanding is that we wanted to use kvm accel also when executed manually using scripts, as we wanted it to be integrated in IBM's internal CI that runs on Power HW. Do we need additional changes for that?
regards,
Harsh
Quoted 3 lines
Thomas
Re: [kvm-unit-tests PATCH 4/6] powerpc: gitlab CI update
Quoted 24 lines · Harsh Prateek Bora
Quoted 21 lines · Thomas Huth
Quoted 20 lines · Harsh Prateek Bora
+ folks who might be interested.
Hi Thomas,
Quoted 14 lines · Thomas Huth
powerpc/unittests.cfg file = selftest-migration.elf · line 33
Quoted 12 lines
+++ b/powerpc/unittests.cfg
(quoted diff) +0
-0@@ -24,6 +24,14 @@ file = selftest-migration.elfmachine = pseries
groups = selftest migration(quoted diff) +2
-0+# make a kvm-only version for CI for now +# TCG accel support with Qemu and distro release used in gitlab CIneeds to checked.
+[selftest-migration-ci]powerpc/unittests.cfg +4
-0+file = selftest-migration.elf +machine = pseries +groups = nodefault selftest migration +accel = kvmThis does not make sense (or I don't understand it) - gitlab-CI currently only runs with TCG for the ppc64 jobs, so adding a separate test for this with "accel = kvm" just adds a job there that will always be skipped. What should this be good for?
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
I understand it may get skipped in gitlab CI for kvm-unit-tests, but it might be helpful to those who can run it on their Power HW. If the job can safely skip on non-ppc HW, I hope it's fine? We would like to get it integrated in IBM's internal CI with Power HW.
You mean you also use a gitlab instance internally within IBM? ... otherwise it does not make sense to add this to the .gitlab-ci.yml file (which you did earlier in this patch).
I do not think we currently use a gitlab runner as of now, but that's a future possibility.
Ok, then please remove the related entries from .gitlab-ci.yml again.
Quoted 4 lines
Chinmay,
My understanding is that we wanted to use kvm accel also when executed manually using scripts, as we wanted it to be integrated in IBM's internal CI that runs on Power HW. Do we need additional changes for that?
KVM unit tests run by default with KVM, so you don't need an extra entry for this in the unittest.cfg file, I think.
Thomas
PATCH 5/6 scripts/arch-run.bash: Fix run_panic() success exit status
In reply to Chinmay RathFrom: Nicholas Piggin <[email protected]>
run_qemu_status() looks for "EXIT: STATUS=%d" if the harness command returned 1, to determine the final status of the test. In the case of panic tests, QEMU should terminate before successful exit status is known, so the run_panic() command must produce the "EXIT: STATUS" line.
With this change, running a panic test returns 0 on success (panic), and the run_test.sh unit test correctly displays it as PASS rather than FAIL.
--- scripts/arch-run.bash | 1 + 1 file changed, 1 insertion(+)
scripts/arch-run.bash +1 -0
@@ -313,6 +313,7 @@ run_panic () else # some QEMU versions report multiple panic events echo "PASS: guest panicked" + echo "EXIT: STATUS=1" ret=1 fi
Signature · 1 line
2.53.0
PATCH 6/6 powerpc: Add a panic test
In reply to Chinmay RathFrom: Nicholas Piggin <[email protected]>
This adds a simple panic test for pseries that works with TCG (unlike the s390x panic tests), making it easier to test this part of the harness code.
--- .gitlab-ci.yml | 2 ++ lib/powerpc/asm/rtas.h | 1 + lib/powerpc/rtas.c | 16 ++++++++++++++++ powerpc/run | 2 +- powerpc/selftest.c | 17 ++++++++++++++++- powerpc/unittests.cfg | 5 +++++ 6 files changed, 41 insertions(+), 2 deletions(-)
.gitlab-ci.yml +2 -0
@@ -205,6 +205,7 @@ build-ppc64be: selftest-migration selftest-migration-skip selftest-migration-ci + selftest-panic selftest-setup sieve smp
@@ -238,6 +239,7 @@ build-ppc64le: selftest-migration selftest-migration-skip selftest-migration-ci + selftest-panic selftest-setup sieve smp
lib/powerpc/asm/rtas.h +1 -0
@@ -26,6 +26,7 @@ extern int rtas_call(int token, int nargs, int nret, int *outputs, ...);extern int rtas_call_unlocked (struct rtas_args *args,int token,int nargs,int nret,int *outputs, ...);extern void rtas_power_off (void ); +extern void rtas_os_panic (void );extern void rtas_stop_self (void );#endif /* __ASSEMBLER__ */
lib/powerpc/rtas.c +16 -0
@@ -182,3 +182,19 @@ void rtas_power_off(void) ret =rtas_call_unlocked (&args, token,2 ,1 ,NULL ,-1 ,-1 );printf ("RTAS power-off returned %d\n" , ret); } + +void rtas_os_panic (void ) +{ +struct rtas_args args; +uint32_t token; +int ret; + + ret =rtas_token ("ibm,os-term" , &token); +if (ret) { +puts ("RTAS ibm,os-term not available\n" ); +return ; + } + + ret =rtas_call_unlocked (&args, token,1 ,1 ,NULL ,"rtas_os_panic" ); +printf ("RTAS ibm,os-term returned %d\n" , ret); +}
powerpc/run +1 -1
@@ -57,7 +57,7 @@ fi command="$qemu -nodefaults $A $M $B $D" command+=" -display none -serial stdio -kernel" -command="$(migration_cmd) $(timeout_cmd) $command" +command="$(panic_cmd) $(migration_cmd) $(timeout_cmd) $command" # powerpc tests currently exit with rtas-poweroff, which exits with 0. # run_test treats that as a failure exit and returns 1, so we need
powerpc/selftest.c +16 -1
@@ -7,6 +7,7 @@*/ #include <libcflat.h> #include <util.h> +#include <asm/rtas.h> #include <asm/setup.h> #include <asm/smp.h>
@@ -47,6 +48,17 @@ static void check_setup(int argc, char **argv)report_abort ("missing input" ); } +static void do_panic (void ) +{ +if (machine_is_pseries ()) { +rtas_os_panic (); + }else { +/* Cause a checkstop with MSR[ME] disabled */ + *((char *)0x10000000000 ) =0 ; + } +report_fail ("survived panic" ); +} +int main (int argc,char **argv) {report_prefix_push ("selftest" );
@@ -60,7 +72,10 @@ int main(int argc, char **argv)check_setup (argc-2 , &argv[2 ]); + }else if (strcmp (argv[1 ],"panic" ) ==0 ) { +do_panic (); + }else { +report_abort ("unknown test %s" , argv[1 ]); } -return report_summary (); }
powerpc/unittests.cfg +5 -0
@@ -19,6 +19,11 @@ test_args = 'setup smp=2 mem=1024' qemu_params = -m 1g groups = selftest +[selftest-panic] +file = selftest.elf +extra_params = -append 'panic' +groups = selftest panic + [selftest-migration] file = selftest-migration.elf machine = pseries
Signature · 1 line
2.53.0