All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brijesh Singh <brijesh.singh@amd.com>
To: <x86@kernel.org>, <linux-kernel@vger.kernel.org>,
	<kvm@vger.kernel.org>, <linux-efi@vger.kernel.org>,
	<platform-driver-x86@vger.kernel.org>,
	<linux-coco@lists.linux.dev>, <linux-mm@kvack.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Joerg Roedel <jroedel@suse.de>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Sean Christopherson <seanjc@google.com>,
	"Vitaly Kuznetsov" <vkuznets@redhat.com>,
	Jim Mattson <jmattson@google.com>,
	"Andy Lutomirski" <luto@kernel.org>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Sergio Lopez <slp@redhat.com>, Peter Gonda <pgonda@google.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	David Rientjes <rientjes@google.com>,
	Dov Murik <dovmurik@linux.ibm.com>,
	Tobin Feldman-Fitzthum <tobin@ibm.com>,
	Borislav Petkov <bp@alien8.de>,
	Michael Roth <michael.roth@amd.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	Andi Kleen <ak@linux.intel.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	<brijesh.ksingh@gmail.com>, <tony.luck@intel.com>,
	<marcorr@google.com>,
	<sathyanarayanan.kuppuswamy@linux.intel.com>,
	Venu Busireddy <venu.busireddy@oracle.com>,
	Brijesh Singh <brijesh.singh@amd.com>
Subject: [PATCH v12 04/46] KVM: SVM: Update the SEV-ES save area mapping
Date: Mon, 7 Mar 2022 15:33:14 -0600	[thread overview]
Message-ID: <20220307213356.2797205-5-brijesh.singh@amd.com> (raw)
In-Reply-To: <20220307213356.2797205-1-brijesh.singh@amd.com>

From: Tom Lendacky <thomas.lendacky@amd.com>

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.

Reviewed-by: Venu Busireddy <venu.busireddy@oracle.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Brijesh Singh <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 eae5c7ab9c6c..7ab508fd8c4c 100644
--- a/arch/x86/include/asm/svm.h
+++ b/arch/x86/include/asm/svm.h
@@ -326,7 +326,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;
@@ -339,9 +345,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;
@@ -352,7 +368,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;
@@ -361,12 +377,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;
@@ -378,16 +394,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 {
@@ -446,7 +480,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
 
-- 
2.25.1


  parent reply	other threads:[~2022-03-07 21:34 UTC|newest]

Thread overview: 129+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 21:33 [PATCH v12 00/46] Add AMD Secure Nested Paging (SEV-SNP) Guest Support Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 01/46] KVM: SVM: Define sev_features and vmpl field in the VMSA Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] KVM: SVM: Define sev_features and VMPL " tip-bot2 for Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 02/46] KVM: SVM: Create a separate mapping for the SEV-ES save area Brijesh Singh
2022-04-05 18:27   ` [PATCH v12 2.1/46] " Brijesh Singh
2022-04-05 18:55     ` Borislav Petkov
2022-04-08  9:09     ` [tip: x86/sev] " tip-bot2 for Tom Lendacky
2022-03-07 21:33 ` [PATCH v12 03/46] KVM: SVM: Create a separate mapping for the GHCB " Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] " tip-bot2 for Tom Lendacky
2022-03-07 21:33 ` Brijesh Singh [this message]
2022-04-08  9:09   ` [tip: x86/sev] KVM: SVM: Update the SEV-ES save area mapping tip-bot2 for Tom Lendacky
2022-03-07 21:33 ` [PATCH v12 05/46] x86/boot: Introduce helpers for MSR reads/writes Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 06/46] x86/boot: Use MSR read/write helpers instead of inline assembly Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 07/46] x86/compressed/64: Detect/setup SEV/SME features earlier in boot Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] x86/compressed/64: Detect/setup SEV/SME features earlier during boot tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 08/46] x86/sev: Detect/setup SEV/SME features earlier in boot Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 09/46] x86/mm: Extend cc_attr to include AMD SEV-SNP Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] " tip-bot2 for Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 10/46] x86/sev: Define the Linux specific guest termination reasons Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] x86/sev: Define the Linux-specific " tip-bot2 for Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 11/46] x86/sev: Save the negotiated GHCB version Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] " tip-bot2 for Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 12/46] x86/sev: Check SEV-SNP features support Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] " tip-bot2 for Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 13/46] x86/sev: Add a helper for the PVALIDATE instruction Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] " tip-bot2 for Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 14/46] x86/sev: Check the vmpl level Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] x86/sev: Check the VMPL level tip-bot2 for Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 15/46] x86/compressed: Add helper for validating pages in the decompression stage Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] " tip-bot2 for Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 16/46] x86/compressed: Register GHCB memory when SEV-SNP is active Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] " tip-bot2 for Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 17/46] x86/sev: " Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] " tip-bot2 for Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 18/46] x86/sev: Add helper for validating pages in early enc attribute changes Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] " tip-bot2 for Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 19/46] x86/kernel: Make the .bss..decrypted section shared in RMP table Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] x86/kernel: Mark the .bss..decrypted section as shared in the " tip-bot2 for Brijesh Singh
2022-06-14  0:46   ` [PATCH v12 19/46] x86/kernel: Make the .bss..decrypted section shared in " Sean Christopherson
2022-06-14 15:43     ` Sean Christopherson
2022-06-14 16:01       ` Tom Lendacky
2022-06-14 16:13         ` Sean Christopherson
2022-06-14 19:00           ` Tom Lendacky
2022-06-14 19:52             ` Sean Christopherson
2022-06-16 16:17               ` Tom Lendacky
2022-06-16 16:41                 ` Sean Christopherson
2022-07-01 16:51                   ` Borislav Petkov
2022-07-07 20:43                     ` Sean Christopherson
2022-03-07 21:33 ` [PATCH v12 20/46] x86/kernel: Validate ROM memory before accessing when SEV-SNP is active Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] " tip-bot2 for Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 21/46] x86/mm: Validate memory when changing the C-bit Brijesh Singh
2022-04-08  9:09   ` [tip: x86/sev] " tip-bot2 for Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 22/46] x86/sev: Use SEV-SNP AP creation to start secondary CPUs Brijesh Singh
2022-04-05  0:24   ` Sean Christopherson
2022-04-05 16:20     ` Brijesh Singh
2022-04-05 19:41       ` Sean Christopherson
2022-04-08  9:09   ` [tip: x86/sev] " tip-bot2 for Tom Lendacky
2022-03-07 21:33 ` [PATCH v12 23/46] x86/head/64: Re-enable stack protection Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 24/46] x86/compressed/acpi: Move EFI detection to helper Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 25/46] x86/compressed/acpi: Move EFI system table lookup " Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 26/46] x86/compressed/acpi: Move EFI config " Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 27/46] x86/compressed/acpi: Move EFI vendor " Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 28/46] x86/compressed/acpi: Move EFI kexec handling into common code Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 29/46] x86/boot: Add Confidential Computing type to setup_data Brijesh Singh
2022-04-06 21:19   ` Thomas Gleixner
2022-04-07 14:47     ` Borislav Petkov
2022-04-07 14:57     ` Brijesh Singh
2022-07-17  5:08       ` H. Peter Anvin
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 30/46] KVM: x86: Move lookup of indexed CPUID leafs to helper Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 31/46] x86/sev: Move MSR-based VMGEXITs for CPUID " Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 32/46] x86/compressed/64: Add support for SEV-SNP CPUID table in #VC handlers Brijesh Singh
2022-03-10 14:51   ` Peter Gonda
2022-03-10 21:25     ` Michael Roth
2022-03-11 17:06       ` Joerg Roedel
2022-03-14 17:34         ` Peter Gonda
2022-03-17 13:11           ` Boris Petkov
2022-03-17 20:20             ` Peter Gonda
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 33/46] x86/boot: Add a pointer to Confidential Computing blob in bootparams Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 34/46] x86/compressed: Add SEV-SNP feature detection/setup Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 35/46] x86/compressed: Use firmware-validated CPUID leaves for SEV-SNP guests Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 36/46] x86/compressed: Export and rename add_identity_map() Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 37/46] x86/compressed/64: Add identity mapping for Confidential Computing blob Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 38/46] x86/sev: Add SEV-SNP feature detection/setup Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 39/46] x86/sev: Use firmware-validated CPUID for SEV-SNP guests Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 40/46] x86/sev: add sev=debug cmdline option to dump SNP CPUID table Brijesh Singh
2022-03-25  9:24   ` Borislav Petkov
2022-04-08  9:08   ` [tip: x86/sev] x86/sev: Add a sev= cmdline option tip-bot2 for Michael Roth
2022-03-07 21:33 ` [PATCH v12 41/46] x86/sev: Provide support for SNP guest request NAEs Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 42/46] x86/sev: Register SEV-SNP guest request platform device Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 43/46] virt: Add SEV-SNP guest driver Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Brijesh Singh
2022-04-18 16:42     ` Dionna Amalie Glaze
2022-04-18 17:14       ` Borislav Petkov
2022-04-18 17:40         ` Tom Lendacky
2022-04-18 21:18           ` Borislav Petkov
2022-08-24 18:01   ` [PATCH v12 43/46] " Dionna Amalie Glaze
2022-08-24 19:28     ` Peter Gonda
2022-08-25 18:54       ` Tom Lendacky
2022-08-25 20:09         ` Peter Gonda
2022-03-07 21:33 ` [PATCH v12 44/46] virt: sevguest: Add support to derive key Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 45/46] virt: sevguest: Add support to get extended report Brijesh Singh
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Brijesh Singh
2022-03-07 21:33 ` [PATCH v12 46/46] virt: sevguest: Add documentation for SEV-SNP CPUID Enforcement Brijesh Singh
2022-03-14 15:37   ` Peter Gonda
2022-04-08  9:08   ` [tip: x86/sev] " tip-bot2 for Michael Roth
2022-03-07 21:53 ` [PATCH v12 43.1/46] virt: Add SEV-SNP guest driver Brijesh Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220307213356.2797205-5-brijesh.singh@amd.com \
    --to=brijesh.singh@amd.com \
    --cc=ak@linux.intel.com \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=brijesh.ksingh@gmail.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dgilbert@redhat.com \
    --cc=dovmurik@linux.ibm.com \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=jroedel@suse.de \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=marcorr@google.com \
    --cc=michael.roth@amd.com \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=pgonda@google.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rientjes@google.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=seanjc@google.com \
    --cc=slp@redhat.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=tobin@ibm.com \
    --cc=tony.luck@intel.com \
    --cc=vbabka@suse.cz \
    --cc=venu.busireddy@oracle.com \
    --cc=vkuznets@redhat.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.