efi: Correct cache flush alignment
authorSimon Glass <sjg@chromium.org>
Mon, 7 Nov 2016 15:47:04 +0000 (08:47 -0700)
committerAlexander Graf <agraf@suse.de>
Mon, 14 Nov 2016 22:24:03 +0000 (23:24 +0100)
Make sure that the cache flushes correctly by ensuring that the end
address is correctly aligned.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
lib/efi_loader/efi_image_loader.c

index 5165377eee662cd5dbf3101c85b5f4e2829efd76..3262d76bcac036b2a2f04fc93667c2e3f2e7bca5 100644 (file)
@@ -174,7 +174,8 @@ void *efi_load_pe(void *efi, struct efi_loaded_image *loaded_image_info)
        efi_loader_relocate(rel, rel_size, efi_reloc);
 
        /* Flush cache */
-       flush_cache((ulong)efi_reloc, virt_size);
+       flush_cache((ulong)efi_reloc,
+                   ALIGN(virt_size, CONFIG_SYS_CACHELINE_SIZE));
        invalidate_icache_all();
 
        /* Populate the loaded image interface bits */