Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3861822pxb; Tue, 17 Nov 2020 05:38:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwv63DOESY9IgbR1SOGylpalBgca9tKNndEthuZgH4xPmuduLbAiIRwvO16UETrb4yHRDJa X-Received: by 2002:a05:6402:849:: with SMTP id b9mr1175396edz.99.1605620314136; Tue, 17 Nov 2020 05:38:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620314; cv=none; d=google.com; s=arc-20160816; b=x9QS9ETBC159STZxADi3jhu2kyxJ2P3OZlAJYCMTlPm7hble1KgzV2QCgNskfyHRbn D61a0cshejT2pT2rTkxb/9Y13XXlfGLfnkrRzmDURZpX06QvTFM7RX5KR2YUDfUHyh0L aAfqydCzZW0UBSjrjPnb4k8ydejqkiz3ucohOIqWxO8yZrrSE7rJ/PBIsc5Yes4OF3YP Qvt5Ko2p+pES7UVEjDwsgsWfPWriIEAPPxB/clCevlTH8ofEQzbF1buP7As+zigqShQM DjlOJe58eMI985bShTVIjMgKh3kGVu6trduNUcr7vw0I+cS503UZdK+yo9Dgn5aA4nc8 tfDg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gmIQXXYrGY9jKzeTvzE5k55JN+TxU8s9ekuqIb6Y+ao=; b=FThD0UZVDUO7BopchP37QG9HYBKk7/4hUnV6csDrdQfni2D9YHZwDsB3GqLTcCughX 6tiMzZUqiCEzudaKqDUgCUsnkciPbo095rbhENZd666MoXoZpN6hsDiPnR9NQIKEnqCB EHNg3zyP8yDDBg7S2z8l0dR4eghcXot3u4k64vbr7H8wqza0hbonkwDOE22DRWijnb1o QR/tv/4WeuQT7b/6YPciwXKeIHihRPluRA8kcOcuizcGojx/0roNaKjW7ZXttvKLL6Zr UcZR36+dRkgI+LoZSIY/uGFbe+tPcCfEMuz3+56eiB2thvtcoQTotdIf0v3GEt6D2siR TPdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hy154G7O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f24si13827135edw.120.2020.11.17.05.38.11; Tue, 17 Nov 2020 05:38:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hy154G7O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731711AbgKQNgN (ORCPT + 99 others); Tue, 17 Nov 2020 08:36:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:47050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732545AbgKQNgI (ORCPT ); Tue, 17 Nov 2020 08:36:08 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8E3DE24654; Tue, 17 Nov 2020 13:36:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605620167; bh=GF8uZORD5QDWHUzWT9fZqoX0F3CBezSaqqLgSAq7ugI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hy154G7OCLHoHsVAHyg8bi+jpcBzDvEHtMNHzjIrYvrnTIWLA03pIjg2JYTyoUVbQ 7gAPFe+ufytbPnUpMyOJXwC7MmzCFUdmRsxmuoL/V6GrXcHGkM2XuJb++MvUiKl5qz RLvKSkFsBJdqe+OztbKi2Zz2ql0F3mJpkL2XAcw0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joerg Roedel , Borislav Petkov , Tom Lendacky , Sasha Levin Subject: [PATCH 5.9 088/255] x86/boot/compressed/64: Introduce sev_status Date: Tue, 17 Nov 2020 14:03:48 +0100 Message-Id: <20201117122143.241789632@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel [ Upstream commit 3ad84246a4097010f3ae3d6944120c0be00e9e7a ] 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 Signed-off-by: Sasha Levin --- 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 dd07e7b41b115..3092ae173f94e 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 -- 2.27.0