Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp352568rwd; Thu, 8 Jun 2023 01:22:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ417U8yiae6SW0KY1XjO0eeJwxsjSAGIiPiAqDLOQy0Y9jg+lVQRGeEospuSH7jnxvQ82u+ X-Received: by 2002:a17:902:c949:b0:1b1:9272:5610 with SMTP id i9-20020a170902c94900b001b192725610mr4471033pla.47.1686212564631; Thu, 08 Jun 2023 01:22:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686212564; cv=none; d=google.com; s=arc-20160816; b=1I/RYUEQtA1TUlsJqFyjoL2dH5t4JAyVLOrebrpNdzyjuXAqq2xo8dCUFMLLP+2S9O AtbUfjVg5DjV1ULhzPIRwTp5JPXpPLVcCQ6VyeUq+kTxH2FPpa8zwLFkpoIv+bw7Cgyn 6ZpfQVH7KzEvMXEFsITXJqX+7Czwzymeo8Fh8Cv8MjuqHjs7RxJdpKaoq3/PwSlkNy0M y2tqVenDS9h83jZ+nldoFrDMaDGtsbpJGxH26g7OPMmz3YqAb0hhCs22jddZkGDu4irW 0QlcwpJ4xAiAHwTMRrR6+BAL/MLvq7GACP4Y6hBRKYhd/mzyJLtqMvhoC8GmrBO5jvtQ e6cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=cN3xWSDYr7VKM8snuuIsTrUsOdx4ybgLB4+GzYxLc78=; b=BRN75h6ssypIsEZFp0nJmBosxHv//uyuAghBsJw9eQ2GIyuR+OHkdskvIunlslFNox bw7LQ08erS/HlxKMnnBQRcpT2bH7FSXEzR53O4Xy5FaunECEXUvS4i75jV3cIVm/j16e B6pU9RqWAFwjKSqRgiA/TTspsZCjPFNqxS3jj1facduFDFQ2M0YOtC8ROjai0ompTw5S nX6VdNWGhHNSuDlb2nx5bNmcQ85So5pSLvBCbU5EYvNVKbUCVq0Bc9P//YuAS8T4vuER 8/avwjkJk66C9oX+ikgnhPR8ROzaKgBwkoisxQ4C8MzJhLDZyC7MmrLtjiad1s7dHQwf tYMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nLw2nED3; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w17-20020a170902e89100b001b176dc95dbsi724859plg.593.2023.06.08.01.22.33; Thu, 08 Jun 2023 01:22:44 -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=@kernel.org header.s=k20201202 header.b=nLw2nED3; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235113AbjFHIFQ (ORCPT + 99 others); Thu, 8 Jun 2023 04:05:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234542AbjFHIE7 (ORCPT ); Thu, 8 Jun 2023 04:04:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE1BE2121; Thu, 8 Jun 2023 01:04:57 -0700 (PDT) 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 7A37464A19; Thu, 8 Jun 2023 08:04:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D76CBC433A0; Thu, 8 Jun 2023 08:04:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686211496; bh=YuQBDllZbwBwxvyPF9jL3eauRaVU0dHpdkr5oSW5Z9Y=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=nLw2nED3lL8I5pUJK91Mc7/IpZ5Ibar5FTvqlQWu/3HChY4zKT24q/nnE7sdk+TsT 1JXr6i8W5p4/YE7zZxD2cPYV5fVwirMDA51cH6f7XNmkVJ6J+uiMjNzj3sKxRcsOWU Slwjy/2wW4+Ufib1+ktqAmv3USeYHh7CkuTWUkfzqT/1wGNBQRvsJUWiR0nZxbwbxe wA13yxmlu7zzFDfqJ2yqaKpnatKsy3XZaxnpFN9hxzMQnjHsWX05r1lXhxF7RJ2nlw 5+hkwpHPUE8XJtgSpHHiHRABReWdr97n2u9WP+1IgKGAzYNxGImOdmPmiky960saEE nJwg5ct8Jig8w== Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2b1b92845e1so2498541fa.0; Thu, 08 Jun 2023 01:04:56 -0700 (PDT) X-Gm-Message-State: AC+VfDw9EvfrCHk1r0RbPJYM7vAb5DsLqhJ1JD4SYgswjrUjKZC4fqEe ATFWjZl5mdjvvsBuZo7wwzlDQGhjqE84pcK9Pmw= X-Received: by 2002:a2e:9f44:0:b0:2b1:d6bf:d8b2 with SMTP id v4-20020a2e9f44000000b002b1d6bfd8b2mr3879003ljk.22.1686211494926; Thu, 08 Jun 2023 01:04:54 -0700 (PDT) MIME-Version: 1.0 References: <20230607072342.4054036-1-ardb@kernel.org> <20230607072342.4054036-11-ardb@kernel.org> <20230607180920.GA3110@yjiang5-mobl.amr.corp.intel.com> In-Reply-To: <20230607180920.GA3110@yjiang5-mobl.amr.corp.intel.com> From: Ard Biesheuvel Date: Thu, 8 Jun 2023 10:04:43 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 10/20] x86/decompressor: Call trampoline directly from C code To: Yunhong Jiang Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Evgeniy Baskov , Borislav Petkov , Andy Lutomirski , Dave Hansen , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Alexey Khoroshilov , Peter Jones , Gerd Hoffmann , Dave Young , Mario Limonciello , Kees Cook , Tom Lendacky , "Kirill A . Shutemov" , Linus Torvalds , Joerg Roedel Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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, 7 Jun 2023 at 20:09, Yunhong Jiang wrote: > > On Wed, Jun 07, 2023 at 09:23:32AM +0200, Ard Biesheuvel wrote: > > Instead of returning to the asm calling code to invoke the trampoline, > > call it straight from the C code that sets the scene. That way, the > > struct return type is no longer needed for returning two values, and the > > call can be made conditional more cleanly in a subsequent patch. > > > > Acked-by: Kirill A. Shutemov > > Signed-off-by: Ard Biesheuvel > > --- > > arch/x86/boot/compressed/head_64.S | 20 +++----------- > > arch/x86/boot/compressed/pgtable_64.c | 28 ++++++++------------ > > 2 files changed, 15 insertions(+), 33 deletions(-) > > ... > > diff --git a/arch/x86/boot/compressed/pgtable_64.c b/arch/x86/boot/compressed/pgtable_64.c > > index d66639c961b8eeda..1d28ad95ea839531 100644 > > --- a/arch/x86/boot/compressed/pgtable_64.c > > +++ b/arch/x86/boot/compressed/pgtable_64.c > > @@ -16,11 +16,6 @@ unsigned int __section(".data") pgdir_shift = 39; > > unsigned int __section(".data") ptrs_per_p4d = 1; > > #endif > > > > -struct paging_config { > > - unsigned long trampoline_start; > > - unsigned long l5_required; > > -}; > > - > > /* Buffer to preserve trampoline memory */ > > static char trampoline_save[TRAMPOLINE_32BIT_SIZE]; > > > > @@ -106,10 +101,10 @@ static unsigned long find_trampoline_placement(void) > > return bios_start - TRAMPOLINE_32BIT_SIZE; > > } > > > > -struct paging_config paging_prepare(void *rmode) > > +asmlinkage void set_paging_levels(void *rmode) > > Can you please change the refer to paging_prepare() in the comments above also? You mean the below, right? --- a/arch/x86/boot/compressed/pgtable_64.c +++ b/arch/x86/boot/compressed/pgtable_64.c @@ -24,7 +24,7 @@ static char trampoline_save[TRAMPOLINE_32BIT_SIZE]; * purposes. * * Avoid putting the pointer into .bss as it will be cleared between - * paging_prepare() and extract_kernel(). + * set_paging_levels() and extract_kernel(). */ unsigned long *trampoline_32bit __section(".data");