Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752011AbdI0V33 (ORCPT ); Wed, 27 Sep 2017 17:29:29 -0400 Received: from mail-dm3nam03on0122.outbound.protection.outlook.com ([104.47.41.122]:33941 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751801AbdI0V31 (ORCPT ); Wed, 27 Sep 2017 17:29:27 -0400 From: Casey Leedom To: "Raj, Ashok" , Robin Murphy CC: Dan Williams , "Harsh Jain" , 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" Subject: Re: DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU Thread-Topic: DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU Thread-Index: AQHTLrKuCX/YGlya50aETYTEmnILyqK9cAoAgAAkZQCACFcnkv//5CkAgAAvAguAAJgAAIAAj7QAgAAh/4CAABrJ6IAAA2oAgAGW6yaAAA4uAP//1k4AgABoxyQ= Date: Wed, 27 Sep 2017 21:29:23 +0000 Message-ID: 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> In-Reply-To: <20170927144847.GA95654@otc-nc-03> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=leedom@chelsio.com; x-originating-ip: [12.32.117.8] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MWHPR12MB1951;6:yqY9ubau5ulOwDVbvw6AwO9N/JLq3XHY9E+ThWeaTh+H3l/+mA0OC0ttQhjw4kReKwv6WgHNp9LwXLkri6s1qa2lbGLrqcmCOICkJeeU37eYt1HREZ39i/Sz8kcHjcuHTYd6/mNtgbuaBiJQTDyCKGVyHWI+2Q0Ak3415zGqAdDogLH8jp9zxAKJCPC37o9AuGz8P55KrY8TtoSKpmxdhnbvKbhbWarYSwzhqRvn2fAmZokmX7b0HvjCbaXmEAihywtO+qDOOuMCh+6w1fvze8jLYUUUCwz5OvjEwuZD6kPvZzTFehBzNsx7/+2mrm6H+XtJ15R5tn8XBb9lwmdAsQ==;5:1YECMuuF5qVztBvpTvmDO5iWSF9aF+0mJnStEEOQ+kT0bvc/6qGbC3a0jWwlouLaujq56NCSN78dF9N+RuRC0QWENlHCzY29a3EWDU1hhvYrSPDmlv2NvoniLCmviM47GYDkG9dnJznQdor8J0FEhQ==;24:GUAETWrgb0+e/DMsvPp53T+6oD9ky9kS4KGYGSmZKBOfa2GzeG/+Y93Gg9ZFtw0vd6rIZR+OmhPDTwTqAzrQx+IRJK9FyHHqy/FpWDkHu8M=;7:83uwxWTK+z3QQ8/5FcFcxAPipVNFhJt6FZhfiF2o1Eza3MujgInU+a6TFJPAYcefuiMUjs9rJd4LXv3305yxGqhu/4z2lUuyJsOdbF3aLbXeHBJ1Z8BMmnOBn73WP0DEwLhBrZxgbCALvWE1AT00wVpQn7iMKxU8GgWEvGYHjdz2iAH6CbISXmZF/zL9Ma2aRQ7MgMGOBG9BefWcv0wKZbOxMo9uG+LRtOpstP7kk3s= x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10019020)(6009001)(346002)(376002)(199003)(189002)(8936002)(74316002)(25786009)(106356001)(105586002)(2900100001)(4326008)(66066001)(2906002)(7696004)(77096006)(93886005)(3280700002)(2950100002)(305945005)(7736002)(3660700001)(50986999)(5660300001)(53936002)(316002)(478600001)(33656002)(99286003)(101416001)(9686003)(55016002)(229853002)(54356999)(81166006)(110136005)(14454004)(54906003)(97736004)(81156014)(8676002)(76176999)(86362001)(189998001)(6246003)(3846002)(68736007)(6506006)(6116002)(102836003)(6436002);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR12MB1951;H:MWHPR12MB1600.namprd12.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; x-ms-office365-filtering-correlation-id: 67f869c8-fcee-47e7-408d-08d505eed272 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254152)(2017082002075)(2017052603199)(201703131423075)(201702281549075);SRVR:MWHPR12MB1951; x-ms-traffictypediagnostic: MWHPR12MB1951: x-exchange-antispam-report-test: UriScan:; x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(3002001)(6041248)(20161123558100)(2016111802025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123555025)(20161123560025)(20161123562025)(6072148)(6043046)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:MWHPR12MB1951;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:MWHPR12MB1951; x-forefront-prvs: 04433051BF spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 X-OriginatorOrg: chelsio.com X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Sep 2017 21:29:23.2132 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 065db76d-a7ae-4c60-b78a-501e8fc17095 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1951 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v8RLTZw6020710 Content-Length: 793 Lines: 23 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. Casey