Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6047847imm; Mon, 27 Aug 2018 08:48:10 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYmgb8oVXn94XPYNf9i4S0HwMJKyAX0d1lp+BYb1DQPxTUbITXHKUeggNjhTYviieTJW/05 X-Received: by 2002:a63:f657:: with SMTP id u23-v6mr12906002pgj.258.1535384890578; Mon, 27 Aug 2018 08:48:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535384890; cv=none; d=google.com; s=arc-20160816; b=gl8IgoaZqV08B3JtVbFNQ8BDocJn7jfCZiaIJ9VK0zOQllaYXP65/LHvAuR9qkfNgF DjLadOO1tOwmZlwihltBX8sXUG0JPTuekM4U9qFfLz1iY81h8g//RdTR90SF49fuGpX0 S34bVMFUSc+K7nlZUNcYLRVkrNJM3buGyGScm5MuIqmngVUYfXvAYEeDWA6UaziZW6Zy +tKFB84JcIH1c9b1evDNSeGwkOgqRtMqvzvhUFwzsxBBiATOEa10uV+Zpvnz9gOJe7VJ oLkej9EXiK6dnXh5sRFH1W4dGR9dvNH5hna903c9BBP8P63UVb267EB8+Rv0ZngpubSL Q4xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=iCSgrku7GDEzBGEGt4+edCgv0+exeZofv0v+E1v0fxU=; b=sEfBH8AX5teyN07V4mZBaE2j5nLqQXHAsb2JT/PT9yZFDHBa/Sdzngxdtdhe4HIWYT LoHe5jbdV6wvpuNlNdquLFH7h59MzYEGThXyzeKjheykQK3R018Hkc7rSJShRDLOM4Pe 9NU2pvyglJrk5kFw3eBvjMoa/j7eB8NfyPuOw9/9jXwan9h+tzddQV7WCFkOCKe/GyJe +b8cz6DClOMq80yf4z267aLBuWVB8ibxXnEqqgvVBHwEQvTKiK3sObpvbzVDV0qEd1Ty 2v6smMEgJjV/A85LafEQeR6T1BK61TC/AUSiviLfIjFUivOvLzp5MiG2Bo9ruqXW3cgR uyUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=MI+1Cx6w; 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 e185-v6si14525083pgc.318.2018.08.27.08.47.55; Mon, 27 Aug 2018 08:48:10 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=MI+1Cx6w; 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 S1727201AbeH0Tdv (ORCPT + 99 others); Mon, 27 Aug 2018 15:33:51 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:56632 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727026AbeH0Tdv (ORCPT ); Mon, 27 Aug 2018 15:33:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=iCSgrku7GDEzBGEGt4+edCgv0+exeZofv0v+E1v0fxU=; b=MI+1Cx6wXFRLoOz+r6LtItZbU V75rqeaQA6W3348YPNQOVs+vZktMs2ElOpqfm1nNeeIAJPBzW0fnKeYjqhat2JxtVV/A2Df/ljb7k 1uH687CFbQ1IOkT8UNVMbZcNXQVzbD6SlyDODA0sOMI4UO4ZU/v4xA8LnTbkWrCpbYs9E+NAdQdT9 AYd2nYpP8pA0++RM0xeNN7uyH+T3qg76l4PZ4KswehmhFK2no0omYbwjtqqB0PK0I0IOm5AC9yEmC oBQaK9bA12qx9A+D6gYLgfUa49HZJhmWrf5xBYg+i3NHBUF6E+USLmuvBp/WgG4PG58OsXJ1fzXV+ qoQMdyULA==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fuJiz-0006iE-Bs; Mon, 27 Aug 2018 15:46:41 +0000 Date: Mon, 27 Aug 2018 08:46:41 -0700 From: Christoph Hellwig To: Guenter Roeck Cc: Linus Torvalds , Linux Kernel Mailing List Subject: Re: Linux 4.19-rc1 Message-ID: <20180827154641.GA17201@infradead.org> References: <20180827134459.GA16094@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180827134459.GA16094@roeck-us.net> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > sparc: > > WARNING: CPU: 0 PID: 1 at ./include/linux/dma-mapping.h:516 esp_sbus_probe+0x408/0x6e8 > WARNING: CPU: 0 PID: 1 at ./include/linux/dma-mapping.h:516 sparc_lance_probe_one+0x428/0x4f > > Missing initialization of coherent_dma_mask in the respective drivers. > > --- > Each platform driver instantiated through a devicetree node now generates > the following warning: > > esp ffd38e00: DMA mask not set > > It isn't a traceback so it may fly under the radar. There is nothing the > drivers can do about it; the message is generated by the core before the > driver probe function is called. No idea what a correct fix might be. Both of these should probably be fixed by something like the patch below: --- From 6294e0e330851ee06e66ab85b348f1d92d375d7a Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Mon, 27 Aug 2018 17:23:24 +0200 Subject: driver core: initialize a default DMA mask for platform device We still treat devices without a DMA mask as defaulting to 32-bits for both mask, but a few releases ago we've started warning about such cases, as they require special cases to work around this sloppyness. Add a dma_mask field to struct platform_object so that we can initialize the dma_mask pointer in struct device and initialize both masks to 32-bits by default. Architectures can still override this in arch_setup_pdev_archdata if needed. Note that the code looks a little odd with the various conditionals because we have to support platform_device structures that are statically allocated. Signed-off-by: Christoph Hellwig --- drivers/base/platform.c | 15 +++++++++++++-- include/linux/platform_device.h | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/base/platform.c b/drivers/base/platform.c index dff82a3c2caa..baf4b06cf2d9 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -225,6 +225,17 @@ struct platform_object { char name[]; }; +static void setup_pdev_archdata(struct platform_device *pdev) +{ + if (!pdev->dev.coherent_dma_mask) + pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); + if (!pdev->dma_mask) + pdev->dma_mask = DMA_BIT_MASK(32); + if (!pdev->dev.dma_mask) + pdev->dev.dma_mask = &pdev->dma_mask; + arch_setup_pdev_archdata(pdev); +}; + /** * platform_device_put - destroy a platform device * @pdev: platform device to free @@ -271,7 +282,7 @@ struct platform_device *platform_device_alloc(const char *name, int id) pa->pdev.id = id; device_initialize(&pa->pdev.dev); pa->pdev.dev.release = platform_device_release; - arch_setup_pdev_archdata(&pa->pdev); + setup_pdev_archdata(&pa->pdev); } return pa ? &pa->pdev : NULL; @@ -472,7 +483,7 @@ EXPORT_SYMBOL_GPL(platform_device_del); int platform_device_register(struct platform_device *pdev) { device_initialize(&pdev->dev); - arch_setup_pdev_archdata(pdev); + setup_pdev_archdata(pdev); return platform_device_add(pdev); } EXPORT_SYMBOL_GPL(platform_device_register); diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 1a9f38f27f65..d84ec1de6022 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -25,6 +25,7 @@ struct platform_device { int id; bool id_auto; struct device dev; + dma_addr_t dma_mask; u32 num_resources; struct resource *resource; -- 2.18.0