From nobody Sun Feb 8 18:24:42 2026 Delivered-To: importer@patchew.org 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+60819+1787277+3901457@groups.io; helo=web01.groups.io; 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+60819+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 1591379945479177.04059383469996; Fri, 5 Jun 2020 10:59:05 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id hYAUYY1788612x0mXVM9ses1; Fri, 05 Jun 2020 10:59:05 -0700 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web10.590.1591379942419327403 for ; Fri, 05 Jun 2020 10:59:03 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cbOSpGC3aFbou+8k4c9P9PQuIAKBDwhiZVcip1+YAk3wvlXhJahFFJkM7LJs8evUJJgxj+bhu6v+Nqf8XIK67/50jQGZz4AeSaDwxR5ic/XmRLDiyXNGItutfruFhirv52bV0NVqiogIZvkocyjREV7ENQQQs/DP3DZRRkzPZeGs7s5z8w2+SVHGlIT3ZO7/eVfFtZ0iIG88a3yblR9s5IFfUZTXMYHGii72TqYVWTFQ3v9xEIjtGtMPEZod6CDzDvPMPyaWQ4nYrIfnirrIHb3qTIzldDtv72QGVmHlU/p8HFYhNbi8ZFGGZnsTIcrI3X+MUyvEeh9vneR2gIEtCQ== 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=tR9itwmvzqnrwPmqxtAv3UD9vQV4B0yiHcnuuWJ0SRQ=; b=VHamP0cll6v3865vNSSV/d7QeW8CkPkBS4ZWXBgqcLYb4Yq7egXZCzhCgoxo9OyqlwcxmitR0yZhLHI0x++0Pb6NxZTuaHzaGQ/PTbrmWYx0dA9DVDwcYanT5dsSHuyYEB/hmeXegm4u9IZj+xP9vf9jalR2FSPcZrVuqWrE+Zt/ACDPIRhqSnplZp06Xtl5JkCaG5xsWSKgq+qcSlJ6F/9qSBIdAPgtAGQVETxs1V5F0WE+tnTUKrcyZCj6HznH6t0MAvWObvdQnw7CSfRHgK1DT/l/BF1GNH5GhFwH5jtoouyO0lBDBbzDPJM1YGsbQKSTSswrZ0dp+V5dfXBysg== 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 DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM5PR12MB1193.namprd12.prod.outlook.com (2603:10b6:3:70::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.22; Fri, 5 Jun 2020 17:59:02 +0000 X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4ce1:9947:9681:c8b1]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4ce1:9947:9681:c8b1%10]) with mapi id 15.20.3066.019; Fri, 5 Jun 2020 17:59:02 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io Subject: [edk2-devel] [PATCH v9 44/46] OvmfPkg: Move the GHCB allocations into reserved memory Date: Fri, 5 Jun 2020 12:58:45 -0500 Message-Id: <7b511508cd39493a3c0197093e14506e75c44f7d.1591363657.git.thomas.lendacky@amd.com> In-Reply-To: References: X-ClientProxiedBy: DM5PR20CA0008.namprd20.prod.outlook.com (2603:10b6:3:93::18) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from tlendack-t1.amd.com (165.204.77.1) by DM5PR20CA0008.namprd20.prod.outlook.com (2603:10b6:3:93::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18 via Frontend Transport; Fri, 5 Jun 2020 17:59:01 +0000 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9c2676fe-a67b-473f-0582-08d8097a2108 X-MS-TrafficTypeDiagnostic: DM5PR12MB1193: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: UiVr2UWbjwazYIOqQ9J+97Si2MxnjUsQBUydUi67CgO26ncIcHNbj/BvQ74qaXsL4A5SJls+Sm4458ujY24prAMsspujTk61KAvG84Dc4XRnGa2sPuXFSRj7xBYQeIVBWflWNx0R86GWSbSC4WEDByDK9F/OSwFAV0c7JSHv4Zj+FqW3XhtOIhA35oBWM7MniT087+haLKr+FXdvIwrebXoBxxwKUrERfNhH6o7w7PFg/EkZeFoJNYu4OB/rXUyWEegK7bVyXRYKoI6yPTy7/k2wxfBbltQNDIRkjDut3L3meywwin9TPXgCAGvBM1aKgHbIfED5Q9tiawrFktwKmew9R103EiNttelgv2wUHdiQ3vghodwgdbTvfwais5tfv77LCOStd7mlM4Z3x+RTxNCxdU/SXb7O1jxfyJlaMVMXwh1rNYnk0KrLFIFGWPW06DfHOs0LMSV2UwmMvTBSxA== X-MS-Exchange-AntiSpam-MessageData: Dm7igLl5Eyudv+8cA14y8n49MGIBamyglF+tMrD+kbqvuliCiMXkd35/1KvvrycG7eozVrvYChxiCkjx+7mSULu93PS3UFe2vm1Tbpi/8IchW3CuG7Q+F2uER4IkIXlYy6F+Gw5EOXNXQTqplnEG9yBZKs9w6rxD4ihebBBJM1mnPwAYafpKvlDfAow6dOcpAJhCL80f+NTwFa295tLQJbOz8JtlVmG1TK+lcWRSClZz+i3/0A8Uj03pak84fBuu0bI892PpyRDd8p7NgpdBY166IiBSctcRapvCRdJ83fWawaGePdZvUh4K3ZLiRut4LVZujBl9EKX2CNivq8nzdmwfdxE0yxfMbytzZ2pvSvvnaSkQZxI8fapAPaiVpA58or8168GHoaEYdFAG6r3vW3tx4NkBp2DuZ+QLpbY790E1cHuSSuOzrfCVPnIvM+UAbZG2WTNmEVytGBZeP/onNMM05J6YS6iRB2O89bbKddg= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c2676fe-a67b-473f-0582-08d8097a2108 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2020 17:59:02.1487 (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: M4C1kK+7yWabeKZ+zN1gJ6AwHrw4Fas0v+JMvc6pMKbUWzZwlmxElxBsEuuwAD1N0j2/wXg3zMQy62QB68mEpw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1193 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: 3MqXVzES2Frb8PKS3CIrPZHhx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1591379945; bh=pH17Ms9bi1ufxAgWC1+vGi6ysef6PAwgx5bW/3G3s90=; h=Content-Type:Date:From:Reply-To:Subject:To; b=VLOPcsn4e1ZXS2D8BmMfhKW0BV7+vaimyisfRr9Wv7LwSCbgTVuJYwkA54x7CU1vgOS q1WYDYqc5IQbHGLOVmiB0BucUxeLdTiNOqak0M+Rl4fmRIxSNuPlTsg5qnCd06IoGI/Eh 63ZX0PnBLjEtxea9Y4ybdHpW6GUlz4/ff5g= X-ZohoMail-DKIM: pass (identity @groups.io) 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 a2b38c591236..4a515a484720 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.27.0 -=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 (#60819): https://edk2.groups.io/g/devel/message/60819 Mute This Topic: https://groups.io/mt/74698716/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-