Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp186136pxw; Fri, 8 Apr 2022 05:03:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzv3yuU9Mi6dPBIebejeiiF0NjoQX6o7DZll0tqCjzPMQJBjXZaBUE2iAZoVy3cboQnD9jS X-Received: by 2002:a17:906:2bd7:b0:6cd:f89d:c828 with SMTP id n23-20020a1709062bd700b006cdf89dc828mr18065044ejg.232.1649419422508; Fri, 08 Apr 2022 05:03:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649419422; cv=none; d=google.com; s=arc-20160816; b=u7y9vx1v6jRZKQJfDy9R84vifFfqsKwXoFvbvEiDAbJpEq6725RVM3riPige7muRmc +b9oNDErP0IlkdFeDAqmkH7MrvoMWnfYFSLJuOhczyr8YtgkEAuBCIUqs4F/gBOV6/Xt hURO7RYGbuBQ68IubbPEUqPn15o3tkroLRa9JZzEq8U0liV1YECT5dQ3cftJVvWtQu9u SAiJfo6Vb1x+eOa5v8vX/qG/7mw8JqEe4z/8LxToiuwYxz37FjlQwRHGAQoZKeR04iE0 SeCKFvBD46o2Bd0j2ZR0WEF1r0NpmIPDMdmV58oAaOAixBXR0MhREbTtl6Pbf34Slrgi 9p0g== 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=Psc4/G96wUB8WroPhG3msuNI4u0HwS7V9GQM3Z50bs8=; b=A1gEvbXQ+VQpNRbBgvviFTiBKvUKGWCSCSjTHfaE7hStdVAxVDOTe8EbN9anS/NgSg kauzt3iKKU4Ee6Fq5sCU1zzLzCcEWE+Ik25dby99wEwitQ36oP8f/kTnv6mqymmnP2w6 g3VpwFDYujU2rUjQf88CyxBbjxHKWMyhJlCN0eb1MnkrnqduHCEzbi/fRS7LLNYTZQxR Dulvk+2qFHDwxzJZtd/WhVKtb3VbtDYR26hEP/htbSymNuDLScVm1Y9VlC3pC3hW0InX q1+4dj5pVTLM/muMRjLFkNj3kCTg4ZR38RGv7FCsrHYvT1w8tUvj1Xfk7PBEzqgwz0Ya +SUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=cxdXHByK; dkim=neutral (no key) header.i=@linutronix.de; 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 l15-20020a056402254f00b00418fe90d5cfsi824367edb.576.2022.04.08.05.03.14; Fri, 08 Apr 2022 05:03:42 -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=cxdXHByK; dkim=neutral (no key) header.i=@linutronix.de; 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 S233563AbiDHJRS (ORCPT + 99 others); Fri, 8 Apr 2022 05:17:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232977AbiDHJMI (ORCPT ); Fri, 8 Apr 2022 05:12:08 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA66724BD45; Fri, 8 Apr 2022 02:09:18 -0700 (PDT) Date: Fri, 08 Apr 2022 09:09:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1649408957; 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=Psc4/G96wUB8WroPhG3msuNI4u0HwS7V9GQM3Z50bs8=; b=cxdXHByKKTUP7xgDZWk4e/Po5jB5F6FYaustO8V10sBiFVHBTKBU79nCb6Arrvh/JqZQ29 quB1KDpEiRBfSjn3WQ+VY73VdCvKiuNCAEG/JnCQ4hXxrD34zCfi+ya59ZgFtNckp1ouqL l0hr3gu9bfXJoQzQKaujDvXDDcFNvT6MCPDD6eWqnSBmAvdsFB7SZ/iyrGvdm/LaGeX0lA 2IFPvERx7FA2SDKpQ2H6efej5kF2rZO6Jg+bJptt75+67RNMQjWJD+TpZO6o0kuQkO3i19 z9XA+uukOoxqlMDJpIveEmb0JB2EbV7RJUARfwxesTMBO8alaUSD9bYQi9DuNA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1649408957; 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=Psc4/G96wUB8WroPhG3msuNI4u0HwS7V9GQM3Z50bs8=; b=+szf55+1rSKJEBsE4Op4gtQqfqjvJKf0vdkbOZsT58TNU7CbiCEsCQkoNBdvj70O0vQimv ooH+KnwYrR89uSBQ== From: "tip-bot2 for Tom Lendacky" 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: Update the SEV-ES save area mapping Cc: Tom Lendacky , Brijesh Singh , Borislav Petkov , Venu Busireddy , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220307213356.2797205-5-brijesh.singh@amd.com> References: <20220307213356.2797205-5-brijesh.singh@amd.com> MIME-Version: 1.0 Message-ID: <164940895609.389.17375070782782842737.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: 6d3b3d34e39eb4ee9a7dbe7e28e2588e160f9c0f Gitweb: https://git.kernel.org/tip/6d3b3d34e39eb4ee9a7dbe7e28e2588e160f9c0f Author: Tom Lendacky AuthorDate: Mon, 07 Mar 2022 15:33:14 -06:00 Committer: Borislav Petkov CommitterDate: Wed, 06 Apr 2022 12:19:51 +02:00 KVM: SVM: Update the SEV-ES save area mapping This is the final step in defining the multiple save areas to keep them separate and ensuring proper operation amongst the different types of guests. Update the SEV-ES/SEV-SNP save area to match the APM. This save area will be used for the upcoming SEV-SNP AP Creation NAE event support. Signed-off-by: Tom Lendacky Signed-off-by: Brijesh Singh Signed-off-by: Borislav Petkov Reviewed-by: Venu Busireddy Link: https://lore.kernel.org/r/20220307213356.2797205-5-brijesh.singh@amd.com --- arch/x86/include/asm/svm.h | 66 ++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 16 deletions(-) diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h index 0789ad8..ec623e7 100644 --- a/arch/x86/include/asm/svm.h +++ b/arch/x86/include/asm/svm.h @@ -334,7 +334,13 @@ struct sev_es_save_area { struct vmcb_seg ldtr; struct vmcb_seg idtr; struct vmcb_seg tr; - u8 reserved_1[43]; + u64 vmpl0_ssp; + u64 vmpl1_ssp; + u64 vmpl2_ssp; + u64 vmpl3_ssp; + u64 u_cet; + u8 reserved_1[2]; + u8 vmpl; u8 cpl; u8 reserved_2[4]; u64 efer; @@ -347,9 +353,19 @@ struct sev_es_save_area { u64 dr6; u64 rflags; u64 rip; - u8 reserved_4[88]; + u64 dr0; + u64 dr1; + u64 dr2; + u64 dr3; + u64 dr0_addr_mask; + u64 dr1_addr_mask; + u64 dr2_addr_mask; + u64 dr3_addr_mask; + u8 reserved_4[24]; u64 rsp; - u8 reserved_5[24]; + u64 s_cet; + u64 ssp; + u64 isst_addr; u64 rax; u64 star; u64 lstar; @@ -360,7 +376,7 @@ struct sev_es_save_area { u64 sysenter_esp; u64 sysenter_eip; u64 cr2; - u8 reserved_6[32]; + u8 reserved_5[32]; u64 g_pat; u64 dbgctl; u64 br_from; @@ -369,12 +385,12 @@ struct sev_es_save_area { u64 last_excp_to; u8 reserved_7[80]; u32 pkru; - u8 reserved_9[20]; - u64 reserved_10; /* rax already available at 0x01f8 */ + u8 reserved_8[20]; + u64 reserved_9; /* rax already available at 0x01f8 */ u64 rcx; u64 rdx; u64 rbx; - u64 reserved_11; /* rsp already available at 0x01d8 */ + u64 reserved_10; /* rsp already available at 0x01d8 */ u64 rbp; u64 rsi; u64 rdi; @@ -386,16 +402,34 @@ struct sev_es_save_area { u64 r13; u64 r14; u64 r15; - u8 reserved_12[16]; - u64 sw_exit_code; - u64 sw_exit_info_1; - u64 sw_exit_info_2; - u64 sw_scratch; + u8 reserved_11[16]; + u64 guest_exit_info_1; + u64 guest_exit_info_2; + u64 guest_exit_int_info; + u64 guest_nrip; u64 sev_features; - u8 reserved_13[48]; + u64 vintr_ctrl; + u64 guest_exit_code; + u64 virtual_tom; + u64 tlb_id; + u64 pcpu_id; + u64 event_inj; u64 xcr0; - u8 valid_bitmap[16]; - u64 x87_state_gpa; + u8 reserved_12[16]; + + /* Floating point area */ + u64 x87_dp; + u32 mxcsr; + u16 x87_ftw; + u16 x87_fsw; + u16 x87_fcw; + u16 x87_fop; + u16 x87_ds; + u16 x87_cs; + u64 x87_rip; + u8 fpreg_x87[80]; + u8 fpreg_xmm[256]; + u8 fpreg_ymm[256]; } __packed; struct ghcb_save_area { @@ -454,7 +488,7 @@ struct ghcb { #define EXPECTED_VMCB_SAVE_AREA_SIZE 740 #define EXPECTED_GHCB_SAVE_AREA_SIZE 1032 -#define EXPECTED_SEV_ES_SAVE_AREA_SIZE 1032 +#define EXPECTED_SEV_ES_SAVE_AREA_SIZE 1648 #define EXPECTED_VMCB_CONTROL_AREA_SIZE 1024 #define EXPECTED_GHCB_SIZE PAGE_SIZE