Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp259376ybj; Fri, 8 May 2020 11:07:19 -0700 (PDT) X-Google-Smtp-Source: APiQypKM+IptTNPMf3k606RBHmX8yXjaqOgvLE6o8NamG1yPXCpbxfw+gusm8HdIxdRj5AmnKI+T X-Received: by 2002:a17:906:200a:: with SMTP id 10mr2868057ejo.294.1588961238956; Fri, 08 May 2020 11:07:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588961238; cv=none; d=google.com; s=arc-20160816; b=joI19qDMbgZKKIN8b2zlYhFLVBIzV/5NwHDzmzsrG9R2SLVofgMvYu9Ca32yAOU9BT YJAf683q3liKfKT/xtxf4lsfzIwcwKBaoCNAoVLAtIRrxyHxOevajUlncakLUvi2W4rK robML9MairBWBbFZLxRGWsWly/bu3ec5JW0qPr88cAF2DpXnz5q5exGTiGuQ+WZ6sVyk yRF2ntspT5wPyDkUdeQ2vV5lTX9dEANuBnG+lwIJIMgcjUYOMuLDU7cK4sBLSORBMSD1 nx+rZcuyrhJ7VX4ygTTOleBoI6B+6BP6g762oVgKySUKeIWWKb3faB/sD9LuLnqyugWO 6kxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=WgRn5i1+dXOOh2qk350ilEtJlRy5QgvvgLbjk7YfBfk=; b=gTZAeH00Vv7gM6iwFHJ99yFJOa4HxwZHdTGStGH9MITEEsBh3/OyaoxMCgtUccso6z vL9HyIofEXPbX0ZE4YusxmSFQac0xmskddSym5eXI63wBDl+ne7xCp2KUQBM9ib7K+Xx HsWYmJjoiTAo6xIWY40dv6MRmHbXqrJ0NLmOnX/cJaS+7Fek3Vs+5f+RKdKPZRg2XwxS j1UDDtiOnh1ujcY51jW9dc6wBzYlxPkbo6V+/raYOZgJlnQ343/bzVJROh/E/IetDG9c rYCnrUitHnyWkvfGw19THeexEFLOxQQZSiaMxttYYb2DheHKOtSQjLvACO7xxoMBoFLL ChnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=P+hLRZUF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l4si1433570edl.169.2020.05.08.11.06.52; Fri, 08 May 2020 11:07:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=P+hLRZUF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728049AbgEHSCx (ORCPT + 99 others); Fri, 8 May 2020 14:02:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:48394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728025AbgEHSCw (ORCPT ); Fri, 8 May 2020 14:02:52 -0400 Received: from e123331-lin.nice.arm.com (amontpellier-657-1-18-247.w109-210.abo.wanadoo.fr [109.210.65.247]) (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 CC95624954; Fri, 8 May 2020 18:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588960972; bh=cy0V4lbi7zDsWS5x9DClkcbqGwBIYKZEuTAbd1OIDjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P+hLRZUFTbB4uFWZe8W30e+YZrzPx19vd8lF3lwHs7ucirq+tAYNfvxXk7GGmB+LA Tp8Z3dII1VHWvDP6jwt2Cezqm86N0ur0mocRGbyIrHwBDZUE3SJRGYdT+sSYkqsoVk 1TGTuEXYPRVWbEPNKup2qFuQTEVCoZr67VYh+j0Q= From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Arnd Bergmann , Arvind Sankar , Guenter Roeck , Joe Perches Subject: [PATCH 12/15] efi/libstub: Fix mixed mode boot issue after macro refactor Date: Fri, 8 May 2020 20:01:54 +0200 Message-Id: <20200508180157.1816-13-ardb@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200508180157.1816-1-ardb@kernel.org> References: <20200508180157.1816-1-ardb@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arvind Sankar Commit 22090f84bc3f ("efi/libstub: unify EFI call wrappers for non-x86") refactored the macros that are used to provide wrappers for mixed-mode calls on x86, allowing us to boot a 64-bit kernel on 32-bit firmware. Unfortunately, this broke mixed mode boot due to the fact that efi_is_native() is not a macro on x86. All of these macros should go together, so rather than testing each one to see if it is defined, condition the generic macro definitions on a new ARCH_HAS_EFISTUB_WRAPPERS, and remove the wrapper definitions on x86 as well if CONFIG_EFI_MIXED is not enabled. Fixes: 22090f84bc3f ("efi/libstub: unify EFI call wrappers for non-x86") Reported-by: Guenter Roeck Signed-off-by: Arvind Sankar Link: https://lore.kernel.org/r/20200504150248.62482-1-nivedita@alum.mit.edu Signed-off-by: Ard Biesheuvel --- arch/x86/include/asm/efi.h | 19 +++++++++++++++---- drivers/firmware/efi/libstub/efistub.h | 14 ++++---------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index cd0c3fbf6156..6b9ab0d8b2a7 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h @@ -225,13 +225,15 @@ efi_status_t efi_set_virtual_address_map(unsigned long memory_map_size, /* arch specific definitions used by the stub code */ -extern const bool efi_is64; +#ifdef CONFIG_EFI_MIXED + +#define ARCH_HAS_EFISTUB_WRAPPERS static inline bool efi_is_64bit(void) { - if (IS_ENABLED(CONFIG_EFI_MIXED)) - return efi_is64; - return IS_ENABLED(CONFIG_X86_64); + extern const bool efi_is64; + + return efi_is64; } static inline bool efi_is_native(void) @@ -356,6 +358,15 @@ static inline u32 efi64_convert_status(efi_status_t status) runtime), \ func, __VA_ARGS__)) +#else /* CONFIG_EFI_MIXED */ + +static inline bool efi_is_64bit(void) +{ + return IS_ENABLED(CONFIG_X86_64); +} + +#endif /* CONFIG_EFI_MIXED */ + extern bool efi_reboot_required(void); extern bool efi_is_table_address(unsigned long phys_addr); diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h index 874233cf8820..4f10a09563f3 100644 --- a/drivers/firmware/efi/libstub/efistub.h +++ b/drivers/firmware/efi/libstub/efistub.h @@ -33,20 +33,14 @@ extern bool efi_novamap; extern const efi_system_table_t *efi_system_table; -#ifndef efi_bs_call +#ifndef ARCH_HAS_EFISTUB_WRAPPERS + +#define efi_is_native() (true) #define efi_bs_call(func, ...) efi_system_table->boottime->func(__VA_ARGS__) -#endif -#ifndef efi_rt_call #define efi_rt_call(func, ...) efi_system_table->runtime->func(__VA_ARGS__) -#endif -#ifndef efi_is_native -#define efi_is_native() (true) -#endif -#ifndef efi_table_attr #define efi_table_attr(inst, attr) (inst->attr) -#endif -#ifndef efi_call_proto #define efi_call_proto(inst, func, ...) inst->func(inst, ##__VA_ARGS__) + #endif #define efi_info(msg) do { \ -- 2.17.1