From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761248Ab3LIJn4 (ORCPT ); Mon, 9 Dec 2013 04:43:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52596 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761036Ab3LIJnv (ORCPT ); Mon, 9 Dec 2013 04:43:51 -0500 From: Dave Young To: linux-kernel@vger.kernel.org Cc: linux-efi@vger.kernel.org, x86@kernel.org, mjg59@srcf.ucam.org, hpa@zytor.com, James.Bottomley@HansenPartnership.com, vgoyal@redhat.com, ebiederm@xmission.com, horms@verge.net.au, kexec@lists.infradead.org, bp@alien8.de, greg@kroah.com, matt@console-pimps.org, toshi.kani@hp.com Subject: [PATCH v5 04/14] efi: add a wrapper function efi_map_region_fixed Date: Mon, 9 Dec 2013 17:42:17 +0800 Message-Id: <1386582147-9802-5-git-send-email-dyoung@redhat.com> In-Reply-To: <1386582147-9802-1-git-send-email-dyoung@redhat.com> References: <1386582147-9802-1-git-send-email-dyoung@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Kexec kernel will use saved runtime virtual mapping, so add a new function efi_map_region_fixed for directly mapping a md to md->virt. The md is passed in from 1st kernel, the virtual addr is saved in md->virt_addr. Matt: coding style reuse __map_region Boris: Strenthen comment lines to 80 cols. Signed-off-by: Dave Young Acked-by: Borislav Petkov --- arch/x86/include/asm/efi.h | 1 + arch/x86/platform/efi/efi_32.c | 2 ++ arch/x86/platform/efi/efi_64.c | 10 ++++++++++ 3 files changed, 13 insertions(+) diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index 89a05b0..9fbaeb2 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h @@ -128,6 +128,7 @@ extern void efi_call_phys_epilog(void); extern void efi_unmap_memmap(void); extern void efi_memory_uc(u64 addr, unsigned long size); extern void __init efi_map_region(efi_memory_desc_t *md); +extern void __init efi_map_region_fixed(efi_memory_desc_t *md); extern void efi_sync_low_kernel_mappings(void); extern void efi_setup_page_tables(void); extern void __init old_map_region(efi_memory_desc_t *md); diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c index e94557c..7b3ec6e 100644 --- a/arch/x86/platform/efi/efi_32.c +++ b/arch/x86/platform/efi/efi_32.c @@ -47,6 +47,8 @@ void __init efi_map_region(efi_memory_desc_t *md) old_map_region(md); } +void __init efi_map_region_fixed(efi_memory_desc_t *md) {} + void efi_call_phys_prelog(void) { struct desc_ptr gdt_descr; diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index c5a6491..ff08cb1 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c @@ -199,6 +199,16 @@ void __init efi_map_region(efi_memory_desc_t *md) md->virt_addr = efi_va; } +/* + * kexec kernel will use efi_map_region_fixed to map efi runtime memory ranges. + * md->virt_addr is the original virtual address which had been mapped in kexec + * 1st kernel. + */ +void __init efi_map_region_fixed(efi_memory_desc_t *md) +{ + __map_region(md, md->virt_addr); +} + void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size, u32 type, u64 attribute) { -- 1.8.3.1