[PATCH kvm-unit-tests 06/10] Remove the duplicated rdmsr/wrmsr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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, },

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux