public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Itaru Kitayama <itaru.kitayama@fujitsu•com>
To: weilin.chang@arm•com
Cc: catalin.marinas@arm•com, itaru.kitayama@fujitsu•com,
	joey.gouly@arm•com, kvm@vger•kernel.org, kvmarm@lists•linux.dev,
	linux-arm-kernel@lists•infradead.org,
	linux-kernel@vger•kernel.org, linux-kselftest@vger•kernel.org,
	maz@kernel•org, oupton@kernel•org, pbonzini@redhat•com,
	shuah@kernel•org, suzuki.poulose@arm•com, will@kernel•org,
	yuzenghui@huawei•com
Subject: [PATCH] KVM: selftest: arm64: Run shadow_stage2 varying guest modes
Date: Thu, 28 May 2026 13:59:30 +0900	[thread overview]
Message-ID: <20260528045930.450339-1-itaru.kitayama@fujitsu.com> (raw)
In-Reply-To: <20260516183003.799058-6-weilin.chang@arm.com>

Refactor main() to use for_each_guest_mode() helper to create
a single VCPU VM with a guest mode ID.

Signed-off-by: Itaru Kitayama <itaru.kitayama@fujitsu•com>
---
 tools/testing/selftests/kvm/arm64/shadow_stage2.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/kvm/arm64/shadow_stage2.c b/tools/testing/selftests/kvm/arm64/shadow_stage2.c
index 5bce55abdea7..05acca22eafe 100644
--- a/tools/testing/selftests/kvm/arm64/shadow_stage2.c
+++ b/tools/testing/selftests/kvm/arm64/shadow_stage2.c
@@ -105,7 +105,7 @@ static void guest_code(void)
 	GUEST_DONE();
 }
 
-int main(void)
+int run_test(enum vm_guest_mode mode, void *unused)
 {
 	struct kvm_vcpu_init init;
 	struct kvm_vcpu *vcpu;
@@ -114,7 +114,8 @@ int main(void)
 	gpa_t gpa;
 
 	TEST_REQUIRE(kvm_check_cap(KVM_CAP_ARM_EL2));
-	vm = vm_create(1);
+	vm = __vm_create(VM_SHAPE(mode), 1, 0);
+
 
 	kvm_get_default_vcpu_target(vm, &init);
 	init.features[0] |= BIT(KVM_ARM_VCPU_HAS_EL2);
@@ -163,3 +164,7 @@ int main(void)
 	kvm_vm_free(vm);
 	return 0;
 }
+
+int main(void) {
+	for_each_guest_mode(run_test, NULL);
+}
-- 
2.43.0



  parent reply	other threads:[~2026-05-28  5:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-16 18:29 [PATCH v3 0/9] KVM: arm64: selftests: Basic nested guest support Wei-Lin Chang
2026-05-16 18:29 ` [PATCH v3 1/9] KVM: arm64: selftests: Add GPR save/restore functions for NV Wei-Lin Chang
2026-05-16 18:29 ` [PATCH v3 2/9] KVM: arm64: selftests: Add helpers for guest hypervisors Wei-Lin Chang
2026-05-16 18:29 ` [PATCH v3 3/9] KVM: arm64: selftests: Add hello_nested basic NV selftest Wei-Lin Chang
2026-05-16 18:29 ` [PATCH v3 4/9] KVM: arm64: selftests: Enhance hello_nested test Wei-Lin Chang
2026-05-16 18:29 ` [PATCH v3 5/9] KVM: arm64: selftests: Add shadow_stage2 test Wei-Lin Chang
2026-05-22  2:02   ` Itaru Kitayama
2026-05-28  4:59   ` Itaru Kitayama [this message]
2026-05-28 16:02     ` [PATCH] KVM: selftest: arm64: Run shadow_stage2 varying guest modes Wei-Lin Chang
2026-05-28 22:14       ` Itaru Kitayama
2026-05-16 18:30 ` [PATCH v3 6/9] KVM: arm64: selftests: shadow_stage2: Allocate L2 stack from dedicated pool Wei-Lin Chang
2026-05-16 18:30 ` [PATCH v3 7/9] KVM: arm64: selftests: shadow_stage2: Check supported stage-2 granule size Wei-Lin Chang
2026-05-16 18:30 ` [PATCH v3 8/9] KVM: arm64: selftests: Add infrastructure for using stage-2 in guest Wei-Lin Chang
2026-05-16 18:30 ` [PATCH v3 9/9] KVM: arm64: selftests: shadow_stage2: Turn on stage-2 translation for the nested guest Wei-Lin Chang
2026-05-19 21:31 ` [PATCH v3 0/9] KVM: arm64: selftests: Basic nested guest support Oliver Upton
2026-05-29 13:38   ` Wei-Lin Chang

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=20260528045930.450339-1-itaru.kitayama@fujitsu.com \
    --to=itaru.kitayama@fujitsu$(echo .)com \
    --cc=catalin.marinas@arm$(echo .)com \
    --cc=joey.gouly@arm$(echo .)com \
    --cc=kvm@vger$(echo .)kernel.org \
    --cc=kvmarm@lists$(echo .)linux.dev \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-kselftest@vger$(echo .)kernel.org \
    --cc=maz@kernel$(echo .)org \
    --cc=oupton@kernel$(echo .)org \
    --cc=pbonzini@redhat$(echo .)com \
    --cc=shuah@kernel$(echo .)org \
    --cc=suzuki.poulose@arm$(echo .)com \
    --cc=weilin.chang@arm$(echo .)com \
    --cc=will@kernel$(echo .)org \
    --cc=yuzenghui@huawei$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox