Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp544432imm; Fri, 11 May 2018 02:31:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrGIHl9f7VbIlhB92CnLjZFMWSHqwCWbTwMqMiLpwZ345YqZ+GZaBr6yT3UIGUDnMD/b6uw X-Received: by 2002:a63:507:: with SMTP id 7-v6mr3845647pgf.446.1526031068517; Fri, 11 May 2018 02:31:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526031068; cv=none; d=google.com; s=arc-20160816; b=dJODKxwcsj3HCR0NsdezxXrL67TnpsiFAoJLE7ciy4bOEgTo+PNR6FDRSk0tk3khja TwIT9KOJ2qTa7tvBMYQ1mv7GYJGpCce6im2Mhi2TNQ4LPPWqgteDpHAh7rnYMH68AY8e HHalzUoOQ/EzEyFRUAA4GlMq9ZoEM6dsYcykQkOzF48bAOl88rEizQX9tlsRA8O/dYhn GLeoI7W4Iisq8hHh15oBPDqsa1WC4EehrQS0r6e+wWR50exVhPC0K2WsxKvA+6gv/IWf YpcwNqJoMjeuu4+eAGgWNOWA9rkqVEeD8A5afvxwx3tlfueF7QIP4Enfvy/0VlQhBN+F m/sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature:arc-authentication-results; bh=itySaTjX+qyi97l1zT7w9M+vIM3BXTuO+V1VrqnERos=; b=B7NA68AzMl1m2W55l9ffvZr38fCioxOQauUvoG2HT2cXieg5oAQV9wilts6ormYz/s qjWwIXemUTt6MykgP0yOcml75OOiT68+dxtuSnd5Ds/fQvm5E/HEy0sNdwV1hhGwA8xI O4XL0mKcwiHIC/UtzyoQGerpvvQjU260zzQZMz2ROGS5iVtewsoBdU4fUPi7KwkGzGeG 7ozzILBrZt3t0iq+twhJTx8eoLZBOIOrprc2bXytkRQCvUlV2fLCqDll7GKuHRvpZeTn y8fl2lNxNzOJ+6z0a19QrMXKJ47CBAMojWOqTmWD3nodV9F0JxUdji33adSt5ryBfiOh EkWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jHDC/7CU; 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 e191-v6si2317288pgc.233.2018.05.11.02.30.53; Fri, 11 May 2018 02:31:08 -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=jHDC/7CU; 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 S1752685AbeEKJai (ORCPT + 99 others); Fri, 11 May 2018 05:30:38 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:39522 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752174AbeEKJaf (ORCPT ); Fri, 11 May 2018 05:30:35 -0400 Received: by mail-pf0-f196.google.com with SMTP id a22-v6so2456746pfn.6; Fri, 11 May 2018 02:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=itySaTjX+qyi97l1zT7w9M+vIM3BXTuO+V1VrqnERos=; b=jHDC/7CU2HfNXPFPWySXFP3fguGGDQX3b1d9KxE/lY3IwpB8N6FUQUz0s2GOdSSQ0N 8NMFIxlAOuIbVaAZ0If48ckuVRf9///4gtmS6P0B1hTRaOu6bYr90CcMh9eCwPt5/pbU OhJQD+USfsLBwrXEGr+tG9HJZYrqX+Ykdo0KSexjbKAwKK00ZVodB+t/aBBJVYUdK8yx PklJv7r/+4GzNVnZEzttrALl/kkqtpP3VTbU4+eAWI4Db7kFy+RsuEPyOn1UWcMgkxpG WRCH/GhtuSMiy93branu5UFohy/F6tYsIo4/kakU+IUC9P+GVjkKM6hQPryUd9t3Lr9m hZvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=itySaTjX+qyi97l1zT7w9M+vIM3BXTuO+V1VrqnERos=; b=oOtSSFmxthr1noBzI2nipFLI128qWl4tSOfuQzbJJiYPRcDLvgylqS4AdeEi518UAs 0lb6pRu9RGq5A1eIgukZsw9b/yGnGE8PQpsj7pM90JH+I6freaQrlZSBkX7GppNlHmUi t75C3YLxUmV30hj91a33RR5fpKFOkjGvridKeU1qia40uwiXkS3Wmz8mZQXnW2J4ZPK4 KdU1zHmfLf9YoSQ/gFsP9uqeNXyF71KzAExspU6LNYJS4JMpFeTaS2bwOBmoP0UvCQi2 y9EtK6XjT+50+qdu/vTUi9WsHvY32fqSEpVZsCT0KJ7YCXVDxEbdY0nLR1ANRDRwt+Yu 7ZxA== X-Gm-Message-State: ALKqPwdSp9GPgspuIXoqkU4pdnXUHegLmsMmTlBa1gg+ofNKgyAHRiQQ AAfyjwGrPKpgaqWo/iy/UrWhkA== X-Received: by 2002:a63:887:: with SMTP id 129-v6mr3802458pgi.17.1526031034989; Fri, 11 May 2018 02:30:34 -0700 (PDT) Received: from [192.168.1.101] (222-154-41-72-adsl.bb.spark.co.nz. [222.154.41.72]) by smtp.gmail.com with ESMTPSA id z13-v6sm8341021pfk.156.2018.05.11.02.30.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 May 2018 02:30:34 -0700 (PDT) Subject: Re: [PATCH net] macmace: Set platform device coherent_dma_mask To: Finn Thain , Geert Uytterhoeven References: <0b13a08d-ba2d-b9dc-4fd9-1f6bad5cd1ee@gmail.com> Cc: "David S. Miller" , linux-m68k , netdev , Linux Kernel Mailing List , Christoph Hellwig From: Michael Schmitz X-Enigmail-Draft-Status: N1110 Message-ID: <8c2c3ad5-eeb5-cf61-b9fb-c6096619e310@gmail.com> Date: Fri, 11 May 2018 21:30:26 +1200 User-Agent: Mozilla/5.0 (X11; Linux ppc; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Finn, Am 11.05.2018 um 17:28 schrieb Finn Thain: > On Fri, 11 May 2018, Michael Schmitz wrote: > >> >> I'm afraid using platform_device_register() (which you already use for >> the SCC devices) is the only option handling this on a per-device basis >> without touching platform core code, while at the same time keeping the >> DMA mask setup out of device drivers > > I don't think that will fly. If you call platform_device_register() and > follow that with a dma mask assignment, you could race with the bus > matching and driver probe, and we are back to the same WARNING message. I wasn't proposing to follow platform_device_register() with the mask assignment, but rather to use the same strategy from the Coldfire FEC patch (f61e64310b75): set pdev.dev.coherent_dma_mask and pdev.dev.dma_mask _before_ calling platform_device_register(). > If you want to use platform_device_register(), you'd have to implement > arch_setup_pdev_archdata() and use that to set up the dma mask. If you want to avoid the overhead of defining the macmace platform device and using platform_device_register() ... seeing as you would not be defining just the DMA mask and nothing else, that's probably the least effort for the MACE and SONIC drivers. >> (I can see Geert's point there - device driver code might be shared >> across implementations of the device on platforms with different DMA >> mask requirements,, something the driver can't be expected to know >> about). > > As I said, these drivers might be expected to be portable between Macs and > early PowerMacs, but the same dma mask would apply AFAIK. > > If a platform driver isn't expected to be portable, I think either method > is reasonable: arch_setup_pdev_archdata() or the method in the patch. > > Anyway, there is this in arch/powerpc/kernel/setup-common.c: > > void arch_setup_pdev_archdata(struct platform_device *pdev) > { > pdev->archdata.dma_mask = DMA_BIT_MASK(32); > pdev->dev.dma_mask = &pdev->archdata.dma_mask; > ... You would have to be careful not to overwrite a pdev->dev.dma_mask and pdev->dev.dma_coherent_mask that might have been set in a platform device passed via platform_device_register here. Coldfire is the only m68k platform currently using that, but there might be others in future. > I'm inclined to propose something similar for m68k. That should fix the > problem, since arch_setup_pdev_archdata() is already in the call chain: > > platform_device_register_simple() > platform_device_register_resndata() > platform_device_register_full() > platform_device_alloc() > arch_setup_pdev_archdata() > > Thoughts? Will this have nasty side effects for m68k platforms that use > smaller dma masks? These can still set a smaller mask in pdev->dev directly and use platform_device_register() instead. But I don't think there are smaller DMA masks used by m68k drivers that use the platform device mechanism at present. I've only looked at arch/m68k though. Cheers, Michael