From patchwork Thu Nov 24 08:12:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 25350 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3258397wrr; Thu, 24 Nov 2022 00:13:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf6EI8AZ0bujNigXcFf3PEPzFtkwZyOR37Yi1sz5FzCfW3SJXIEiRgPogJgRQ6x141Pyy7Ud X-Received: by 2002:a62:1715:0:b0:574:684c:e41e with SMTP id 21-20020a621715000000b00574684ce41emr5296862pfx.72.1669277616222; Thu, 24 Nov 2022 00:13:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669277616; cv=none; d=google.com; s=arc-20160816; b=xgxAQI9/h1AJCeoPCSLaYQKMU53Thb78FTrlLKgrPugbBBJOuEzAXDDzCPmuHy9+Qg cx4XRMUCoHOyuWQTb+WKW5jJ+U6CmfA2KhHM+xT1kyH68gQf9DQ86w3K2e237Gk3hm8G sASUnPTf9k5CxcY/sE4bHmVjsnoKYnd/uj2HPE/JixD1zBuI188fhb0r/zpVl6eVVJud 30KeXcjT3mgjGL4S3yyww0wABpZICP9z93IO/67KYOm5z43Na5RA3kp6ETV0twd089sY T0q6Hx7/bLqqyn8kdmadoCQWg6S9UlTYY2AtlHdvJZ8mf91fab0enV96vsBZk6VhBZty 11zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=sXG1WiaHSdDH9/dXCMjF+OGQtyZOdzl8X9IRE8OLDaw=; b=GJj00BQwHCLR3kQdzQ/eU7QtOSxDyrSFem6LBeuKQFEOt9uj9YtkEZ9qIlTHGIcgxn DTR9Cx0y5A+aWnhw0n3pipMtpG4ZIPNdgQep9wFDEomQniwtlzPymDB79YJKcyPT+bhG YvfQqOzF3UcExVltvfUKOxJMP0sBXSzceRxqYl6BetmufKLg3uU75LW8yWGyNPZFJFhs vzeQ/t55LHlRfX3pt4DP4qzWIa+cFo8YX3/sGbwFOodWhaMRVFiE9vI4zzCl9/moQ0oK tkQlGe/N1NNix6UubsyUbCYzyFudkny/Oyi0ulZdaqqKNknfhE2YtNqRz26hOaJq/Pgv F+pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=EbFBsiSk; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p22-20020a635b16000000b004777166873csi392174pgb.548.2022.11.24.00.13.23; Thu, 24 Nov 2022 00:13:36 -0800 (PST) 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=@linutronix.de header.s=2020 header.b=EbFBsiSk; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229789AbiKXINH (ORCPT + 99 others); Thu, 24 Nov 2022 03:13:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229819AbiKXIMO (ORCPT ); Thu, 24 Nov 2022 03:12:14 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F16EEE2B5E; Thu, 24 Nov 2022 00:12:02 -0800 (PST) Date: Thu, 24 Nov 2022 08:12:00 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669277521; h=from:from:sender:sender:reply-to: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sXG1WiaHSdDH9/dXCMjF+OGQtyZOdzl8X9IRE8OLDaw=; b=EbFBsiSkXkRnoSblrxUeKTMkYlrsbRoWId6pjVAmZT39FKAUMmbw7XLFbflUgAs/O1b5m6 Y6P9rRuYglZCt0BMmVHfJ5hGeBm+LSb4mNdld3qcPUcFAdqrPXFxQh28SYd5iZuitRfLvB g5B8/XeETwIswBFecZV/ghXIo5m1VoiqVyyM7kcM7u18zsyP88O3oEL6I//N8b5mSvUFlb HrpfPBlbJG5vOcZvQzXR3tlQJaZANuaaGqfTxbuhz8x3W9Nx4vU0ZmRTJTM9aLiMI/OMr0 b/imeYXpTtnga6NVZPmi0Trb8rgo9+rSyBuZZpAkIur/RCVUUoyOIfZEv9TKqw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669277521; h=from:from:sender:sender:reply-to: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sXG1WiaHSdDH9/dXCMjF+OGQtyZOdzl8X9IRE8OLDaw=; b=tdZgBhkIfS4KeNA2TmajMjpNvZNEuIrLXabD1CKXxj7l1Tw6dhvwnpVmAf2JOd/PYEsnv3 +8TqiQ6pzT/LwFDA== From: "tip-bot2 for Ard Biesheuvel" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/boot] x86/boot/compressed: Adhere to calling convention in get_sev_encryption_bit() Cc: Ard Biesheuvel , Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221122161017.2426828-16-ardb@kernel.org> References: <20221122161017.2426828-16-ardb@kernel.org> MIME-Version: 1.0 Message-ID: <166927752026.4906.18301917171535332713.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750364446020789131?= X-GMAIL-MSGID: =?utf-8?q?1750364446020789131?= The following commit has been merged into the x86/boot branch of tip: Commit-ID: 30c9ca16a5271ba6f8ad9c86507ff1c789c94677 Gitweb: https://git.kernel.org/tip/30c9ca16a5271ba6f8ad9c86507ff1c789c94677 Author: Ard Biesheuvel AuthorDate: Tue, 22 Nov 2022 17:10:15 +01:00 Committer: Borislav Petkov CommitterDate: Thu, 24 Nov 2022 08:57:41 +01:00 x86/boot/compressed: Adhere to calling convention in get_sev_encryption_bit() Make get_sev_encryption_bit() follow the ordinary i386 calling convention, and only call it if CONFIG_AMD_MEM_ENCRYPT is actually enabled. This clarifies the calling code, and makes it more maintainable. Signed-off-by: Ard Biesheuvel Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20221122161017.2426828-16-ardb@kernel.org --- arch/x86/boot/compressed/head_64.S | 5 +++-- arch/x86/boot/compressed/mem_encrypt.S | 10 ---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index db577fb..6ba2c21 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S @@ -180,12 +180,13 @@ SYM_FUNC_START(startup_32) */ /* * If SEV is active then set the encryption mask in the page tables. - * This will insure that when the kernel is copied and decompressed + * This will ensure that when the kernel is copied and decompressed * it will be done so encrypted. */ - call get_sev_encryption_bit xorl %edx, %edx #ifdef CONFIG_AMD_MEM_ENCRYPT + call get_sev_encryption_bit + xorl %edx, %edx testl %eax, %eax jz 1f subl $32, %eax /* Encryption bit is always above bit 31 */ diff --git a/arch/x86/boot/compressed/mem_encrypt.S b/arch/x86/boot/compressed/mem_encrypt.S index 14cf04a..e696745 100644 --- a/arch/x86/boot/compressed/mem_encrypt.S +++ b/arch/x86/boot/compressed/mem_encrypt.S @@ -18,12 +18,7 @@ .text .code32 SYM_FUNC_START(get_sev_encryption_bit) - xor %eax, %eax - -#ifdef CONFIG_AMD_MEM_ENCRYPT push %ebx - push %ecx - push %edx movl $0x80000000, %eax /* CPUID to check the highest leaf */ cpuid @@ -54,12 +49,7 @@ SYM_FUNC_START(get_sev_encryption_bit) xor %eax, %eax .Lsev_exit: - pop %edx - pop %ecx pop %ebx - -#endif /* CONFIG_AMD_MEM_ENCRYPT */ - RET SYM_FUNC_END(get_sev_encryption_bit)