From patchwork Tue Aug 28 08:44:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 145300 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp927510ljw; Tue, 28 Aug 2018 01:44:54 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYLsolTsB7AN1pJLxhZPstgqGKLBqB1iztDryudqKtcZZYE5vfLisAGTn+8atLUtWIVLJk3 X-Received: by 2002:a17:902:b491:: with SMTP id y17-v6mr593705plr.160.1535445894089; Tue, 28 Aug 2018 01:44:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535445894; cv=none; d=google.com; s=arc-20160816; b=ne6MGFbSI4WnOfFerIFpLKsXOgkLMBnDp3JZCylaxZbMgo5TpzGBli0CKpVldB6L/4 ScsnVesY9DHA1bq7mXhUPtwETkxJTARDFun7RMSMU/wpAKtCwM3ZPB/434VS0SsOR6eG /fSyFAcdGCVTzk9rB34yE7S/zI7w3U+obflPrl44DrKEN0GSLMLbaCzxTpFc56W7sjkK 4MmQKrAcbRh7eVNZTp9gkKOiVP1W9NvYFLz4F95Ry9pyazI+xz2uLUPXOfdWpvnAQnkW m8BF5+VXU0/l4exSqhDrnYU2FcAcbj6KADam9vy9LFCv5tXvFvZ2Lh4D5/UgZQstbknk W5/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:message-id:date:subject:to:from :delivered-to:arc-authentication-results; bh=5M8pHWwQ3DZZxFOqH6t2R82xdw/fui+tRPJsDIkAfIY=; b=DtxbwyuLMSTL8IJ2So6v45TdsEJzWUrZ7NQBsnok6t6HHmjVXfDZcBR3eHkm9udANv Rpk5mkz1oW3G6VpeeVC/i/FTjoPhwSkgyD4PTy0nwH8MFaKYm8OQ4JwMtyNLaK/WGRvq VSXjHynozVD+gh/KQ6L6GlJvvl/uULRjqrc4rPPA5GrJNNt6lAJkwrOorHsmzv+UvlCO 7TJQTLIGbqASA2ctuOaVCIdw2xjiIVi4aY/lDaSbMk+e5uRtTP5yC693p3u97BK3ADiE 12bAjlPTZsgjAbJdipK+zCE2F6CmLRrGFDCvxtdARi2ikKckyiNqhGUPoZowSeluBCB8 /epA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id b2-v6si521235pgc.541.2018.08.28.01.44.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Aug 2018 01:44:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6D4F36E32A; Tue, 28 Aug 2018 08:44:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by gabe.freedesktop.org (Postfix) with ESMTPS id A206C6E32A for ; Tue, 28 Aug 2018 08:44:51 +0000 (UTC) Received: by mail-lf1-x142.google.com with SMTP id i7-v6so696412lfh.5 for ; Tue, 28 Aug 2018 01:44:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DH0VeF1CCV6x0r/23lK4YuefgkYnsYHLg2X0nKjGmoQ=; b=cXZvQKdyKTrM3ZD6QOOERr4DFhec0LyNM4JRDG6/3Y2jrpR1FDTdwZyrnx5ecvobv1 N9Hkp8qkhxnFUfEKTeB9pT9tGb987mXvgNWm1MqRqoBugEPHUjohB0ZT5L0q6jIvyvYH TpilxCxAKEACp6Uu3bSDKMiI1ETTeHbPWVQ9+2AykQa1WCuIbRTf4qwo5KEQXuBZJvMM +MryVYx73GxfWQYaKhkjgmy+dKRlMXuooUdD7VTFXYjacTSqCr09caPIAgWi5H9bLsbU LxNqsyiKdjcbveK0NajjvVtf46l6S5SeapVnLNw12w/p9JgA71UZnCyb/Bctuhdbur6F Jjsw== X-Gm-Message-State: APzg51Cmi3bJFWVxOkw7ordGEiM70+3ZKCg2NBlIocEwQ5oGtuXOOi3N eCDAxOXh/wyjFaxxSqWjGMdzQA== X-Received: by 2002:a19:db94:: with SMTP id t20-v6mr534473lfi.126.1535445890071; Tue, 28 Aug 2018 01:44:50 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id n22-v6sm94248lfh.59.2018.08.28.01.44.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Aug 2018 01:44:48 -0700 (PDT) From: Linus Walleij To: Christoph Hellwig , Marek Szyprowski , Robin Murphy Subject: [PATCH] of/platform: Initialise AMBA default DMA masks Date: Tue, 28 Aug 2018 10:44:42 +0200 Message-Id: <20180828084442.30176-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" commit a5516219b102 ("of/platform: Initialise default DMA masks") sets up the coherent_dma_mask of platform devices created from the device tree, but fails to do the same for AMBA (PrimeCell) devices. This leads to a regression in kernel v4.19-rc1 triggering the WARN_ONCE() in kernel/dma/coherent.c, dma_alloc_attrs() WARN_ON_ONCE(dev && !dev->coherent_dma_mask): ------------[ cut here ]------------ WARNING: CPU: 0 PID: 1 at ../include/linux/dma-mapping.h:522 drm_gem_cma_create+0x1dc/0x21c Modules linked in: CPU: 0 PID: 1 Comm: swapper Not tainted 4.19.0-rc1+ #15 Hardware name: ARM-Versatile (Device Tree Support) [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (__warn+0xcc/0xf4) [] (__warn) from [] (warn_slowpath_null+0x3c/0x48) [] (warn_slowpath_null) from [] (drm_gem_cma_create+0x1dc/0x21c) [] (drm_gem_cma_create) from [] (drm_gem_cma_dumb_create+0x44/0x98) [] (drm_gem_cma_dumb_create) from [] (drm_client_framebuffer_create+0x80/0x204) [] (drm_client_framebuffer_create) from [] (drm_fb_helper_generic_probe+0x4c/0x200) [] (drm_fb_helper_generic_probe) from [] (__drm_fb_helper_initial_config_and_unlock+0x1cc/0x454) [] (__drm_fb_helper_initial_config_and_unlock) from [] (drm_fb_helper_fbdev_setup+0x104/0x218) [] (drm_fb_helper_fbdev_setup) from [] (drm_fbdev_cma_init+0x7c/0xac) [] (drm_fbdev_cma_init) from [] (drm_fb_cma_fbdev_init+0x8/0x14) [] (drm_fb_cma_fbdev_init) from [] (pl111_amba_probe+0x3c8/0x4a4) [] (pl111_amba_probe) from [] (amba_probe+0xd8/0x154) [] (amba_probe) from [] (really_probe+0x200/0x2ac) [] (really_probe) from [] (driver_probe_device+0x5c/0x168) [] (driver_probe_device) from [] (__driver_attach+0xd0/0xd4) [] (__driver_attach) from [] (bus_for_each_dev+0x70/0xb4) [] (bus_for_each_dev) from [] (bus_add_driver+0x170/0x204) [] (bus_add_driver) from [] (driver_register+0x74/0x108) [] (driver_register) from [] (do_one_initcall+0x48/0x1a0) [] (do_one_initcall) from [] (kernel_init_freeable+0x104/0x1c4) [] (kernel_init_freeable) from [] (kernel_init+0x8/0xf0) [] (kernel_init) from [] (ret_from_fork+0x14/0x34) Exception stack(0xc781ffb0 to 0xc781fff8) ffa0: 00000000 00000000 00000000 00000000 ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 ---[ end trace 2dc47eb796bde006 ]--- This regresses the PL111 DRM driver in drivers/gpu/drm/pl111 that uses the AMBA PrimeCell to instantiate the frame buffer device, as it cannot allocate a chunk of coherent memory anymore due to the missing mask. Fixes: a5516219b102 ("of/platform: Initialise default DMA masks") Cc: Robin Murphy Cc: Rob Herring Cc: Christoph Hellwig Cc: Eric Anholt Cc: Noralf Trønnes Signed-off-by: Linus Walleij --- I don't know which tree Robins patch came in from, but I assume Christoph's, so can you carry this patch as well? --- drivers/of/platform.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 7ba90c290a42..7435c79ca56d 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -242,6 +242,9 @@ static struct amba_device *of_amba_device_create(struct device_node *node, goto err_clear_flag; /* setup generic device info */ + dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); + if (!dev->dev.dma_mask) + dev->dev.dma_mask = &dev->dev.coherent_dma_mask; dev->dev.of_node = of_node_get(node); dev->dev.fwnode = &node->fwnode; dev->dev.parent = parent ? : &platform_bus;