From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751944AbZHYMxe (ORCPT ); Tue, 25 Aug 2009 08:53:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750856AbZHYMxc (ORCPT ); Tue, 25 Aug 2009 08:53:32 -0400 Received: from ey-out-2122.google.com ([74.125.78.27]:25829 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751441AbZHYMx3 convert rfc822-to-8bit (ORCPT ); Tue, 25 Aug 2009 08:53:29 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=ftARwDXHcAJG63TpTD4gJAbUTBmRLugmqzRFUa6HzpW6zDbaM/bvaAB+HZIjDoNNhs F1Wbc7FksetlENVtZnHYCWB4tBQEJp049aE1sQcJUvSJX8T1SFiAObT8ajH/2vwS4SPa 9xE4Lp0FIWI9UDT1ZIyfOIG4RUaIueTY/NAb4= MIME-Version: 1.0 In-Reply-To: <20090806222543.GG31579@n2100.arm.linux.org.uk> References: <200908061208.22131.laurent.pinchart@ideasonboard.com> <20090806114619.GW2080@trinity.fluff.org> <200908061506.23874.laurent.pinchart@ideasonboard.com> <1249584374.29182.20.camel@david-laptop> <20090806222543.GG31579@n2100.arm.linux.org.uk> Date: Tue, 25 Aug 2009 08:53:29 -0400 Message-ID: Subject: Re: How to efficiently handle DMA and cache on ARMv7 ? (was "Is get_user_pages() enough to prevent pages from being swapped out ?") From: Steven Walter To: Russell King - ARM Linux Cc: David Xiao , Laurent Pinchart , Ben Dooks , Hugh Dickins , Robin Holt , "linux-kernel@vger.kernel.org" , v4l2_linux , "linux-arm-kernel@lists.arm.linux.org.uk" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 6, 2009 at 6:25 PM, Russell King - ARM Linux wrote: [...] > As far as userspace DMA coherency, the only way you could do it with > current kernel APIs is by using get_user_pages(), creating a scatterlist > from those, and then passing it to dma_map_sg().  While the device has > ownership of the SG, userspace must _not_ touch the buffer until after > DMA has completed. [...] Would that work on a processor with VIVT caches? It seems not. In particular, dma_map_page uses page_address to get a virtual address to pass to map_single(). map_single() in turn uses this address to perform cache maintenance. Since page_address() returns the kernel virtual address, I don't see how any cache-lines for the userspace virtual address would get invalidated (for the DMA_FROM_DEVICE case). If that's true, then what is the correct way to allow DMA to/from a userspace buffer with a VIVT cache? If not true, what am I missing? Thanks -- -Steven Walter