Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752388AbdGGHW5 (ORCPT ); Fri, 7 Jul 2017 03:22:57 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:35091 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750983AbdGGHWy (ORCPT ); Fri, 7 Jul 2017 03:22:54 -0400 From: Naoya Horiguchi To: Naoya Horiguchi Cc: Baoquan He , Kees Cook , linux-kernel@vger.kernel.org, , Thomas Gleixner , "H. Peter Anvin" , Ingo Molnar , , Thomas Garnier , , Matt Fleming , "Jun'ichi Nomura" Subject: [PATCH v2 2/2] x86/efi: clean up dead code around efi_reserve_boot_services() Date: Fri, 7 Jul 2017 16:22:44 +0900 Message-Id: <1499412164-23511-2-git-send-email-n-horiguchi@ah.jp.nec.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <20170706083106.GA21796@hori1.linux.bs1.fc.nec.co.jp> References: <20170706083106.GA21796@hori1.linux.bs1.fc.nec.co.jp> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1651 Lines: 51 EFI_BOOT_SERVICES_{CODE|DATA} regions never overlap the kernel now, so we can clean up the check in efi_reserve_boot_services(). Signed-off-by: Naoya Horiguchi --- arch/x86/platform/efi/quirks.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git next-20170705/arch/x86/platform/efi/quirks.c next-20170705_patched/arch/x86/platform/efi/quirks.c index 8a99a2e..191f6f7 100644 --- next-20170705/arch/x86/platform/efi/quirks.c +++ next-20170705_patched/arch/x86/platform/efi/quirks.c @@ -292,27 +292,6 @@ void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size) efi_memmap_install(new_phys, num_entries); } -/* - * Helper function for efi_reserve_boot_services() to figure out if we - * can free regions in efi_free_boot_services(). - * - * Use this function to ensure we do not free regions owned by somebody - * else. We must only reserve (and then free) regions: - * - * - Not within any part of the kernel - * - Not the BIOS reserved area (E820_TYPE_RESERVED, E820_TYPE_NVS, etc) - */ -static bool can_free_region(u64 start, u64 size) -{ - if (start + size > __pa_symbol(_text) && start <= __pa_symbol(_end)) - return false; - - if (!e820__mapped_all(start, start+size, E820_TYPE_RAM)) - return false; - - return true; -} - void __init efi_reserve_boot_services(void) { efi_memory_desc_t *md; @@ -350,7 +329,7 @@ void __init efi_reserve_boot_services(void) * one else cares about it. We own it and can * free it later. */ - if (can_free_region(start, size)) + if (e820__mapped_all(start, start+size, E820_TYPE_RAM)) continue; } -- 2.7.0