From: Jason Wang <jasowang@redhat.com>
To: mtosatti@redhat.com, avi@redhat.com, kvm@vger.kernel.org
Subject: [PATCH kvm-unit-tests v2 06/10] Remove the duplicated rdmsr/wrmsr
Date: Thu, 26 Aug 2010 17:21:59 +0800 [thread overview]
Message-ID: <20100826092159.1690.58517.stgit@FreeLancer> (raw)
In-Reply-To: <20100826091520.1690.44200.stgit@FreeLancer>
They have been implemented in lib/x86/processor.h. Also rename the
cpuid to cpuid_test because cpuid have been defined.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
x86/msr.c | 16 +---------------
x86/vmexit.c | 20 +++-----------------
2 files changed, 4 insertions(+), 32 deletions(-)
diff --git a/x86/msr.c b/x86/msr.c
index 1e7987d..9c85369 100644
--- a/x86/msr.c
+++ b/x86/msr.c
@@ -1,6 +1,7 @@
/* msr tests */
#include "libcflat.h"
+#include "processor.h"
struct msr_info {
int index;
@@ -87,21 +88,6 @@ static void report(const char *name, int passed)
printf("%s: %s\n", name, passed ? "PASS" : "FAIL");
}
-static void wrmsr(unsigned index, unsigned long long value)
-{
- unsigned a = value, d = value >> 32;
-
- asm volatile("wrmsr" : : "a"(a), "d"(d), "c"(index));
-}
-
-static unsigned long long rdmsr(unsigned index)
-{
- unsigned a, d;
-
- asm volatile("rdmsr" : "=a"(a), "=d"(d) : "c"(index));
- return ((unsigned long long)d << 32) | a;
-}
-
static void test_msr_rw(int msr_index, unsigned long long input, unsigned long long expected)
{
unsigned long long r = 0;
diff --git a/x86/vmexit.c b/x86/vmexit.c
index 707d5c6..819c24b 100644
--- a/x86/vmexit.c
+++ b/x86/vmexit.c
@@ -1,6 +1,7 @@
#include "libcflat.h"
#include "smp.h"
+#include "processor.h"
static inline unsigned long long rdtsc()
{
@@ -32,7 +33,7 @@ static unsigned int inl(unsigned short port)
# define R "e"
#endif
-static void cpuid(void)
+static void cpuid_test(void)
{
asm volatile ("push %%"R "bx; cpuid; pop %%"R "bx"
: : : "eax", "ecx", "edx");
@@ -48,21 +49,6 @@ static void vmcall(void)
#define MSR_EFER 0xc0000080
#define EFER_NX_MASK (1ull << 11)
-unsigned long long rdmsr(unsigned index)
-{
- unsigned a, d;
-
- asm volatile("rdmsr" : "=a"(a), "=d"(d) : "c"(index));
- return ((unsigned long long)d << 32) | a;
-}
-
-void wrmsr(unsigned index, unsigned long long val)
-{
- unsigned a = val, d = val >> 32;
-
- asm volatile("wrmsr" : : "a"(a), "d"(d), "c"(index));
-}
-
static void mov_from_cr8(void)
{
unsigned long cr8;
@@ -112,7 +98,7 @@ static struct test {
int (*valid)(void);
int parallel;
} tests[] = {
- { cpuid, "cpuid", .parallel = 1, },
+ { cpuid_test, "cpuid", .parallel = 1, },
{ vmcall, "vmcall", .parallel = 1, },
{ mov_from_cr8, "mov_from_cr8", .parallel = 1, },
{ mov_to_cr8, "mov_to_cr8" , .parallel = 1, },
next prev parent reply other threads:[~2010-08-26 9:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-26 9:21 [PATCH kvm-unit-tests v2 00/10] Minor cleanup and fix for Jason Wang
2010-08-26 9:21 ` [PATCH kvm-unit-tests v2 01/10] Do not track config.mak and kvmtrace Jason Wang
2010-08-26 9:21 ` [PATCH kvm-unit-tests v2 02/10] Remove trailing whitespaces Jason Wang
2010-08-26 9:21 ` [PATCH kvm-unit-tests v2 03/10] Makefile cleanup Jason Wang
2010-08-26 9:21 ` [PATCH kvm-unit-tests v2 04/10] Correct the path in README Jason Wang
2010-08-26 9:21 ` [PATCH kvm-unit-tests v2 05/10] Drop print.S Jason Wang
2010-08-26 9:21 ` Jason Wang [this message]
2010-08-26 9:22 ` [PATCH kvm-unit-tests v2 07/10] Correct the tss size Jason Wang
2010-08-26 9:22 ` [PATCH kvm-unit-tests v2 08/10] Do not check cr8 access when running in 32 bit Jason Wang
2010-08-26 9:22 ` [PATCH kvm-unit-tests v2 09/10] Do not test IA32_EFER in 32bit mode Jason Wang
2010-08-26 9:22 ` [PATCH kvm-unit-tests v2 10/10] Add 32 bit smp initialization code Jason Wang
2010-08-26 18:45 ` [PATCH kvm-unit-tests v2 00/10] Minor cleanup and fix for Marcelo Tosatti
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=20100826092159.1690.58517.stgit@FreeLancer \
--to=jasowang@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@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).