Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp163905pxw; Fri, 8 Apr 2022 04:23:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqJmlqkfu5rK5xl+TN/G7VDStVmeU5O2xC2ssRqZak0wgRsKgEcv5zllcC3pDhyvCAcJFa X-Received: by 2002:a17:903:22c2:b0:154:565b:b273 with SMTP id y2-20020a17090322c200b00154565bb273mr19065282plg.115.1649416994427; Fri, 08 Apr 2022 04:23:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649416994; cv=none; d=google.com; s=arc-20160816; b=kGWkoIwecGGsdZgt+FgS43ThFMBbLOA2gVMk6IGuBYnBukHF0dhEJDEN9kZ7V1qjD+ Fzl4LaY8nRmvzE7ic90kX+UjKrMgVp1pgCnltX/TmUcAIiPNK3Uiezb9kkqPKQLqmx0B DKPv7Qlg7XePD84NIAwUGfpJz0et4JExfIEiuHFzs6cWcjBysqlDVrk5tFfywAQCTes8 hFER5KjQ5RalsJJYkd8kkH9HwNeqVD48q5/NMpHxfthKbhI+9anC67xYTAnMap8m4iPp dNhRUTVkOrBqIVjn56IhkZ9Sg/XzjWp522gwSKuJO0BiFHWbNi+McJ83s6Dm2tyrU4OR GqNA== 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=0oKqHiLnMom7KHZmkSWx6feYRwXfc7vGRty8GGglGvg=; b=kZuovTJq2PVsIGx72KGWdDty00ojwxB8rjHBOqtPA6S0cY9OjslwD317F5sYA235E8 cQBy6Ri79fL6KFa64fxZiQACaqWvbLhyoZpjQTga/9XTKfggTIJnc6RirxhxrpcBh5Di 4Q/vIzZ/awOo1QbM5s110pQmhyVrWIXRPHqUdZxaj+JRxinc/vrM+WQccZLp9giHgdkR KbRdptY0pJ24kpbEbo7xaOiHgfgClwWw8hDQsq/vdAgPs99v+ASIoACMzw2lsySZWKsi 4V1Xp1ueTMMOss3EwLKJpWH5W7tSoRXhybpKlG5a3rRS/a7FGWl33wlMavlrVIOO3KZR H8fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=JhNmRiTF; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=ttvozkTJ; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h131-20020a636c89000000b003825f9c93a9si975263pgc.524.2022.04.08.04.22.58; Fri, 08 Apr 2022 04:23:14 -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=@linutronix.de header.s=2020 header.b=JhNmRiTF; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=ttvozkTJ; 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 S233825AbiDHJRp (ORCPT + 99 others); Fri, 8 Apr 2022 05:17:45 -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 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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 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",