kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nadav Amit <namit@vmware.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: <kvm@vger.kernel.org>, Nadav Amit <namit@vmware.com>
Subject: [kvm-unit-tests PATCH 2/5] x86: svm: check TSC adjust support
Date: Tue, 30 Jun 2020 02:45:13 -0700	[thread overview]
Message-ID: <20200630094516.22983-3-namit@vmware.com> (raw)
In-Reply-To: <20200630094516.22983-1-namit@vmware.com>

MSR_IA32_TSC_ADJUST may be supported by KVM on AMD machines, but it does
not show on AMD manual. Check CPUID to see if it supported before
running the relevant tests.

Signed-off-by: Nadav Amit <namit@vmware.com>
---
 x86/svm_tests.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/x86/svm_tests.c b/x86/svm_tests.c
index a2c993d..92cefaf 100644
--- a/x86/svm_tests.c
+++ b/x86/svm_tests.c
@@ -893,6 +893,11 @@ static bool npt_rw_l1mmio_check(struct svm_test *test)
 #define TSC_OFFSET_VALUE    (~0ull << 48)
 static bool ok;
 
+static bool tsc_adjust_supported(void)
+{
+    return this_cpu_has(X86_FEATURE_TSC_ADJUST);
+}
+
 static void tsc_adjust_prepare(struct svm_test *test)
 {
     default_prepare(test);
@@ -2010,7 +2015,7 @@ struct svm_test svm_tests[] = {
     { "npt_rw_l1mmio", npt_supported, npt_rw_l1mmio_prepare,
       default_prepare_gif_clear, npt_rw_l1mmio_test,
       default_finished, npt_rw_l1mmio_check },
-    { "tsc_adjust", default_supported, tsc_adjust_prepare,
+    { "tsc_adjust", tsc_adjust_supported, tsc_adjust_prepare,
       default_prepare_gif_clear, tsc_adjust_test,
       default_finished, tsc_adjust_check },
     { "latency_run_exit", default_supported, latency_prepare,
-- 
2.25.1


  parent reply	other threads:[~2020-06-30  9:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30  9:45 [kvm-unit-tests PATCH 0/5] x86: svm: fixes Nadav Amit
2020-06-30  9:45 ` [kvm-unit-tests PATCH 1/5] x86: Remove boot_idt assembly assignment Nadav Amit
2020-06-30  9:45 ` Nadav Amit [this message]
2020-06-30  9:45 ` [kvm-unit-tests PATCH 3/5] x86: svm: flush TLB on each test Nadav Amit
2020-06-30  9:45 ` [kvm-unit-tests PATCH 4/5] x86: svm: wrong reserved bit in npt_rsvd_pfwalk_prepare Nadav Amit
2020-06-30 11:06   ` Paolo Bonzini
2020-06-30 16:54   ` Paolo Bonzini
2020-06-30 17:37     ` Nadav Amit
2020-06-30  9:45 ` [kvm-unit-tests PATCH 5/5] x86: svm: avoid advancing rip incorrectly on exc_inject Nadav Amit

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=20200630094516.22983-3-namit@vmware.com \
    --to=namit@vmware.com \
    --cc=kvm@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;
as well as URLs for NNTP newsgroup(s).