From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Frysinger Date: Wed, 24 Aug 2011 14:06:26 -0400 Subject: [U-Boot] [PATCH] mmc:dcache: Cache line size aligned internal MMC buffers In-Reply-To: References: <1313745913-28672-1-git-send-email-l.majewski@samsung.com> <20110824132553.A5F2C11F9E76@gemini.denx.de> Message-ID: <201108241406.28704.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wednesday, August 24, 2011 13:27:05 Anton Staaf wrote: > On Wed, Aug 24, 2011 at 6:25 AM, Wolfgang Denk wrote: > > Lukasz Majewski wrote: > >> 4. get_dcache_line_size() can be simply defined as > >> #define get_dcache_line_size() CONFIG_SYS_CACHE_LINE_SIZE if we > >> _really_ want to save a few bytes. > > > > Actually I fail to understand why we would ever need > > get_dcache_line_size() in a boot loader. > > It is required so that we can correctly allocate buffers that will be > used by DMA engines to read or write data. The reason that these > buffers need to be cache line size aligned is because unaligned cache > invalidates are not possible to do in a safe way. The problem is that > invalidating a partial cache line requires invalidating the entire > line. And the other part of the line can contain nearby variables > (especially if the buffer is stack allocated), so we have to first > flush the cache line to be safe. However, that flush will clobber the > values that the DMA engine wrote to main memory that are not reflected > in the cache. right, and that's why i want to "hide" it be hind a "dma buffer allocate" API so that people can just say "i want a dma safe buffer" rather than having to delve into these details. they'll inevitable get confused and screw it up. ;) -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. Url : http://lists.denx.de/pipermail/u-boot/attachments/20110824/e9c342c4/attachment.pgp