Re: [RFC PATCH v2 18/20] powerpc/64s: Use contiguous PMD/PUD instead of HUGEPD

2024-05-21 Thread Nicholas Piggin
On Tue May 21, 2024 at 2:43 AM AEST, Christophe Leroy wrote: > > > Le 20/05/2024 à 14:54, Nicholas Piggin a écrit : > > On Sat May 18, 2024 at 5:00 AM AEST, Christophe Leroy wrote: > >> On book3s/64, the only user of hugepd is hash in 4k mode. > >> > >> Al

Re: [RFC PATCH v2 18/20] powerpc/64s: Use contiguous PMD/PUD instead of HUGEPD

2024-05-20 Thread Nicholas Piggin
On Sat May 18, 2024 at 5:00 AM AEST, Christophe Leroy wrote: > On book3s/64, the only user of hugepd is hash in 4k mode. > > All other setups (hash-64, radix-4, radix-64) use leaf PMD/PUD. > > Rework hash-4k to use contiguous PMD and PUD instead. > > In that setup there are only two huge page

Re: [kvm-unit-tests PATCH v9 07/31] scripts: allow machine option to be specified in unittests.cfg

2024-05-08 Thread Nicholas Piggin
On Wed May 8, 2024 at 11:36 PM AEST, Thomas Huth wrote: > On 08/05/2024 14.58, Thomas Huth wrote: > > On 08/05/2024 14.55, Thomas Huth wrote: > >> On 08/05/2024 14.27, Nicholas Piggin wrote: > >>> On Wed May 8, 2024 at 1:08 AM AEST, Thomas Huth wrote: > >>

Re: [PATCH v6] arch/powerpc/kvm: Add support for reading VPA counters for pseries guests

2024-05-08 Thread Nicholas Piggin
On Wed May 8, 2024 at 10:36 PM AEST, Michael Ellerman wrote: > Gautam Menghani writes: > > PAPR hypervisor has introduced three new counters in the VPA area of > > LPAR CPUs for KVM L2 guest (see [1] for terminology) observability - 2 > > for context switches from host to guest and vice versa,

Re: [kvm-unit-tests PATCH v9 07/31] scripts: allow machine option to be specified in unittests.cfg

2024-05-08 Thread Nicholas Piggin
On Wed May 8, 2024 at 1:08 AM AEST, Thomas Huth wrote: > On 04/05/2024 14.28, Nicholas Piggin wrote: > > This allows different machines with different requirements to be > > supported by run_tests.sh, similarly to how different accelerators > > are handled. > >

Re: [PATCH v6] arch/powerpc/kvm: Add support for reading VPA counters for pseries guests

2024-05-08 Thread Nicholas Piggin
s - local_paca->l2_to_l1_cs, > + l2_runtime_ns - > local_paca->l2_runtime_agg); > + local_paca->l1_to_l2_cs = l1_to_l2_ns; > + local_paca->l2_to_l1_cs = l2_to_l1_ns; > + local_paca->l2_runtime_agg = l2_runtime_ns; > +} So

Re: [kvm-unit-tests PATCH v9 03/31] powerpc: Mark known failing tests as kfail

2024-05-06 Thread Nicholas Piggin
On Mon May 6, 2024 at 5:37 PM AEST, Thomas Huth wrote: > On 04/05/2024 14.28, Nicholas Piggin wrote: > > Mark the failing h_cede_tm and spapr_vpa tests as kfail. > > > > Signed-off-by: Nicholas Piggin > > --- > > powerpc/spapr_vpa.c | 3 ++- > > po

Re: [kvm-unit-tests PATCH v9 01/31] doc: update unittests doc

2024-05-06 Thread Nicholas Piggin
On Mon May 6, 2024 at 5:03 PM AEST, Thomas Huth wrote: > On 04/05/2024 14.28, Nicholas Piggin wrote: > > This adds a few minor fixes. > > > > Signed-off-by: Nicholas Piggin > > --- > > docs/unittests.txt | 12 +++- > > 1 file changed, 7 inse

[kvm-unit-tests PATCH v9 31/31] powerpc: gitlab CI update

2024-05-04 Thread Nicholas Piggin
This adds testing for the powernv machine, and adds a gitlab-ci test group instead of specifying all tests in .gitlab-ci.yml, and adds a few new tests (smp, atomics) that are known to work in CI. Signed-off-by: Nicholas Piggin --- .gitlab-ci.yml| 30

[kvm-unit-tests PATCH v9 30/31] powerpc: Add facility to query TCG or KVM host

2024-05-04 Thread Nicholas Piggin
incorrectly considered to be kvm && !tcg. Use this facility to restrict some of the known test failures to TCG. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 3 +++ lib/powerpc/setup.c | 25 + powerpc/atomics.c | 2 +-

[kvm-unit-tests PATCH v9 29/31] powerpc: Remove remnants of ppc64 directory and build structure

2024-05-04 Thread Nicholas Piggin
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. Signed-off-by: Nicholas Piggin --- MAINTAINERS| 1 - configure

[kvm-unit-tests PATCH v9 28/31] configure: Make arch_libdir a first-class entity

2024-05-04 Thread Nicholas Piggin
dev Cc: kvm-ri...@lists.infradead.org Cc: linuxppc-dev@lists.ozlabs.org Reviewed-by: Andrew Jones Signed-off-by: Nicholas Piggin --- Makefile | 2 +- configure | 18 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 5b7998b79..7fe93dfd8

[kvm-unit-tests PATCH v9 27/31] powerpc: add pmu tests

2024-05-04 Thread Nicholas Piggin
Add some initial PMU testing. - PMC5/6 tests - PMAE / PMI test - BHRB basic tests Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 2 + lib/powerpc/asm/reg.h | 9 + lib/powerpc/asm/setup.h | 1 + lib/powerpc/setup.c | 23 ++ powerpc/Makefile.common

[kvm-unit-tests PATCH v9 26/31] powerpc: add usermode support

2024-05-04 Thread Nicholas Piggin
instruction interrupt test is added. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 9 + lib/powerpc/asm/reg.h | 1 + lib/powerpc/asm/smp.h | 1 + lib/powerpc/io.c| 7 +++ lib/powerpc/processor.c | 38

[kvm-unit-tests PATCH v9 25/31] powerpc: Add sieve.c common test

2024-05-04 Thread Nicholas Piggin
Now that sieve copes with lack of MMU support, it can be run by powerpc. Signed-off-by: Nicholas Piggin --- powerpc/Makefile.common | 1 + powerpc/sieve.c | 1 + powerpc/unittests.cfg | 3 +++ 3 files changed, 5 insertions(+) create mode 12 powerpc/sieve.c diff --git a/powerpc

[kvm-unit-tests PATCH v9 24/31] common/sieve: Support machines without MMU

2024-05-04 Thread Nicholas Piggin
Not all powerpc CPUs provide MMU support. Define vm_available() that is true by default but archs can override it. Use this to run VM tests. Cc: Paolo Bonzini Cc: Thomas Huth Cc: k...@vger.kernel.org Reviewed-by: Andrew Jones Signed-off-by: Nicholas Piggin --- common/sieve.c | 14

[kvm-unit-tests PATCH v9 23/31] common/sieve: Use vmalloc.h for setup_mmu definition

2024-05-04 Thread Nicholas Piggin
-by: Nicholas Piggin --- common/sieve.c | 1 + lib/libcflat.h | 2 -- lib/s390x/io.c | 1 + lib/s390x/uv.h | 1 + lib/x86/vm.h | 1 + s390x/mvpg.c | 1 + s390x/selftest.c | 1 + x86/pmu.c | 1 + x86/pmu_lbr.c | 1 + x86

[kvm-unit-tests PATCH v9 22/31] powerpc: Add MMU support

2024-05-04 Thread Nicholas Piggin
Add support for radix MMU, 4kB and 64kB pages. This also adds MMU interrupt test cases, and runs the interrupts test entirely with MMU enabled if it is available (aside from machine check tests). Acked-by: Andrew Jones (configure changes) Signed-off-by: Nicholas Piggin --- configure

[kvm-unit-tests PATCH v9 21/31] powerpc: Add timebase tests

2024-05-04 Thread Nicholas Piggin
This has a known failure on QEMU TCG machines where the decrementer interrupt is not lowered when the DEC wraps from -ve to +ve. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/reg.h | 1 + powerpc/Makefile.common | 1 + powerpc/timebase.c | 331

[kvm-unit-tests PATCH v9 20/31] powerpc: Add atomics tests

2024-05-04 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- powerpc/Makefile.common | 1 + powerpc/atomics.c | 375 powerpc/unittests.cfg | 9 + 3 files changed, 385 insertions(+) create mode 100644 powerpc/atomics.c diff --git a/powerpc/Makefile.common b/powerpc

[kvm-unit-tests PATCH v9 19/31] powerpc: Avoid using larx/stcx. in spinlocks when only one CPU is running

2024-05-04 Thread Nicholas Piggin
The test harness uses spinlocks if they are implemented with larx/stcx. it can prevent some test scenarios such as testing migration of a reservation. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/smp.h| 1 + lib/powerpc/smp.c| 5 + lib/powerpc/spinlock.c | 29

[kvm-unit-tests PATCH v9 18/31] powerpc: Permit ACCEL=tcg,thread=single

2024-05-04 Thread Nicholas Piggin
Modify run script to permit single vs mttcg threading, add a thread=single smp case to unittests.cfg. Signed-off-by: Nicholas Piggin --- powerpc/run | 4 ++-- powerpc/unittests.cfg | 6 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/powerpc/run b/powerpc/run

[kvm-unit-tests PATCH v9 16/31] powerpc: add SMP and IPI support

2024-05-04 Thread Nicholas Piggin
powerpc SMP support is very primitive and does not set up a first-class runtime environment for secondary CPUs. This reworks SMP support, and provides a complete C and harness environment for the secondaries, including interrupt handling, as well as IPI support. Signed-off-by: Nicholas Piggin

[kvm-unit-tests PATCH v9 17/31] powerpc: Add cpu_relax

2024-05-04 Thread Nicholas Piggin
Add a cpu_relax variant that uses SMT priority nop instructions like Linux. This was split out of the SMP patch because it affects the sprs test case. Signed-off-by: Nicholas Piggin --- lib/ppc64/asm/barrier.h | 1 + powerpc/sprs.c | 4 ++-- 2 files changed, 3 insertions(+), 2

[kvm-unit-tests PATCH v9 15/31] powerpc: Enable page alloc operations

2024-05-04 Thread Nicholas Piggin
These will be used for stack allocation for secondary CPUs. Signed-off-by: Nicholas Piggin --- lib/powerpc/setup.c | 8 powerpc/Makefile.common | 1 + 2 files changed, 9 insertions(+) diff --git a/lib/powerpc/setup.c b/lib/powerpc/setup.c index 58be93f08..73ca2f931 100644

[kvm-unit-tests PATCH v9 14/31] powerpc: Remove broken SMP exception stack setup

2024-05-04 Thread Nicholas Piggin
stack for the boot processor. Make the stack 64kB while we're here, to match the size of the regular stack. Signed-off-by: Nicholas Piggin --- lib/powerpc/setup.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/powerpc/setup.c b/lib/powerpc/setup.c index

[kvm-unit-tests PATCH v9 13/31] powerpc: Add rtas stop-self support

2024-05-04 Thread Nicholas Piggin
rtas operations. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/rtas.h | 2 ++ lib/powerpc/rtas.c | 78 +- 2 files changed, 64 insertions(+), 16 deletions(-) diff --git a/lib/powerpc/asm/rtas.h b/lib/powerpc/asm/rtas.h

[kvm-unit-tests PATCH v9 12/31] powerpc: general interrupt tests

2024-05-04 Thread Nicholas Piggin
Add basic testing of various kinds of interrupts, machine check, page fault, illegal, decrementer, trace, syscall, etc. This has a known failure on QEMU TCG pseries machines where MSR[ME] can be incorrectly set to 0. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 4 + lib

[kvm-unit-tests PATCH v9 11/31] powerpc/sprs: Test hypervisor registers on powernv machine

2024-05-04 Thread Nicholas Piggin
This enables HV privilege registers to be tested with the powernv machine. Acked-by: Thomas Huth Signed-off-by: Nicholas Piggin --- powerpc/sprs.c | 33 + 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/powerpc/sprs.c b/powerpc/sprs.c index

[kvm-unit-tests PATCH v9 10/31] powerpc: Fix emulator illegal instruction test for powernv

2024-05-04 Thread Nicholas Piggin
Illegal instructions cause 0xe40 (HEAI) interrupts rather than program interrupts. Acked-by: Thomas Huth Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 1 + lib/powerpc/setup.c | 13 + powerpc/emulator.c | 16 3 files changed, 30

[kvm-unit-tests PATCH v9 09/31] powerpc: Support powernv machine with QEMU TCG

2024-05-04 Thread Nicholas Piggin
Add support for QEMU's powernv machine. This uses standard firmware (skiboot) rather than a minimal firmware shim. Reviewed-by: Cédric Le Goater Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 23 +++ lib/powerpc/asm/reg.h | 4 ++ lib/powerpc/hcall.c

[kvm-unit-tests PATCH v9 08/31] scripts: Accommodate powerpc powernv machine differences

2024-05-04 Thread Nicholas Piggin
error message. Acked-by: Thomas Huth Signed-off-by: Nicholas Piggin --- powerpc/unittests.cfg | 1 + scripts/runtime.bash | 6 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/powerpc/unittests.cfg b/powerpc/unittests.cfg index 699736926..f562de9f4 100644 --- a/powerpc

[kvm-unit-tests PATCH v9 07/31] scripts: allow machine option to be specified in unittests.cfg

2024-05-04 Thread Nicholas Piggin
This allows different machines with different requirements to be supported by run_tests.sh, similarly to how different accelerators are handled. Acked-by: Thomas Huth Acked-by: Andrew Jones Signed-off-by: Nicholas Piggin --- docs/unittests.txt | 7 +++ scripts/common.bash | 8

[kvm-unit-tests PATCH v9 06/31] powerpc/sprs: Avoid taking PMU interrupts caused by register fuzzing

2024-05-04 Thread Nicholas Piggin
Storing certain values in MMCR0 can cause PMU interrupts when msleep enables MSR[EE], and this crashes the test. Freeze the PMU counters and clear any PMU exception before calling msleep. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/reg.h | 4 powerpc

[kvm-unit-tests PATCH v9 05/31] powerpc/sprs: Specify SPRs with data rather than code

2024-05-04 Thread Nicholas Piggin
, but also the code might one day be reused for a hypervisor-privileged test. Acked-by: Thomas Huth Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/reg.h | 2 + powerpc/sprs.c| 650 +- 2 files changed, 460 insertions(+), 192 deletions(-) diff --git

[kvm-unit-tests PATCH v9 04/31] powerpc: Update unittests for latest QEMU version

2024-05-04 Thread Nicholas Piggin
The latest QEMU fixes some known bugs in migration which allow some migration tests to be re-enabled on tcg. Signed-off-by: Nicholas Piggin --- powerpc/unittests.cfg | 5 - 1 file changed, 5 deletions(-) diff --git a/powerpc/unittests.cfg b/powerpc/unittests.cfg index 432c81d58..699736926

[kvm-unit-tests PATCH v9 03/31] powerpc: Mark known failing tests as kfail

2024-05-04 Thread Nicholas Piggin
Mark the failing h_cede_tm and spapr_vpa tests as kfail. Signed-off-by: Nicholas Piggin --- powerpc/spapr_vpa.c | 3 ++- powerpc/tm.c| 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/powerpc/spapr_vpa.c b/powerpc/spapr_vpa.c index c2075e157..46fa0485c 100644

[kvm-unit-tests PATCH v9 02/31] report: Add known failure reporting option

2024-05-04 Thread Nicholas Piggin
and a pass causes the test to fail. So add kfail for known failures. Mark the failing ppc64 h_cede_tm and spapr_vpa tests as kfail. Signed-off-by: Nicholas Piggin --- lib/libcflat.h | 2 ++ lib/report.c | 33 + 2 files changed, 27 insertions(+), 8 deletions

[kvm-unit-tests PATCH v9 00/31] powerpc improvements

2024-05-04 Thread Nicholas Piggin
fails. Thanks, Nick Nicholas Piggin (31): doc: update unittests doc report: Add known failure reporting option powerpc: Mark known failing tests as kfail powerpc: Update unittests for latest QEMU version powerpc/sprs: Specify SPRs with data rather than code powerpc/sprs: Avoid taking

[kvm-unit-tests PATCH v9 01/31] doc: update unittests doc

2024-05-04 Thread Nicholas Piggin
This adds a few minor fixes. Signed-off-by: Nicholas Piggin --- docs/unittests.txt | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/unittests.txt b/docs/unittests.txt index 3192a60ec..7cf2c55ad 100644 --- a/docs/unittests.txt +++ b/docs/unittests.txt

Re: [kvm-unit-tests PATCH v8 03/35] migration: Add a migrate_skip command

2024-04-15 Thread Nicholas Piggin
On Tue Apr 9, 2024 at 1:59 AM AEST, Nico Boehr wrote: > Quoting Nicholas Piggin (2024-04-05 10:35:04) > [...] > > diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash > > index 39419d4e2..4a1aab48d 100644 > > --- a/scripts/arch-run.bash > > +++ b/scripts/arch-

Re: [RFC PATCH] powerpc: Optimise barriers for fully ordered atomics

2024-04-15 Thread Nicholas Piggin
On Sat Apr 13, 2024 at 7:48 PM AEST, Michael Ellerman wrote: > Nicholas Piggin writes: > > "Fully ordered" atomics (RMW that return a value) are said to have a > > full barrier before and after the atomic operation. This is implemented > > as: > > > &g

[RFC PATCH] powerpc: Optimise barriers for fully ordered atomics

2024-04-12 Thread Nicholas Piggin
ack atomic ops on cached memory. [ Remains to be seen if this is always faster when there is other activity going on, and if it's faster on non-POEWR CPUs or perhaps older ones like 970 that might not optimise isync so much. ] Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/synch.h |

Re: [PATCH] KVM: PPC: Book3S HV nestedv2: Cancel pending HDEC exception

2024-04-09 Thread Nicholas Piggin
On Mon Apr 8, 2024 at 3:20 PM AEST, Michael Ellerman wrote: > Thorsten Leemhuis writes: > > On 05.04.24 05:20, Michael Ellerman wrote: > >> "Linux regression tracking (Thorsten Leemhuis)" > >> writes: > >>> Hi, Thorsten here, the Linux kernel's regression tracker. Top-posting > >>> for once, to

[kvm-unit-tests PATCH v8 35/35] powerpc: gitlab CI update

2024-04-05 Thread Nicholas Piggin
This adds testing for the powernv machine, and adds a gitlab-ci test group instead of specifying all tests in .gitlab-ci.yml. Signed-off-by: Nicholas Piggin --- .gitlab-ci.yml| 30 -- powerpc/unittests.cfg | 14 -- 2 files changed, 16 insertions

[kvm-unit-tests PATCH v8 34/35] powerpc: Remove remnants of ppc64 directory and build structure

2024-04-05 Thread Nicholas Piggin
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. Signed-off-by: Nicholas Piggin --- MAINTAINERS| 1 - configure

[kvm-unit-tests PATCH v8 33/35] configure: Make arch_libdir a first-class entity

2024-04-05 Thread Nicholas Piggin
dev Cc: kvm-ri...@lists.infradead.org Cc: linuxppc-dev@lists.ozlabs.org Reviewed-by: Andrew Jones Signed-off-by: Nicholas Piggin --- Makefile | 2 +- configure | 18 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 4f35fffc6..4e0f54543

[kvm-unit-tests PATCH v8 32/35] powerpc: add pmu tests

2024-04-05 Thread Nicholas Piggin
Add some initial PMU testing. - PMC5/6 tests - PMAE / PMI test - BHRB basic tests Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 2 + lib/powerpc/asm/reg.h | 9 + lib/powerpc/asm/setup.h | 1 + lib/powerpc/setup.c | 23 ++ powerpc/Makefile.common

[kvm-unit-tests PATCH v8 31/35] powerpc: add usermode support

2024-04-05 Thread Nicholas Piggin
instruction interrupt test is added. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 9 + lib/powerpc/asm/reg.h | 1 + lib/powerpc/asm/smp.h | 1 + lib/powerpc/io.c| 7 +++ lib/powerpc/processor.c | 38

[kvm-unit-tests PATCH v8 30/35] powerpc: Add sieve.c common test

2024-04-05 Thread Nicholas Piggin
Now that sieve copes with lack of MMU support, it can be run by powerpc. Signed-off-by: Nicholas Piggin --- powerpc/Makefile.common | 1 + powerpc/sieve.c | 1 + powerpc/unittests.cfg | 3 +++ 3 files changed, 5 insertions(+) create mode 12 powerpc/sieve.c diff --git a/powerpc

[kvm-unit-tests PATCH v8 29/35] common/sieve: Support machines without MMU

2024-04-05 Thread Nicholas Piggin
Not all powerpc CPUs provide MMU support. Define vm_available() that is true by default but archs can override it. Use this to run VM tests. Cc: Paolo Bonzini Cc: Thomas Huth Cc: k...@vger.kernel.org Reviewed-by: Andrew Jones Signed-off-by: Nicholas Piggin --- common/sieve.c | 14

[kvm-unit-tests PATCH v8 28/35] common/sieve: Use vmalloc.h for setup_mmu definition

2024-04-05 Thread Nicholas Piggin
-by: Nicholas Piggin --- common/sieve.c | 1 + lib/libcflat.h | 2 -- lib/s390x/io.c | 1 + lib/s390x/uv.h | 1 + lib/x86/vm.h | 1 + s390x/mvpg.c | 1 + s390x/selftest.c | 1 + x86/pmu.c | 1 + x86/pmu_lbr.c | 1 + x86

[kvm-unit-tests PATCH v8 27/35] powerpc: Add MMU support

2024-04-05 Thread Nicholas Piggin
Add support for radix MMU, 4kB and 64kB pages. This also adds MMU interrupt test cases, and runs the interrupts test entirely with MMU enabled if it is available (aside from machine check tests). Acked-by: Andrew Jones (configure changes) Signed-off-by: Nicholas Piggin --- configure

[kvm-unit-tests PATCH v8 26/35] powerpc: Add timebase tests

2024-04-05 Thread Nicholas Piggin
This has a known failure on QEMU TCG machines where the decrementer interrupt is not lowered when the DEC wraps from -ve to +ve. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/reg.h | 1 + powerpc/Makefile.common | 1 + powerpc/timebase.c | 329

[kvm-unit-tests PATCH v8 25/35] powerpc: Add atomics tests

2024-04-05 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- powerpc/Makefile.common | 1 + powerpc/atomics.c | 374 powerpc/unittests.cfg | 9 + 3 files changed, 384 insertions(+) create mode 100644 powerpc/atomics.c diff --git a/powerpc/Makefile.common b/powerpc

[kvm-unit-tests PATCH v8 24/35] powerpc: Avoid using larx/stcx. in spinlocks when only one CPU is running

2024-04-05 Thread Nicholas Piggin
The test harness uses spinlocks if they are implemented with larx/stcx. it can prevent some test scenarios such as testing migration of a reservation. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/smp.h| 1 + lib/powerpc/smp.c| 5 + lib/powerpc/spinlock.c | 29

[kvm-unit-tests PATCH v8 23/35] powerpc: Permit ACCEL=tcg,thread=single

2024-04-05 Thread Nicholas Piggin
Modify run script to permit single vs mttcg threading, add a thread=single smp case to unittests.cfg. Signed-off-by: Nicholas Piggin --- powerpc/run | 4 ++-- powerpc/unittests.cfg | 6 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/powerpc/run b/powerpc/run

[kvm-unit-tests PATCH v8 22/35] powerpc: add SMP and IPI support

2024-04-05 Thread Nicholas Piggin
powerpc SMP support is very primitive and does not set up a first-class runtime environment for secondary CPUs. This reworks SMP support, and provides a complete C and harness environment for the secondaries, including interrupt handling, as well as IPI support. Signed-off-by: Nicholas Piggin

[kvm-unit-tests PATCH v8 21/35] powerpc: Remove broken SMP exception stack setup

2024-04-05 Thread Nicholas Piggin
stack for the boot processor. Make the stack 64kB while we're here, to match the size of the regular stack. Signed-off-by: Nicholas Piggin --- lib/powerpc/setup.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/powerpc/setup.c b/lib/powerpc/setup.c index

[kvm-unit-tests PATCH v8 20/35] powerpc: Add rtas stop-self support

2024-04-05 Thread Nicholas Piggin
rtas operations. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/rtas.h | 2 ++ lib/powerpc/rtas.c | 78 +- 2 files changed, 64 insertions(+), 16 deletions(-) diff --git a/lib/powerpc/asm/rtas.h b/lib/powerpc/asm/rtas.h

[kvm-unit-tests PATCH v8 19/35] powerpc: general interrupt tests

2024-04-05 Thread Nicholas Piggin
Add basic testing of various kinds of interrupts, machine check, page fault, illegal, decrementer, trace, syscall, etc. This has a known failure on QEMU TCG pseries machines where MSR[ME] can be incorrectly set to 0. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 4 + lib

[kvm-unit-tests PATCH v8 18/35] powerpc/sprs: Test hypervisor registers on powernv machine

2024-04-05 Thread Nicholas Piggin
This enables HV privilege registers to be tested with the powernv machine. Acked-by: Thomas Huth Signed-off-by: Nicholas Piggin --- powerpc/sprs.c | 33 + 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/powerpc/sprs.c b/powerpc/sprs.c index

[kvm-unit-tests PATCH v8 17/35] powerpc: Fix emulator illegal instruction test for powernv

2024-04-05 Thread Nicholas Piggin
Illegal instructions cause 0xe40 (HEAI) interrupts rather than program interrupts. Acked-by: Thomas Huth Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 1 + lib/powerpc/setup.c | 13 + powerpc/emulator.c | 16 3 files changed, 30

[kvm-unit-tests PATCH v8 16/35] powerpc: Support powernv machine with QEMU TCG

2024-04-05 Thread Nicholas Piggin
Add support for QEMU's powernv machine. This uses standard firmware (skiboot) rather than a minimal firmware shim. Reviewed-by: Cédric Le Goater Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 23 +++ lib/powerpc/asm/reg.h | 4 ++ lib/powerpc/hcall.c

[kvm-unit-tests PATCH v8 15/35] scripts: Accommodate powerpc powernv machine differences

2024-04-05 Thread Nicholas Piggin
error message. Acked-by: Thomas Huth Signed-off-by: Nicholas Piggin --- powerpc/unittests.cfg | 1 + scripts/runtime.bash | 6 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/powerpc/unittests.cfg b/powerpc/unittests.cfg index 432c81d58..4929e71a1 100644 --- a/powerpc

[kvm-unit-tests PATCH v8 14/35] scripts: allow machine option to be specified in unittests.cfg

2024-04-05 Thread Nicholas Piggin
This allows different machines with different requirements to be supported by run_tests.sh, similarly to how different accelerators are handled. Acked-by: Thomas Huth Acked-by: Andrew Jones Signed-off-by: Nicholas Piggin --- docs/unittests.txt | 6 ++ scripts/common.bash | 8

[kvm-unit-tests PATCH v8 13/35] doc: start documentation directory with unittests.cfg doc

2024-04-05 Thread Nicholas Piggin
Consolidate unittests.cfg documentation in one place. Suggested-by: Andrew Jones Signed-off-by: Nicholas Piggin --- arm/unittests.cfg | 26 ++--- docs/unittests.txt| 89 +++ powerpc/unittests.cfg | 25 ++-- riscv/unittests.cfg

[kvm-unit-tests PATCH v8 12/35] powerpc/sprs: Avoid taking PMU interrupts caused by register fuzzing

2024-04-05 Thread Nicholas Piggin
Storing certain values in MMCR0 can cause PMU interrupts when msleep enables MSR[EE], and this crashes the test. Freeze the PMU counters and clear any PMU exception before calling msleep. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/reg.h | 4 powerpc

[kvm-unit-tests PATCH v8 11/35] powerpc/sprs: Specify SPRs with data rather than code

2024-04-05 Thread Nicholas Piggin
, but also the code might one day be reused for a hypervisor-privileged test. Acked-by: Thomas Huth Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/reg.h | 2 + powerpc/sprs.c| 647 +- 2 files changed, 457 insertions(+), 192 deletions(-) diff --git

[kvm-unit-tests PATCH v8 10/35] powerpc: interrupt stack backtracing

2024-04-05 Thread Nicholas Piggin
, so the unwinder can recognize the initial interrupt frame. The additional cstart entry-frame is no longer required because the unwinder now looks for frame == 0 as well as address == 0. Signed-off-by: Nicholas Piggin --- lib/powerpc/processor.c | 4 +++- lib/ppc64/asm/stack.h | 3 +++ lib

[kvm-unit-tests PATCH v8 09/35] powerpc: Fix stack backtrace termination

2024-04-05 Thread Nicholas Piggin
if it were a stack frame. But this is fragile, and does not work with powernv where address 0 contains firmware instructions. Use the existing dummy frame on stack as the NULL caller, and create a new frame on stack for the entry code. Signed-off-by: Nicholas Piggin --- powerpc/cstart64.S | 15

[kvm-unit-tests PATCH v8 08/35] powerpc: Fix KVM caps on POWER9 hosts

2024-04-05 Thread Nicholas Piggin
KVM does not like to run on POWER9 hosts without cap-ccf-assist=off. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- powerpc/run | 2 ++ 1 file changed, 2 insertions(+) diff --git a/powerpc/run b/powerpc/run index e469f1eb3..5cdb94194 100755 --- a/powerpc/run +++ b/powerpc/run

[kvm-unit-tests PATCH v8 07/35] common: add memory dirtying vs migration test

2024-04-05 Thread Nicholas Piggin
. The selftest-migration test time is reduced significantly because this test Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- common/memory-verify.c | 68 + common/selftest-migration.c | 8 ++--- powerpc/Makefile.common | 1 + powerpc/memory-verify.c

[kvm-unit-tests PATCH v8 06/35] gitlab-ci: Run migration selftest on s390x and powerpc

2024-04-05 Thread Nicholas Piggin
The migration harness is complicated and easy to break so CI will be helpful. Signed-off-by: Nicholas Piggin --- .gitlab-ci.yml | 32 +++- s390x/unittests.cfg | 8 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab

[kvm-unit-tests PATCH v8 05/35] arch-run: Add a "continuous" migration option for tests

2024-04-05 Thread Nicholas Piggin
cooperative migration iterations reduced to avoid increasing test time too much. Signed-off-by: Nicholas Piggin --- common/selftest-migration.c | 16 +-- lib/migrate.c | 18 lib/migrate.h | 3 ++ scripts/arch-run.bash | 55

[kvm-unit-tests PATCH v8 04/35] (arm|s390): Use migrate_skip in test cases

2024-04-05 Thread Nicholas Piggin
Have tests use the new migrate_skip command in skip paths, rather than calling migrate_once to prevent harness reporting an error. s390x/migration.c adds a new command that looks like it was missing previously. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- arm/gic.c

[kvm-unit-tests PATCH v8 03/35] migration: Add a migrate_skip command

2024-04-05 Thread Nicholas Piggin
a migration. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- common/selftest-migration.c | 14 - lib/migrate.c | 19 - lib/migrate.h | 2 ++ powerpc/unittests.cfg | 6 ++ s390x/unittests.cfg | 5 + scripts/arch

[kvm-unit-tests PATCH v8 02/35] arch-run: Keep infifo open

2024-04-05 Thread Nicholas Piggin
files and fifos so it does not have to be removed explicitly. With this we can let the cat out of the subshell, simplifying the input pipeline. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- scripts/arch-run.bash | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions

[kvm-unit-tests PATCH v8 01/35] arch-run: Add functions to help handle migration directives from test

2024-04-05 Thread Nicholas Piggin
The migration harness will be expanded to deal with more commands from the test, moving these checks into functions helps keep things managable. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- scripts/arch-run.bash | 20 +++- 1 file changed, 15 insertions(+), 5

[kvm-unit-tests PATCH v8 00/35] migration, powerpc improvements

2024-04-05 Thread Nicholas Piggin
/msg00567.html) Thanks, Nick Nicholas Piggin (35): arch-run: Add functions to help handle migration directives from test arch-run: Keep infifo open migration: Add a migrate_skip command (arm|s390): Use migrate_skip in test cases arch-run: Add a "continuous" migration option for test

Re: [kvm-unit-tests PATCH v7 07/35] common: add memory dirtying vs migration test

2024-04-04 Thread Nicholas Piggin
On Fri Mar 29, 2024 at 3:37 AM AEST, Thomas Huth wrote: > On 19/03/2024 08.58, Nicholas Piggin wrote: > > This test stores to a bunch of pages and verifies previous stores, > > while being continually migrated. Default runtime is 5 seconds. > > > > Add this tes

Re: [kvm-unit-tests PATCH v7 06/35] gitlab-ci: Run migration selftest on s390x and powerpc

2024-03-28 Thread Nicholas Piggin
On Tue Mar 26, 2024 at 2:08 AM AEST, Thomas Huth wrote: > On 19/03/2024 08.58, Nicholas Piggin wrote: > > The migration harness is complicated and easy to break so CI will > > be helpful. > > > > Signed-off-by: Nicholas Piggin > > --- > > .gitlab-ci.yml

Re: [PATCH] arch/powerpc/kvm: Add support for reading VPA counters for pseries guests

2024-03-20 Thread Nicholas Piggin
On Wed Mar 20, 2024 at 12:28 AM AEST, Gautam Menghani wrote: > PAPR hypervisor has introduced three new counters in the VPA area of > LPAR CPUs for KVM L2 guest (see [1] for terminology) observability - 2 > for context switches from host to guest and vice versa, and 1 counter > for getting the

Re: [PATCH] KVM: PPC: Book3S HV nestedv2: Cancel pending HDEC exception

2024-03-20 Thread Nicholas Piggin
On Wed Mar 13, 2024 at 5:26 PM AEST, Vaibhav Jain wrote: > This reverts commit 180c6b072bf360b686e53d893d8dcf7dbbaec6bb ("KVM: PPC: > Book3S HV nestedv2: Do not cancel pending decrementer exception") which > prevented cancelling a pending HDEC exception for nestedv2 KVM guests. It > was done to

[kvm-unit-tests PATCH v7 35/35] powerpc: gitlab CI update

2024-03-19 Thread Nicholas Piggin
This adds testing for the powernv machine, and adds a gitlab-ci test group instead of specifying all tests in .gitlab-ci.yml. Signed-off-by: Nicholas Piggin --- .gitlab-ci.yml| 20 powerpc/unittests.cfg | 14 -- 2 files changed, 16 insertions(+), 18

[kvm-unit-tests PATCH v7 34/35] powerpc: Remove remnants of ppc64 directory and build structure

2024-03-19 Thread Nicholas Piggin
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. Signed-off-by: Nicholas Piggin --- MAINTAINERS| 1 - configure

[kvm-unit-tests PATCH v7 33/35] configure: Make arch_libdir a first-class entity

2024-03-19 Thread Nicholas Piggin
dev Cc: kvm-ri...@lists.infradead.org Cc: linuxppc-dev@lists.ozlabs.org Reviewed-by: Andrew Jones Signed-off-by: Nicholas Piggin --- Makefile | 2 +- configure | 18 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 4f35fffc6..4e0f54543

[kvm-unit-tests PATCH v7 32/35] powerpc: add pmu tests

2024-03-19 Thread Nicholas Piggin
Add some initial PMU testing. - PMC5/6 tests - PMAE / PMI test - BHRB basic tests Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 2 + lib/powerpc/asm/reg.h | 9 + lib/powerpc/asm/setup.h | 1 + lib/powerpc/setup.c | 23 +++ powerpc/Makefile.common

[kvm-unit-tests PATCH v7 31/35] powerpc: add usermode support

2024-03-19 Thread Nicholas Piggin
instruction interrupt test is added. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 9 + lib/powerpc/asm/reg.h | 1 + lib/powerpc/asm/smp.h | 1 + lib/powerpc/io.c| 7 +++ lib/powerpc/processor.c | 38

[kvm-unit-tests PATCH v7 30/35] powerpc: Add sieve.c common test

2024-03-19 Thread Nicholas Piggin
Now that sieve copes with lack of MMU support, it can be run by powerpc. Signed-off-by: Nicholas Piggin --- powerpc/Makefile.common | 1 + powerpc/sieve.c | 1 + powerpc/unittests.cfg | 3 +++ 3 files changed, 5 insertions(+) create mode 12 powerpc/sieve.c diff --git a/powerpc

[kvm-unit-tests PATCH v7 29/35] common/sieve: Support machines without MMU

2024-03-19 Thread Nicholas Piggin
Not all powerpc CPUs provide MMU support. Define vm_available() that is true by default but archs can override it. Use this to run VM tests. Cc: Paolo Bonzini Cc: Thomas Huth Cc: k...@vger.kernel.org Reviewed-by: Andrew Jones Signed-off-by: Nicholas Piggin --- common/sieve.c | 14

[kvm-unit-tests PATCH v7 28/35] common/sieve: Use vmalloc.h for setup_mmu definition

2024-03-19 Thread Nicholas Piggin
-by: Nicholas Piggin --- common/sieve.c | 1 + lib/libcflat.h | 2 -- lib/s390x/io.c | 1 + lib/s390x/uv.h | 1 + lib/x86/vm.h | 1 + s390x/mvpg.c | 1 + s390x/selftest.c | 1 + x86/pmu.c | 1 + x86/pmu_lbr.c | 1 + x86

[kvm-unit-tests PATCH v7 27/35] powerpc: Add MMU support

2024-03-19 Thread Nicholas Piggin
Add support for radix MMU, 4kB and 64kB pages. This also adds MMU interrupt test cases, and runs the interrupts test entirely with MMU enabled if it is available (aside from machine check tests). Acked-by: Andrew Jones (configure changes) Signed-off-by: Nicholas Piggin --- configure

[kvm-unit-tests PATCH v7 26/35] powerpc: Add timebase tests

2024-03-19 Thread Nicholas Piggin
This has a known failure on QEMU TCG machines where the decrementer interrupt is not lowered when the DEC wraps from -ve to +ve. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/reg.h | 1 + powerpc/Makefile.common | 1 + powerpc/timebase.c | 329

[kvm-unit-tests PATCH v7 25/35] powerpc: Add atomics tests

2024-03-19 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- powerpc/Makefile.common | 1 + powerpc/atomics.c | 374 powerpc/unittests.cfg | 9 + 3 files changed, 384 insertions(+) create mode 100644 powerpc/atomics.c diff --git a/powerpc/Makefile.common b/powerpc

[kvm-unit-tests PATCH v7 24/35] powerpc: Avoid using larx/stcx. in spinlocks when only one CPU is running

2024-03-19 Thread Nicholas Piggin
The test harness uses spinlocks if they are implemented with larx/stcx. it can prevent some test scenarios such as testing migration of a reservation. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/smp.h| 1 + lib/powerpc/smp.c| 5 + lib/powerpc/spinlock.c | 29

[kvm-unit-tests PATCH v7 23/35] powerpc: Permit ACCEL=tcg,thread=single

2024-03-19 Thread Nicholas Piggin
Modify run script to permit single vs mttcg threading, add a thread=single smp case to unittests.cfg. Signed-off-by: Nicholas Piggin --- powerpc/run | 4 ++-- powerpc/unittests.cfg | 6 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/powerpc/run b/powerpc/run

[kvm-unit-tests PATCH v7 22/35] powerpc: add SMP and IPI support

2024-03-19 Thread Nicholas Piggin
powerpc SMP support is very primitive and does not set up a first-class runtime environment for secondary CPUs. This reworks SMP support, and provides a complete C and harness environment for the secondaries, including interrupt handling, as well as IPI support. Signed-off-by: Nicholas Piggin

[kvm-unit-tests PATCH v7 21/35] powerpc: Remove broken SMP exception stack setup

2024-03-19 Thread Nicholas Piggin
stack for the boot processor. Make the stack 64kB while we're here, to match the size of the regular stack. Signed-off-by: Nicholas Piggin --- lib/powerpc/setup.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/powerpc/setup.c b/lib/powerpc/setup.c index

[kvm-unit-tests PATCH v7 20/35] powerpc: Add rtas stop-self support

2024-03-19 Thread Nicholas Piggin
rtas operations. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/rtas.h | 2 ++ lib/powerpc/rtas.c | 78 +- 2 files changed, 64 insertions(+), 16 deletions(-) diff --git a/lib/powerpc/asm/rtas.h b/lib/powerpc/asm/rtas.h

  1   2   3   4   5   6   7   8   9   10   >