Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp481586ybm; Wed, 22 May 2019 06:36:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEaEk1OWt+NqaSm7IEf+ARndQCdFsiz5KlxhLIlS5uczdoogR1IxdBLrNRISbt+53g7BMW X-Received: by 2002:a63:7d09:: with SMTP id y9mr69654552pgc.350.1558532170582; Wed, 22 May 2019 06:36:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558532170; cv=none; d=google.com; s=arc-20160816; b=dyLsNqpR8DSeyqC1ya1JviY2sgcbUwGbQGRhcEqI9vP/ej36W5JS4LuvQ1kel8RSu/ JQPlUG+IO2I2LwCRIxaE2TLm6albKQAid/wIlSV71KcYMblCNVFaHd1JPXeHY5Dr2fFR 4qG56AGa/WxilHuAYoh7P9MUP/06/+UYzLsvZ2ZLydWtg9DQwn3wu3c6hS5CvJApoJhv HrPJaOCZyGPLGZYYweexvjzTU9z0JJxnqEVdO/kKD3sI8qhWPFSvZ8ayVB/1xkUSgvpN TvpX27vAZwCF7d715l8bQ9qvcHwDfQtAw0yN3uOanSLXwHKlfHVX6m4/jCxbfpMtvTTO q3YQ== 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=44atPCjEkKHHFhdPW0xXSf5/vtxcSEZxopOJxy+vFS8=; b=sp5tZA7MnP+2/eCl36945fia262HpZ2hn6nEOt85TeA5rnIT8HyUsqicGTrKR6Lps+ NoMaC3+OGGHGbvfsDaEWQfAvHrbFnnA6RK705JIXpFnL+YRUXf2LedQPGyHNiX9yQ3VG vKKTQTFGa5IwuQOYrD5rYQ5dXQPwupChZcurJM0Klf1bfxDGy/oNJ5GbFd5pdyyzzOZW XSpMRdTbWp4PqS8NoEysAtpyr2iXHSrdlfVnjhMYSqf/rmcuT+B1o8jws+KBwVC3P8RC 5vgi83iehqanNhMmF5UAg39LMZpobWj+qrue1Gu89W8B1x+Armn/+j8w6lduLNbQQQCP 9dxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y17si27736520pfe.220.2019.05.22.06.35.54; Wed, 22 May 2019 06:36:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729471AbfEVNeY (ORCPT + 99 others); Wed, 22 May 2019 09:34:24 -0400 Received: from verein.lst.de ([213.95.11.211]:39603 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728827AbfEVNeY (ORCPT ); Wed, 22 May 2019 09:34:24 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id 2550C67358; Wed, 22 May 2019 15:34:01 +0200 (CEST) Date: Wed, 22 May 2019 15:34:00 +0200 From: Christoph Hellwig To: Robin Murphy Cc: Christoph Hellwig , Horia =?utf-8?Q?Geant=C4=83?= , Konrad Rzeszutek Wilk , Marek Szyprowski , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com Subject: Re: [PATCH] swiotlb: sync buffer when mapping FROM_DEVICE Message-ID: <20190522133400.GA27229@lst.de> References: <20190522072018.10660-1-horia.geanta@nxp.com> <20190522123243.GA26390@lst.de> <6cbe5470-16a6-17e9-337d-6ba18b16b6e8@arm.com> <20190522130921.GA26874@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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 22, 2019 at 02:25:38PM +0100, Robin Murphy wrote: > Sure, but that should be irrelevant since the effective problem here is in > the sync_*_for_cpu direction, and it's the unmap which nobbles the buffer. > If the driver does this: > > dma_map_single(whole buffer); > > dma_unmap_single(whole buffer); > > > then it could instead do this and be happy: > > dma_map_single(whole buffer, SKIP_CPU_SYNC); > > dma_sync_single_for_cpu(updated part of buffer); > dma_unmap_single(whole buffer, SKIP_CPU_SYNC); > Assuming the driver knows how much was actually DMAed this would solve the issue. Horia, does this work for you?