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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07C26C4332F for ; Fri, 8 Apr 2022 09:18:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233854AbiDHJRr (ORCPT ); Fri, 8 Apr 2022 05:17:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233210AbiDHJMd (ORCPT ); Fri, 8 Apr 2022 05:12:33 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9373224CED5; Fri, 8 Apr 2022 02:09:21 -0700 (PDT) Date: Fri, 08 Apr 2022 09:09:18 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1649408959; 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=0oKqHiLnMom7KHZmkSWx6feYRwXfc7vGRty8GGglGvg=; b=JhNmRiTFD781Agkk91aVKYy2b8EloJL6ik/SdszItgzRhYBfFC5JU6hRxTzW3a0z/GlwbU l54bIxqPORFhxmNt+7JeDDB8RssmtxXJd91F05GiHl3AmqjZEY82q0CSVt82W2TLl6Lg/A yPv8Yv7Ri5dnSaUVhs1sQrtStEIqbvbi9pQX9ay0lXY69VHRzGrZOMwiZmGth6QGBZEbvQ HAkMBZjzssvTmTv3OWCODXySlHvkn8pIT4q1U94QKEon9l/TjZwqtCpONItZ8sAoBuHMsr Z4/rhb/dI9YCkIm9D9+ZdWhXeKq81E7DvqIV6BmhQ0Gwb9LOfxKSyzIlMdxpAA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1649408959; 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=0oKqHiLnMom7KHZmkSWx6feYRwXfc7vGRty8GGglGvg=; b=ttvozkTJ8TLa9AuteV3UFkILePIxhBEGsdtkQ/zw5oUQ45Rc6eU38O05FbapiTQljlQaET f7XPsX3UBcfsddBQ== From: "tip-bot2 for Brijesh Singh" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/sev] KVM: SVM: Define sev_features and VMPL field in the VMSA Cc: Brijesh Singh , Borislav Petkov , Venu Busireddy , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220307213356.2797205-2-brijesh.singh@amd.com> References: <20220307213356.2797205-2-brijesh.singh@amd.com> MIME-Version: 1.0 Message-ID: <164940895872.389.9988227433375119855.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/sev branch of tip: Commit-ID: 046f773be106ec8eb92b13414c90f8e279deffe0 Gitweb: https://git.kernel.org/tip/046f773be106ec8eb92b13414c90f8e279deffe0 Author: Brijesh Singh AuthorDate: Mon, 07 Mar 2022 15:33:11 -06:00 Committer: Borislav Petkov CommitterDate: Tue, 05 Apr 2022 19:09:27 +02:00 KVM: SVM: Define sev_features and VMPL field in the VMSA The hypervisor uses the sev_features field (offset 3B0h) in the Save State Area to control the SEV-SNP guest features such as SNPActive, vTOM, ReflectVC etc. An SEV-SNP guest can read the sev_features field through the SEV_STATUS MSR. While at it, update dump_vmcb() to log the VMPL level. See APM2 Table 15-34 and B-4 for more details. Signed-off-by: Brijesh Singh Signed-off-by: Borislav Petkov Reviewed-by: Venu Busireddy Link: https://lore.kernel.org/r/20220307213356.2797205-2-brijesh.singh@amd.com --- arch/x86/include/asm/svm.h | 6 ++++-- arch/x86/kvm/svm/svm.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h index f70a510..f2d01f3 100644 --- a/arch/x86/include/asm/svm.h +++ b/arch/x86/include/asm/svm.h @@ -282,7 +282,8 @@ struct vmcb_save_area { struct vmcb_seg ldtr; struct vmcb_seg idtr; struct vmcb_seg tr; - u8 reserved_1[43]; + u8 reserved_1[42]; + u8 vmpl; u8 cpl; u8 reserved_2[4]; u64 efer; @@ -347,7 +348,8 @@ struct vmcb_save_area { u64 sw_exit_info_1; u64 sw_exit_info_2; u64 sw_scratch; - u8 reserved_11[56]; + u64 sev_features; + u8 reserved_11[48]; u64 xcr0; u8 valid_bitmap[16]; u64 x87_state_gpa; diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index bd4c64b..81cb518 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -3117,8 +3117,8 @@ static void dump_vmcb(struct kvm_vcpu *vcpu) "tr:", save01->tr.selector, save01->tr.attrib, save01->tr.limit, save01->tr.base); - pr_err("cpl: %d efer: %016llx\n", - save->cpl, save->efer); + pr_err("vmpl: %d cpl: %d efer: %016llx\n", + save->vmpl, save->cpl, save->efer); pr_err("%-15s %016llx %-13s %016llx\n", "cr0:", save->cr0, "cr2:", save->cr2); pr_err("%-15s %016llx %-13s %016llx\n",