From nobody Sun Feb 8 19:44:00 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.12 as permitted sender) smtp.mailfrom=bounce+27952+55290+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 1583214232079671.7948409524245; Mon, 2 Mar 2020 21:43:52 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 4N0rYY1788612x6Qyo1Oofwd; Mon, 02 Mar 2020 21:43:51 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web10.91.1583214230107484776 for ; Mon, 02 Mar 2020 21:43:50 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S+WJ2tij2AHVatmzD9HCL0gB8OQ2cjDd3wQyWdGKslB9TWaz6/KEDboUmGrn+IOBZNIrN8PZpbZLVGQl+LfRc0SBtyj1AwX0MpDm2d4Ii132Pr16oDcbjh9U3CobernnK5D/+oDHOKscZahn0A/7A8tTHIQLAZoR6O3Eh9JM+LXcHwju6VdxEaRIOO8xY9qBp3IkAGmmLTJ41yiGS62zNMMI8CSC7Do30WY0tVnXiPGZhyQHuZ2TCPazh1bWoLxXtcG4A6Z1l4yUzzWy70gWAk+Mbm74ED04atiABt/XJ7ETruouIEQkpbgtKf4zoVnYR1xOPrsM8l+EtsvG3BOyzQ== 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=/gD3/JiWWH6lCijCxIDgMBaXHOePBFx/x5o72hLTxhU=; b=Xzr3ojIIKQ7kl3UXQ0IgDMlj/BokjpUk5+7us2k94b5txKdt4P7cxO9HqEvc/FKDmv40qgFd9LICEc3+JaerFVc9Ed6LJmTsLWrIP04GEnPp2F0WA9qv8OHTNNo6nHF3/c+Uu2t9oekkOOuV8PNhS7WxaT8TxyF56LUEIQRbWMXQv2ZS5devP7ST/sZ6/I78LqvFDkf2b9Qy1CCgOFqBoIj5MKvAbMcVCvlHlup1XHxzSGWp7UQZDotXX6c6AqzMD2YkxOIXRQVyPxgmcFinon8hdolfoVXdqEJSbh4yx5j9N/okvvxfXzQZly/7yV+EX2vCGCB16+bUlWX4JZUmTw== 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 (2603:10b6:5:15e::26) by DM6PR12MB3291.namprd12.prod.outlook.com (2603:10b6:5:186::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.16; Tue, 3 Mar 2020 05:43:48 +0000 X-Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::f0f9:a88f:f840:2733]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::f0f9:a88f:f840:2733%7]) with mapi id 15.20.2772.019; Tue, 3 Mar 2020 05:43:48 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io Subject: [edk2-devel] [PATCH v5 41/42] OvmfPkg: Move the GHCB allocations into reserved memory Date: Mon, 2 Mar 2020 23:43:34 -0600 Message-Id: In-Reply-To: References: X-ClientProxiedBy: SN4PR0501CA0066.namprd05.prod.outlook.com (2603:10b6:803:41::43) To DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from tlendack-t1.amd.com (165.204.77.1) by SN4PR0501CA0066.namprd05.prod.outlook.com (2603:10b6:803:41::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.5 via Frontend Transport; Tue, 3 Mar 2020 05:43:47 +0000 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 78a83004-74c7-450a-344d-08d7bf35d827 X-MS-TrafficTypeDiagnostic: DM6PR12MB3291: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+55290+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: 7z2opyOBkHS59TEWV6/eyES49SO6/Tdw0dM1ud8M9KUduNlmVEuKyLKfUaQVJajrKsdUhyCjCqFDZhC2ozllv7bct2MlBjtsF6ohV6snL3mJtSLKQ4X8anUfJL/iDPcjIm1BwVr6ovizTnwSJtnnC8ZkDAnGd9EsdtT/LtcHizjqIP6aXBw0pl6OD7zFMg5R64RqiF53SvrYMHrx3VVJREEE4rqYJZSVebhNk8AWExyrBAEBgu/7YdrJBIhjVKbbO3Zk0AisgV6VeRoCjdKTZKdfn3i/vqKhXRm4QNzJttE7ceeHz3AR6qRKHyIULUgvJXLOk6X4hqR8Lw8Nthp4PFpxMZvX48vbOj5x5amKYob0FxRyFq5XxirTXnzIvqSvkELpWrcyemAodqB6B2Y1t+562eh/u06VyYwBf7c05t7jQvuytlO+P/amyk0MYb0TeXYtdsHqs/j1Eo6J6Whjh3wUwk+k3CarVNM7N7lI9tT3c90n4A5IsuB+bbHeVV7WQ1+vsu+ghD2lnfXItZu0EA== X-MS-Exchange-AntiSpam-MessageData: bujRI6OSSti2KZhMjqe/Z9toYoIG6xvxDlXqJXOPWMJxCpaY6JcRGYoej+CoAYBhfakmJf+UbSfLPr04c8rca1KTgVWZZO1GY4qR0Zd0aVEN38TtjuElhpOqHRcdj1QHkF6tMwMmPaXLlkpUNYTLTA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78a83004-74c7-450a-344d-08d7bf35d827 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2020 05:43:47.8333 (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: kNdjKCh3ZH5MMv1ocC3PCl+9LQ4V+21+FRZdg3YSVHUBhDERcAHDoJGGUjJqv3+1JEM7e/FRHoYUcRR6fF91qQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3291 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: lQ8unvDegKMBKAoOJ6swFt3nx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1583214231; bh=fm4rPyizeQtdGcoPs0O04xObPD+dNbLfDDTHgXytYWA=; h=Content-Type:Date:From:Reply-To:Subject:To; b=Md/xkipG9t6+k8vEMyrG70ku/0iVDpowlrvsTRjKYAwcIN6CtgubqMUCda+dKBm8j4T 4B71XwQcWHXeXevkJUhs1V95L0eK5+ztHCWJDvk8iAvtYEZ6iWMo8tbhlTFPDy41zZtco lTwsXEEF6f+Xt96Mzsy8c9U/jNLeWQFPRqQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Laszlo Ersek Signed-off-by: Tom Lendacky --- 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 38885de359af..2b6c965808e9 100644 --- a/OvmfPkg/PlatformPei/AmdSev.c +++ b/OvmfPkg/PlatformPei/AmdSev.c @@ -51,9 +51,11 @@ AmdSevEsInitialize ( =20 // // Allocate GHCB and per-CPU variable 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 !=3D NULL); =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 (#55290): https://edk2.groups.io/g/devel/message/55290 Mute This Topic: https://groups.io/mt/71694685/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-