From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9498BC2D0A3 for ; Thu, 29 Oct 2020 19:18:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A3572076E for ; Thu, 29 Oct 2020 19:18:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="IGFvAgHE"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="3O//TZeM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726051AbgJ2TSd (ORCPT ); Thu, 29 Oct 2020 15:18:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725937AbgJ2TRo (ORCPT ); Thu, 29 Oct 2020 15:17:44 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7CFFC0613CF; Thu, 29 Oct 2020 12:17:44 -0700 (PDT) Date: Thu, 29 Oct 2020 19:17:42 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1603999063; 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=R7+dGBqc2f5XoJ4SOWY6qsm+q+4HuAyLb5Pp0X1TMoM=; b=IGFvAgHE4DOkxvXmUQz/lSNYe8PAlWmBlWNwYvdrgxZTKxYAlyXV098Df5VSNIOIgXNuwZ hUpO93h3X2lMB0mStHdJJjb4QfJBYy8KAXvt6TqMWox+G8RclNe7aBve/ZXXAd6hSSPUsv UzYHv5WLcWWuq9mFvXzEcTKkVEWuPpXXWz8dxoBEZKaqOIuwUlHDNIpvls+8u2bEDR8PXh wDWHZoexgIi1AMsrpux/B9ugp/WJHcinKj2WKoJ49NvTTmz/+hrum8aNykrcfLv/WxFcFF iZrrk3QEZaUNAnVLPy0TK/GtwyTCOdFaYOKnfSFM6g8kIHlW5AwN2+e2NXJp+g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1603999063; 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=R7+dGBqc2f5XoJ4SOWY6qsm+q+4HuAyLb5Pp0X1TMoM=; b=3O//TZeM1OiO4AKIX024mIS03kOlDzBmLxSNU/H5MD4CHWOKs8nCMOdBh+CcTFqgzHy1HC 32goRrYs+7QhzVDQ== From: "tip-bot2 for Joerg Roedel" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/seves] x86/boot/compressed/64: Introduce sev_status Cc: Joerg Roedel , Borislav Petkov , Tom Lendacky , x86 , LKML In-Reply-To: <20201028164659.27002-2-joro@8bytes.org> References: <20201028164659.27002-2-joro@8bytes.org> MIME-Version: 1.0 Message-ID: <160399906249.397.15926591077255529069.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/seves branch of tip: Commit-ID: 3ad84246a4097010f3ae3d6944120c0be00e9e7a Gitweb: https://git.kernel.org/tip/3ad84246a4097010f3ae3d6944120c0be00e9e7a Author: Joerg Roedel AuthorDate: Wed, 28 Oct 2020 17:46:55 +01:00 Committer: Borislav Petkov CommitterDate: Thu, 29 Oct 2020 10:54:36 +01:00 x86/boot/compressed/64: Introduce sev_status Introduce sev_status and initialize it together with sme_me_mask to have an indicator which SEV features are enabled. Signed-off-by: Joerg Roedel Signed-off-by: Borislav Petkov Reviewed-by: Tom Lendacky Link: https://lkml.kernel.org/r/20201028164659.27002-2-joro@8bytes.org --- arch/x86/boot/compressed/mem_encrypt.S | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/x86/boot/compressed/mem_encrypt.S b/arch/x86/boot/compressed/mem_encrypt.S index dd07e7b..3092ae1 100644 --- a/arch/x86/boot/compressed/mem_encrypt.S +++ b/arch/x86/boot/compressed/mem_encrypt.S @@ -81,6 +81,19 @@ SYM_FUNC_START(set_sev_encryption_mask) bts %rax, sme_me_mask(%rip) /* Create the encryption mask */ + /* + * Read MSR_AMD64_SEV again and store it to sev_status. Can't do this in + * get_sev_encryption_bit() because this function is 32-bit code and + * shared between 64-bit and 32-bit boot path. + */ + movl $MSR_AMD64_SEV, %ecx /* Read the SEV MSR */ + rdmsr + + /* Store MSR value in sev_status */ + shlq $32, %rdx + orq %rdx, %rax + movq %rax, sev_status(%rip) + .Lno_sev_mask: movq %rbp, %rsp /* Restore original stack pointer */ @@ -96,5 +109,6 @@ SYM_FUNC_END(set_sev_encryption_mask) #ifdef CONFIG_AMD_MEM_ENCRYPT .balign 8 -SYM_DATA(sme_me_mask, .quad 0) +SYM_DATA(sme_me_mask, .quad 0) +SYM_DATA(sev_status, .quad 0) #endif