forked from pool/u-boot
1 OBS-URL: https://build.opensuse.org/request/show/390469 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/u-boot?expand=0&rev=72
54 lines
1.7 KiB
Diff
54 lines
1.7 KiB
Diff
From 087b2b685be9c55af1b5ecce057da26536982b5c Mon Sep 17 00:00:00 2001
|
|
From: Alexander Graf <agraf@suse.de>
|
|
Date: Mon, 4 Apr 2016 09:25:09 +0200
|
|
Subject: [PATCH 15/17] efi_loader: Always flush in cache line size granularity
|
|
|
|
The cache line flush helpers only work properly when they get aligned
|
|
start and end addresses. Round our flush range to cache line size. It's
|
|
safe because we're guaranteed to flush within a single page which has the
|
|
same cache attributes.
|
|
|
|
Reported-by: Marek Vasut <marex@denx.de>
|
|
Signed-off-by: Alexander Graf <agraf@suse.de>
|
|
|
|
---
|
|
|
|
v1 -> v2:
|
|
|
|
- Fix compilation on systems without CONFIG_SYS_CACHELINE_SIZE
|
|
---
|
|
lib/efi_loader/efi_runtime.c | 10 +++++++++-
|
|
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
|
|
index 22bcd08..3ee27ca 100644
|
|
--- a/lib/efi_loader/efi_runtime.c
|
|
+++ b/lib/efi_loader/efi_runtime.c
|
|
@@ -20,6 +20,13 @@ static efi_status_t EFI_RUNTIME_TEXT EFIAPI efi_unimplemented(void);
|
|
static efi_status_t EFI_RUNTIME_TEXT EFIAPI efi_device_error(void);
|
|
static efi_status_t EFI_RUNTIME_TEXT EFIAPI efi_invalid_parameter(void);
|
|
|
|
+#ifdef CONFIG_SYS_CACHELINE_SIZE
|
|
+#define EFI_CACHELINE_SIZE CONFIG_SYS_CACHELINE_SIZE
|
|
+#else
|
|
+/* Just use the greatest cache flush alignment requirement I'm aware of */
|
|
+#define EFI_CACHELINE_SIZE 128
|
|
+#endif
|
|
+
|
|
#if defined(CONFIG_ARM64)
|
|
#define R_RELATIVE 1027
|
|
#define R_MASK 0xffffffffULL
|
|
@@ -194,7 +201,8 @@ void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map)
|
|
#endif
|
|
|
|
*p = newaddr;
|
|
- flush_dcache_range((ulong)p, (ulong)&p[1]);
|
|
+ flush_dcache_range((ulong)p & ~(EFI_CACHELINE_SIZE - 1),
|
|
+ ALIGN((ulong)&p[1], EFI_CACHELINE_SIZE));
|
|
}
|
|
|
|
#ifndef IS_RELA
|
|
--
|
|
1.8.5.6
|
|
|