Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp979491ybz; Fri, 1 May 2020 12:04:14 -0700 (PDT) X-Google-Smtp-Source: APiQypIT4lFHUvF3IJoYaeBop8hsx2c4l7kdakVtP4ll0zZqR7U+wyi9g9slOo8cHyrfrmkkswjB X-Received: by 2002:a17:907:4365:: with SMTP id nd5mr4343968ejb.231.1588359854798; Fri, 01 May 2020 12:04:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588359854; cv=none; d=google.com; s=arc-20160816; b=M3ntnG5IXo9MDtq0yn4nyLRdZXa/MDyQ97X9yLB6pGNkEkKq80xFkiavIVF9SAmUDy TLHKA9Bah89MufBLLINLrpt/6yKlFOhrjWne8FfPWXnILWk2uM8YbG18qlIsNDw2cPHT xi22XkKogq6cYRtPSNOnqQbmqbh9Sj4N/c9mAMdkxeLfDDSw8OhUl1p+mFq8X9GFYuEC AW6RvBC51krFCu8nE/Ebj/SX0zE7j4mz1BF4cOrvpmG6h/4q6o9FuyWW4KNDm/CiBrHS heCUzBhwTGcYXy4aTeX30W9PsWOc0Y007aRpeXi+wwfAPSJc2EMpS8gCMRye52IUbone hpOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=LMHcXNrz3zhrHnqit232OJlMzuARuHoUe7nsiYDOkco=; b=XEPD+Ee5FfYBwX6/DozNF0bor4RvKIoilMtsH7++XbvJ+i1JsvSVm3QjGRNMkfsxLB 8zhk3cEzcqoFcP9twGqs+qikKTqYzbm4KNbtSrOk6HyRw4WzwDPVeAktqZhiUpg/LFT6 K5mJ9bGjnAfCO/qWiLo+zxObaUDCMY5RyQFGOz6kkNs08BsJuaJ3y3UuHcCL4ytg8bjb YovsiJLMSzp7wuQjwkvs99cebLdkDfjzB9g5Hpc2gWsSZx/iA+cc57hKIGYCyc4iwEDG 0KQNtDuP1uKbZGIJLXWPWtP9hgQBrOE3jQvfhlkm5mVhq0M7/N1CAcFs9Wc0iUYdGWr5 Zd+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UntPIa0C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rv13si2292430ejb.115.2020.05.01.12.03.39; Fri, 01 May 2020 12:04:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UntPIa0C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730439AbgEATBx (ORCPT + 99 others); Fri, 1 May 2020 15:01:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729766AbgEATBw (ORCPT ); Fri, 1 May 2020 15:01:52 -0400 Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 861B0C061A0C for ; Fri, 1 May 2020 12:01:51 -0700 (PDT) Received: by mail-oi1-x244.google.com with SMTP id c124so547916oib.13 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=C1i6XdpelA27iVrYS2VzIaJceG6/Y1zuNyIdri5uoJrSwA2Hfjs4SS2wzhXCiFlT1t aaIpGilxZlfYl4ehBLuflatTX0c1Eh3TTJE2wSXJHF+ItjOShEAKL584Z84zp+LjGki/ D5DdnlrjNYOxpPB+/ggVVA1vpapCyNHy2dGEQ+r99NGxojE1bhDo1Hv21y2v5fc4WLvL 8CRgPGiYt7cpwAzRT0HFR3FwicPooVe17UANtX2dEhrcrQnIMO/DF61kBS2suQk87/aN t5y9VxNh78NNEPlH2TpYJ5fOsB7vdD0iY0i9ARwmEt9Uv2c1PhKPeg8jXECn6CpMeSdE iLGw== X-Gm-Message-State: AGi0PuYv2cvtBOUoojRlh8YfatpQIWr/eeQNErMYHUecyv2UUSMpqMEB sSKjVEj8pTRMG97+3JRmcxqMceiZ7svEzDyfrnv5Cg== 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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