Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753407AbdGJFvy (ORCPT ); Mon, 10 Jul 2017 01:51:54 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:36441 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753244AbdGJFvw (ORCPT ); Mon, 10 Jul 2017 01:51:52 -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" , Ard Biesheuvel Subject: [PATCH v3 2/2] x86/efi: clean up dead code around efi_reserve_boot_services() Date: Mon, 10 Jul 2017 14:51:36 +0900 Message-Id: <1499665896-23731-2-git-send-email-n-horiguchi@ah.jp.nec.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <20170710054733.GA22619@hori1.linux.bs1.fc.nec.co.jp> References: <20170710054733.GA22619@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