Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4183817pxt; Tue, 10 Aug 2021 23:10:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzv8Ndnw6H45m0SeIVC3VzN7Dzkz0NQ5bO9uNd6fheycuafF1wrgUdVC9ef7u05QqwqPvqE X-Received: by 2002:a92:dd82:: with SMTP id g2mr189730iln.279.1628662235105; Tue, 10 Aug 2021 23:10:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628662235; cv=none; d=google.com; s=arc-20160816; b=dN3xKsRFMi2F7AmQEHRwSUga7tGLG489YRdJBRWjvRI9RPotWJBstAoydUv6DPxq6t rieJ34UigaXL2r3BGbywg3tcSbKmbx/ixHWEtOPI6VswFckCQfkGgBTgRreFSQMHaFXn RA0WiT+4f35eOSTHcNP9XEXpA+F/VMCB9Dae4YDfEmhFT+gwTqhIXQlasMPHPAXOT3jh 3pH7ds8GbzKPNAKR8Ame8yaKYgypoU2Wx/kc6mjIaXGJtBzS0oanGN8c/yLd7T52dVFo 8O9CYCnh0bdu0K3FeujEeKtl8uy5GT/0Aef08SGYRnp4in7waZoLD+RLoWrZ/XblxMsS uKIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ho6/AeZ5c1e6H7tCddsJ5x23ZKaDp8UDRhTSPgHPvu0=; b=ZoysHEkpmRqPbusbsonKt6ilTWht8tVsNkGCJKsYNZF3T4985UmNNUWDVHz2N4r6fK ANq8VX85bVF3BSHqU7mubuXNEMA3EA4XPxGs2j+UjGp5CzyN/IvbQil9Zp7FN54yK2In EPy/QJ0cffx5fNYTZYa2j+R/n0iJ+tXufmUVawm3vYpd9GC+nGl50rGRuZiRQAAtrPvU CL1m2WOtQBYjdrJUSPLna/xAlV9Xi4dyK8boiyyDb7Id/2xBz5vn0ew1tPFkmTbbWKwR Dda1/62d60KvuuGo/5P9Gstje/2zkYkpZpv6Adx1XAVcaoxtoKCqyeC9QXgqi5tpbXG5 LiGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=cZJRapbb; 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 l14si5546535ilf.100.2021.08.10.23.10.23; Tue, 10 Aug 2021 23:10:35 -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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=cZJRapbb; 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 S234660AbhHKGId (ORCPT + 99 others); Wed, 11 Aug 2021 02:08:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234584AbhHKGIa (ORCPT ); Wed, 11 Aug 2021 02:08:30 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25DCEC061765 for ; Tue, 10 Aug 2021 23:08:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ho6/AeZ5c1e6H7tCddsJ5x23ZKaDp8UDRhTSPgHPvu0=; b=cZJRapbbrIvpgLvOp7/1uAXVx5 dUxcxMYN8KjE8/1aIb4A1gTXnPj/PCrV39losPl6E2htv9/fydbXUf/YByRpUt3Gxxmzwo86jmo7+ f8/Fk0dONTrPS8qOO9ogUq9y3ZQy4P+hn/BJ3ZeudBRF9l+cMu2AD82AlwSSMs0ju2mixWhnMbyU3 jxO8eMH97woKOLErPaAXI5dt7g635pg0SXEQcjEvJE5wwmu8CJPfuKI8KlG6lYScP490vN8rugRDx +zNFkOXyjv6tAJitWfjSzsmHjN13O3Pd0lwwJx4xn5Eh/pVLL/vDznokXwU+5wPRbvNqOuhsV22cE N82GXKbg==; Received: from hch by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDhOf-00D2xK-2R; Wed, 11 Aug 2021 06:07:33 +0000 Date: Wed, 11 Aug 2021 07:07:25 +0100 From: Christoph Hellwig To: David Stevens Cc: Robin Murphy , Will Deacon , linux-kernel@vger.kernel.org, Tom Murphy , iommu@lists.linux-foundation.org Subject: Re: [PATCH v3 3/5] dma-iommu: add SKIP_CPU_SYNC after syncing Message-ID: References: <20210811024247.1144246-1-stevensd@google.com> <20210811024247.1144246-4-stevensd@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210811024247.1144246-4-stevensd@google.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c > index 4f0cc4a0a61f..be0214b1455c 100644 > --- a/drivers/iommu/dma-iommu.c > +++ b/drivers/iommu/dma-iommu.c > @@ -859,8 +859,11 @@ static dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page, > static void iommu_dma_unmap_page(struct device *dev, dma_addr_t dma_handle, > size_t size, enum dma_data_direction dir, unsigned long attrs) > { > - if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC)) > + if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC)) { > iommu_dma_sync_single_for_cpu(dev, dma_handle, size, dir); > + attrs |= DMA_ATTR_SKIP_CPU_SYNC; > + } > + > __iommu_dma_unmap_swiotlb(dev, dma_handle, size, dir, attrs); I don't think this is the correct way to go. Instead just call the raw cache sync helper instead of iommu_dma_sync_single_for_cpu, similar to what dma-direct does. Same for the map side.