From: Vishal Annapurve <vannapurve@google.com>
To: x86@kernel.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Cc: pbonzini@redhat.com, shuah@kernel.org, bgardon@google.com,
seanjc@google.com, oupton@google.com, peterx@redhat.com,
vkuznets@redhat.com, dmatlack@google.com, pgonda@google.com,
andrew.jones@linux.dev, Vishal Annapurve <vannapurve@google.com>
Subject: [V4 PATCH 3/3] KVM: selftests: Add arch specific post vm creation hook
Date: Tue, 15 Nov 2022 21:38:45 +0000 [thread overview]
Message-ID: <20221115213845.3348210-4-vannapurve@google.com> (raw)
In-Reply-To: <20221115213845.3348210-1-vannapurve@google.com>
Add arch specific API kvm_arch_vm_post_create to perform any required setup
after VM creation.
Suggested-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
Reviewed-by: Peter Gonda <pgonda@google.com>
Signed-off-by: Vishal Annapurve <vannapurve@google.com>
---
tools/testing/selftests/kvm/include/kvm_util_base.h | 4 ++++
tools/testing/selftests/kvm/lib/kvm_util.c | 9 ++++++---
tools/testing/selftests/kvm/lib/x86_64/processor.c | 6 ++++++
3 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h
index eec0e4898efe..1e7d3eae8c91 100644
--- a/tools/testing/selftests/kvm/include/kvm_util_base.h
+++ b/tools/testing/selftests/kvm/include/kvm_util_base.h
@@ -843,4 +843,8 @@ static inline int __vm_disable_nx_huge_pages(struct kvm_vm *vm)
*/
void kvm_selftest_arch_init(void);
+/*
+ * API to execute architecture specific setup after creating the VM.
+ */
+void kvm_arch_vm_post_create(struct kvm_vm *vm);
#endif /* SELFTEST_KVM_UTIL_BASE_H */
diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
index deb4c731b9fa..3ed72980c996 100644
--- a/tools/testing/selftests/kvm/lib/kvm_util.c
+++ b/tools/testing/selftests/kvm/lib/kvm_util.c
@@ -340,9 +340,8 @@ struct kvm_vm *__vm_create(enum vm_guest_mode mode, uint32_t nr_runnable_vcpus,
kvm_vm_elf_load(vm, program_invocation_name);
-#ifdef __x86_64__
- vm_create_irqchip(vm);
-#endif
+ kvm_arch_vm_post_create(vm);
+
return vm;
}
@@ -2022,6 +2021,10 @@ void __vm_get_stat(struct kvm_vm *vm, const char *stat_name, uint64_t *data,
}
}
+__weak void kvm_arch_vm_post_create(struct kvm_vm *vm)
+{
+}
+
__weak void kvm_selftest_arch_init(void)
{
}
diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
index 39c4409ef56a..fa65e8142c16 100644
--- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
+++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
@@ -1327,3 +1327,9 @@ bool vm_is_unrestricted_guest(struct kvm_vm *vm)
return get_kvm_intel_param_bool("unrestricted_guest");
}
+
+
+void kvm_arch_vm_post_create(struct kvm_vm *vm)
+{
+ vm_create_irqchip(vm);
+}
--
2.38.1.431.g37b22c650d-goog
next prev parent reply other threads:[~2022-11-15 21:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 21:38 [V4 PATCH 0/3] Minor improvements to the selftest setup logic Vishal Annapurve
2022-11-15 21:38 ` [V4 PATCH 1/3] KVM: selftests: move common startup logic to kvm_util.c Vishal Annapurve
2022-11-16 17:36 ` Sean Christopherson
2022-11-17 18:21 ` Vishal Annapurve
2022-11-15 21:38 ` [V4 PATCH 2/3] KVM: selftests: Add arch specific initialization Vishal Annapurve
2022-11-16 17:46 ` Sean Christopherson
2022-11-17 18:24 ` Vishal Annapurve
2022-11-15 21:38 ` Vishal Annapurve [this message]
2022-11-16 17:39 ` [V4 PATCH 3/3] KVM: selftests: Add arch specific post vm creation hook Sean Christopherson
2022-11-16 18:00 ` [V4 PATCH 0/3] Minor improvements to the selftest setup logic Sean Christopherson
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=20221115213845.3348210-4-vannapurve@google.com \
--to=vannapurve@google.com \
--cc=andrew.jones@linux.dev \
--cc=bgardon@google.com \
--cc=dmatlack@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=oupton@google.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=pgonda@google.com \
--cc=seanjc@google.com \
--cc=shuah@kernel.org \
--cc=vkuznets@redhat.com \
--cc=x86@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox