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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5425BC7618E for ; Mon, 24 Apr 2023 06:05:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231346AbjDXGFX (ORCPT ); Mon, 24 Apr 2023 02:05:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231178AbjDXGEv (ORCPT ); Mon, 24 Apr 2023 02:04:51 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F3784EE0; Sun, 23 Apr 2023 23:03:23 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id C5E5D67373; Mon, 24 Apr 2023 08:03:13 +0200 (CEST) Date: Mon, 24 Apr 2023 08:03:13 +0200 From: Christoph Hellwig To: Petr =?utf-8?B?VGVzYcWZw61r?= Cc: Robin Murphy , Christoph Hellwig , Petr Tesarik , Jonathan Corbet , Marek Szyprowski , Borislav Petkov , "Paul E. McKenney" , Andrew Morton , Randy Dunlap , Damien Le Moal , Kim Phillips , "Steven Rostedt (Google)" , "open list:DOCUMENTATION" , open list , "open list:DMA MAPPING HELPERS" , Roberto Sassu , Alexander Graf Subject: Re: [RFC v1 3/4] swiotlb: Allow dynamic allocation of bounce buffers Message-ID: <20230424060313.GB9805@lst.de> References: <0334a54332ab75312c9de825548b616439dcc9f5.1679309810.git.petr.tesarik.ext@huawei.com> <20230328040724.GB25506@lst.de> <4268fa4e-4f0f-a2f6-a2a5-5b78ca4a073d@huaweicloud.com> <8cf7c515-9ce6-a2ed-0643-972aa3eba2fb@huaweicloud.com> <20230407055704.GD6803@lst.de> <20230407121555.4290a011@meshulam.tesarici.cz> <20230421150349.35966e0b@meshulam.tesarici.cz> <4bd8ce51-5874-0aa3-bc82-fec0cee9b8f1@arm.com> <20230421170934.185a03a0@meshulam.tesarici.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230421170934.185a03a0@meshulam.tesarici.cz> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 21, 2023 at 05:09:34PM +0200, Petr Tesařík wrote: > > > A. Only grouping those fields in their own struct? > > > B. Or move the definition to another include file (cf. MAINTAINERS)? > > > C. Or store a pointer in struct device? > > > > dev->dma_parms is already this, and IIRC still has some very old > > comments somewhere about consolidating the other DMA-related fields in > > there. > > Thank you for the hint! I have actually seen dma_parms, but since it > can be NULL and was initialized from various drivers, it did not occur > to me that NULL simply means not DMA-capable. Yes, dma_parms are still optional. A much better hint is the dma_mask itself, which for historic reasons is implemented in a completely awfull way as a pointer to something stored in the containing struture, which all kinds of platform devices or minor buses doing nasty hacks there.