From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Durrant Subject: [PATCH v8 12/13] x86/hvm: always re-emulate I/O from a buffer Date: Thu, 9 Jul 2015 17:55:25 +0100 Message-ID: <1436460926-16976-13-git-send-email-paul.durrant@citrix.com> References: <1436460926-16976-1-git-send-email-paul.durrant@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1436460926-16976-1-git-send-email-paul.durrant@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Paul Durrant , Keir Fraser List-Id: xen-devel@lists.xenproject.org If memory mapped I/O is 'chunked' then the I/O must be re-emulated, otherwise only the first chunk will be processed. This patch makes sure all I/O from a buffer is re-emulated regardless of whether it is a read or a write. Signed-off-by: Paul Durrant Cc: Keir Fraser Acked-by: Jan Beulich Reviewed-by: Andrew Cooper --- v7: - No change v6: - Added Andrew's reviewed-by v5: - Added Jan's acked-by --- xen/arch/x86/hvm/emulate.c | 4 ++-- xen/include/asm-x86/hvm/vcpu.h | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index 1444b56..89b1616 100644 --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -147,7 +147,7 @@ static int hvmemul_do_io( (p.data_is_ptr != data_is_addr) ) domain_crash(curr->domain); - if ( data_is_addr || dir == IOREQ_WRITE ) + if ( data_is_addr ) return X86EMUL_UNHANDLEABLE; goto finish_access; default: @@ -187,7 +187,7 @@ static int hvmemul_do_io( rc = hvm_send_assist_req(s, &p); if ( rc != X86EMUL_RETRY || curr->domain->is_shutting_down ) vio->io_req.state = STATE_IOREQ_NONE; - else if ( data_is_addr || dir == IOREQ_WRITE ) + else if ( data_is_addr ) rc = X86EMUL_OKAY; } break; diff --git a/xen/include/asm-x86/hvm/vcpu.h b/xen/include/asm-x86/hvm/vcpu.h index 01cbfe5..13ff54f 100644 --- a/xen/include/asm-x86/hvm/vcpu.h +++ b/xen/include/asm-x86/hvm/vcpu.h @@ -81,8 +81,7 @@ struct hvm_vcpu_io { static inline bool_t hvm_vcpu_io_need_completion(const struct hvm_vcpu_io *vio) { return (vio->io_req.state == STATE_IOREQ_READY) && - !vio->io_req.data_is_ptr && - (vio->io_req.dir == IOREQ_READ); + !vio->io_req.data_is_ptr; } #define VMCX_EADDR (~0ULL) -- 1.7.10.4