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 9E7B8C433FE for ; Fri, 10 Dec 2021 15:45:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243717AbhLJPse (ORCPT ); Fri, 10 Dec 2021 10:48:34 -0500 Received: from mail-mw2nam10on2088.outbound.protection.outlook.com ([40.107.94.88]:16865 "EHLO NAM10-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S243350AbhLJPr6 (ORCPT ); Fri, 10 Dec 2021 10:47:58 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GF1aEf0m1Ois5ZSPSTrc/oE4yV6WO/d1wTsIGYH1ETP9By1/8A452UmpGKntab8Buei/sxA39blBH6fQvfLs5sD501ZNo5U6dH1YQNoS4n+YMVPTRUP9jN1WskHedE2yodYZBByoKOviW9Q/pKbbIH8QURYeQEmoQgW9NROd1W1sAfzm0NO2BflXLUJ7MqDqP3tIkbhc1YS2vI6h9xe4HzxdR8sRSNmq1zVWqUl8u9us2/ktyeflYvq/tBpUOcUlavhGj8o2GLCZeUet4AbzPEt5K6hCZDynv+cOEsEeyyeIJoH26vcMsimt9tIeQsy5OwSCfOr0zXbf9OEl2lS+QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5yYGZkXYbkKsCZF4e6t1+n+SfDJC4kr8FCySTr9HpfQ=; b=h9NbfzTWeDCu2pok3E36k1ByYSt6vAAzuH0LZpiqA/TZi9fF4aYi5nO8JL6TH0TIZ/Y2EOSYJaPoPxHILgLsLunRCvuLlfD0N1dY/5DoMIkqHaWWVY/t/72tMZcGmYgTowCM0CPUkv2fYsVuctk2dvVBT/btGPbSL4663nIfcyo6igx6jN1bY7n6HaVOyQYZI0/dZsQCc9/nmsYegP2majgnGBDeNUl2RLoJ7taNB9/NdbEfmlByVcYt28Z8mbW5Xl0CYDQfDgN42pZZC8nIuOasLb9Wq9a4gC9ilE1C15XZujooHIb4E+Fp+N6oEf/faL9wWw0j56MtjEyBdBBNsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5yYGZkXYbkKsCZF4e6t1+n+SfDJC4kr8FCySTr9HpfQ=; b=L3k/03hQqkqH74729uheE08ztAowQPLi4ytHOc/+Li9cNgfDUmtO2ZQ9lBaBJTUu/OdG3uVEh2cIxl8yGDZjkDXSxi6b14H/zGTQks//4GEqMaKxVCOGgF4LTr04hPm/JbCqA7kjUKUsWv/wCNalGA+j0czBZj5aBxMioZUJ0a8= Received: from BN6PR1201CA0008.namprd12.prod.outlook.com (2603:10b6:405:4c::18) by MN2PR12MB3021.namprd12.prod.outlook.com (2603:10b6:208:c2::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.21; Fri, 10 Dec 2021 15:44:20 +0000 Received: from BN8NAM11FT067.eop-nam11.prod.protection.outlook.com (2603:10b6:405:4c:cafe::b7) by BN6PR1201CA0008.outlook.office365.com (2603:10b6:405:4c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.19 via Frontend Transport; Fri, 10 Dec 2021 15:44:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT067.mail.protection.outlook.com (10.13.177.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Fri, 10 Dec 2021 15:44:20 +0000 Received: from sbrijesh-desktop.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Fri, 10 Dec 2021 09:44:17 -0600 From: Brijesh Singh To: , , , , , , CC: Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , "Vitaly Kuznetsov" , Jim Mattson , "Andy Lutomirski" , Dave Hansen , Sergio Lopez , Peter Gonda , "Peter Zijlstra" , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Borislav Petkov , Michael Roth , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , "Dr . David Alan Gilbert" , , , , Brijesh Singh Subject: [PATCH v8 19/40] KVM: SVM: Update the SEV-ES save area mapping Date: Fri, 10 Dec 2021 09:43:11 -0600 Message-ID: <20211210154332.11526-20-brijesh.singh@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211210154332.11526-1-brijesh.singh@amd.com> References: <20211210154332.11526-1-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a3600ff1-76fc-42d9-4934-08d9bbf3ee90 X-MS-TrafficTypeDiagnostic: MN2PR12MB3021:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GqFzzQsa4zAGqf+2auGZ6Uehl545yVDyszs7lHqW1dkpa2YCHhQ4PV51xCFry1PLfph8dTnJ7aqqNnqiweldg6yu9a/FbjODd0flb35/iLUnXDthvccUmZo6i8nKuUSHYox/0odzTMDJEMFr4tZzuoRwY4jxqK/B2ISZ23ylw+4ErzKoUiyn/ux1FqvtzcppQOWCFT5PdFQW2s0YZ7Bz4TC03zcKywsnr5hiF0DL4LTj5nk6UJ6jkkfkkpIZfY2eFZo/nEfNgRrwaqEjcwNPFxj3i9WFcQxCOfuno67vB+qjrtjmJY0wafWyFmU6TOMU/chsNMen1aedIikKhVzgvQVwqvc0iNnNJRYSOQb0DOmYh2QsFlNcDP8p9JYMhbVLB9lOx4mPNvwbAqPYP0Pr9hlj6amrw13xF0UCSMK7gRYFYIXigJ6krP6LcdkFKGgXfO2Lqlf4nvo+oyJpTnbzQMcjM6jFqyBwJf1qZ2RKz7GjMII3cY+aEFcr0alNONQiBN0AylRM/9ujmdjG+ZDp0au+9HQRoljAPBjO4A37Sx2W+M30yQVhp54y/6cx+kdwQ2binJoUwpbO8o4Z7yagXUpGo59hFSz/y99qujI/QV2Hg6ti800Q1dbu55LsMnmi14QjnZIPOMmcfpgNr46kYYtKyRykfeU5YuTTqxb+b3ilKJNF3RyKH1n22ctVGB+oWrfSM+d/bPyEn64aH2DHJCuND6Ein+u6ydS4ds+gsZOk1evoZxR+yD+2twGHV1C/wgBP6+TYtUlOU85dm1v/SKY8HLwsp3vQpRB4EICxgUQra9yT/gmwAOycag08p3oS X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(40470700001)(70586007)(2616005)(70206006)(186003)(336012)(16526019)(82310400004)(8676002)(508600001)(316002)(7406005)(6666004)(81166007)(36860700001)(356005)(26005)(7416002)(40460700001)(47076005)(4326008)(86362001)(5660300002)(83380400001)(426003)(7696005)(15650500001)(54906003)(110136005)(1076003)(8936002)(2906002)(44832011)(36756003)(2101003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2021 15:44:20.3047 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3600ff1-76fc-42d9-4934-08d9bbf3ee90 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT067.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3021 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tom Lendacky 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 --- 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 5ff1fa364a31..7d90321e7775 100644 --- a/arch/x86/include/asm/svm.h +++ b/arch/x86/include/asm/svm.h @@ -290,7 +290,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; @@ -303,9 +309,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; @@ -316,7 +332,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; @@ -325,12 +341,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; @@ -342,16 +358,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 { @@ -410,7 +444,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