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

[Xen-changelog] [xen master] Revert "x86/HVM: use available linear->phys translations in REP MOVS/STOS handling"



commit 851cd8dcdd211389adaf264c1ffc89b8431b988c
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Jun 15 17:28:05 2016 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jun 15 17:28:05 2016 +0200

    Revert "x86/HVM: use available linear->phys translations in REP MOVS/STOS 
handling"
    
    This reverts commit bfa84968b2dd1612be73b36addccd3b2f5bda23f as
    being broken: We shouldn't reduce *reps here.
---
 xen/arch/x86/hvm/emulate.c | 73 ++++++++++------------------------------------
 1 file changed, 15 insertions(+), 58 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index d164092..8a033a3 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -1156,7 +1156,6 @@ static int hvmemul_rep_movs(
 {
     struct hvm_emulate_ctxt *hvmemul_ctxt =
         container_of(ctxt, struct hvm_emulate_ctxt, ctxt);
-    struct hvm_vcpu_io *vio = &current->arch.hvm_vcpu.hvm_io;
     unsigned long saddr, daddr, bytes;
     paddr_t sgpa, dgpa;
     uint32_t pfec = PFEC_page_present;
@@ -1179,43 +1178,16 @@ static int hvmemul_rep_movs(
     if ( hvmemul_ctxt->seg_reg[x86_seg_ss].attr.fields.dpl == 3 )
         pfec |= PFEC_user_mode;
 
-    bytes = PAGE_SIZE - (saddr & ~PAGE_MASK);
-    if ( vio->mmio_access.read_access &&
-         (vio->mmio_gva == (saddr & PAGE_MASK)) &&
-         bytes >= bytes_per_rep )
-    {
-        sgpa = pfn_to_paddr(vio->mmio_gpfn) | (saddr & ~PAGE_MASK);
-        if ( *reps * bytes_per_rep > bytes )
-            *reps = bytes / bytes_per_rep;
-    }
-    else
-    {
-        rc = hvmemul_linear_to_phys(saddr, &sgpa, bytes_per_rep, reps, pfec,
-                                    hvmemul_ctxt);
-        if ( rc != X86EMUL_OKAY )
-            return rc;
-
-        latch_linear_to_phys(vio, saddr, sgpa, 0);
-    }
-
-    bytes = PAGE_SIZE - (daddr & ~PAGE_MASK);
-    if ( vio->mmio_access.write_access &&
-         (vio->mmio_gva == (daddr & PAGE_MASK)) &&
-         bytes >= bytes_per_rep )
-    {
-        dgpa = pfn_to_paddr(vio->mmio_gpfn) | (daddr & ~PAGE_MASK);
-        if ( *reps * bytes_per_rep > bytes )
-            *reps = bytes / bytes_per_rep;
-    }
-    else
-    {
-        rc = hvmemul_linear_to_phys(daddr, &dgpa, bytes_per_rep, reps,
-                                    pfec | PFEC_write_access, hvmemul_ctxt);
-        if ( rc != X86EMUL_OKAY )
-            return rc;
+    rc = hvmemul_linear_to_phys(
+        saddr, &sgpa, bytes_per_rep, reps, pfec, hvmemul_ctxt);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
-        latch_linear_to_phys(vio, daddr, dgpa, 1);
-    }
+    rc = hvmemul_linear_to_phys(
+        daddr, &dgpa, bytes_per_rep, reps,
+        pfec | PFEC_write_access, hvmemul_ctxt);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
     /* Check for MMIO ops */
     (void) get_gfn_query_unlocked(current->domain, sgpa >> PAGE_SHIFT, &sp2mt);
@@ -1307,40 +1279,25 @@ static int hvmemul_rep_stos(
 {
     struct hvm_emulate_ctxt *hvmemul_ctxt =
         container_of(ctxt, struct hvm_emulate_ctxt, ctxt);
-    struct hvm_vcpu_io *vio = &current->arch.hvm_vcpu.hvm_io;
-    unsigned long addr, bytes;
+    unsigned long addr;
     paddr_t gpa;
     p2m_type_t p2mt;
     bool_t df = !!(ctxt->regs->eflags & X86_EFLAGS_DF);
     int rc = hvmemul_virtual_to_linear(seg, offset, bytes_per_rep, reps,
                                        hvm_access_write, hvmemul_ctxt, &addr);
 
-    if ( rc != X86EMUL_OKAY )
-        return rc;
-
-    bytes = PAGE_SIZE - (addr & ~PAGE_MASK);
-    if ( vio->mmio_access.write_access &&
-         (vio->mmio_gva == (addr & PAGE_MASK)) &&
-         bytes >= bytes_per_rep )
-    {
-        gpa = pfn_to_paddr(vio->mmio_gpfn) | (addr & ~PAGE_MASK);
-        if ( *reps * bytes_per_rep > bytes )
-            *reps = bytes / bytes_per_rep;
-    }
-    else
+    if ( rc == X86EMUL_OKAY )
     {
         uint32_t pfec = PFEC_page_present | PFEC_write_access;
 
         if ( hvmemul_ctxt->seg_reg[x86_seg_ss].attr.fields.dpl == 3 )
             pfec |= PFEC_user_mode;
 
-        rc = hvmemul_linear_to_phys(addr, &gpa, bytes_per_rep, reps, pfec,
-                                    hvmemul_ctxt);
-        if ( rc != X86EMUL_OKAY )
-            return rc;
-
-        latch_linear_to_phys(vio, addr, gpa, 1);
+        rc = hvmemul_linear_to_phys(
+            addr, &gpa, bytes_per_rep, reps, pfec, hvmemul_ctxt);
     }
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
     /* Check for MMIO op */
     (void)get_gfn_query_unlocked(current->domain, gpa >> PAGE_SHIFT, &p2mt);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

 


Rackspace

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