From: Cathy Avery <cavery@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, pbonzini@redhat.com
Subject: [PATCH kvm-unit-tests 2/2] svm: INIT intercept test
Date: Mon, 8 Jun 2020 08:28:00 -0400 [thread overview]
Message-ID: <20200608122800.6315-3-cavery@redhat.com> (raw)
In-Reply-To: <20200608122800.6315-1-cavery@redhat.com>
INIT vcpu 2 and intercept the INIT. This test
will leave the vcpu in an unusable state.
Signed-off-by: Cathy Avery <cavery@redhat.com>
---
x86/svm_tests.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/x86/svm_tests.c b/x86/svm_tests.c
index c1abd55..a4dbe91 100644
--- a/x86/svm_tests.c
+++ b/x86/svm_tests.c
@@ -1789,6 +1789,43 @@ static bool virq_inject_check(struct svm_test *test)
return get_test_stage(test) == 5;
}
+static volatile bool init_intercept;
+
+static void init_signal_intercept_prepare(struct svm_test *test)
+{
+
+ vmcb_ident(vmcb);
+ vmcb->control.intercept |= (1ULL << INTERCEPT_INIT);
+ init_intercept = false;
+}
+
+static void init_signal_test(struct svm_test *test)
+{
+ apic_icr_write(APIC_DEST_SELF | APIC_DEST_PHYSICAL | APIC_DM_INIT | APIC_INT_ASSERT, 0);
+}
+
+static bool init_signal_finished(struct svm_test *test)
+{
+ vmcb->save.rip += 3;
+
+ if (vmcb->control.exit_code != SVM_EXIT_INIT) {
+ report(false, "VMEXIT not due to init intercept. Exit reason 0x%x",
+ vmcb->control.exit_code);
+ return true;
+ }
+
+ init_intercept = true;
+
+ report(true, "INIT to vcpu intercepted");
+
+ return true;
+}
+
+static bool init_signal_check(struct svm_test *test)
+{
+ return init_intercept;
+}
+
#define TEST(name) { #name, .v2 = name }
/*
@@ -1950,6 +1987,9 @@ struct svm_test svm_tests[] = {
{ "virq_inject", default_supported, virq_inject_prepare,
default_prepare_gif_clear, virq_inject_test,
virq_inject_finished, virq_inject_check },
+ { "svm_init_signal_intercept_test", default_supported, init_signal_intercept_prepare,
+ default_prepare_gif_clear, init_signal_test,
+ init_signal_finished, init_signal_check, .on_vcpu = 2 },
TEST(svm_guest_state_test),
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL }
};
--
2.20.1
next prev parent reply other threads:[~2020-06-08 12:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-08 12:27 [PATCH kvm-unit-tests 0/2] svm: INIT test and test_run on selected vcpu Cathy Avery
2020-06-08 12:27 ` [PATCH kvm-unit-tests 1/2] svm: Add ability to execute test via test_run on a vcpu other than vcpu 0 Cathy Avery
2020-06-08 12:40 ` Paolo Bonzini
2020-06-08 12:28 ` Cathy Avery [this message]
2020-06-08 12:47 ` [PATCH kvm-unit-tests 2/2] svm: INIT intercept test Paolo Bonzini
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=20200608122800.6315-3-cavery@redhat.com \
--to=cavery@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox