]> git.sur5r.net Git - u-boot/commitdiff
efi_loader: make pool allocations cacheline aligned
authorRob Clark <robdclark@gmail.com>
Wed, 13 Sep 2017 22:05:36 +0000 (18:05 -0400)
committerAlexander Graf <agraf@suse.de>
Wed, 20 Sep 2017 08:48:09 +0000 (10:48 +0200)
This avoids printf() spam about file reads (such as loading an image)
into unaligned buffers (and the associated memcpy()).  And generally
seems like a good idea.

Signed-off-by: Rob Clark <robdclark@gmail.com>
[agraf: use __aligned]
Signed-off-by: Alexander Graf <agraf@suse.de>
lib/efi_loader/efi_memory.c

index 9e079f1fa3a66cc301cd1bf039b7896f97f473f4..d47759e08edc62104db13b0c4cef4ae9234abf82 100644 (file)
@@ -43,7 +43,7 @@ void *efi_bounce_buffer;
  */
 struct efi_pool_allocation {
        u64 num_pages;
-       char data[];
+       char data[] __aligned(ARCH_DMA_MINALIGN);
 };
 
 /*
@@ -356,7 +356,8 @@ efi_status_t efi_allocate_pool(int pool_type, unsigned long size,
 {
        efi_status_t r;
        efi_physical_addr_t t;
-       u64 num_pages = (size + sizeof(u64) + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT;
+       u64 num_pages = (size + sizeof(struct efi_pool_allocation) +
+                        EFI_PAGE_MASK) >> EFI_PAGE_SHIFT;
 
        if (size == 0) {
                *buffer = NULL;