Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp253466ybz; Fri, 17 Apr 2020 00:07:57 -0700 (PDT) X-Google-Smtp-Source: APiQypITiciujMyggPaX2HA4lTXGDqaO/9u4m7W3Qq0oGnJHlz6ZM1V6rm6zMWvDCey2W9DPtY5u X-Received: by 2002:aa7:d894:: with SMTP id u20mr1531443edq.205.1587107277441; Fri, 17 Apr 2020 00:07:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587107277; cv=none; d=google.com; s=arc-20160816; b=0zIrNf4zFKV7km6GV06JArjjmoq0F6NBm6tte7/cFIs91s3vOPbSrk7OkicuIYFMN3 8teqceayaxFOb4YCK6kgkpnTL6yCHpattza5eIYsF/rnktMk+UNtEE/Q83VY3DsnXlMe fAhTNDzaUEoDyhKpgt+V6lSQ+M8wkNHw05m7f9b63SCoN7vG30KZjd0FUAWXAKOstcY3 1Ee/N7Icrtu/YeInh6bo0mXAOUo5veskrFyouIP+hwZ5UHJsQjuNoq5lkXYZm74Y+DqQ cWq0NG4qrIpK/fCt1QJwX/gsIXh/7PjNc9fBaSFCI7sSjOkZW0BxiioCnvae5FpVYypl fNfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=p5CIpNTlmypBr831igvq86jrpUloAPzHJM7Wweos6e4=; b=Ah3Uot3cYfrO0FSl0VZ4H+VacibO1rQkueVO8L77licIzOvQvn9VkY+fs3EDl5mme6 IMGUN1LM7UAy2xYqJ6uFqudFRTGguArGEf9BxAjUr7hfkw9MW60/dX4frlCiN3BnM2IN gBEsoYWJ8XJpbr6d9EqlFrbOx3UgpAgzT891jRCrPBwHzWAvSg5lxsTYtMHsjILw8HJZ jXULQcBK+yx18qhY9/av4hKhbq0WCtuFqlXQiec7MdodH4FsfSfeZTblI7ofygY1655I oDxpperm9PuJL60JWMTjujbvhOld6sWiLAP843zsz7mUafIpA2VBw7BhkNDyCH0GRbql Qo+Q== 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 g15si13575287eje.418.2020.04.17.00.07.34; Fri, 17 Apr 2020 00:07:57 -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; 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 S1728636AbgDQHG1 (ORCPT + 99 others); Fri, 17 Apr 2020 03:06:27 -0400 Received: from verein.lst.de ([213.95.11.211]:56015 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728338AbgDQHG0 (ORCPT ); Fri, 17 Apr 2020 03:06:26 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 6053468BFE; Fri, 17 Apr 2020 09:06:21 +0200 (CEST) Date: Fri, 17 Apr 2020 09:06:20 +0200 From: Christoph Hellwig To: David Rientjes Cc: Christoph Hellwig , Tom Lendacky , Brijesh Singh , Jon Grimm , Joerg Roedel , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org Subject: Re: [patch 1/7] dma-remap: separate DMA atomic pools from direct remap code Message-ID: <20200417070620.GA19153@lst.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 14, 2020 at 05:04:52PM -0700, David Rientjes wrote: > DMA atomic pools will be needed beyond only CONFIG_DMA_DIRECT_REMAP so > separate them out into their own file. > > This also adds a new Kconfig option that can be subsequently used for > options, such as CONFIG_AMD_MEM_ENCRYPT, that will utilize the coherent > pools but do not have a dependency on direct remapping. > > For this patch alone, there is no functional change introduced. > > Reviewed-by: Christoph Hellwig > Signed-off-by: David Rientjes > --- > kernel/dma/Kconfig | 6 ++- > kernel/dma/Makefile | 1 + > kernel/dma/pool.c | 123 ++++++++++++++++++++++++++++++++++++++++++++ > kernel/dma/remap.c | 114 ---------------------------------------- > 4 files changed, 129 insertions(+), 115 deletions(-) > create mode 100644 kernel/dma/pool.c > > diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig > index 4c103a24e380..d006668c0027 100644 > --- a/kernel/dma/Kconfig > +++ b/kernel/dma/Kconfig > @@ -79,10 +79,14 @@ config DMA_REMAP > select DMA_NONCOHERENT_MMAP > bool > > -config DMA_DIRECT_REMAP > +config DMA_COHERENT_POOL > bool > select DMA_REMAP > > +config DMA_DIRECT_REMAP > + bool > + select DMA_COHERENT_POOL > + > config DMA_CMA > bool "DMA Contiguous Memory Allocator" > depends on HAVE_DMA_CONTIGUOUS && CMA > diff --git a/kernel/dma/Makefile b/kernel/dma/Makefile > index d237cf3dc181..370f63344e9c 100644 > --- a/kernel/dma/Makefile > +++ b/kernel/dma/Makefile > @@ -6,4 +6,5 @@ obj-$(CONFIG_DMA_DECLARE_COHERENT) += coherent.o > obj-$(CONFIG_DMA_VIRT_OPS) += virt.o > obj-$(CONFIG_DMA_API_DEBUG) += debug.o > obj-$(CONFIG_SWIOTLB) += swiotlb.o > +obj-$(CONFIG_DMA_COHERENT_POOL) += pool.o > obj-$(CONFIG_DMA_REMAP) += remap.o > diff --git a/kernel/dma/pool.c b/kernel/dma/pool.c > new file mode 100644 > index 000000000000..6612c2d51d3c > --- /dev/null > +++ b/kernel/dma/pool.c > @@ -0,0 +1,123 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (C) 2020 Google LLC This now also lost the ARM copyright in addition to the Linuxfoundation one, but I can fix that up. Otherwise it looks good to me.