From: "Jan Beulich" Subject: Re: [PATCH v3 04/18] x86/hvm: make sure translated MMIO reads or writes fall within a page Date: Tue, 23 Jun 2015 16:52:43 +0100 Message-ID: <55899CEB0200007800088748@mail.emea.novell.com> References: <1435055997-30017-1-git-send-email-paul.durrant@citrix.com> <1435055997-30017-5-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 1Z7QVC-0005sG-2Q for xen-devel@lists.xenproject.org; Tue, 23 Jun 2015 15:52:46 +0000 In-Reply-To: <1435055997-30017-5-git-send-email-paul.durrant@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Paul Durrant Cc: Andrew Cooper , Keir Fraser , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org >>> On 23.06.15 at 12:39, wrote: > ...otherwise they will simply carry on to the next page using a normal > linear-to-phys translation. And what's wrong about this? > --- a/xen/arch/x86/hvm/emulate.c > +++ b/xen/arch/x86/hvm/emulate.c > @@ -586,7 +586,6 @@ static int __hvmemul_read( > p_data); > if ( rc != X86EMUL_OKAY || bytes == chunk ) > return rc; > - addr += chunk; > off += chunk; > gpa += chunk; > p_data += chunk; > @@ -594,6 +593,8 @@ static int __hvmemul_read( > if ( bytes < chunk ) > chunk = bytes; > } > + > + return X86EMUL_UNHANDLEABLE; > } All the loop above does is leverage that we don't need to do a translation, as we already know the physical address. Continuing if the access crosses a page boundary is not wrong at all afaict. Jan