From: Stefano Stabellini Subject: [PATCH for-4.6] efi: introduce efi_arch_flush_dcache_area Date: Mon, 7 Sep 2015 15:13:50 +0100 Message-ID: <1441635230-20986-1-git-send-email-stefano.stabellini@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZYxD6-0002AQ-AM for xen-devel@lists.xenproject.org; Mon, 07 Sep 2015 14:15:52 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: wei.liu2@citrix.com, ian.campbell@citrix.com, JBeulich@suse.com, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org Objects loaded by FileHandle->Read need to be flushed to dcache, otherwise copy_from_paddr will read stale data when copying the kernel, causing a failure to boot. Introduce efi_arch_flush_dcache_area and call it from read_file. This commit introduces no functional changes on x86. Reported-by: Mark Rutland Signed-off-by: Stefano Stabellini CC: ian.campbell@citrix.com CC: JBeulich@suse.com CC: wei.liu2@citrix.com --- xen/arch/arm/efi/efi-boot.h | 7 +++++++ xen/arch/x86/efi/efi-boot.h | 2 ++ xen/common/efi/boot.c | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index 6a12d91..fd79658 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -9,6 +9,7 @@ #include void noreturn efi_xen_start(void *fdt_ptr, uint32_t fdt_size); +void __flush_dcache_area(const void * vaddr, unsigned long size); #define DEVICE_TREE_GUID \ {0xb1b621d5, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0}} @@ -571,6 +572,12 @@ static void __init efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *mode_info) { } + +static void efi_arch_flush_dcache_area(const void *vaddr, UINTN size) +{ + __flush_dcache_area(vaddr, size); +} + /* * Local variables: * mode: C diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index 2dd69f6..4c7f383 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -640,6 +640,8 @@ static bool_t __init efi_arch_use_config_file(EFI_SYSTEM_TABLE *SystemTable) return 1; /* x86 always uses a config file */ } +static void efi_arch_flush_dcache_area(const void *vaddr, UINTN size) { } + /* * Local variables: * mode: C diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 75a939f..f0f26c1 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -526,7 +526,8 @@ static bool_t __init read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name, PrintErr(what); PrintErr(L" failed for "); PrintErrMesg(name, ret); - } + } else + efi_arch_flush_dcache_area(file->ptr, file->size); return 1; } -- 1.7.10.4