From nobody Wed Oct 1 20:41:28 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47717+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1568985409116204.8219666396501; Fri, 20 Sep 2019 06:16:49 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id QH0VYY1788612xm6CrXNkEU0; Fri, 20 Sep 2019 06:16:48 -0700 X-Received: from NAM01-BY2-obe.outbound.protection.outlook.com (NAM01-BY2-obe.outbound.protection.outlook.com [40.107.81.83]) by groups.io with SMTP; Fri, 20 Sep 2019 06:16:47 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iT81yz+fcWiGkebDbAJrnM65V+02x18pQQAhxKEKp5f/KCLmdS07mkXNDloCNef+nqLPbVaHYabOax9qwzUydRE+ywamWoXU/O1EHOUFpsh3fGOLIKHs1UbQotIrmmMl7zZSk40/EEZfEMKwefMK3C73uLA0f5mkJzkGpb/2Vewu8ppwN+Id5LhnhIWxXrcNfsO+untqrkkASwFKlvJgGTZyeupsfL9fJ3Wjf8kCXqdmjeNdAL/4MyaYnl6GcPvJ7XbJNtG0b3ubIC+9aH8gKIhrqyYFlLW4sWe+QS5XBl0p+PeMukEpMcSQUp5VU8+MUwQ4SnVxR2L4acl43lwJ7A== 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-SenderADCheck; bh=Ypb/cN3XEpC6nmzam0gTbuuSFGKYA6mgpPzL+8E5OtM=; b=YS1kLfLo5U/OG/1U/Zh79seFgKb+0+06s6DTD6tvxivyqEBO6d/xJmIU+pZ6EIuV1qJiGyyGuSzgeMeyjiA/c+J3B2J9VG3b+CquPRpr/L/XlHubMuOWEpuNSSQuDOK0/AeD0Zo3REhMnumutjmQ5zy1xMHT3+LWU05R0FC5L929tUbFsb6gTFcMEBMkmR+i+0vNIr5XJEyUDSm4NHGNUAtzhFYDeiT5Yr+lbWzELhOPAKXPlp6XPojmXmzAPwf9zOUSNRgtyVIJegCXCx2GZ9cB69OZkaaqtyPYxNPnvHstoJdV/1J8ue7EPqKHYwXRL/VuAIc+IgC+N8nHdPrzFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from DM6PR12MB3163.namprd12.prod.outlook.com (20.179.104.150) by DM6PR12MB3995.namprd12.prod.outlook.com (10.255.175.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.23; Fri, 20 Sep 2019 13:16:46 +0000 X-Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::400e:f0c3:7ca:2fcc]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::400e:f0c3:7ca:2fcc%6]) with mapi id 15.20.2284.009; Fri, 20 Sep 2019 13:16:45 +0000 From: "Lendacky, Thomas" To: "devel@edk2.groups.io" Subject: [edk2-devel] [RFC PATCH v2 39/44] OvmfPkg: Move the GHCB allocations into reserved memory Thread-Topic: [RFC PATCH v2 39/44] OvmfPkg: Move the GHCB allocations into reserved memory Thread-Index: AQHVb7WmcbqDkeRSr0uzt9gjRcV44g== Date: Fri, 20 Sep 2019 13:16:45 +0000 Message-ID: <7a169f2dd9e6ae7f266b8ef2b690865dc04b4764.1568922729.git.thomas.lendacky@amd.com> References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN6PR06CA0023.namprd06.prod.outlook.com (2603:10b6:805:8e::36) To DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:182::22) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [165.204.78.1] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4dbac3fb-a7e5-49ce-25e3-08d73dccc949 x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: DM6PR12MB3995: x-ms-exchange-purlcount: 1 x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3044; Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+47717+1787277+3901457@groups.io; helo=web01.groups.io; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 8xvjs7rb0q5O0BL3Ncpw/7i0ltS1/q7w2HLHwKYet3XhlMs0Ajf/j0Lw6TjTktKjFHvcCkOM37q7EcFCUhh7EYFGK7SliNyGfeGqzBerFnNCk0jeGlqqXURHxSu5hzqQrpwR5CxOjb6uD3KohQyyJWG9/0jDM+ytjk2crvS/hjpQNlpFln4KRiVW4GYfLg6fDZJswp1kt3KccCI7I178C2fs3gwEbqO/kqQWvGfgXVRC0NUpL/xBPiBOvmzmG3l1FOVZBRfmSFA9x3/scJBvbRcqsKfB+zMTho7lSCUzhSrrCsHbM4f+bCEecMsv2w/WwjVfbL+DTm8HtUMJ/s1InX5wANylGKlD9GYHtC41q1jq+gomb4O2zIOkyjDlVL1xL2TMWVQFUouAZ15O5Ccqg721jKy+0n1dHsw4EBQG80A= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4dbac3fb-a7e5-49ce-25e3-08d73dccc949 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Sep 2019 13:16:45.8190 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: tgBt/nh87vS/Rn50oM6LxBjZ5jtg3BYCQrmX/MnPq0Lp4z/G/0zWX5G3TEk55NdnsakY5KNWh+iaiZC5HG7ENA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3995 Precedence: Bulk List-Unsubscribe: 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,thomas.lendacky@amd.com X-Gm-Message-State: TGjqM8K8fzGPSbeXWY0o7AZPx1787277AA= Content-Language: en-US Content-ID: Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1568985408; bh=q4jkaPpHgk6ElkqcstAKC6flzpOi5Yc9K9O1o6O3UTw=; h=Content-Type:Date:From:Reply-To:Subject:To; b=Mu574lI0Ka0EvwbAADco7mcDQ6NkWRbKe9cfnMED/NMHIxLLbvCTKk2Vhzsc1CbZFXw ksNT2ALRM9qBfp+3E012DgYjYo1haDTnsx/AzSM6TacI+3cU+vOvGGfFqpQQ0ESjRgPSi UI/k7Lwxrt6Ixi95A9YdSPyMLj+LUcXDgQE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Tom Lendacky BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2198 After having transitioned from UEFI to the OS, the OS will need to boot the APs. For an SEV-ES guest, the APs will have been parked by UEFI using GHCB pages allocated by UEFI. The hypervisor will write to the GHCB SW_EXITINFO2 field of the GHCB when the AP is booted. As a result, the GHCB pages must be marked reserved so that the OS does not attempt to use them and experience memory corruption because of the hypervisor write. Change the GHCB allocation from the default boot services memory to reserved memory. Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Signed-off-by: Tom Lendacky Reviewed-by: Laszlo Ersek --- OvmfPkg/PlatformPei/AmdSev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c index d6733447bdf2..53eeb59702ae 100644 --- a/OvmfPkg/PlatformPei/AmdSev.c +++ b/OvmfPkg/PlatformPei/AmdSev.c @@ -49,9 +49,11 @@ AmdSevEsInitialize ( =20 // // Allocate GHCB pages. + // Since the pages must survive across the UEFI to OS transition + // make them reserved. // GhcbPageCount =3D mMaxCpuCount * 2; - GhcbBase =3D AllocatePages (GhcbPageCount); + GhcbBase =3D AllocateReservedPages (GhcbPageCount); ASSERT (GhcbBase); =20 GhcbBasePa =3D (PHYSICAL_ADDRESS)(UINTN) GhcbBase; --=20 2.17.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 (#47717): https://edk2.groups.io/g/devel/message/47717 Mute This Topic: https://groups.io/mt/34230273/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-