From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Durrant Subject: [PATCH v5 15/16] x86/hvm: always re-emulate I/O from a buffer Date: Tue, 30 Jun 2015 14:05:57 +0100 Message-ID: <1435669558-5421-16-git-send-email-paul.durrant@citrix.com> References: <1435669558-5421-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: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z9vO9-0005F5-Vz for xen-devel@lists.xenproject.org; Tue, 30 Jun 2015 13:15:50 +0000 In-Reply-To: <1435669558-5421-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.xenproject.org Cc: Andrew Cooper , 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 Cc: Andrew Cooper --- 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 b5fb0da..8bb56a2 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 7ffa28a..506ce89 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