Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965381AbbKDKyc (ORCPT ); Wed, 4 Nov 2015 05:54:32 -0500 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:58949 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965253AbbKDKyb (ORCPT ); Wed, 4 Nov 2015 05:54:31 -0500 Date: Wed, 4 Nov 2015 10:54:20 +0000 From: Russell King - ARM Linux To: Will Deacon Cc: Sanjeev Sharma , m.szyprowski@samsung.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ARM:dma-mapping: Handle DMA_BIDIRECTIONAL in _dma_page_cpu_to_dev() Message-ID: <20151104105420.GL8644@n2100.arm.linux.org.uk> References: <1446631008-5854-1-git-send-email-sanjeev_sharma@mentor.com> <20151104103913.GC5405@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151104103913.GC5405@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1319 Lines: 27 On Wed, Nov 04, 2015 at 10:39:13AM +0000, Will Deacon wrote: > On Wed, Nov 04, 2015 at 03:26:48PM +0530, Sanjeev Sharma wrote: > > _dma_page_cpu_to_dev() treat DMA_BIDIRECTIONAL similar to DMA_TO_DEVICE > > which means that destination buffer is device memory,means cpu may have > > written some data to source buffer and data may be in cache line.For > > cleaner operation we need to call outer_flush_range() which will > > clean and invalidate outer cache lines. > > Why isn't the clean sufficient in this case? We're mapping the buffer > to the device, so we clean the dirty lines in the CPU caches and make > them visible to the device. If the CPU later wants to read the buffer > (i.e. after the device has DMA'd into it), you'll need to map the > buffer to the CPU, which will perform the invalidation of the CPU caches. Indeed. bidirectional mode is already handled prefectly well by this code. No patches are required. (I never received the original email.) -- FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/