Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2962947imm; Mon, 28 May 2018 21:04:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqGNqssh53y65yN25MhpRyOqhJnODsYCLcr4n9YqLyxvHGQA/XvS63pBO/HiOjGTIvh1Kvg X-Received: by 2002:aa7:864d:: with SMTP id a13-v6mr15904891pfo.199.1527566654335; Mon, 28 May 2018 21:04:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527566654; cv=none; d=google.com; s=arc-20160816; b=Vo/91VTXgUiX/vve6SVZCNL4Y6nyGeorLfd90lhAJng/IBsQXDyIo+ObdU5QpSV9ei 0ZRpSzgBxZK/ri1tMkuG8MX/BG+rMSAVvz2HBO4qCqJ8vD4xoZi2lDU014gsEqLwhm0r xNYGLqybRu60Ct4gp+Pd+LfxaRkNCCz55VQlLLf0FDigQdjD0vRkXIyd2pOPlGE6J/5t sCuHYQLh6TPB3Tx044h+QYR3DCxMBx3WmF2UGDnY1a372UPdnITvHrFOnwAT0rX2lqVL TNk49NwHkQNsbPi3PsOwNeVWV4S68FGHWzJ7shPs49UhW+M07hPtaEby64LSWYFR87/I wCkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date:arc-authentication-results; bh=XE8mj6jwZefU+ZkDQiWgMrANFfL/nKGcjDZiCRowp8E=; b=MGZebFIYV6PyStIPiSqyHWe302eqrvBwZJ0na/mkTA9qObBKnwJFStFTJRXDkL0Akc WQBxysgHUcQfS5r69MqhUUQrqJLhoLPImvscs1zgnwCsMjQdkx5ZUQbuBIV74u2pCIGI XVLxrCP4d/IrKRHIXLGF3WjqbYRHRx4WS6fUzKgkXEdRSsV4OoSsjFWk0ALPlH5HMrB8 egsKJgKGCBXOVSAtH8A1O1qY8+L2qiGFjOY+uWAhpNgA8lOJVmPQ28Uz2YLdQU1yQap4 LG6t8Ukph6opQZmIKFwi5qMfrG8zu1uNMGjITQnZ32H0KWMCb8LZfc3Qa6AVQZ3rORQt UIng== 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 1-v6si31020483plo.20.2018.05.28.21.03.59; Mon, 28 May 2018 21:04:14 -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 S1756094AbeE2CPD (ORCPT + 99 others); Mon, 28 May 2018 22:15:03 -0400 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:56986 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755922AbeE2CO7 (ORCPT ); Mon, 28 May 2018 22:14:59 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id DC1B423EB6; Mon, 28 May 2018 22:14:57 -0400 (EDT) Date: Tue, 29 May 2018 12:15:05 +1000 (AEST) From: Finn Thain To: Geert Uytterhoeven cc: Christoph Hellwig , Michael Schmitz , Guenter Roeck , Joshua Thompson , Greg Ungerer , linux-m68k , Linux Kernel Mailing List Subject: Re: [RFC PATCH] m68k: set dma and coherent masks for Macintosh SONIC based ethernet In-Reply-To: Message-ID: References: <1527378785-13326-1-git-send-email-linux@roeck-us.net> <55c1c33b-4a34-bd72-57de-577ce8d95e0b@gmail.com> <2ffd0de6-e8d6-6449-7c05-cbbfd8a99a97@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 28 May 2018, Geert Uytterhoeven wrote: > > Do we have a consensus on the way forward? My prefered solution remains the two driver patches that I originally submitted, which you objected to: https://lkml.org/lkml/2018/5/3/10 https://lkml.org/lkml/2018/5/3/9 So there is no consensus yet. To my mind, the existing code is pretty clear: drivers should set the (default) mask. See also, $ egrep -r -A1 "coherent_dma_mask.*expected" */ drivers/of/device.c: * Set default coherent_dma_mask to 32 bit. Drivers are expected to drivers/of/device.c- * setup the correct supported mask. -- drivers/acpi/arm64/iort.c: * Set default coherent_dma_mask to 32 bit. Drivers are expected to drivers/acpi/arm64/iort.c- * setup the correct supported mask. $ And drivers/usb/dwc2/platform.c: /* * Use reasonable defaults so platforms don't have to provide these. */ if (!dev->dev.dma_mask) dev->dev.dma_mask = &dev->dev.coherent_dma_mask; retval = dma_set_coherent_mask(&dev->dev, DMA_BIT_MASK(32)); And FWIW, $ egrep -wlr "dma_set_mask_and_coherent|dma_set_coherent_mask|dma_coerce_mask_and_coherent" drivers/ | wc -l 196 I suppose that a driver should avoid lengthening an existing device mask. Since an arch gets to apply limits in the dma ops it implements, why would arch code also have to set a limit in the form of default platform device masks? Powerpc seems to be the only arch that does this. The same line of reasoning suggests that the problematic WARN_ON should not appear in include/linux/ in the first place. If it is needed by certain architectures, it should be in arch/x. I would send a patch to revert commit 205e1b7f51e4 ("dma-mapping: warn when there is no coherent_dma_mask") if I thought that arch code was not somehow relying on it. But I'll leave that up to Chrisoph. --