u32     sctlr_after_ebs;
 };
 
+static inline void efi_capsule_flush_cache_range(void *addr, int size)
+{
+       __cpuc_flush_dcache_area(addr, size);
+}
+
 #endif /* _ASM_ARM_EFI_H */
 
 void efi_virtmap_load(void);
 void efi_virtmap_unload(void);
 
+static inline void efi_capsule_flush_cache_range(void *addr, int size)
+{
+       __flush_dcache_area(addr, size);
+}
+
 #endif /* _ASM_EFI_H */
 
 #include <linux/highmem.h>
 #include <linux/efi.h>
 #include <linux/vmalloc.h>
+#include <asm/efi.h>
 #include <asm/io.h>
 
 typedef struct {
                else
                        sglist[j].data = page_to_phys(sg_pages[i + 1]);
 
+#if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
+               /*
+                * At runtime, the firmware has no way to find out where the
+                * sglist elements are mapped, if they are mapped in the first
+                * place. Therefore, on architectures that can only perform
+                * cache maintenance by virtual address, the firmware is unable
+                * to perform this maintenance, and so it is up to the OS to do
+                * it instead.
+                */
+               efi_capsule_flush_cache_range(sglist, PAGE_SIZE);
+#endif
                kunmap_atomic(sglist);
        }