From mboxrd@z Thu Jan 1 00:00:00 1970 From: Albert ARIBAUD Date: Fri, 05 Aug 2011 13:26:00 +0200 Subject: [U-Boot] [PATCH v2] ARM926ejs: Add routines to invalidate D-Cache In-Reply-To: <1312543408.31913.170.camel@ubuntu> References: <1312519452-22926-1-git-send-email-hong.xu@atmel.com> <4E3B8A16.50604@aribaud.net> <4E3B8FF3.2070400@atmel.com> <4E3B91C1.2040307@aribaud.net> <4E3B9753.3020002@ti.com> <4E3BC715.9070706@atmel.com> <4E3BCA55.5070003@ti.com> <4E3BCDEB.8090106@aribaud.net> <1312543408.31913.170.camel@ubuntu> Message-ID: <4E3BD348.5090609@aribaud.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Reinhard, On 05/08/2011 13:23, Reinhard Meyer wrote: > Dear Albert, Aneesh, Eric, >>> We have a fundamental problem when it comes to invalidating an >>> un-aligned buffer. Either you flush the boundary lines and corrupt your >>> buffer at boundaries OR you invalidate without flushing and corrupt >>> memory around your buffer. Both are not good! The only real solution is >>> to have aligned buffers, if you want to have D-cache enabled and do DMA >>> at the same time. >> >> Plus, there should not be *heavy* modifications; DMA engines tend to use >> essentially two types of memory-resident objects: data buffers and >> buffer descriptors. There's only a small handful of places in the driver >> code to look at to find where these objects are allocated and how. >> >> So I stand by my opinion: since the cache invalidation routine should >> only be called with cache-aligned objects, there is no requirement to >> flush the first (resp. last) cache line in case of unaligned start >> (resp.stop), and I don't want cache operations performed when they are >> not required. > > After considering all issues, any driver that does flush OR invalidate a > cache line that it does not fully "own" is prone to cause problems. > > At flushing: some DMA might just have put data into the partial line. > At invalidating: some Software might have put data, but the writeback > had not occured. > > So both flush AND invalidate functions should check for this event and > emit a proper warning on the console. Fully agreed. > My 2.7 cents... > Reinhard Amicalement, -- Albert.