Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp5483886rwb; Wed, 21 Sep 2022 08:23:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM58eT2n7QzzRGs9dOS8o0mnUhX1UYkASQQkhrKl+2/RAiYPYGxpE3XbGkp8xwXQaymcPXEs X-Received: by 2002:a05:6402:370c:b0:453:9fab:1b53 with SMTP id ek12-20020a056402370c00b004539fab1b53mr20505621edb.28.1663773811825; Wed, 21 Sep 2022 08:23:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663773811; cv=none; d=google.com; s=arc-20160816; b=zH6gkIUDtNGE3zpRcxDwpO90+gpafjyIIPRV0qxQz+S2VaBJho1oM54Z2LCY+4gRLU eHD+JgvMnhr1Rlrg4hP/36Pk19HgyyxcDoc1w+8CMNaN5Ix9SGG/sWj5hMzO6/tTe42z WUhx1Nhdh26E/Uc+R6WYmUdvhcAzsI0lo2LdetH1bBwm7g4AuMtK72H3rlqsKV/iIfGm O3HWd3Tgz91XceseuBLUsQa8YMmxgiwIoiVtaPmVtcNwofnul4+B71PnPzmHhu7P7cqW BQbACbx8OzJ7k1BdOoWCYsOJjLqTZv4fz76BpMTpki9sWiCBbgjac1NZvvAWJCtjiObU QjpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ocnEPO/SsMN+voswWTGU8fRIQMH1PQURZ1CPA48K+V8=; b=fZMxDiDi/MKHoe/5Os9S7eIhcHkb9u6XmNRzkKwReNfoqIP6AH968AqJ0laGNXs7ly /InGGkBk4gt09mnFp0Tzri/aaxxeZ4NiwmL7xNA+1URWM52CBP3tp8iCY+KaDiMX0AVX 4bxyqmoqKp7wklNQTJP/iIOhztZhNX6trrvQJHnD2JTqK5AWwDI10Xw48ALKkxtWjv5I /HJpnIjgy9r/Z2NcRrVjMGgCV+olqPPHJlpaLWWN+tWzoRy86k7FoU4LtU9QorDb62/R uJaUdr5ppa8tR2PJyisrhjIQA61T5ORPNGFgB7V5/F4jfCzd6kIwhrxOk0SFQ8y5lUiD Byyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p2bc0kbC; 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 e5-20020a170906314500b007317274bb0dsi2501148eje.979.2022.09.21.08.23.04; Wed, 21 Sep 2022 08:23:31 -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=p2bc0kbC; 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 S230474AbiIUO4W (ORCPT + 99 others); Wed, 21 Sep 2022 10:56:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229995AbiIUOzn (ORCPT ); Wed, 21 Sep 2022 10:55:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B18681834C; Wed, 21 Sep 2022 07:55:04 -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 A981F630B4; Wed, 21 Sep 2022 14:55:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40560C433B5; Wed, 21 Sep 2022 14:55:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663772103; bh=WbgVHaEsv5DRy1pEnyeBQ/OqX8UNa7Fs1hsnZgK0mbI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p2bc0kbCvcuAPSActZg/u0iWc9IK+6wA6qp3E6RksO7tBA12uIpO8X6MVHspBtSs8 AuBdbZoSJ3cu8I0ThN0e0RLbPoss8DZNUdKSVs5eh9fcpaF6YzijJapfB6Psuv4xLD hcitweaOVUCj22DCGCTE+HRNZN7OdlQXL+7O9TFuVnG3qcCfof4xiKZNsfs/LEEP3D A/ocLuRwUfyCi+ypkK6V1FGPXRFO7Ya+LG4lTnDo2N3dUTM7AzTMbiyQ9J+8qUvbpg obfaDAOAH72/yVUhdnW6Pe3sk15SHpSIwlwY5Hhld85X2LS/xfRAVnJR28+5rg2DIw jYwuPapccNYPg== From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Michael Roth Subject: [PATCH v2 15/16] x86/compressed: adhere to calling convention in get_sev_encryption_bit() Date: Wed, 21 Sep 2022 16:54:21 +0200 Message-Id: <20220921145422.437618-16-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220921145422.437618-1-ardb@kernel.org> References: <20220921145422.437618-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1893; i=ardb@kernel.org; h=from:subject; bh=WbgVHaEsv5DRy1pEnyeBQ/OqX8UNa7Fs1hsnZgK0mbI=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjKyWcevoeMnFcfMXlfXHL30Iq3+wkmMmF/rwOYRei I6uhA3WJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYyslnAAKCRDDTyI5ktmPJCUmC/ 9PIkfSMlPNkplXoVMIGJv1kha8yGwZcGkLAusvMD/tOWh7GhO77LFwxHgAdqqGV++BRskKw5CCpR7p kyWMqZVadBPVk36naHLD3eOwi1pI7IAbYVc8aCkY77OFZxd9kzWcfRzGNzQlrWo6tx1uFdV8q+jjIm VRdWFfI7z2vsnM28gg+DGlw+N1vPCJJ/V6tSqITg7aXuK7JHJW0Zjs5iz13DhC78gBaq4B+canV6Ps Uz/o/bt1X7suyIJA7CmCWMLr2bN4W7m99J/DCq2JiiU0Ilz0FCg9zDn18ssoIW5+QbSwP75WsTgNE7 aEPXOzap/8hRadAa6Cwr2Vy83CnkLPDmRFkJ0UOH5vRQ5c+ULFyYO9v4E8neTxCMNSmSDLdHsviI8x TXlfNp6egbZhFIxAufVJo1szP2/laiYOA22vETgDaCZGLyKWgh5bRxBkaIXOTNrvFmdaYFfZImsBqS hw262c2MifxwvCyt7C6xe7QVB+Nf5ox3Uie/lMPEtiQQA= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 Content-Transfer-Encoding: 8bit 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 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 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 --- 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 232cd3fa3e84..a7bbc8d73a08 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 14cf04a1ed09..e69674588a31 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) -- 2.35.1