Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp142247pxj; Tue, 15 Jun 2021 22:22:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJLY77pTQz9X+j+snaXf1mHt5CHS+LFyz59FB7/vgkkNx2obpcA7Q5ISIPqUIFZalZWqYp X-Received: by 2002:aa7:c3ce:: with SMTP id l14mr1924799edr.99.1623820929227; Tue, 15 Jun 2021 22:22:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623820929; cv=none; d=google.com; s=arc-20160816; b=nXsJd3flTe0UYgyWfISMIvRM2HF2yNPpygQUfM/pDH1CAoHgAgNDa2QoPduTZbjItt 0PXkHfsbGEeMoJFO5MK8zI/xwWdb4rwVARVhk4jWrpvStPFocGGu2xblxw0TqZYrF0xn 5SLM8bSNgIYJUPTEPSxztINcCs2qijWYkHFP9thoLb+ExlXRzKdFjJIR8K3LTD00Ksk+ XPVhBIUlf9VpiaFExsGuv0oXmpJKb5UaU838LyMHC9e86XYFOmBXcacYRCFs6E+mLnSE 32384UuloE6DwibYOpKTXewNlhKZIMW6vmyM75EHhYYYzyM4UIdQKzANb5+d7EP9BtaQ nNhw== 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=EFNjn42pPPLncujXA+SvpmU0/joUDi7tA7+2ySb7J1E=; b=H/SifmyRq1Z1ZEM/Ec1LtgpvqamMI/CGh+vBh62WQNgPDJy4T1ETcsNE76n9ABXCFb DOX2wC1KvhIiobc7CaIIm8g1qvSNXrvvqTj7j8zezsv40w1i8qg/xIqCjxhClkgRtZ2W FPw1yWO+W2P8Hikx62FC49+beH7W42eb93Fya00hGee+60NxXfMm74/txM6O9Px0dORw +t5NN3G9AcfNdH8Y9NfvAkfkBKiELPCmCPC1QUq/xSRS0M0lh9cnMa7tpN8/4nerXYd0 HZAEjshD3I9yFZzB1F/nF2ZVf7wtzZxia/yB+NLvD2UZvTZ1ksN7dZZdE8khZqMdsEI8 jF7w== 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 p2si1179718edu.249.2021.06.15.22.21.46; Tue, 15 Jun 2021 22:22:09 -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 S231252AbhFPFUv (ORCPT + 99 others); Wed, 16 Jun 2021 01:20:51 -0400 Received: from verein.lst.de ([213.95.11.211]:52521 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230336AbhFPFUu (ORCPT ); Wed, 16 Jun 2021 01:20:50 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id EC67D68AFE; Wed, 16 Jun 2021 07:18:39 +0200 (CEST) Date: Wed, 16 Jun 2021 07:18:39 +0200 From: Christoph Hellwig To: Claire Chang Cc: Christoph Hellwig , Rob Herring , mpe@ellerman.id.au, Joerg Roedel , Will Deacon , Frank Rowand , Konrad Rzeszutek Wilk , boris.ostrovsky@oracle.com, jgross@suse.com, Marek Szyprowski , benh@kernel.crashing.org, paulus@samba.org, "list@263.net:IOMMU DRIVERS" , sstabellini@kernel.org, Robin Murphy , grant.likely@arm.com, xypron.glpk@gmx.de, Thierry Reding , mingo@kernel.org, bauerman@linux.ibm.com, peterz@infradead.org, Greg KH , Saravana Kannan , "Rafael J . Wysocki" , heikki.krogerus@linux.intel.com, Andy Shevchenko , Randy Dunlap , Dan Williams , Bartosz Golaszewski , linux-devicetree , lkml , linuxppc-dev@lists.ozlabs.org, xen-devel@lists.xenproject.org, Nicolas Boichat , Jim Quinlan , Tomasz Figa , bskeggs@redhat.com, Bjorn Helgaas , chris@chris-wilson.co.uk, Daniel Vetter , airlied@linux.ie, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, jani.nikula@linux.intel.com, Jianxiong Gao , joonas.lahtinen@linux.intel.com, linux-pci@vger.kernel.org, maarten.lankhorst@linux.intel.com, matthew.auld@intel.com, rodrigo.vivi@intel.com, thomas.hellstrom@linux.intel.com Subject: Re: [PATCH v11 09/12] swiotlb: Add restricted DMA alloc/free support Message-ID: <20210616051839.GA27982@lst.de> References: <20210616035240.840463-1-tientzu@chromium.org> <20210616035240.840463-10-tientzu@chromium.org> <20210616045918.GA27537@lst.de> 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 16, 2021 at 01:10:02PM +0800, Claire Chang wrote: > On Wed, Jun 16, 2021 at 12:59 PM Christoph Hellwig wrote: > > > > On Wed, Jun 16, 2021 at 12:04:16PM +0800, Claire Chang wrote: > > > Just noticed that after propagating swiotlb_force setting into > > > io_tlb_default_mem->force, the memory allocation behavior for > > > swiotlb_force will change (i.e. always skipping arch_dma_alloc and > > > dma_direct_alloc_from_pool). > > > > Yes, I think we need to split a "use_for_alloc" flag from the force flag. > > How about splitting is_dev_swiotlb_force into is_swiotlb_force_bounce > (io_tlb_mem->force_bounce) and is_swiotlb_force_alloc > (io_tlb_mem->force_alloc)? Yes, something like that. I'd probably not use force for the alloc side given that we otherwise never allocte from the swiotlb buffer.