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=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 47A76C4724C for ; Fri, 1 May 2020 19:01:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F3605216FD for ; Fri, 1 May 2020 19:01:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UntPIa0C" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3605216FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8FC8F8E0005; Fri, 1 May 2020 15:01:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8855D8E0001; Fri, 1 May 2020 15:01:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 725948E0005; Fri, 1 May 2020 15:01:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0166.hostedemail.com [216.40.44.166]) by kanga.kvack.org (Postfix) with ESMTP id 559798E0001 for ; Fri, 1 May 2020 15:01:52 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 1295D181AEF07 for ; Fri, 1 May 2020 19:01:52 +0000 (UTC) X-FDA: 76769069664.08.sort20_678f287fee43c X-HE-Tag: sort20_678f287fee43c X-Filterd-Recvd-Size: 6770 Received: from mail-oi1-f194.google.com (mail-oi1-f194.google.com [209.85.167.194]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Fri, 1 May 2020 19:01:51 +0000 (UTC) Received: by mail-oi1-f194.google.com with SMTP id t199so578239oif.7 for ; Fri, 01 May 2020 12:01:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LMHcXNrz3zhrHnqit232OJlMzuARuHoUe7nsiYDOkco=; b=UntPIa0Cvl/kGm1Feg2IwMKj/LyidTxG24GKd+jWt7NC0FWh32Mo+L7v/raeC6ovRf ADYVNuFPCd+kiw17nIQhzCbWAVAukYbQ+8UmP+ySXXb2ziBYjBruuXz+8O0yFE+gBjpE zkeFaW/GLk8b2Lz5UX5r5JfawXzw+4HhNTZtEQgpRPA97wluyD/i17WepzTgof+gACX9 n5n4GewjabnbZRDxX6DKw4084Q4FcSuexAMrnh6DZQ4QRsFyoQaBLXWdpNkv2QfdjXWi B9qn836vftMISEpaE1gzPC8ddaRZgavhorj7xAbff9tWbwKlIyEMQlabcYNnOwDE4YZ8 qklA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LMHcXNrz3zhrHnqit232OJlMzuARuHoUe7nsiYDOkco=; b=t8aG4lsron3t1QptkYhAi7aSlmGvz03JcCu84O1UHTv0cVG3kvXh83KQr3IfZFk3+r 2DWWxvynFOK168+KpETPCxFCyZQNZ0YD9iGgVZwUemjya6Pvdwmri7BYXdPqw6tQH2O4 vORGcU6pX/vh/Dd2OqmSpLXemKFYsppcZxbsQRp2IeLvmBrIsu5/pmKgTRlE5F3pmCoa 6xpPheeeIufHSA9ixtz2kvbP5xZ7kiw9IlyWOhbyEFjkqk1LprATki+IfEOwd2+QBEQ6 apFhRjMcPolmGeGPDuMVSE8ta2UQMuxlgFq2AQB86olSpjgPDGOFqXjN76UyEizQpi+j dl6A== X-Gm-Message-State: AGi0PuYCMCMWXtEHSxoAGQKxrWp5iPock7Cj9/z9zl3l6u4U/HW+IBBU MprPj+dJ5y3iCyidTLbfd0MipD6eLAptiz/hxM0KvA== X-Google-Smtp-Source: APiQypJYvqKKFvfOFQUK1ntLEscYvQrHeBF7fGsVt3flNjLdjYuuXkdbUHFmseAznhnmIL+vzVVh7igl6t18YXGu6mU= X-Received: by 2002:a54:4f02:: with SMTP id e2mr838335oiy.10.1588359710953; Fri, 01 May 2020 12:01:50 -0700 (PDT) MIME-Version: 1.0 References: <20200501073949.120396-1-john.stultz@linaro.org> <20200501073949.120396-4-john.stultz@linaro.org> <20200501102143.xcckvsfecumbei3c@DESKTOP-E1NTVVP.localdomain> <47e7eded-7240-887a-39e1-97c55bf752e7@arm.com> In-Reply-To: <47e7eded-7240-887a-39e1-97c55bf752e7@arm.com> From: John Stultz Date: Fri, 1 May 2020 12:01:40 -0700 Message-ID: Subject: Re: [RFC][PATCH 3/4] dma-buf: cma_heap: Extend logic to export CMA regions tagged with "linux,cma-heap" To: Robin Murphy Cc: Brian Starkey , lkml , Rob Herring , Sumit Semwal , "Andrew F. Davis" , Benjamin Gaignard , Liam Mark , Pratik Patel , Laura Abbott , Chenbo Feng , Alistair Strachan , Sandeep Patil , Hridya Valsaraju , Christoph Hellwig , Marek Szyprowski , Andrew Morton , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , dri-devel , linux-mm , nd Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, May 1, 2020 at 4:08 AM Robin Murphy wrote: > > On 2020-05-01 11:21 am, Brian Starkey wrote: > > Hi John, > > > > On Fri, May 01, 2020 at 07:39:48AM +0000, John Stultz wrote: > >> This patch reworks the cma_heap initialization so that > >> we expose both the default CMA region and any CMA regions > >> tagged with "linux,cma-heap" in the device-tree. > >> > >> Cc: Rob Herring > >> Cc: Sumit Semwal > >> Cc: "Andrew F. Davis" > >> Cc: Benjamin Gaignard > >> Cc: Liam Mark > >> Cc: Pratik Patel > >> Cc: Laura Abbott > >> Cc: Brian Starkey > >> Cc: Chenbo Feng > >> Cc: Alistair Strachan > >> Cc: Sandeep Patil > >> Cc: Hridya Valsaraju > >> Cc: Christoph Hellwig > >> Cc: Marek Szyprowski > >> Cc: Robin Murphy > >> Cc: Andrew Morton > >> Cc: devicetree@vger.kernel.org > >> Cc: dri-devel@lists.freedesktop.org > >> Cc: linux-mm@kvack.org > >> Signed-off-by: John Stultz > >> --- > >> drivers/dma-buf/heaps/cma_heap.c | 18 +++++++++--------- > >> 1 file changed, 9 insertions(+), 9 deletions(-) > >> > >> diff --git a/drivers/dma-buf/heaps/cma_heap.c b/drivers/dma-buf/heaps/cma_heap.c > >> index 626cf7fd033a..dd154e2db101 100644 > >> --- a/drivers/dma-buf/heaps/cma_heap.c > >> +++ b/drivers/dma-buf/heaps/cma_heap.c > >> @@ -141,6 +141,11 @@ static int __add_cma_heap(struct cma *cma, void *data) > >> { > >> struct cma_heap *cma_heap; > >> struct dma_heap_export_info exp_info; > >> + struct cma *default_cma = dev_get_cma_area(NULL); > >> + > >> + /* We only add the default heap and explicitly tagged heaps */ > >> + if (cma != default_cma && !cma_dma_heap_enabled(cma)) > >> + return 0; > > > > Thinking about the pl111 thread[1], I'm wondering if we should also > > let drivers call this directly to expose their CMA pools, even if they > > aren't tagged for dma-heaps in DT. But perhaps that's too close to > > policy. > > That sounds much like what my first thoughts were - apologies if I'm > wildly off-base here, but as far as I understand: > > - Device drivers know whether they have their own "memory-region" or not. > - Device drivers already have to do *something* to participate in dma-buf. > - Device drivers know best how they make use of both the above. > - Therefore couldn't it be left to drivers to choose whether to register > their CMA regions as heaps, without having to mess with DT at all? I guess I'm not opposed to this. But I guess I'd like to see some more details? You're thinking the pl111 driver would add the "memory-region" node itself? Assuming that's the case, my only worry is what if that memory-region node isn't a CMA area, but instead something like a carveout? Does the driver need to parse enough of the dt to figure out where to register the region as a heap? thanks -john