From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.89]) by mx.groups.io with SMTP id smtpd.web10.94.1634144265718206493 for ; Wed, 13 Oct 2021 09:57:46 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=BI8Jocei; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.223.89, mailfrom: brijesh.singh@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ekmvp+eT34NsZKjKDjp++Bft3zF69/RoehhQe+4KG9JopbXxi4V7HChJ8KgFFdtqiaOLUgfnjGdYnFU5R96MLKujwkuCvxCOJ8uQ6/EUABdgZbI5je+NLl+FkNzjB1ASKRUfppFDR+9aUTrJh7jZMQko2g24jAmviDSR6nqlFqer5fHyC77ZeUvHoHhaRAmgQ5uaYApdMAeQUd2Fv2fDS4mlhKqu6Hw/P2Hclc4SSdyAfEKm6PfTkRVXRjmWgU4Ci0+a3LLypKi8e77Mjujj2yMSj8RHlYVikUQ497G+gvPESlQAvOJFS/prIWKWsmx5ziHMROfBbbPH11S2dp6zbA== 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=28wM8DRAdgO30JnP1gJgf86JvPmnXfkqgnWPF8rmMI4=; b=cZJ1t2DbrYicGeA5cqfjM8JYedLlOnih6hZGORP4slDDOXhflAaUQR4xPnkPrPVyeFt0e3tTAvXwT3ODnSeQ7l+POTUWyLZ1/CAGW31i0YJ8RrqMZ3YiQG0HL+Lv6VQNNUqYzg/udvXeNgrwdpkBpUdQAL5KteyOIlvSUk78CrrvpDbqzXvCyp08Ud4c4HGxoOEM+mDJZCiWZJ7EV+lWkMPt0OifQZcdKqJhWmYORsw+7u708VxLnclOrqpXCcB2L70sqSabvtr6igrSpA2e8N/Gb3h2uD7K8oooPoX2Oxlo9ecmQOhovaP/sqsMX2RYTVFT9puNK7PaqrbZKRySXg== 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 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=28wM8DRAdgO30JnP1gJgf86JvPmnXfkqgnWPF8rmMI4=; b=BI8JoceiabLZWtlJvZ6MX5cqY3JEyXTUI+RBJcnREuwVdqzvWiHqehZoKD8T42KfddyzC2sT47BL8/6agOC+hI+7NgRq2hcgTE2lXqygZsTo9ESDgEpg9LJYEpGj5lVoe6ppf3bM8k+BuH4YgKBLXYxhdfDK68ZKyvJsQBP3Xr8= Received: from MW4PR04CA0041.namprd04.prod.outlook.com (2603:10b6:303:6a::16) by MN2PR12MB2943.namprd12.prod.outlook.com (2603:10b6:208:ad::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.24; Wed, 13 Oct 2021 16:57:42 +0000 Received: from CO1NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:303:6a:cafe::c9) by MW4PR04CA0041.outlook.office365.com (2603:10b6:303:6a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Wed, 13 Oct 2021 16:57:42 +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 (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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT039.mail.protection.outlook.com (10.13.174.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Wed, 13 Oct 2021 16:57:41 +0000 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.8; Wed, 13 Oct 2021 11:57:39 -0500 From: "Brijesh Singh" 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: [PATCH v9 04/32] OvmfPkg/ResetVector: introduce SEV metadata descriptor for VMM use Date: Wed, 13 Oct 2021 11:56:45 -0500 Message-ID: <20211013165713.727815-5-brijesh.singh@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211013165713.727815-1-brijesh.singh@amd.com> References: <20211013165713.727815-1-brijesh.singh@amd.com> MIME-Version: 1.0 Return-Path: brijesh.singh@amd.com X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: afd94a52-9011-4f50-78bb-08d98e6a9233 X-MS-TrafficTypeDiagnostic: MN2PR12MB2943: 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: BCL:0; X-Microsoft-Antispam-Message-Info: rnSFmTi1N402klAQdXOEM/XwTJGfLVX8VVXoK9YUcRBCDqkkzijpGQiTIut6xxkPpW9Jbqc7PPouLXXE5CDXhj4wxbcumpotRyAhCwyq52pBaKycyHDpJfOmQt+wxas44Flz1+TKo8+0IDQK94SSa/CHa9UnTcbSZ20Yp7PXNNsd3hoym0I5nKQ12ZqBCtwYcPmXfFE952P9/MIIB4E9fZB6nrkf9I64+ytYPe4ZU019EZPcxXtylib7xwkVW9ENTjdz5JasoUTwCjCWW8EiknYlE+MYV6w725bVSQE3Oeo8sQkPlxMMDRA9lT6Mpe7eLpIg4c3e2mEliEkXR6an49a766uIX/xDA6cpIB1hHNQ3CgZMcJx1Y0ahegoWpLxSDpX1EJz6NZg046kXQejuAJf+WSfkf0tQ8vrdEzaRU/4LNgZ+4Svp9a22aVQhnGy5/A9byj+x6AS17kwlFgCbjKaLVhWr8dXT+PDRrGem0KN4fGDBI0oTN+6jjYtbffbBRDAkyj1O/kuubkNfgVb1eCkv5OLjsuL/t0LwmiTC+71n2Q0bfe3Z5fxTWY9OZyv/vdddMRAGNfEmf/k1rd0oFh/RP5RATFp8geZPwGA/S8jFBDpNb3QDFQJ5gcUKyrEdQcgq1uUBJCmW/uJIjF4bxtwReVKazET4kvqjRJyyBUAfuvVyEZTcLdLOQRgQs5+zFh3iak0qHf5EuAZR/UI4qSo3GNV4+ACXebd1Dekw5he/miVKEJiqPyMFQ3zxP3jJ8CFd95d7GYhfaI9Bro8HXdEi4S8CmMxSJTmLdhB1z80WXUqV3fTSgUy0H34aVgjj X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(81166007)(6666004)(508600001)(70586007)(6916009)(8936002)(1076003)(966005)(5660300002)(356005)(70206006)(2906002)(83380400001)(19627235002)(316002)(8676002)(36756003)(36860700001)(86362001)(82310400003)(2616005)(47076005)(7696005)(16526019)(26005)(54906003)(44832011)(336012)(4326008)(426003)(186003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2021 16:57:41.8641 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: afd94a52-9011-4f50-78bb-08d98e6a9233 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: CO1NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB2943 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain 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 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 d1d800c56745..b37bc9c7da64 100644 --- a/OvmfPkg/ResetVector/ResetVector.nasmb +++ b/OvmfPkg/ResetVector/ResetVector.nasmb @@ -80,6 +80,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