public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: kvm@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Subject: [PATCH 2/3] x86: vmx: Use cpuid_maxphyaddr()
Date: Thu, 28 Aug 2014 15:02:29 -0300	[thread overview]
Message-ID: <1409248950-16268-3-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1409248950-16268-1-git-send-email-ehabkost@redhat.com>

The vmx test code calls cpuid(0x80000008) without checking xlevel first.
Change it to use cpuid_maxphyaddr() instead.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 x86/vmx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/x86/vmx.c b/x86/vmx.c
index ef9caca..132e5f0 100644
--- a/x86/vmx.c
+++ b/x86/vmx.c
@@ -161,7 +161,7 @@ void print_vmexit_info()
 static void test_vmclear(void)
 {
 	struct vmcs *tmp_root;
-	int width = cpuid(0x80000008).a & 0xff;
+	int width = cpuid_maxphyaddr();
 
 	/*
 	 * Note- The tests below do not necessarily have a
@@ -652,7 +652,7 @@ static int test_vmxon(void)
 {
 	int ret, ret1;
 	u64 *tmp_region = vmxon_region;
-	int width = cpuid(0x80000008).a & 0xff;
+	int width = cpuid_maxphyaddr();
 
 	/* Unaligned page access */
 	vmxon_region = (u64 *)((intptr_t)vmxon_region + 1);
@@ -694,7 +694,7 @@ out:
 static void test_vmptrld(void)
 {
 	struct vmcs *vmcs, *tmp_root;
-	int width = cpuid(0x80000008).a & 0xff;
+	int width = cpuid_maxphyaddr();
 
 	vmcs = alloc_page();
 	vmcs->revision_id = basic.revision;
-- 
1.9.3


  parent reply	other threads:[~2014-08-28 18:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-28 18:02 [PATCH 0/3] kvm-unit-tests: Check CPUID level/xlevel before using CPUID data Eduardo Habkost
2014-08-28 18:02 ` [PATCH 1/3] x86: apic: Look up MAXPHYADDR on CPUID correctly Eduardo Habkost
2014-08-28 18:02 ` Eduardo Habkost [this message]
2014-08-28 18:02 ` [PATCH 3/3] x86: Check level, xlevel before returning CPUID data Eduardo Habkost
2014-08-29  7:54 ` [PATCH 0/3] kvm-unit-tests: Check CPUID level/xlevel before using " 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=1409248950-16268-3-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.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