Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752915AbdLERWC (ORCPT ); Tue, 5 Dec 2017 12:22:02 -0500 Received: from ale.deltatee.com ([207.54.116.67]:51590 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752179AbdLERWB (ORCPT ); Tue, 5 Dec 2017 12:22:01 -0500 To: Jon Mason , Serge Semin Cc: Dave Jiang , "Hubbe, Allen" , "S-k, Shyam-sundar" , "Yu, Xiangliang" , Gary R Hook , Sergey.Semin@t-platforms.ru, linux-ntb , linux-kernel References: <20171203191736.3399-1-fancer.lancer@gmail.com> <20171203191736.3399-3-fancer.lancer@gmail.com> From: Logan Gunthorpe Message-ID: Date: Tue, 5 Dec 2017 10:21:58 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: linux-kernel@vger.kernel.org, linux-ntb@googlegroups.com, Sergey.Semin@t-platforms.ru, gary.hook@amd.com, Xiangliang.Yu@amd.com, Shyam-sundar.S-k@amd.com, Allen.Hubbe@emc.com, dave.jiang@intel.com, fancer.lancer@gmail.com, jdmason@kudzu.us X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: [PATCH v2 02/15] NTB: Set dma mask and dma coherent mask to NTB devices X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1151 Lines: 27 On 05/12/17 09:51 AM, Jon Mason wrote: > On Sun, Dec 3, 2017 at 2:17 PM, Serge Semin wrote: >> The dma_mask and dma_coherent_mask fields of the NTB struct device >> weren't initialized in hardware drivers. In fact it should be done >> instead of PCIe interface usage, since NTB clients are supposed to >> use NTB API only and left unaware of real hardware implementation. >> In addition to that ntb_device_register() method shouldn't clear >> the passed ntb_dev structure, since it dma_mask is initialized >> by hardware drivers. > > This seems like a bug fix. Should this be broken out of this patch or > is it not noticed without your changes? I was digging into this a bit more and in addition to my earlier review comments I think the patch is incorrect for a couple reasons: 1) dma_set_mask() (and friends) are meant to inform the kernel of device specific restrictions it cannot know. Calling it with the parent PCI device's mask seems pointless. 2) Every dma_alloc() call in the NTB subsystem uses the PCI device's struct device. This is ugly in itself but until it changes this patch does nothing. Logan