From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Thu, 9 Jul 2015 15:32:51 -0500 Subject: [U-Boot] [PATCH v2 7/8] mtd/nand/ubi: assortment of alignment fixes In-Reply-To: <1436428076.2953.14.camel@localhost.localdomain> References: <1436397933.2658.88.camel@freescale.com> <1436428076.2953.14.camel@localhost.localdomain> Message-ID: <1436473971.2658.130.camel@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thu, 2015-07-09 at 09:47 +0200, Marcel Ziswiler wrote: > Hi Scott > > On Wed, 2015-07-08 at 18:25 -0500, Scott Wood wrote: > > > > As per discussion on v1, this isn't enough to guarantee that the stop > > address > > will be aligned. There needs to be a wrapper around memalign() that > > cache- > > aligns the size as well. > > > > -Scott > > Sorry, that isn't quite clear to me yet. You're saying I would need to > handle that in this patch? > > Looking through the sources I actually found only one single usage of > memalign() which explicitly takes care of this the way you propose: > > drivers/usb/host/xhci-mem.c: ptr = memalign(cacheline_size, ALIGN(size, > cacheline_size)); > > I'm just wondering about the 107 other places in U-Boot where memalign() > is already used the way I do in this patch. I suppose there are enough existing ones that it won't hurt to add more -- it's still an improvement over the current situation -- but it'd be good to fix it properly before it gets forgotten. > Wouldn't there need to be an infrastructure solution done to e.g. > memalign() itself? No, just a wrapper: static inline void *malloc_cache_aligned(size_t size) { return memalign(ARCH_DMA_MINALIGN, ALIGN(size, ARCH_DMA_MINALIGN)); }