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=-7.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 8804FC433DF for ; Fri, 21 Aug 2020 09:14:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6E14320732 for ; Fri, 21 Aug 2020 09:14:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728254AbgHUJOF (ORCPT ); Fri, 21 Aug 2020 05:14:05 -0400 Received: from mx.socionext.com ([202.248.49.38]:43523 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725855AbgHUJOE (ORCPT ); Fri, 21 Aug 2020 05:14:04 -0400 Received: from unknown (HELO kinkan-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 21 Aug 2020 18:14:02 +0900 Received: from mail.mfilter.local (m-filter-2 [10.213.24.62]) by kinkan-ex.css.socionext.com (Postfix) with ESMTP id 0634C18006E; Fri, 21 Aug 2020 18:14:03 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Fri, 21 Aug 2020 18:14:03 +0900 Received: from yuzu.css.socionext.com (yuzu [172.31.8.45]) by kinkan.css.socionext.com (Postfix) with ESMTP id BBB8B1A0508; Fri, 21 Aug 2020 18:14:02 +0900 (JST) Received: from [10.212.1.43] (unknown [10.212.1.43]) by yuzu.css.socionext.com (Postfix) with ESMTP id 30198120137; Fri, 21 Aug 2020 18:14:02 +0900 (JST) Subject: Re: [PATCH] dma-buf: heaps: Introduce dma_heap_add_cma() for non-default CMA heap To: John Stultz Cc: Sumit Semwal , "Andrew F . Davis" , Benjamin Gaignard , Liam Mark , Laura Abbott , Brian Starkey , Christian Koenig , linux-media@vger.kernel.org, dri-devel , "moderated list:DMA BUFFER SHARING FRAMEWORK" , lkml References: <1594948208-4739-1-git-send-email-hayashi.kunihiko@socionext.com> From: Kunihiko Hayashi Message-ID: <377e6e65-0b44-ecd0-cfc5-6fbc82be35d5@socionext.com> Date: Fri, 21 Aug 2020 18:14:01 +0900 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On 2020/08/01 4:38, John Stultz wrote: > On Fri, Jul 31, 2020 at 2:32 AM Kunihiko Hayashi > wrote: >> On 2020/07/29 4:17, John Stultz wrote: >>> Do you have a upstream driver that you plan to make use this new call? >> >> Unfortunately I don't have an upstream driver using this call. >> >> This call is called from dma-buf heaps "importer" or "customer", >> and I only made an example (do nothing) importer driver >> to test the call. >> >>> We want to have in-tree users of code added. >> >> I think this is a generic way to use non-default CMA heaps, however, >> we need in-tree "importer" drivers to want to use non-default CMA heaps. >> I don't find it from now. >> > > Yea, I and again, I do agree this is functionality that will be > needed. But we'll need to wait for a user (camera driver, etc which > would utilize the reserved cma region) before we can merge it > upstream. :( Do let me know if you have an out of tree driver that > would make use of it, and we can see what can be done to help upstream > things. Sorry for late. Before I prepare or find a user driver as "importer", I think something is different in this patch. This patch makes it possible to treat non-default CMA connected to "importer" device with memory-region as dma-buf heaps. However, the allocated memory from this dma-buf heaps can be used for "any" devices, and the "importer" can treat memories from other dma-buf heaps. So, the "importer" and the non-default CMA aren't directly related, and I think an "exporter" for the non-default CMA should be enabled. In paticular, the kernel initializer (as an "exporter") calls dma_heap_add_cma() for all CMAs defined in Devicetree, and the device files associated with each CMA appear under "/dev/dma_heap/". For example: /dev/dma_heap/linux,cma@10000000 /dev/dma_heap/linux,cma@11000000 /dev/dma_heap/linux,cma@12000000 ... All of these device files can be fairly allocated to any "importer" device. Actually I think that the kernel should executes dma_heap_add_cma() for ALL defined reserved-memory nodes. If this idea hasn't been discussed yet and this is reasonable, I'll prepare RFC patches. Thank you, --- Best Regards Kunihiko Hayashi