From: Oliver Upton <oliver.upton@linux.dev>
To: kvmarm@lists.linux.dev
Cc: Marc Zyngier <maz@kernel.org>, Joey Gouly <joey.gouly@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <seanjc@google.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Janosch Frank <frankja@linux.ibm.com>,
Claudio Imbrenda <imbrenda@linux.ibm.com>,
David Hildenbrand <david@redhat.com>,
linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org,
Oliver Upton <oliver.upton@linux.dev>
Subject: [PATCH 00/13] KVM: arm64: selftests: Run selftests in VHE EL2
Date: Wed, 17 Sep 2025 14:20:30 -0700 [thread overview]
Message-ID: <20250917212044.294760-1-oliver.upton@linux.dev> (raw)
I've been working on some MMU-related features that are unused by KVM
meaning they're somewhat annoying to test. Because of that, I found the
time / patience to port our existing selftests infrastructure over to
running in VHE EL2, opportunistically promoting tests when the stars
align.
Creating a VGIC is a hard requirement of enabling EL2 for a VM. As a
consequence of this, I need to eat my words from my earlier conversation
with Sean on this topic and hammer in a default VGICv3. This requires
some participation from the arch-neutral code given the ordering
constraints on vCPU and VGIC creation.
At the tail end of this series is a sanity test for EL2 but nothing is
actually running nested (yet). Despite that, running in EL2 has proven
valuable already as it has uncovered a bug [*].
This is all _very_ lightly tested on an M2 :) Applies to 6.17-rc4
[*]: https://lore.kernel.org/kvmarm/20250917203125.283116-1-oliver.upton@linux.dev/
Oliver Upton (13):
KVM: arm64: selftests: Provide kvm_arch_vm_post_create() in library
code
KVM: arm64: selftests: Initialize VGICv3 only once
KVM: arm64: selftests: Add helper to check for VGICv3 support
KVM: arm64: selftests: Add unsanitised helpers for VGICv3 creation
KVM: arm64: selftests: Create a VGICv3 for 'default' VMs
KVM: arm64: selftests: Alias EL1 registers to EL2 counterparts
KVM: arm64: selftests: Provide helper for getting default vCPU target
KVM: arm64: selftests: Select SMCCC conduit based on current EL
KVM: arm64: selftests: Use hyp timer IRQs when test runs at EL2
KVM: arm64: selftests: Use the vCPU attr for setting nr of PMU
counters
KVM: arm64: selftests: Initialize HCR_EL2
KVM: arm64: selftests: Enable EL2 by default
KVM: arm64: selftests: Add basic test for running in VHE EL2
tools/testing/selftests/kvm/Makefile.kvm | 1 +
.../testing/selftests/kvm/arm64/arch_timer.c | 13 +--
.../kvm/arm64/arch_timer_edge_cases.c | 13 +--
tools/testing/selftests/kvm/arm64/hello_el2.c | 58 ++++++++++++
.../testing/selftests/kvm/arm64/hypercalls.c | 2 +-
tools/testing/selftests/kvm/arm64/kvm-uuid.c | 2 +-
.../testing/selftests/kvm/arm64/no-vgic-v3.c | 2 +
tools/testing/selftests/kvm/arm64/psci_test.c | 13 +--
.../testing/selftests/kvm/arm64/set_id_regs.c | 20 ++--
.../selftests/kvm/arm64/smccc_filter.c | 17 +++-
tools/testing/selftests/kvm/arm64/vgic_init.c | 2 +
tools/testing/selftests/kvm/arm64/vgic_irq.c | 4 +-
.../selftests/kvm/arm64/vgic_lpi_stress.c | 8 +-
.../selftests/kvm/arm64/vpmu_counter_access.c | 75 +++++++--------
.../selftests/kvm/dirty_log_perf_test.c | 35 -------
tools/testing/selftests/kvm/dirty_log_test.c | 1 +
tools/testing/selftests/kvm/get-reg-list.c | 9 +-
.../selftests/kvm/include/arm64/arch_timer.h | 24 +++++
.../kvm/include/arm64/kvm_util_arch.h | 5 +-
.../selftests/kvm/include/arm64/processor.h | 73 +++++++++++++++
.../selftests/kvm/include/arm64/vgic.h | 3 +
.../testing/selftests/kvm/include/kvm_util.h | 7 +-
.../selftests/kvm/lib/arm64/processor.c | 91 ++++++++++++++++---
tools/testing/selftests/kvm/lib/arm64/vgic.c | 64 +++++++++----
tools/testing/selftests/kvm/lib/kvm_util.c | 15 ++-
.../testing/selftests/kvm/lib/x86/processor.c | 2 +-
tools/testing/selftests/kvm/s390/cmma_test.c | 2 +-
tools/testing/selftests/kvm/steal_time.c | 2 +-
28 files changed, 395 insertions(+), 168 deletions(-)
create mode 100644 tools/testing/selftests/kvm/arm64/hello_el2.c
base-commit: b320789d6883cc00ac78ce83bccbfe7ed58afcf0
--
2.47.3
next reply other threads:[~2025-09-17 21:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-17 21:20 Oliver Upton [this message]
2025-09-17 21:20 ` [PATCH 01/13] KVM: arm64: selftests: Provide kvm_arch_vm_post_create() in library code Oliver Upton
2025-09-18 1:25 ` Itaru Kitayama
2025-09-17 21:20 ` [PATCH 02/13] KVM: arm64: selftests: Initialize VGICv3 only once Oliver Upton
2025-09-18 10:44 ` Zenghui Yu
2025-09-17 21:20 ` [PATCH 03/13] KVM: arm64: selftests: Add helper to check for VGICv3 support Oliver Upton
2025-09-18 1:45 ` Itaru Kitayama
2025-09-17 21:20 ` [PATCH 04/13] KVM: arm64: selftests: Add unsanitised helpers for VGICv3 creation Oliver Upton
2025-09-17 21:20 ` [PATCH 05/13] KVM: arm64: selftests: Create a VGICv3 for 'default' VMs Oliver Upton
2025-09-17 21:20 ` [PATCH 06/13] KVM: arm64: selftests: Alias EL1 registers to EL2 counterparts Oliver Upton
2025-09-17 21:20 ` [PATCH 07/13] KVM: arm64: selftests: Provide helper for getting default vCPU target Oliver Upton
2025-09-17 21:56 ` Itaru Kitayama
2025-09-17 22:00 ` Oliver Upton
2025-09-17 21:20 ` [PATCH 08/13] KVM: arm64: selftests: Select SMCCC conduit based on current EL Oliver Upton
2025-09-17 21:20 ` [PATCH 09/13] KVM: arm64: selftests: Use hyp timer IRQs when test runs at EL2 Oliver Upton
2025-09-17 21:20 ` [PATCH 10/13] KVM: arm64: selftests: Use the vCPU attr for setting nr of PMU counters Oliver Upton
2025-09-17 21:20 ` [PATCH 11/13] KVM: arm64: selftests: Initialize HCR_EL2 Oliver Upton
2025-09-17 21:20 ` [PATCH 12/13] KVM: arm64: selftests: Enable EL2 by default Oliver Upton
2025-09-17 21:20 ` [PATCH 13/13] KVM: arm64: selftests: Add basic test for running in VHE EL2 Oliver Upton
2025-09-24 18:37 ` [PATCH 00/13] KVM: arm64: selftests: Run selftests " Marc Zyngier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250917212044.294760-1-oliver.upton@linux.dev \
--to=oliver.upton@linux.dev \
--cc=borntraeger@linux.ibm.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=joey.gouly@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=suzuki.poulose@arm.com \
--cc=yuzenghui@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.