Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932086AbdI1NjO (ORCPT ); Thu, 28 Sep 2017 09:39:14 -0400 Received: from stargate.chelsio.com ([12.32.117.8]:38903 "EHLO stargate.chelsio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753164AbdI1NjM (ORCPT ); Thu, 28 Sep 2017 09:39:12 -0400 Subject: Re: DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU To: Casey Leedom , "Raj, Ashok" , Robin Murphy Cc: Dan Williams , Herbert Xu , "linux-kernel@vger.kernel.org" , "iommu@lists.linux-foundation.org" , "linux-crypto@vger.kernel.org" , "dwmw2@infradead.org" , Michael Werner , "nd@arm.com" References: <20170925155430.GB131920@otc-nc-03> <6d2af675-7b97-6eaf-4daa-d7bf80a05923@chelsio.com> <437a9bd8-d4d6-22ca-1a64-1a3e73f1101a@arm.com> <20170927181802.3dcd7efb@m750.lan> <20170927144847.GA95654@otc-nc-03> From: Harsh Jain Message-ID: <26d68681-a157-26d3-84cb-6684dcaf3135@chelsio.com> Date: Thu, 28 Sep 2017 19:08:21 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1012 Lines: 27 On 28-09-2017 02:59, Casey Leedom wrote: > Hey Raj, > > Let us know if you need help in gathering more debugging information. For > the time being we've decided to ERRATA the use of the Intel I/O MMU with > IPsec till we Root Cause the issue. But this is still at the top of Harsh's > bug list. > > With Robin's comments, I'm almost sure that the: > > (iov_pfn + sg->offset) << VTD_PAGE_SHIFT) > > in your suggested patch is an issue. iov_pfn is a Page Frame Number and > sg->offset is a Byte Offset. It feels like this should be: > > size_t page_off = sg->offset & ~VTD_PAGE_MASK; > unsigned long pfn_off = sg->offset >> VTD_PAGE_MASK; > ... > sg->dma_address = ((dma_addr_t) > (iov_pfn + pfn_off) << VTD_PAGE_SHIFT) + page_off; > > When Harsh tried your original patch, Harsh' test system wouldn't even boot. Today I tried with "Intel_iommu=sp_off" boot option. Traffic runs without any error for more than 1 hrs. What magic this option did? :) > > Casey