Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp224105imm; Thu, 10 May 2018 19:12:26 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrYgyzU8AYSByTGdrzjBmyfhcQ8ra2p0aA1A8LyZMHd0aOKkRWsoqA1gSkuOgOXL3GRXArd X-Received: by 2002:a62:32c6:: with SMTP id y189-v6mr3531505pfy.241.1526004746905; Thu, 10 May 2018 19:12:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526004746; cv=none; d=google.com; s=arc-20160816; b=t7Dev5johrCbhbUU+c+YeIfuHLbSP+7zOysYs2+wYyq3MoDUvV7TR+vRHZQEgRpc5H 1gPy+aYmrFXNunrKLC0GRX4HKvC2pvnAU56Wu8lEOEdptpEnsH/e5AmvHiU+2oSooo4d kRbSe5AslR3v+2JkllBHTjpfSEQIcg70BQpbE1HzTDF2I8jb6w2RCutsZJ/qqxP+8fTn FUL3kaWNXJp0mFimtjv66n666wSb9fuDmp21p2XgdsijJEqRF40+3AD5VTmrTzsRHOk/ YyEyjwFhJUwAQLpRClsdpIejr6iLm9niIKTM9SWAtmXdCUd6RTohgXHC3+KuS8sPISks ZLXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=xrCPkNpJxn1u2i+/kWo9zBhzbs0cEENrgr1htf5Pt+M=; b=t0IOYM1K93mjeGdwrNC9BJGft+ijg+6z3GKm+1src2UGcVp0v8cSIlWvarSd228D5U gPFvD31bJDNo7rFKUCb82wWKN3Q+kZdXmAZVOCfCVHeYywUR4Ax6WiRMt/2AX9cVcnl0 1dvcZ5Dd9CNYrRKmOzam0YLIDKZgcNLKnxyPRsROtnwt+duhqw/Bs7cDbP6TM9nHYeYr O1LQZRvqrBDnNOUvIBww8Q8ll80lGwpa2rQFiaaE5xorKJVSAbBxKFLGZAypOLwdTF7C g0x5G5SAmeOQ9heyE83XW0VYjmaX8P4cSJz0Vpbl/T7wm42K5rXNbjDFVsWGjdkfD4BI xJMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CKUS5Hj0; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c21-v6si1470113pgw.657.2018.05.10.19.12.12; Thu, 10 May 2018 19:12:26 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CKUS5Hj0; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752062AbeEKCL6 (ORCPT + 99 others); Thu, 10 May 2018 22:11:58 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:41749 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750937AbeEKCLz (ORCPT ); Thu, 10 May 2018 22:11:55 -0400 Received: by mail-pl0-f65.google.com with SMTP id az12-v6so2370043plb.8; Thu, 10 May 2018 19:11:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xrCPkNpJxn1u2i+/kWo9zBhzbs0cEENrgr1htf5Pt+M=; b=CKUS5Hj0PciSKVBogYyyJ7IXctFzalfRhH9Fl/SoiRZA7SoJyoAfefv/DAL1X+pYjw zhwTduDmm6tPmwxLnzIsvCg+fw9iSWiseRFvJyi9HMUakbcUsNzwqy5OHVgz/gxDrGf4 6bxCLFK1rKWZthAyYKhZW3CPkHcRkYTtC2XyD+CZcH7ZaiLqGvO1vRRxcWHoaJZQgeJv e+u0ANoTk6UUR6MP7EAFkXLErk3kb6Bk3A8acFfjCUtBfO/Q9zkjhIw4Mq8uIuSu61+5 REagaikOnROzqXD6zJlLU2PQapvSjq+Hl+kAHsC4438ShBVvB98p8MtCH/sprLYo5hcm E3Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xrCPkNpJxn1u2i+/kWo9zBhzbs0cEENrgr1htf5Pt+M=; b=BSl/FYbd3/sFsr/fEXdrPD11kf6eRn2llzJpdf4PdgMSWO3bFgQYJstbKmYW4MRun5 n0C+7vbzGH2hLcix7WQUpOI5dA6fY+mTcWKryYNa30n5fM3slZnAXOnwYpeE/bQrLXVk /qNcrM6FUOM6lIvT1yJizxKIr4EXsx9QBsXWmm1mFB/7a5nhc62eLOCqLcGPiDl60I9N Eqtsw01OlKA639aiJ1XDjwmPr5ybnwdVJypsSgkUxOnxY4JZNQsYtoXZsuc3UD9kaHqf p1+B4LN47QefkifAxhI7U9cgR9Ocx74E+DAuXrpmGOK/VYjTcjwELPNEWlQ9rNee6hav 8hTg== X-Gm-Message-State: ALKqPwdwgNZvnBQy5oUKK+gMmmfa6YxnimV6HIl1cEPd5WhdEryuk0LV 0yVdFXT6o+T4mYyc2y4uIqgLltEqgogZwcgRip8= X-Received: by 2002:a17:902:566:: with SMTP id 93-v6mr3633028plf.327.1526004715393; Thu, 10 May 2018 19:11:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.183.5 with HTTP; Thu, 10 May 2018 19:11:54 -0700 (PDT) In-Reply-To: References: From: Michael Schmitz Date: Fri, 11 May 2018 14:11:54 +1200 Message-ID: Subject: Re: [PATCH net] macmace: Set platform device coherent_dma_mask To: Finn Thain Cc: Geert Uytterhoeven , "David S. Miller" , linux-m68k , netdev , Linux Kernel Mailing List , Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Finn, On Fri, May 11, 2018 at 11:55 AM, Finn Thain wrote: >> > What's worse, if you do pass a dma_mask in struct >> > platform_device_info, you end up with this problem in >> > platform_device_register_full(): >> > >> > if (pdevinfo->dma_mask) { >> > /* >> > * This memory isn't freed when the device is put, >> > * I don't have a nice idea for that though. Conceptually >> > * dma_mask in struct device should not be a pointer. >> > * See http://thread.gmane.org/gmane.linux.kernel.pci/9081 >> > */ >> > pdev->dev.dma_mask = >> > kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL); >> >> Maybe platform_device_register_full() should rather check whether >> dev.coherent_dma_mask is set, and make dev.dma_mask point to that? This >> is how we solved the warning issue for the Zorro bus devices... >> (8614f1b58bd0e920a5859464a500b93152c5f8b1) >> > > The claim in the comment above that a pointer is the wrong solution > suggests that your proposal won't get far. Also, your proposal doesn't I read the comment to be mostly concerned about not freeing memory, and attempted to address that. I won't pretend it's the right thing to do if the pointer will go away anyway, and I certainly won't submit a patch. Sorry for muddling the issue. > address the other issues I raised: a new > platform_device_register_simple_dma() API would only have two callers, and > the dma mask setup for device-tree probed platform devices is apparently a > work-in-progress (which I don't want to churn up). Yes, and that's why I would prefer your old patch handling this in the device driver (which Geert didn't like), or in the alternative to set the mask up when registering a device with its bus where appropriate. I concede this won't help with pure platform devices but as we can't test all these, we should leave the fix for platfoem devices up to Christoph. > >> > > With people setting the mask to kill the WARNING splat, this may >> > > become more common. >> > >> > Since the commit which introduced the WARNING, only commits f61e64310b75 >> > ("m68k: set dma and coherent masks for platform FEC ethernets") and >> > 7bcfab202ca7 ("powerpc/macio: set a proper dma_coherent_mask") seem to be >> > aimed at squelching that WARNING. >> > >> > (Am I missing any others?) >> >> Zorro devices :-) > > Right, I should add commit 55496d3fe2ac ("zorro: Set up z->dev.dma_mask > for the DMA API") to that list. > >> Which begs the question: why can' you set up all Nubus bus devices' DMA >> masks in nubus_device_register(), or nubus_add_board()? > > I am expecting to see the same WARNING from the nubus sonic driver but it > hasn't happened yet, so I don't have a patch for it yet. In anycase, the > nubus fix would be a lot like the zorro bus fix, so I don't see a problem. That's odd. But what I meant to say is that by setting up dma_coherent_mask in nubus_add_board(), and pointing dma_mask to that, ypu won't need any patches to Nubus device drivers. I must be missing something else... Cheers, Michael > > --