From nobody Sat Feb 7 06:55:50 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+82567+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1634962465084632.6723438005837; Fri, 22 Oct 2021 21:14:25 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id OX5qYY1788612x1NjRP9yaWL; Fri, 22 Oct 2021 21:14:24 -0700 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.51]) by mx.groups.io with SMTP id smtpd.web08.2768.1634962463979096657 for ; Fri, 22 Oct 2021 21:14:24 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=elkk75lacJjXyWI0+OOXwwF08KfGsnDNV5zFAP7I7/8gUooz6gNe3YecjuqqH4U16UkUu8VQcXFX3Ds9vex9gTFgkfIM1fqHOUYU1qslRH6/JCdvcPNGyKm9YorVTHxKUsdMX8rog7eSoPWr4A3BuWHftqllaH2kzi1U20mblSP92zbzCtz+FsZHOqwk3/TvqQt7py0kAMNlAyKHspDkgvO9sPIeVAwfHw+2oJ3LKYXjeVcfMMUFUT7mQzwth93x/rtEEZA6SN3MpymjWq+LMYhlELJM+QcA8sXCJRQwVyiIQPVhq1QdMkeK5wWjp3Ze/jSiAC+0aTrdW0wdSXBPbA== 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=PjB8hBBKZ+qAfScvjIZJe7Z9wRSSHxa8h8DCN0Lak1U=; b=KbdGDInPhM80E2IW14eG+A0UrxFwc61J1fBV9rS3gaEkIMwWokLP7MBvkjnLx2Bt6WMu4ot/nrAolXTyEDhJUhlYCOBie1avMq0XIJl6PXW6L4wOUry7yTgi9CdZ4xjAIg/TgzHT+4wkb0Lf4OPe7K/AxXOpd8gS5X7gShUUvjrtqePj7JlJtOsTSMvQGpG2qMsdz2dOKJME21ZM4X3W/Gj3W3+nTB0lll+HWOpN578b/ZdLmFWKLZ41n9xbt7s4E0FZ3SOSh57+93UYMUHFWKuUzI/ueqpC2vf/zYxZ022JabWPLVVBd2L7gcedGwS6EW6B3NI8XP9sI1f6tEz1pA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=edk2.groups.io 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 X-Received: from DM6PR01CA0023.prod.exchangelabs.com (2603:10b6:5:296::28) by DM4PR12MB5085.namprd12.prod.outlook.com (2603:10b6:5:388::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18; Sat, 23 Oct 2021 04:14:22 +0000 X-Received: from DM6NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:5:296:cafe::6c) by DM6PR01CA0023.outlook.office365.com (2603:10b6:5:296::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Sat, 23 Oct 2021 04:14:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+82567+1787277+3901457@groups.io; helo=mail02.groups.io; 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=SATLEXMB04.amd.com; X-Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT004.mail.protection.outlook.com (10.13.172.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4628.16 via Frontend Transport; Sat, 23 Oct 2021 04:14:21 +0000 X-Received: from sbrijesh-desktop.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Fri, 22 Oct 2021 23:14:19 -0500 From: "Brijesh Singh via groups.io" To: CC: James Bottomley , Min Xu , "Jiewen Yao" , Tom Lendacky , "Jordan Justen" , Ard Biesheuvel , Erdem Aktas , "Michael Roth" , Gerd Hoffmann , Brijesh Singh , Michael Roth Subject: [edk2-devel] [PATCH v11 04/32] OvmfPkg/ResetVector: introduce SEV metadata descriptor for VMM use Date: Fri, 22 Oct 2021 23:13:21 -0500 Message-ID: <20211023041349.1263726-5-brijesh.singh@amd.com> In-Reply-To: <20211023041349.1263726-1-brijesh.singh@amd.com> References: <20211023041349.1263726-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 33c7d4a1-a54e-4c03-f14c-08d995db9745 X-MS-TrafficTypeDiagnostic: DM4PR12MB5085: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: 4wcnLuywQy/2sBA1/d40Vmdm1KBtc0U8eTFkWoCU2/TIlfGSq67borCLpR2SSmHyUh+s5EIi8smd/T62Ge0pcrgVHeHKzfNy4rPQoPV4VI9/tE4FzdlW/rN+dCC6mWjIglooe7wI0uBO3nkKMugZ+9d6xqfUiPZhSkmMXoYWJUjrV6hfq92UlvOIW1MbYOCNuLoK1m099aUS+qZfGizP/5E4RCBxM4imQADwQNjuUqk9ty2yJUS7VWjDD2z1aaUgk47wXnareGhh3XL26ICp3lJaxwhj+5DGSv4veVZjXsPMgi9xzzu72c9HMk3vpdAt2AGwPcYA7/m9igt3RCOs6KAt9742ymIXY1BXfCMXw5+qDK23jcNSjAOrLtBdOP94lASEhXTTfRcisMSycujmBRjJyGa3Y73nphj8FVpNsP2sW8qHrIju42w9nhIgj2E3adFL+h3xNPkNTtPfGab5xmrGnIGdwrqe15CpSSNGRy7lh/5Scyh15HreJ/IlrQ5ANOVLXd0/dnTzpl1D+GjoSrEjAyV3l568IynfMnViBC7VzF3ddHZiJJ6jwg9Mmt35hMyS80dzcxaqP2Q6tHLU8g5pw27alcHSwHdFXPG1bXfuUfyFMc8Z+89eFHrbdMNmA8q6tdQ2aRCNtMYK3HCGb37n75L1Z4plEgTT9hz2chtYNd7aynuvZLzyF1aBcjOef8b/N9EBc8CDK2+gA6DDZGIaskAsg0CtgOKUPcGaJpnkGYSO3rjdK9/lsiZhJbxBaymcn5mtwZHXveNI5NynFK54awZFDUOqAlHTVnJQHmxARymKn/XvTBlCQRCfhRyQ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2021 04:14:21.7146 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 33c7d4a1-a54e-4c03-f14c-08d995db9745 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5085 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,brijesh.singh@amd.com X-Gm-Message-State: z0nvSqst6aCxGKkNAxBlir92x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634962464; bh=16bUuspOD+JoqGVkvNvqMY1Uhqq53DbFCUE4wlsOGXs=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=GMPqN9PvHzrziHk/b8IzbW/k+k4/K1csB26g0NtHj3gzqRcRGi2+d+XF5llhYP05pET PJNH58nUz9fJDZrGG1UvrxbUJSUOeIDQw8oxB1qeplgyAeYriDreQ4aKfK6mRBesNmlDT nXv8d3Vtck5YGgYJn+58RDIo6QMV0eIxBtE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634962466667100010 Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3275 The OvmfPkgX86 build reserves memory regions in MEMFD. The memory regions get accessed in the SEC phase. AMD SEV-SNP require that the guest's private memory be accepted or validated before access. Introduce a Guided metadata structure that describes the reserved memory regions. The VMM can locate the metadata structure by iterating through the reset vector guid and process the areas based on the platform specific requirements. Cc: Michael Roth Cc: James Bottomley Cc: Min Xu Cc: Jiewen Yao Cc: Tom Lendacky Cc: Jordan Justen Cc: Ard Biesheuvel Cc: Erdem Aktas Cc: Gerd Hoffmann Acked-by: Gerd Hoffmann Signed-off-by: Brijesh Singh --- OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm | 17 ++++++++++ OvmfPkg/ResetVector/ResetVector.nasmb | 1 + OvmfPkg/ResetVector/X64/OvmfSevMetadata.asm | 34 ++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 OvmfPkg/ResetVector/X64/OvmfSevMetadata.asm diff --git a/OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm b/OvmfPkg/ResetVe= ctor/Ia16/ResetVectorVtf0.asm index 7ec3c6e980c3..2c1f764e9d7d 100644 --- a/OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm +++ b/OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm @@ -47,6 +47,23 @@ TIMES (15 - ((guidedStructureEnd - guidedStructureStart = + 15) % 16)) DB 0 ; guidedStructureStart: =20 +%ifdef ARCH_X64 +; +; SEV metadata descriptor +; +; Provide the start offset of the metadata blob within the OVMF binary. + +; GUID : dc886566-984a-4798-A75e-5585a7bf67cc +; +OvmfSevMetadataOffsetStart: + DD (fourGigabytes - OvmfSevMetadataGuid) + DW OvmfSevMetadataOffsetEnd - OvmfSevMetadataOffsetStart + DB 0x66, 0x65, 0x88, 0xdc, 0x4a, 0x98, 0x98, 0x47 + DB 0xA7, 0x5e, 0x55, 0x85, 0xa7, 0xbf, 0x67, 0xcc +OvmfSevMetadataOffsetEnd: + +%endif + ; SEV Hash Table Block ; ; This describes the guest ram area where the hypervisor should diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb b/OvmfPkg/ResetVector/Re= setVector.nasmb index 21b5fd82b830..6a3b1b73cf53 100644 --- a/OvmfPkg/ResetVector/ResetVector.nasmb +++ b/OvmfPkg/ResetVector/ResetVector.nasmb @@ -81,6 +81,7 @@ %include "Ia32/Flat32ToFlat64.asm" %include "Ia32/AmdSev.asm" %include "Ia32/PageTables64.asm" +%include "X64/OvmfSevMetadata.asm" %endif =20 %include "Ia16/Real16ToFlat32.asm" diff --git a/OvmfPkg/ResetVector/X64/OvmfSevMetadata.asm b/OvmfPkg/ResetVec= tor/X64/OvmfSevMetadata.asm new file mode 100644 index 000000000000..c42ad779be49 --- /dev/null +++ b/OvmfPkg/ResetVector/X64/OvmfSevMetadata.asm @@ -0,0 +1,34 @@ +;-------------------------------------------------------------------------= ---- +; @file +; OVMF metadata for the AMD SEV confidential computing guests +; +; Copyright (c) 2021, AMD Inc. All rights reserved.
+; +; SPDX-License-Identifier: BSD-2-Clause-Patent +;-------------------------------------------------------------------------= ---- + +BITS 64 + +%define OVMF_SEV_METADATA_VERSION 1 + +; The section must be accepted or validated by the VMM before the boot +%define OVMF_SECTION_TYPE_SNP_SEC_MEM 0x1 + +ALIGN 16 + +TIMES (15 - ((OvmfSevGuidedStructureEnd - OvmfSevGuidedStructureStart + 15= ) % 16)) DB 0 + +OvmfSevGuidedStructureStart: +; +; OvmfSev metadata descriptor +; +OvmfSevMetadataGuid: + +_Descriptor: + DB 'A','S','E','V' ; Signature + DD OvmfSevGuidedStructureEnd - _Descriptor ; Length + DD OVMF_SEV_METADATA_VERSION ; Version + DD (OvmfSevGuidedStructureEnd - _Descriptor - 16) / 12 ; Number of secti= ons + +OvmfSevGuidedStructureEnd: + ALIGN 16 --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#82567): https://edk2.groups.io/g/devel/message/82567 Mute This Topic: https://groups.io/mt/86530710/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-