Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp744401rwb; Thu, 6 Oct 2022 04:04:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6MmJcNehNQXgNfAJD8HbN5+W9dwcmQX0RvHTRTs5g3maar1zxvVKD87pEu1K+icdnc8ntD X-Received: by 2002:a62:c584:0:b0:558:2095:e5ed with SMTP id j126-20020a62c584000000b005582095e5edmr4666697pfg.64.1665054272287; Thu, 06 Oct 2022 04:04:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665054272; cv=none; d=google.com; s=arc-20160816; b=GQi8oYKi+r0S7c9QJ9HmmqXHkqMqUIPrp5Akes6740Dzi8cqIA7C/ErAiZsCi4iD4O TL5YKcFCO0i3FipF2FWEUHeU0QI9+22q6h0V6Az7enBum8o/+IpJPGk7xPj/pKb2AdoJ jySw3uIDfffQEGaFaS0R/LKPnq3noNc9RVPEWahGEl0uNmx4LjvCWoOgTF6PqbChiq/s q5upIdrhzT7vS/x7z7hNRm972+9UthIx3uDlKyEMy3j7wtbiUMRJCt4MQUfqRZTV6TO8 gcy31U4yk88XGPhK8dNEyyTya4z91F8i5oB4jqsXYnlCMwdQ9AOITdvF7PBFdxw3PPoA vBNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lI2U8GUzh56RaXmUbzcG4s1t1kCj4GC+HIaGfQgEczQ=; b=VY1FUicAfWcNqaHC9RBD0db4lFlL3BPk41xObTXVMHizEqk7O8wcHFbB0UBJ8eP7cf SO6j/S9BYvtt7PmY3qNbdk4fh/eOm08MA5hs2co1JBMFrFxQOrKr1J9ZXKgQ9T9T45if yTbtt4I6WCBz7N8rTA9OeJM6fiCl87BEb74sBmfkbnFTwQrkhuPWa0CpoINuGz/GKKUb l4igmNFHyoXKodlGqPnwREgOtDSnkwNX08noyYJKIUQG9OQu7zweTXqrbe+BLUduAmxj zZxZhGlQtBZRc+uZapYkM81z9D5wm4S9v2XMhCPUKRAo+bxIEoSQ4OhgrrWmRC12Zc5n sp3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=Q9FGB2RH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f12-20020a63554c000000b0042bba5a062csi19546130pgm.280.2022.10.06.04.04.11; Thu, 06 Oct 2022 04:04:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=Q9FGB2RH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229673AbiJFLDO (ORCPT + 99 others); Thu, 6 Oct 2022 07:03:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbiJFLDM (ORCPT ); Thu, 6 Oct 2022 07:03:12 -0400 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96783F25; Thu, 6 Oct 2022 04:03:11 -0700 (PDT) Received: from zn.tnic (p200300ea9733e732329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:9733:e732:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 357151EC0409; Thu, 6 Oct 2022 13:03:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1665054186; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=lI2U8GUzh56RaXmUbzcG4s1t1kCj4GC+HIaGfQgEczQ=; b=Q9FGB2RHtc5XLgiBhHeuiAF3alhbaXqshtYmVOXu46ogUed/6VjX6WwCC/3r0Z4toUaLCM ooVpczIDhlmyJ/I/X6GQmMcQee93RgIhxfvDuCmGfatt3vYKIs3LfsAm3k+BxAy+ExslgF CDaUcQSilycXnf/7auZadzF7H56K0Sk= Date: Thu, 6 Oct 2022 13:03:01 +0200 From: Borislav Petkov To: Ard Biesheuvel Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Dave Hansen , Michael Roth Subject: Re: [PATCH v2 03/16] x86/compressed: efi-mixed: move bootargs parsing out of 32-bit startup code Message-ID: References: <20220921145422.437618-1-ardb@kernel.org> <20220921145422.437618-4-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220921145422.437618-4-ardb@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 21, 2022 at 04:54:09PM +0200, Ard Biesheuvel wrote: > Move the logic that chooses between the different EFI entrypoints out of > the 32-bit boot path, and into a 64-bit helper that can perform the same > task much more cleanly. While at it, document the mixed mode boot flow > in a code comment. > > Signed-off-by: Ard Biesheuvel > --- > arch/x86/boot/compressed/efi_mixed.S | 43 ++++++++++++++++++++ > arch/x86/boot/compressed/head_64.S | 24 ++--------- > 2 files changed, 47 insertions(+), 20 deletions(-) > > diff --git a/arch/x86/boot/compressed/efi_mixed.S b/arch/x86/boot/compressed/efi_mixed.S > index 67e7edcdfea8..77e77c3ea393 100644 > --- a/arch/x86/boot/compressed/efi_mixed.S > +++ b/arch/x86/boot/compressed/efi_mixed.S > @@ -22,6 +22,49 @@ > > .code64 > .text > +/* > + * When booting in 64-bit mode on 32-bit EFI firmware, startup_64_mixedmode() > + * is the first thing that runs after switching to long mode. Depending on > + * whether the EFI handover protocol or the compat entry point was used to > + * enter the kernel, it will either branch to the 64-bit EFI handover > + * entrypoint at offset 0x390 in the image, or to the 64-bit EFI PE/COFF > + * entrypoint efi_pe_entry(). In the former case, the bootloader must provide a > + * struct bootparams pointer as the third argument, so the presence of such a > + * pointer is used to disambiguate. > + * > + * +--------------+ > + * +------------------+ +------------+ +------>| efi_pe_entry | > + * | efi32_pe_entry |---->| | | +-----------+--+ > + * +------------------+ | | +------+---------------+ | > + * | startup_32 |---->| startup_64_mixedmode | | > + * +------------------+ | | +------+---------------+ V > + * | efi32_stub_entry |---->| | | +------------------+ > + * +------------------+ +------------+ +---->| efi64_stub_entry | > + * +-------------+----+ > + * +------------+ +----------+ | > + * | startup_64 |<----| efi_main |<--------------+ > + * +------------+ +----------+ > + */ That is much appreciated. Questions: - is this whole handover ABI documented somewhere? - efi32_pe_entry() is the 32-bit PE/COFF entry point? I.e., that is called by a 32-bit EFI fw when the kernel is a PE/COFF executable? But then Documentation/admin-guide/efi-stub.rst talks about the EFI stub and exactly that. Hmm, so what is efi32_pe_entry() then? > +SYM_FUNC_START(startup_64_mixedmode) ... mixed_mode I guess. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette