Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751495AbdI1SjJ (ORCPT ); Thu, 28 Sep 2017 14:39:09 -0400 Received: from mga04.intel.com ([192.55.52.120]:27574 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750942AbdI1SjH (ORCPT ); Thu, 28 Sep 2017 14:39:07 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,450,1500966000"; d="scan'208";a="157230399" Date: Thu, 28 Sep 2017 08:43:46 -0700 From: "Raj, Ashok" To: Robin Murphy Cc: Casey Leedom , "joro@8bytes.org" , "dwmw2@infradead.org" , Harsh Jain , "herbert@gondor.apana.org.au" , "iommu@lists.linux-foundation.org" , "linux-crypto@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Michael Werner , Atul Gupta Subject: Re: [PATCH] iommu/vt-d: Fix scatterlist offset handling Message-ID: <20170928154345.GA101272@otc-nc-03> References: <644c3e01654f8bd48d669c36e424959d6ef0e27e.1506607370.git.robin.murphy@arm.com> <20170928132942.GA99552@otc-nc-03> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1551 Lines: 42 Hi Robin thanks.. i have no idea.. i see all the other patches from you :-) my email has decided to play games with me i suppose :-) On Thu, Sep 28, 2017 at 05:59:11PM +0100, Robin Murphy wrote: > I hope our email server hasn't got blacklisted again... Said patch is > the top of this very thread we're replying on[1] - you were definitely > on cc :( (sg->dma_address + sg->dma_len) ----+ sg->dma_address ---------+ | iov_pfn------+ | | | | | v v v iova: a b c d e f |--------|--------|--------|--------|--------| <...calculated....> [_____mapped______] pfn: 0 1 2 3 4 5 |--------|--------|--------|--------|--------| ^ ^ ^ | | | sg->page ----+ | | sg->offset --------------+ | (sg->offset + sg->length) ----------+ The picture seems right. Looking at the code i'm not sure if i understand it correctly. pgoff = sg->offset & ~PAGE_MASK; this gets the offset past the start of page. sg->dma_address = ((dma_addr_t)iov_pfn << VTD_PAGE_SHIFT) + pgoff; this would set dma_address at b+off instead of starting at c+off correct? > > Robin > > [1]:https://lists.linuxfoundation.org/pipermail/iommu/2017-September/024371.html