From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Mon, 24 Aug 2020 10:26:44 -0400 Subject: [PATCH] Fix data abort caused by mis-aligning fit data in In-Reply-To: <54acaa00c3d44dc3b175dc55b44f1373@4rf.com> References: <54acaa00c3d44dc3b175dc55b44f1373@4rf.com> Message-ID: <20200824142644.GA13719@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, Jul 24, 2020 at 05:19:39AM +0000, Reuben Dowle wrote: > Attempting to place device tree immediately after an image in memory can lead > to mis-aligned data accesses if that image size is not divisible by the > alignment requirements of the architecture. > > Data aborts caused by this were observed on a custom Marvel A388 based system, > where the image was a uboot FIT file. The total size varies depending on the > uboot device tree size, which does not always lead to correct alignment. > > Signed-off-by: Reuben Dowle > --- > common/spl/spl_fit.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c > index 365104f..d221075 100644 > --- a/common/spl/spl_fit.c > +++ b/common/spl/spl_fit.c > @@ -349,9 +349,9 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, > > /* > * Use the address following the image as target address for the > - * device tree. > + * device tree. Ensure that address is appropriately aligned. > */ > - image_info.load_addr = spl_image->load_addr + spl_image->size; > + image_info.load_addr = ALIGN(spl_image->load_addr + spl_image->size, ARCH_DMA_MINALIGN); > > /* Figure out which device tree the board wants to use */ > node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, index++); Sorry for the late reply here. While we do need to ensure that the device tree is aligned, the documented alignment requirement for all platforms is 8 byte, so we should document and use that here in case future platforms require a higher alignment. Thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: