Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5542060imm; Tue, 12 Jun 2018 09:20:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLJ/XqTOFXchMvJVJLONg8TARJg+txptp+z1y+qPMY1+KqhFy0RLGvICpgoA7XTFfTNgcHm X-Received: by 2002:a63:7c03:: with SMTP id x3-v6mr916477pgc.412.1528820431453; Tue, 12 Jun 2018 09:20:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528820431; cv=none; d=google.com; s=arc-20160816; b=XUb/P7CHpv6uVWezUbNKrgCGG8ep37r3550wNN/4C630SscsvkNHBirayF1uTcFTou tRuU7FHVjdKvT8puKXD0WMbuldNFNGJl86xo5OU7Hzp7NmSsPVccnJ9y3CetQqzyFOPS tbz/2VkHIEonR8Ewg2sclKYlrOA0fxa9+XxXLW5ZmY4HC4mOsMS5REsaaeAA0QfXeyaV ePAoHujZp1zvgTdsECIGGAvLeLZdPm50Pc2qAgMXf77OML1L9yfRgEee63DpW/mCNJ4z wLlPTzqLS16ClpPqUTV+7BsGRw9/M5k8bTdpCj+3z008ZLD4q+66zmGLPs5q//rtqpGv xg5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:arc-authentication-results; bh=v1kFRuOtWwzYw53nzhw8VC4FYqi3oA6N+94NDsiLLos=; b=IKN0sDrV3SoFPezoM2GjSTiQ5aBSW3GFp7rqrmvF3UNPG5GzRCaARuPp54WTPSXkpG lN7lF6O2HkFKrnKbT3Tn0EBR/z5ocFj/iLfxb8qxsK655LoofZlN3KNwpYNwXQVVvb9u nymPetOkhf3rmUsbE0VAj3so68CM0pwe3N1PZTMpKtgxu1S4NrydZIcKa50TeO6ayy5v 7MaEKe4xNwSSExeZQMT/WlpaVAycrk2Cl06GAxM51b5McIfIZTNxAKGiFtT0VO0FEZeD /RK1MhAg2jbXZhqMzCV75T4uAJ6oyAOvZLRgRkgyV8O/HmVt5JdEgjNtdtbKMjl0GW7v MgVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3-v6si372803pgf.364.2018.06.12.09.20.17; Tue, 12 Jun 2018 09:20:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934429AbeFLQSW (ORCPT + 99 others); Tue, 12 Jun 2018 12:18:22 -0400 Received: from ale.deltatee.com ([207.54.116.67]:54992 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933638AbeFLQSV (ORCPT ); Tue, 12 Jun 2018 12:18:21 -0400 Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.89) (envelope-from ) id 1fSlzq-0000hB-0q; Tue, 12 Jun 2018 10:18:14 -0600 To: Jon Mason Cc: linux-kernel , linux-ntb , Dave Jiang , Allen Hubbe , Serge Semin , Shyam Sundar S K , Shuah Khan References: <20180609000819.13883-1-logang@deltatee.com> <20180609000819.13883-3-logang@deltatee.com> From: Logan Gunthorpe Message-ID: Date: Tue, 12 Jun 2018 10:18:12 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: shuah@kernel.org, Shyam-sundar.S-k@amd.com, fancer.lancer@gmail.com, allenbh@gmail.com, dave.jiang@intel.com, linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, jdmason@kudzu.us X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-8.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE,MYRULES_FREE autolearn=ham autolearn_force=no version=3.4.1 Subject: Re: [PATCH 2/8] NTB: Setup the DMA mask globally for all drivers 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/06/18 09:48 AM, Jon Mason wrote: > ntb.c is more of a glue layer, and this is more device specific. > While I like adding it here for more common code, it should probably > reside in the ntb_hw_*.c files to enforce the hw specific code all > reside in that layer. So, this probably needs to be replaced with a > patch which adds the setting of the mask to the switchtec driver. I disagree strongly. You can tell it's not device specific seeing we have 4 devices that need the exact same code. In fact, there is nothing device specific in those lines of code as the device specific part comes when a driver sets the PCI parent device's DMA mask. These lines just initialize the dma_mask for the new NTB device with its parent's mask. This is just sensible given that nothing now works if it is not done and trusting driver writers to get it right is not a good idea seeing we already screwed it up once. Furthermore, it violates DRY (do not repeat yourself). If there is something driver specific that must be done (although I can't actually imagine what this would be) the drivers are free to change the mask after calling ntb_register but getting the common case setup in common code is just good design. Logan