From nobody Mon Feb 9 01:06:35 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+63359+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+63359+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 1595875452699362.9074960511483; Mon, 27 Jul 2020 11:44:12 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id BI9bYY1788612xJ9bNRfbybH; Mon, 27 Jul 2020 11:44:12 -0700 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.52]) by mx.groups.io with SMTP id smtpd.web10.62906.1595875451711785417 for ; Mon, 27 Jul 2020 11:44:11 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VL98dDj+HHZqgQxqEEmjA89KBbPg/WsOqc23Si6gSUjnYf+R5ECSQfUz4JD72oyA1GBtt3pdvRRRr7aJ0XtaL2bEK7nrgJrM5Q4Jxu5Po2HSwYjftxBZEzJPPYwU1e5JmnnAG7Eba9KtgUmz80R55OzFHKJGiMBfVUWDsQLYA1ll/O6uejAjaLrvNHazNSlzGQfRU8MLBHk8h9NxGMyf6YjukwBYgeL6RfnbygBtm+oJOoBHpKYsZFz/H2Gn5TlpZgb0gLIHY1JFpPNb+7eGjf8lk+0GBYk8MHwJZaqFGWo/nYQ1gz3e4FgxNUwzWpCR6a7d3+9UbDaIflXoLg9lKg== 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=cYWmh/fcAwIXIlWubzjDdUIKKdxtd9nRLkFVJO7hvKY=; b=Xf4oNAPbLoMJ2lPHFmQGax8J9EHJ8w6IMVezbnil4euDRrMxZdB9zN/zFyn3GaeDNjD14AydZ8vpTS/qHMpjhrdzrDr/5aOpjOaOiyl+v+celOItTl1TvZ4pEFQQB6kysGNIq09bQL6x+eQMhGJwyFzvCaMPWLHI817ch3xaKvU44BgG6oMQv4jul6TjkKTgowLRAnYqH7Fhfv2KP56yng7dIUZ1T4eX/fZhAB9aEZly2XO890NbDwA3b3PJDXR1yNkqFaUDHIEvjQf9ap08C0O3nx28a7uIMacfUSgfvaxOAsxSYB1CijNPfsWGiVNCi22oGU7uFHb4mztFgY22xg== 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 DM5PR12MB1257.namprd12.prod.outlook.com (2603:10b6:3:74::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Mon, 27 Jul 2020 18:44:10 +0000 X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::25ec:e6ba:197c:4eb0]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::25ec:e6ba:197c:4eb0%8]) with mapi id 15.20.3216.031; Mon, 27 Jul 2020 18:44:10 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io Subject: [edk2-devel] [PATCH v12 44/46] OvmfPkg: Move the GHCB allocations into reserved memory Date: Mon, 27 Jul 2020 13:43:29 -0500 Message-ID: In-Reply-To: References: X-ClientProxiedBy: DM5PR19CA0040.namprd19.prod.outlook.com (2603:10b6:3:9a::26) 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 DM5PR19CA0040.namprd19.prod.outlook.com (2603:10b6:3:9a::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Mon, 27 Jul 2020 18:44:10 +0000 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2391125b-2e89-4396-ecc7-08d8325d0d0e X-MS-TrafficTypeDiagnostic: DM5PR12MB1257: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: PK7TrnF0yEPrn9WArKEnxjTH18IrJTOurZ1Xmz5ABJjchxHrjqoL7XwYmbPLskIFuF7OrhK8QhGPqG0bqSZ18bvJADNZjd81B+UPbHtosDRsJT5Mutez17FJSj7cMea7M4qIq2DRSDtMWGnu/XPpFqkl8XBygW+yZOvOofuBFZ30bMv5z2MqCI6EMXzJ/v6FknDfydyHugVeXKBn7uIFg332I10KbZE5AdtkYGlMYtHgUaz3NLZT96pr3rR8ZivbnqI1UFnCZyHxQ4jP2XVqpbmY48G8Sg9sNuTXBoFwMK2PvMOkLFUf0QxvdAsp/gJ1Z+eY6k/4Ve+WmdTFBACshJ/7Y6fpqXLj/HfmUBF1pzCHycQVkwe4IuaJ6O8K8oA/tOakcFPkjaKoIYs7kqCekXvFY6bWbL4ZqMCxyv48sf35KEpKyPFhhO0OOLXQ7mF59UgKO3wQLz9hgL9B3uP3WA== X-MS-Exchange-AntiSpam-MessageData: QEwGWGqdPmyuQKcEjRMQt+w3WTshq8E9SLweusbGw+/JfdkYZ+HaEvHUbAqGGCfU55a7RLsf6RnBBZb3MK1EZqe1SB2s9uvsiJaFT1Cp7BCWO4yiBmosXfvfB9oodTRJD+AqxpFLub0qGrk68Q5jpQclQZwofPtlXCS96kHYmMafu+Ol+DLRWnY+V8fKOzexx77qnESSBRofmmkfQMEbIgpTC4IKVuFAuiM+UlM9gL1ofN2k9zzBzweFpXhsE2+WGf8MDJJ90ct4wRNsNfFLfB3vyeTC+rpeXZkrtGP0qmZaXpVCxgFV1kqpBWUk5rnqk8LMIxVt9Tlt10HULLpEjpBeA8svB8CY3rON3X7nukFf2q0YPqtTdHpGwzhkR5KLCz/tSQKwqSVfbQEj1vvwwMSaG+zzBVMOifTdiRNrizdzOPphB79BpBujkbFVVsivb4i0oYsNtZvBOY6l+jjd7tlXh7M35x8kon0tmp+YiGs= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2391125b-2e89-4396-ecc7-08d8325d0d0e X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2020 18:44:10.7453 (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: xJMeNXR1YxqWzeV++M8le4CNxyrS6U/eGlrnTSCEVig4q5453449EHYK5nxM3wIxlo6rNcD6jw1/ghf8qtTlvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1257 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: HlfYYT3U7jUzmmotu5fVUYQcx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1595875452; bh=/8XgfXd6EqFEQ1OLKgVvCaxeOhfI7PXiG0O1ZdAxoLI=; h=Content-Type:Date:From:Reply-To:Subject:To; b=OCMl8a/k+S32Yz0BcpPCracEKVXNyOq1oKSSt6+WizzFdZTTtLqUU6eQRFDI8v3JeoQ 7TJdDZKTu6CSwvjftozc/UQlZ0baE2gFxGXfC8gLst3c07SB769VvMjBEVmUNuGYLOTfR KAvVHRtpnw+R2hOXnrAsLbGUrI8Hbqn8LJU= 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 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 (#63359): https://edk2.groups.io/g/devel/message/63359 Mute This Topic: https://groups.io/mt/75829487/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-