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

[Xen-changelog] [xen master] x86emul: support CLWB



commit 4fb1aceed5888932b3426b76bd9d3d9ca2a7e7d6
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Jan 11 13:41:45 2017 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jan 11 13:41:45 2017 +0100

    x86emul: support CLWB
    
    Just like for CLFLUSH{,OPT} back it by the wbinvd() hook for now.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c 
b/xen/arch/x86/x86_emulate/x86_emulate.c
index e3ec313..6f34d0c 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1309,6 +1309,7 @@ static bool vcpu_has(
 #define vcpu_has_rtm()         vcpu_has(         7, EBX, 11, ctxt, ops)
 #define vcpu_has_smap()        vcpu_has(         7, EBX, 20, ctxt, ops)
 #define vcpu_has_clflushopt()  vcpu_has(         7, EBX, 23, ctxt, ops)
+#define vcpu_has_clwb()        vcpu_has(         7, EBX, 24, ctxt, ops)
 
 #define vcpu_must_have(feat) \
     generate_exception_if(!vcpu_has_##feat(), EXC_UD)
@@ -5334,11 +5335,20 @@ x86_emulate(
             vcpu_must_have(sse2);
             asm volatile ( "lfence" ::: "memory" );
             break;
-        case 6: /* mfence */
-            fail_if(modrm_mod != 3);
-            generate_exception_if(vex.pfx, EXC_UD);
-            vcpu_must_have(sse2);
-            asm volatile ( "mfence" ::: "memory" );
+        case 6:
+            if ( modrm_mod == 3 ) /* mfence */
+            {
+                generate_exception_if(vex.pfx, EXC_UD);
+                vcpu_must_have(sse2);
+                asm volatile ( "mfence" ::: "memory" );
+                break;
+            }
+            /* else clwb */
+            fail_if(!vex.pfx);
+            vcpu_must_have(clwb);
+            fail_if(!ops->wbinvd);
+            if ( (rc = ops->wbinvd(ctxt)) != X86EMUL_OKAY )
+                goto done;
             break;
         case 7:
             if ( modrm_mod == 3 ) /* sfence */
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.