Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp323431pxb; Wed, 13 Jan 2021 04:45:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJxIVCWnSIQjrd44EGlsNJGovzlpe7MIHxr5+eoqk414OV0Tjy6czQ9hrtcp6ZiAU7indU7U X-Received: by 2002:aa7:cdc3:: with SMTP id h3mr1632324edw.52.1610541900974; Wed, 13 Jan 2021 04:45:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610541900; cv=none; d=google.com; s=arc-20160816; b=y5y8gPJVBh3Irfg0EReShW32u1hw2CvANGe3DAmSmcsw3JE8CSKOHk0akBoiYePzMH WAs3StVmaTvXdUrSyEXD8e6UdMuOBbbzZ8HQgbl9Gj+nkVitTzwBlxcjYG1apyn5eLAN Lqlz/rvKEc0om/Mdn98crONjvNOcewlK2haV5lAH44aYDMIhRiANJ7HWhbumODDJf1hu 1t8p3QiayZzQL1NgY3EB2nQmryrEf8fEkEUJ/dg8YSC6FftfF6K1inLwEQgCcPPakRIB fCjz+GMmmkInIjYg0c0scKhpDr6dYVTm6GvZCWAbqmxI4FSGe1JjsyzS7DxIqbhUWsdX BEbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=3N+ni5cIVQIf9Ml5pw3zKKxtsSzpuPReY5o1YGLmHK8=; b=OR8EdvUOURMXVwn9CDdwM8iekX8FdwfBDNJw1+inz7Gb01zx6nTSuMEkemzpD/xKsi IwSiAfQH/KWKLz31Bh35IsOctYkfb8E7riy8XN5/imZjejLyq7wNLPBIKOG6pw/07oGX rxngEzSejLf98Aq/Gj9Bo7pLvezDJhHKTjgKVi5dxxHFNyLczN9udRqE2WSSg8EoG5js DkZZSLdZ9Ag+OJvHLn6PgoCuFLe5SnHBgv2MqoUfRyUr14hN/kxLfPjJCr8WZgdYzSez cnb/gc9mH+2sBp4/DOc4QuNynjKHXwI0qm+KvRS9eFK/6esm3t6s+Rq1WMI1rNYB9CtW gKJg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w5si968711edd.350.2021.01.13.04.44.37; Wed, 13 Jan 2021 04:45:00 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727105AbhAMMmz (ORCPT + 99 others); Wed, 13 Jan 2021 07:42:55 -0500 Received: from verein.lst.de ([213.95.11.211]:60024 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725774AbhAMMmz (ORCPT ); Wed, 13 Jan 2021 07:42:55 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id 3EA2768B02; Wed, 13 Jan 2021 13:42:09 +0100 (CET) Date: Wed, 13 Jan 2021 13:42:09 +0100 From: Christoph Hellwig To: Claire Chang Cc: robh+dt@kernel.org, mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org, joro@8bytes.org, will@kernel.org, frowand.list@gmail.com, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, jgross@suse.com, sstabellini@kernel.org, hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com, grant.likely@arm.com, xypron.glpk@gmx.de, treding@nvidia.com, mingo@kernel.org, bauerman@linux.ibm.com, peterz@infradead.org, gregkh@linuxfoundation.org, saravanak@google.com, rafael.j.wysocki@intel.com, heikki.krogerus@linux.intel.com, andriy.shevchenko@linux.intel.com, rdunlap@infradead.org, dan.j.williams@intel.com, bgolaszewski@baylibre.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, iommu@lists.linux-foundation.org, xen-devel@lists.xenproject.org, tfiga@chromium.org, drinkcat@chromium.org Subject: Re: [RFC PATCH v3 2/6] swiotlb: Add restricted DMA pool Message-ID: <20210113124209.GA1383@lst.de> References: <20210106034124.30560-1-tientzu@chromium.org> <20210106034124.30560-3-tientzu@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210106034124.30560-3-tientzu@chromium.org> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +#ifdef CONFIG_SWIOTLB > + struct io_tlb_mem *dma_io_tlb_mem; > #endif Please add a new config option for this code instead of always building it when swiotlb is enabled. > +static int swiotlb_init_io_tlb_mem(struct io_tlb_mem *mem, phys_addr_t start, > + size_t size) Can you split the refactoring in swiotlb.c into one or more prep patches? > +static int rmem_swiotlb_device_init(struct reserved_mem *rmem, > + struct device *dev) > +{ > + struct io_tlb_mem *mem = rmem->priv; > + int ret; > + > + if (dev->dma_io_tlb_mem) > + return -EBUSY; > + > + if (!mem) { > + mem = kzalloc(sizeof(*mem), GFP_KERNEL); > + if (!mem) > + return -ENOMEM; What is the calling convention here that allows for a NULL and non-NULL private data?