All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/HVM: fix interaction between internal and extern emulation
@ 2017-11-27  8:28 Jan Beulich
  2017-11-27 11:59 ` Andrew Cooper
  2017-11-28  9:49 ` Paul Durrant
  0 siblings, 2 replies; 15+ messages in thread
From: Jan Beulich @ 2017-11-27  8:28 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Julien Grall, Paul Durrant

handle_hvm_io_completion() is being involved in resuming from requests
sent to a device model only, while re-invocation of internally handled
I/O which couldn't be handled in one go simply re-starts the affected
instruction. When an internally handled split request is being followed
by one sent to a device model, so far nothing reset vio->io_completion,
leading to an MMIO emulation attempt on the next instruction _after_ the
one succesfully sent to qemu if that one doesn't itself require
completion handling.

Since only repeated string instructions are affected, strictly speaking
the adjustment to handle_pio() isn't needed. Do it nevertheless for
consistency as well as to avoid the lack thereof becoming an issue in
the future; put the main change in generic enough a place to also cover
VMX real mode emulation.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
It has been puzzling me for years how we could get away without clearing
vio->io_completion in any more central place, i.e. other than as part of
handling the completion.

--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2107,6 +2107,7 @@ static int _hvm_emulate_one(struct hvm_e
     hvm_emulate_init_per_insn(hvmemul_ctxt, vio->mmio_insn,
                               vio->mmio_insn_bytes);
 
+    vio->io_completion = HVMIO_no_completion;
     vio->mmio_retry = 0;
 
     rc = x86_emulate(&hvmemul_ctxt->ctxt, ops);
--- a/xen/arch/x86/hvm/io.c
+++ b/xen/arch/x86/hvm/io.c
@@ -139,6 +139,8 @@ bool handle_pio(uint16_t port, unsigned
     if ( dir == IOREQ_WRITE )
         data = guest_cpu_user_regs()->eax;
 
+    vio->io_completion = HVMIO_no_completion;
+
     rc = hvmemul_do_pio_buffer(port, size, dir, &data);
 
     if ( hvm_vcpu_io_need_completion(vio) )




_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-11-28 13:20 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-27  8:28 [PATCH] x86/HVM: fix interaction between internal and extern emulation Jan Beulich
2017-11-27 11:59 ` Andrew Cooper
2017-11-28  9:49 ` Paul Durrant
2017-11-28 10:02   ` Jan Beulich
2017-11-28 10:05     ` Paul Durrant
2017-11-28 10:16       ` Jan Beulich
2017-11-28 10:22         ` Paul Durrant
2017-11-28 10:40           ` Jan Beulich
2017-11-28 11:01             ` Paul Durrant
2017-11-28 11:06               ` Paul Durrant
2017-11-28 11:26                 ` Jan Beulich
2017-11-28 11:30                   ` Paul Durrant
2017-11-28 11:58                     ` Paul Durrant
2017-11-28 12:03                       ` Jan Beulich
2017-11-28 13:20                         ` Paul Durrant

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.