From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1q1Tzs-0007qe-DB for mharc-grub-devel@gnu.org; Tue, 23 May 2023 11:32:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q1TzS-0007ZP-EB for grub-devel@gnu.org; Tue, 23 May 2023 11:32:01 -0400 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q1TzQ-0002PH-D5 for grub-devel@gnu.org; Tue, 23 May 2023 11:31:58 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DF358630E7; Tue, 23 May 2023 15:31:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49974C43443; Tue, 23 May 2023 15:31:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684855913; bh=mPFOx0fTe609jOn6Fu/JNcEXVWOry+S09oH0ohPqyZE=; h=From:To:Cc:Subject:Date:From; b=DXcWJBjUfQqSExLYJvSkln6m5R/xlLmiEgMg6h2DygGYTxaR/WxQMmXdTYRekpgtm 63ESF1bYOIfe3R65ZawvRGERooHBstTLnoaoSOreA9nzbGSAg1aIycAuHLNoBOKSwI AENq78gxtLUMu/YX3eQAXMEY0HKS9jR4vtZlU3+NiUg+Qc3dEivH5fI71+/b8ScxBy lzNT70JyDAWV0vD0UbbQpfofz1fHmDELj5GN6SIk6M70bPfO5gaHXU3NCFvAEIylVS 8SjVn2qxeATX16Y6kjqTRF1lwzgl/PrZPNTd5BWd2mAkeWwtKVe7wv7mHqySRoQSBa SvoE0vakG70ng== From: Ard Biesheuvel To: grub-devel@gnu.org Cc: Ard Biesheuvel , Daniel Kiper , Glenn Washburn Subject: [PATCH v4 0/5] efi: Implement generic EFI boot for x86 Date: Tue, 23 May 2023 17:31:40 +0200 Message-Id: <20230523153145.822782-1-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3392; i=ardb@kernel.org; h=from:subject; bh=mPFOx0fTe609jOn6Fu/JNcEXVWOry+S09oH0ohPqyZE=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JISXnTtQpc960vU/PdM1ZUWD8qjhYZbEDi31RY+rUDp5nO TxxFy92lLIwiHEwyIopsgjM/vtu5+mJUrXOs2Rh5rAygQxh4OIUgIkYRzEy7OgvTX7zomrDR42W u2fZAh6GsUw45SLKop/vZLlFMu/gVYb/VbummMq+5m56cK94/pX/a07rcTy+fY9p49d159x2Xz+ awQ4A X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2604:1380:4641:c500::1; envelope-from=ardb@kernel.org; helo=dfw.source.kernel.org X-Spam_score_int: -70 X-Spam_score: -7.1 X-Spam_bar: ------- X-Spam_report: (-7.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 May 2023 15:32:02 -0000 Switch the i386-efi and x86_64-efi builds to the generic EFI loader, which enters the Linux kernel via the EFI stub and provides the initrd via the LoadFile2 protocol. This unifies x86 with other EFI architectures, and removes the dependency on the setup header and struct bootparams. Do some preparatory cleanup first, so we no longer need to rely on the MS to SysV calling convention translation code. Changes since v3: - add missing efiapi annotations to efiemu routines - work around dead code warning from Coverity by making unnecessary changes to the initrd loading logic in the generic EFI loader Changes since v2: - rebase onto latest master, which has the Loongarch changes - retain Itanium support for now - simplify the fallback logic - attempt to load the image as usual, and fallback on failure or if the image does not implement LoadFile2 Changes since v1: - drop Itanium support, which is a maintenance burden as it shares the EFI code with other architectures, but does not have a EFI stub in Linux, and there is no way to test whether our changes break the boot for it or not; - enable generic EFI for i386 as well - wire up the existing x86 code as a fallback for kernels that lack EFI stub or LoadFile2 support. This removes the need for additional changes to support v5.8 or older kernels. Cc: Daniel Kiper Cc: Glenn Washburn Ard Biesheuvel (5): efi: Make EFI PXE protocol methods non-callable efi: Add calling convention annotation to all prototypes efi: Drop all uses of efi_call_XX wrappers efi: Remove x86_64 call wrappers efi: Use generic EFI loader for x86_64 and i386 grub-core/Makefile.core.def | 3 +- grub-core/commands/acpi.c | 8 +- grub-core/commands/efi/efitextmode.c | 8 +- grub-core/commands/efi/lsefi.c | 5 +- grub-core/commands/efi/tpm.c | 21 +- grub-core/disk/efi/efidisk.c | 7 +- grub-core/efiemu/runtime/efiemu.c | 48 +- grub-core/kern/arm/efi/init.c | 12 +- grub-core/kern/efi/efi.c | 56 +- grub-core/kern/efi/init.c | 15 +- grub-core/kern/efi/mm.c | 17 +- grub-core/kern/i386/efi/tsc.c | 2 +- grub-core/kern/ia64/efi/init.c | 14 +- grub-core/kern/loongarch64/efi/init.c | 10 +- grub-core/kern/x86_64/efi/callwrap.S | 129 ---- grub-core/lib/efi/datetime.c | 9 +- grub-core/lib/efi/halt.c | 4 +- grub-core/lib/efi/relocator.c | 6 +- grub-core/loader/efi/appleloader.c | 8 +- grub-core/loader/efi/chainloader.c | 20 +- grub-core/loader/efi/linux.c | 47 +- grub-core/loader/i386/linux.c | 8 + grub-core/mmap/efi/mmap.c | 16 +- grub-core/net/drivers/efi/efinet.c | 26 +- grub-core/term/efi/console.c | 29 +- grub-core/term/efi/serial.c | 18 +- grub-core/video/efi_gop.c | 18 +- grub-core/video/efi_uga.c | 8 +- include/grub/efi/api.h | 666 +++++++++----------- include/grub/efi/efi.h | 2 +- include/grub/efi/tpm.h | 149 +++-- 31 files changed, 628 insertions(+), 761 deletions(-) delete mode 100644 grub-core/kern/x86_64/efi/callwrap.S -- 2.39.2