From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Bohan Subject: Re: memcpy alignment for DEVICE_nGnRnE Date: Mon, 7 Apr 2014 17:35:47 -0700 Message-ID: <20140408003547.GA18321@codeaurora.org> References: <53072343.4080505@marvell.com> <20140221105307.GE25363@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from smtp.codeaurora.org ([198.145.11.231]:49611 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753765AbaDHAf4 (ORCPT ); Mon, 7 Apr 2014 20:35:56 -0400 Content-Disposition: inline In-Reply-To: <20140221105307.GE25363@localhost> Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org To: Catalin Marinas Cc: Zhou Zhu , Bin Wang , Chao Xie , "linux-arm-kernel@lists.infradead.org" , Leo Yan , linux-arm-msm@vger.kernel.org Hi Catalin, On Fri, Feb 21, 2014 at 10:53:08AM +0000, Catalin Marinas wrote: > On Fri, Feb 21, 2014 at 09:58:27AM +0000, Zhou Zhu wrote: > > We faced one issue using memcpy for memory type DEVICE_nGnRnE > > (pgprot_noncached). If the address is not aligned, exception would > > happen due to the alignment of this type could not be handled by hardware. > > Indeed, that's expected. This memory type is the equivalent of Strongly > Ordered. > > > Is there any plan and ongoing patch to support this or we need to keep > > address aligned for memcpy using pgprot_noncached memory in drivers? > > You either change the memory type to pgprot_writecombine() or use the > right API (memcpy_toio/memcpy_fromio, these could be further optimised, > similar to powerpc for example, but I didn't get there yet). How should we handle Device Memory with copy_from_user / copy_to_user? Should we follow the same scheme and create copy_from_user_io / copy_to_user_io, or rather enforce that the stock routines handle alignment? Thanks, Mike -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation