From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03784C2D0C2 for ; Mon, 30 Dec 2019 18:09:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CBA91206DB for ; Mon, 30 Dec 2019 18:09:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577729367; bh=Nm2GkN0v9JKdH/m8HQfUDrkVQHewuDa6fkB1QsjK/gE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gaOmWZMy++9OrL6le9G0nfHYnhicjqx5Jpq7qPr5H51OqTdnT4C5EmAyYJiBVHEEQ 1PjoF7HY4loPEuD+rU4MZu+TuQ55j+U1ed8h6e3/oB7EUJhM+biJTijp82c6TvE+AG sOkOheDqHqJNUcj2BhTTyM68rboTo1NmZ9Emuig0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727599AbfL3SJ1 (ORCPT ); Mon, 30 Dec 2019 13:09:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:38024 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727318AbfL3SJ1 (ORCPT ); Mon, 30 Dec 2019 13:09:27 -0500 Received: from localhost.localdomain (91-167-84-221.subs.proxad.net [91.167.84.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 79AA92080A; Mon, 30 Dec 2019 18:09:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577729366; bh=Nm2GkN0v9JKdH/m8HQfUDrkVQHewuDa6fkB1QsjK/gE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ftd5FUiWWXQcXPGAUANU5AJb1y1+9d1H/ku2fCwzf59DYN0tZFO+CP9rNSxnrLgkc hMvmf+rdvsHGVAnx41dk4BNX/3W56RY/DnVK7PRf8M4/QPEYuq0NrZOrd0KxoySyMm ZTIQjQzqL/MRSKgNNWfLeHXttfb20ItB9V+c+96s= From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: Ard Biesheuvel , Ingo Molnar , Arvind Sankar , Hans de Goede , Andy Lutomirski Subject: [PATCH v2 03/14] efi/x86: re-disable RT services for 32-bit kernels running on 64-bit EFI Date: Mon, 30 Dec 2019 19:08:23 +0100 Message-Id: <20191230180834.75601-4-ardb@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191230180834.75601-1-ardb@kernel.org> References: <20191230180834.75601-1-ardb@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Commit a8147dba75b1 ("efi/x86: Rename efi_is_native() to efi_is_mixed()") renamed and refactored efi_is_native() into efi_is_mixed(), but failed to take into account that these are not diametrical opposites. Mixed mode is a construct that permits 64-bit kernels to boot on 32-bit firmware, but there is another non-native combination which is supported, i.e., 32-bit kernels booting on 64-bit firmware, but only for boot and not for runtime services. Also, mixed mode can be disabled in Kconfig, in which case the 64-bit kernel can still be booted from 32-bit firmware, but without access to runtime services. Due to this oversight, efi_runtime_supported() now incorrectly returns true for such configurations, resulting in crashes at boot. So fix this by making efi_runtime_supported() aware of this. As a side effect, some efi_thunk_xxx() stubs have become obsolete, so remove them as well. Signed-off-by: Ard Biesheuvel --- arch/x86/include/asm/efi.h | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index 2d1378f19b74..b35b5d423e9d 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h @@ -163,10 +163,10 @@ static inline bool efi_is_mixed(void) static inline bool efi_runtime_supported(void) { - if (!efi_is_mixed()) + if (IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT)) return true; - if (!efi_enabled(EFI_OLD_MEMMAP)) + if (IS_ENABLED(CONFIG_EFI_MIXED) && !efi_enabled(EFI_OLD_MEMMAP)) return true; return false; @@ -176,7 +176,6 @@ extern void parse_efi_setup(u64 phys_addr, u32 data_len); extern void efifb_setup_from_dmi(struct screen_info *si, const char *opt); -#ifdef CONFIG_EFI_MIXED extern void efi_thunk_runtime_setup(void); extern efi_status_t efi_thunk_set_virtual_address_map( void *phys_set_virtual_address_map, @@ -184,19 +183,6 @@ extern efi_status_t efi_thunk_set_virtual_address_map( unsigned long descriptor_size, u32 descriptor_version, efi_memory_desc_t *virtual_map); -#else -static inline void efi_thunk_runtime_setup(void) {} -static inline efi_status_t efi_thunk_set_virtual_address_map( - void *phys_set_virtual_address_map, - unsigned long memory_map_size, - unsigned long descriptor_size, - u32 descriptor_version, - efi_memory_desc_t *virtual_map) -{ - return EFI_SUCCESS; -} -#endif /* CONFIG_EFI_MIXED */ - /* arch specific definitions used by the stub code */ -- 2.20.1