From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, Sean Christopherson <seanjc@google.com>
Subject: [kvm-unit-tests PATCH 14/14] x86: msr: Verify that EFER.SCE can be written on 32-bit vCPUs
Date: Wed, 21 Apr 2021 20:05:04 -0700 [thread overview]
Message-ID: <20210422030504.3488253-15-seanjc@google.com> (raw)
In-Reply-To: <20210422030504.3488253-1-seanjc@google.com>
Verify that EFER can be written, and that the SYSCALL enable bit can be
set, on 32-bit vCPUs.
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
x86/msr.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/x86/msr.c b/x86/msr.c
index 8a1b0b2..7a551c4 100644
--- a/x86/msr.c
+++ b/x86/msr.c
@@ -29,9 +29,7 @@ struct msr_info msr_info[] =
MSR_TEST(MSR_FS_BASE, addr_64, true),
MSR_TEST(MSR_GS_BASE, addr_64, true),
MSR_TEST(MSR_KERNEL_GS_BASE, addr_64, true),
-#ifdef __x86_64__
- MSR_TEST(MSR_EFER, 0xD00, false),
-#endif
+ MSR_TEST(MSR_EFER, EFER_SCE, false),
MSR_TEST(MSR_LSTAR, addr_64, true),
MSR_TEST(MSR_CSTAR, addr_64, true),
MSR_TEST(MSR_SYSCALL_MASK, 0xffffffff, true),
@@ -44,6 +42,13 @@ static void test_msr_rw(struct msr_info *msr, unsigned long long val)
unsigned long long r, orig;
orig = rdmsr(msr->index);
+ /*
+ * Special case EFER since clearing LME/LMA is not allowed in 64-bit mode,
+ * and conversely setting those bits on 32-bit CPUs is not allowed. Treat
+ * the desired value as extra bits to set.
+ */
+ if (msr->index == MSR_EFER)
+ val |= orig;
wrmsr(msr->index, val);
r = rdmsr(msr->index);
wrmsr(msr->index, orig);
--
2.31.1.498.g6c1eba8ee3d-goog
prev parent reply other threads:[~2021-04-22 3:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-22 3:04 [kvm-unit-tests PATCH 00/14] x86: MSR_GS_BASE and friends Sean Christopherson
2021-04-22 3:04 ` [kvm-unit-tests PATCH 01/14] x86/cstart: Don't use MSR_GS_BASE in 32-bit boot code Sean Christopherson
2021-04-22 9:44 ` Paolo Bonzini
2021-04-22 10:02 ` Paolo Bonzini
2021-04-22 17:57 ` Sean Christopherson
2021-04-23 6:57 ` Paolo Bonzini
2021-04-22 3:04 ` [kvm-unit-tests PATCH 02/14] x86: msr: Exclude GS/FS_BASE MSRs from 32-bit builds Sean Christopherson
2021-04-22 3:04 ` [kvm-unit-tests PATCH 03/14] x86: msr: Advertise GenuineIntel as vendor to play nice with SYSENTER Sean Christopherson
2021-04-22 10:11 ` Paolo Bonzini
2021-04-22 3:04 ` [kvm-unit-tests PATCH 04/14] x86: msr: Restore original MSR value after writing arbitrary test value Sean Christopherson
2021-04-22 3:04 ` [kvm-unit-tests PATCH 05/14] x86: Force the compiler to retrieve exception info from per-cpu area Sean Christopherson
2021-04-22 3:04 ` [kvm-unit-tests PATCH 06/14] x86: msr: Replace spaces with tabs in all of msr.c Sean Christopherson
2021-04-22 3:04 ` [kvm-unit-tests PATCH 07/14] x86: msr: Use ARRAY_SIZE() instead of open coded equivalent Sean Christopherson
2021-04-22 3:04 ` [kvm-unit-tests PATCH 08/14] x86: msr: Use the #defined MSR indices in favor of open coding the values Sean Christopherson
2021-04-22 3:04 ` [kvm-unit-tests PATCH 09/14] x86: msr: Drop the explicit expected value Sean Christopherson
2021-04-22 3:05 ` [kvm-unit-tests PATCH 10/14] x86: msr: Add builder macros to define MSR entries Sean Christopherson
2021-04-22 3:05 ` [kvm-unit-tests PATCH 11/14] x86: msr: Pass msr_info instead of doing a lookup at runtime Sean Christopherson
2021-04-22 3:05 ` [kvm-unit-tests PATCH 12/14] x86: msr: Verify 64-bit only MSRs fault on 32-bit hosts Sean Christopherson
2021-04-22 10:32 ` Paolo Bonzini
2021-04-22 3:05 ` [kvm-unit-tests PATCH 13/14] x86: msr: Test that always-canonical MSRs #GP on non-canonical value Sean Christopherson
2021-04-22 3:05 ` Sean Christopherson [this message]
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=20210422030504.3488253-15-seanjc@google.com \
--to=seanjc@google.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