[kvm-unit-tests PATCH 4/5] x86: Move invpcid_safe() to processor.h and convert to asm_safe()

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

 



Move invpcid_safe() to processor.h so that it can be used by other tests,
and convert it to use asm_safe() instead of open coding ASM_TRY() usage.

Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
 lib/x86/processor.h | 7 +++++++
 x86/pcid.c          | 8 --------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/lib/x86/processor.h b/lib/x86/processor.h
index b9f0436c..243eacde 100644
--- a/lib/x86/processor.h
+++ b/lib/x86/processor.h
@@ -737,6 +737,13 @@ static inline void invlpg(volatile void *va)
 	asm volatile("invlpg (%0)" ::"r" (va) : "memory");
 }
 
+
+static inline int invpcid_safe(unsigned long type, void *desc)
+{
+	/* invpcid (%rax), %rbx */
+	return asm_safe(".byte 0x66,0x0f,0x38,0x82,0x18", "a" (desc), "b" (type));
+}
+
 static inline void safe_halt(void)
 {
 	asm volatile("sti; hlt");
diff --git a/x86/pcid.c b/x86/pcid.c
index 4dfc6fd0..c503efb8 100644
--- a/x86/pcid.c
+++ b/x86/pcid.c
@@ -10,14 +10,6 @@ struct invpcid_desc {
     u64 addr : 64;
 };
 
-static int invpcid_safe(unsigned long type, void *desc)
-{
-    asm volatile (ASM_TRY("1f")
-                  ".byte 0x66,0x0f,0x38,0x82,0x18 \n\t" /* invpcid (%rax), %rbx */
-                  "1:" : : "a" (desc), "b" (type));
-    return exception_vector();
-}
-
 static void test_pcid_enabled(void)
 {
     int passed = 0;
-- 
2.40.0.348.gf938b09366-goog




[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