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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F46AC43334 for ; Tue, 12 Jul 2022 09:58:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BDF1A940033; Tue, 12 Jul 2022 05:58:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B8EF66B00EE; Tue, 12 Jul 2022 05:58:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A55EB940033; Tue, 12 Jul 2022 05:58:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 977306B00EC for ; Tue, 12 Jul 2022 05:58:54 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 742F360B6C for ; Tue, 12 Jul 2022 09:58:54 +0000 (UTC) X-FDA: 79677998988.15.E2F99C1 Received: from sender4-op-o14.zoho.com (sender4-op-o14.zoho.com [136.143.188.14]) by imf18.hostedemail.com (Postfix) with ESMTP id D87581C0070 for ; Tue, 12 Jul 2022 09:58:52 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1657619911; cv=none; d=zohomail.com; s=zohoarc; b=N8Wwh5ZrxfDe+GMBeGfpPZ3e1nuPgwR/Ify54BgR/Yfuw59X3b4hF88u7M5kFxD6JtdN7DccyjsoC3jHAdFWdgVyKs7RVH5GuAOcRvy6t81XuUX+Y519PMYa4Vekry9GKbkm6Kv5DGvql91k2q5sQRG7+P2Oq2otk5Mtjo4DcNA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657619911; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=oYmnSNasXsz26eSg9mhjVYwcpWPPoFUecXawM5smvMI=; b=MzX9q3FPWhevfCqNo9ft00EODGHInwZJvoozx7vsSY6Gfb0tp+RNI2/BYX0QMYjm4VoG9OcW6ui3zOmBjlh+kOBAyBzlyuQUViE9RuIX1H51jBvQmh8S13h+8+6gDP0yBK27K1+nY0LgjuXoJjwqxkZ7xBBPhapQvei/GTYlnKs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=linux.beauty; spf=pass smtp.mailfrom=me@linux.beauty; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1657619911; s=zmail; d=linux.beauty; i=me@linux.beauty; h=Date:Date:From:From:To:To:Cc:Cc:Message-ID:In-Reply-To:References:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=oYmnSNasXsz26eSg9mhjVYwcpWPPoFUecXawM5smvMI=; b=mKhuxwbrK9EMCJnF4zTdx0uxUgK8wH1F7Xd/+pDIdxpnyLBwQikRq8VQ47b/dbvN sQcsiMof1gsZvHJJMLSB62FG0KgoJN0N+rMygSmQA5ch3Q83q+uk/NroA5OD1AHKBkB q2bqkah1dvzWqGHOLbk+Oqd1XBeiBUU8hQemu1xM= Received: from mail.zoho.com by mx.zohomail.com with SMTP id 1657619909505764.9703126327654; Tue, 12 Jul 2022 02:58:29 -0700 (PDT) Date: Tue, 12 Jul 2022 17:58:29 +0800 From: Li Chen To: "Arnd Bergmann" Cc: "Catalin Marinas" , "Will Deacon" , "Rob Herring" , "Frank Rowand" , "Andrew Morton" , "Li Chen" , "Linux ARM" , "Linux Kernel Mailing List" , "DTML" , "Linux-MM" Message-ID: <181f1d88b64.e2eb2601586551.453778983551010212@linux.beauty> In-Reply-To: References: <20220711122459.13773-1-me@linux.beauty> <20220711122459.13773-5-me@linux.beauty> <181efcca6ae.de84203d522625.7740936811073442334@linux.beauty> Subject: Re: [PATCH 4/4] sample/reserved_mem: Introduce a sample of struct page and dio support to no-map rmem MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Importance: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1657619933; a=rsa-sha256; cv=pass; b=hsJ+MtIzfoxEwmgeiEkumAxEyc28jXk6ThSC5ROtMDVaAJX2aHhwt8hLBwPzPcLpe2mMJG +QyCpr0L77vmtoFq3Cftu0n4/6BHDSrn9JL5JB0AjQq4hR+vNxGC4HvR921vN+3Gd0F5mB DE8DxM8T95o+mZ+kfAZF/9PWh6TzFIs= ARC-Authentication-Results: i=2; imf18.hostedemail.com; dkim=pass header.d=linux.beauty header.s=zmail header.b=mKhuxwbr; spf=pass (imf18.hostedemail.com: domain of me@linux.beauty designates 136.143.188.14 as permitted sender) smtp.mailfrom=me@linux.beauty; arc=pass ("zohomail.com:s=zohoarc:i=1"); dmarc=none ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657619933; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=oYmnSNasXsz26eSg9mhjVYwcpWPPoFUecXawM5smvMI=; b=bnN4wpzRhiLuy8WBNBwapwAKouYzm0SySykcsNynSSVoezyPZqvDk4m7dZvzEj5qBR8eet qZAyvXcw/Mjfy9kfuIKn7ra14ODIgnUMjXeTR2jkhO5oodo8o/xA4CTlM+h+xnNH1MpsLg 3BE3facaws88BmhRS5LAyohxtdXi/I4= X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: D87581C0070 X-Rspam-User: X-Stat-Signature: nyq3pnqi9bgfbwdbc7upes7ndkq3mf5e Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=linux.beauty header.s=zmail header.b=mKhuxwbr; spf=pass (imf18.hostedemail.com: domain of me@linux.beauty designates 136.143.188.14 as permitted sender) smtp.mailfrom=me@linux.beauty; arc=pass ("zohomail.com:s=zohoarc:i=1"); dmarc=none X-HE-Tag: 1657619932-168472 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: Hi Arnd, ---- On Tue, 12 Jul 2022 15:50:46 +0800 Arnd Bergmann wrote --- > On Tue, Jul 12, 2022 at 2:26 AM Li Chen wrote: > > ---- On Mon, 11 Jul 2022 21:28:10 +0800 Arnd Bergmann wrote --- > > > On Mon, Jul 11, 2022 at 2:24 PM Li Chen wrote: > > > > > > > > From: Li Chen > > > > > > > > This sample driver shows how to build struct pages support to no-map rmem. > > > > > > > > Signed-off-by: Li Chen > > > > > > Not sure what a sample driver helps here if there are no actual users in-tree. > > > > > > It would make more sense to merge the driver that wants to actually use this > > > first, and then add the additional feature. > > > > Totally agree, but we plan to start rewriting our video driver in a long time, it > > has many legacy codes and I need to rewrite a lot of codes to migrate to v4l2. > > That's why I also submit a sample driver here: to make the review progress > > easier and don't need reviewers to read video driver codes. > > The problem is that this patch may not be the right solution for your new > driver either. As Christoph also commented, what you do here is rather > unusual, and without seeing the video driver first, we have no way of > knowing whether there is something the driver should be doing > differently to solve the original problem. Ok, I will update the patch series after rewriting and upstreaming our video driver. > > > > > +/* > > > > + * dts example > > > > + * rmem: rmem@1 { > > > > + * compatible = "shared-dma-pool"; > > > > + * no-map; > > > > + * size = <0x0 0x20000000>; > > > > + * }; > > > > + * perf { > > > > + * compatible = "example,rmem"; > > > > + * memory-region = <&rmem>; > > > > + * }; > > > > > > The problem here is that the DT is meant to describe the platform in an OS > > > independent way, so having a binding that just corresponds to a user space > > > interface is not a good abstraction. > > > > Gotcha, but IMO dts + rmem is the only choice for our use case. In our real > > case, we use reg instead of size to specify the physical address, so > > memremap cannot be used. > > Does your hardware require a fixed address for the buffer? If it can be > anywhere in memory (or at least within a certain range) but just has to > be physically contiguous, the normal way would be to use a CMA area > to allocate from, which gives you 'struct page' backed pages. The limitation is our DSP can only access 32bit memory, but total dram is > 4G, so I cannot use "size = <...>" in our real case (it might get memory above 4G). I'm not sure if other vendors' DSP also has this limitation, if so, how do they deal with it if throughput matters. Regards, Li