From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 883CDC43603 for ; Tue, 17 Dec 2019 01:12:45 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 51806206E6 for ; Tue, 17 Dec 2019 01:12:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KOJWiM6p"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Ud8Pp6GN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 51806206E6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jZsEz2x/kJrT3ZuJH1S+tiNCykfGfChBRcoPZwH/gO4=; b=KOJWiM6pR3YwgQ bMvP0Mx44agTVIlxeNC0WUN2oRlHOjIvBJYnRH1JZnLTgh+02w7iWhy3dIcosMXF278wyBSKuKIuf kzcMv+jSrIEQCuMmNjZUZm8ZEnj+tMsjCsm4inOZr9BqV8LP4jQzTDJn7ZjsrwIn0RXfMo3n/UEKB 8IF6DPAIr2W7YK8dGAZ84wb/V62ibNVGls4hGl+TUeofE3iIYwNOKkwfwMS9cXJq0jzXMGS2owLhL 2Sk9Y+e+N5yTjBef8HUJf8S03gsjbhfqEUsYEZlUW3HPkiZhzrqaORcNKOjr2TBcxfqnoXzR6vEFJ h7e20nliqZq35hqUMd0w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ih1Po-0000h5-C2; Tue, 17 Dec 2019 01:12:44 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ih1Pl-0000fW-8R; Tue, 17 Dec 2019 01:12:43 +0000 Received: from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 93CEC9C5; Tue, 17 Dec 2019 02:12:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1576545147; bh=KcjcirugnejZF/v8qYCaUPEjRMBZVSzSBT527du65ro=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ud8Pp6GNKk4VcnODZGhTIPdvic9f0EE0uzu/AAfk2bEcRKWujIP+SVNygSd9k21Gb DVO6vq1bgcVLDVrJXIgx0bDBc93dTNvbxS9tvJFvDxOuW3JTGYv0dIsw5Z0diCsI6L 9RMPQHAJ8kEN1Gd9ZH6orkpF5w+Ad7q9Pquc6Yuo= Date: Tue, 17 Dec 2019 03:12:15 +0200 From: Laurent Pinchart To: Rob Herring Subject: Re: [PATCH 5/6] drm/mediatek: Convert to use CMA helpers Message-ID: <20191217011215.GM4856@pendragon.ideasonboard.com> References: <20191021214550.1461-1-robh@kernel.org> <20191021214550.1461-6-robh@kernel.org> <1cbca96c-19dd-1d15-949c-7fbcc15369b4@gmail.com> <1571864784.19128.8.camel@mtksdaap41> <1571900577.27203.6.camel@mtksdaap41> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1571900577.27203.6.camel@mtksdaap41> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191216_171241_605458_033A6210 X-CRM114-Status: GOOD ( 26.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko =?utf-8?Q?St=C3=BCbner?= , Neil Armstrong , David Airlie , Liviu Dudau , Daniel Kurtz , Sandy Huang , Benjamin Gaignard , Yannick Fertre , Nicolas Boichat , Kevin Hilman , Xinwei Kong , Xinliang Liu , "open list:ARM/Rockchip SoC..." , Chen-Yu Tsai , Noralf =?utf-8?Q?Tr=C3=B8nnes?= , "James \(Qian\) Wang" , CK Hu , Philipp Zabel , Ulrich Hecht , Alexandre Torgue , Chen Feng , Maarten Lankhorst , Maxime Ripard , "moderated list:ARM/Mediatek SoC support" , dri-devel , Matthias Brugger , Daniel Vetter , Sean Paul , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , Philippe Cornu , Vincent Abriou , Kieran Bingham , Maxime Coquelin , Rongrong Zou Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Rob, On Thu, Oct 24, 2019 at 03:02:57PM +0800, CK Hu wrote: > On Wed, 2019-10-23 at 17:56 -0500, Rob Herring wrote: > > On Wed, Oct 23, 2019 at 4:06 PM CK Hu wrote: > > > On Wed, 2019-10-23 at 12:42 -0500, Rob Herring wrote: > > > > On Tue, Oct 22, 2019 at 12:07 PM Matthias Brugger wrote: > > > > > On 21/10/2019 23:45, Rob Herring wrote: > > > > > > The only reason the Mediatek driver doesn't use the CMA helpers is it > > > > > > sets DMA_ATTR_NO_KERNEL_MAPPING and does a vmap() on demand. Using > > > > > > vmap() is not even guaranteed to work as DMA buffers may not have a > > > > > > struct page. Now that the CMA helpers support setting > > > > > > DMA_ATTR_NO_KERNEL_MAPPING as needed or not, convert Mediatek driver to > > > > > > use CMA helpers. > > > > > > > > > > > > Cc: CK Hu > > > > > > Cc: Philipp Zabel > > > > > > Cc: David Airlie > > > > > > Cc: Daniel Vetter > > > > > > Cc: Matthias Brugger > > > > > > Cc: linux-arm-kernel@lists.infradead.org > > > > > > Cc: linux-mediatek@lists.infradead.org > > > > > > Signed-off-by: Rob Herring > > > > > > --- > > > > > > > > > > I tested this on my Chromebook with some patches on top of v5.4-rc1 [1], which > > > > > work. If I add your patches on top of that, the system does not boot up. > > > > > Unfortunately I don't have a serial console, so I wasn't able to see if there is > > > > > any error message. > > > > > > > > Thanks for testing. I'm based on drm-misc-next, but don't see anything > > > > obvious there that would matter. There are some mmap changes, but I > > > > think they shouldn't matter. > > > > > > > > Did you have fbcon enabled? That may give more clues about where the problem is. > > > > > > There are priv->dma_dev for dma device, but it is not drm device. In > > > mt8173.dtsi [1], there are mmsys device and ovl device, mmsys device is > > > drm device and ovl device is mmsys's sub device which provide dma > > > function, so ovl is the priv->dma_dev. I think your patch directly use > > > drm device for dma operation and this would cause dma function fail. > > > Please use priv->dma_dev for dma operation. > > > > Right, thanks for catching that. Either we'll need to make CMA GEM > > object have a struct device ptr or adjust the drm_device.dev to have > > the necessary DMA setup. > > > > One question though, why do you use CMA when you have an IOMMU? That's > > not optimal as CMA size may be limited. Or you don't always have an > > IOMMU? Please note that the DRM GEM CMA helpers are misnamed, they use the DMA coherent allocation API, and thus don't use CMA if the device is backed by an IOMMU. They should really have been named DRM GEM DMA helpers. > For all upstreamed mediatek SoC, all has IOMMU, so it does not need CMA. > I think we use CMA just because we refer to other drm driver to > implement mediatek drm driver and we misused CMA helper function but it > works. I think we should change to more accurate implementation. If you > want, you could modify it in this series. > -- Regards, Laurent Pinchart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel