From nobody Fri Dec 19 19:12:46 2025 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+57907+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 1587616439530179.34145557404406; Wed, 22 Apr 2020 21:33:59 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id n0BxYY1788612xK7XAWepQ8G; Wed, 22 Apr 2020 21:33:59 -0700 X-Received: from NAM02-BL2-obe.outbound.protection.outlook.com (NAM02-BL2-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web12.629.1587616437172260741 for ; Wed, 22 Apr 2020 21:33:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b+R9+HiXHW3S1mvIkwzst5WSJEo8FW5TAyKbo+jnLr9TEWrFhV9GBpZ+tiZJccGERtBBf2xMyxnB9oPzf8LD9sOD0chiXMrfcTNsBdoxSDG/2l3sRMoTup3cumbwPzrnm4nv0c0Ys1wc+AtHlMfm95PK52I3Zx9/PMo1pjlQIDLSoEInCVu30wbemyxvbgsUt/te4BeaADmmPvcKPaMOxLDtWZcVwsFaTTvt+fdHL8PX2UmMFwT4NJUnG562n2O19x//+gEfS0sxzC162u6HbTSNMsC8Im90c5kzHTPxRK9/lIiiX2prQF3l+kzEbSTDQrXTSS6uXyy5JnXJOnq4DQ== 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=h/HsJtfcCrSFBrqeh53xWY83LTIhtvHdgADj1Yi5fEg=; b=gzZbNYGARE9EV+cMi3xcLu9tRkSHzOKXNvoT2tm8oDjRKSxV/oNoCFsLISi9tSzBa8Najik29dRsNQvDW1u8thuE9wVKiKP8B+rBrQPokywLwegTfHdq+vlU8svB6N3cJVmtncWYhcljcmgmyMjUCCoHW9nh2g73wgpIa437hSlKqR5fi4jC0NrnrnvP/jjrvgMyLnrpYdEkQ8afEN5cX402oTg8rCxnxtCWEgCm+HsChEOAeMGsMnjut1rw0nVvU5XZuYDhi1MKXJjB3veAUuVhVItCkFtqxlh5VUOgX/Imauc1yBCPzrb4vATGMv4ZjS7vr1d4KtNICk/EB+0X6Q== 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 DM6PR12MB3228.namprd12.prod.outlook.com (2603:10b6:5:18c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.29; Thu, 23 Apr 2020 04:33:56 +0000 X-Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::9ae:cb95:c925:d5bf]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::9ae:cb95:c925:d5bf%4]) with mapi id 15.20.2921.032; Thu, 23 Apr 2020 04:33:56 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io Subject: [edk2-devel] [PATCH v7 42/43] OvmfPkg: Move the GHCB allocations into reserved memory Date: Wed, 22 Apr 2020 23:33:42 -0500 Message-Id: In-Reply-To: References: X-ClientProxiedBy: SN4PR0201CA0053.namprd02.prod.outlook.com (2603:10b6:803:20::15) 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 SN4PR0201CA0053.namprd02.prod.outlook.com (2603:10b6:803:20::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13 via Frontend Transport; Thu, 23 Apr 2020 04:33:55 +0000 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 198d7a41-6859-4a50-4452-08d7e73f88c3 X-MS-TrafficTypeDiagnostic: DM6PR12MB3228: 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+57907+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: YdsV/GbMBQlBjX6UF6pCK2lgyZeg7fXutM/JwLEdup0BF42fgmHlznFb3etokvhSnHs5MM21tSxxIiU8Fl+l8jEGfubb18LYXDM6GKzoZuBoyZpvni2uTliCF9KjZKRpW8CMCX5rly9RkW5j7JW+6EI2p56he2MViOa6m/82PCf5Wo+luBpfSONS227XLS/CIEm2TKGuizHP9OqYuMSJBjvSrPcQcQ6dEECQb4P/Ne9790po/uwUlM8dYo9HEtRtTVgcJqu7xwaYIcr4MX3BtslB6HFpWxXJ7hmy4OAzklfIQopDLYPI3MR77adJbK5T/SFk599vfu1RU3vs5IRIWhO5CqV9jY+DzfMWHvup4XrrszsiVehEojClyhoHlewWDE6MAxFzYG/LP8sCnHiuuFTSizvHiOZiVTVidhEnY6LzwPqv8QGJI3rJ84nI9sJBsbzBpg2PZ4c0TiLNHhAkLIpD7q0ek1AwoK2XIpDcm63UyM04IJCPO8kK16gvxPa4McrnSq5N8tgU85hkEq1FzfTZlLpaRs/WMWam3+TkaVbJq+PveBXBWaemJby3SbwGkQgjnGa5t2ZP+Ldd9rIRVg== X-MS-Exchange-AntiSpam-MessageData: 1SjMrxauRT+du34ZOvvM+IIA3wdvKsMSqn+9VI6ABoERjxwC2KUE2MDjK03h7pS806C6FeQ1nz3gNHN5/s97Ho9Swndxu1bCmfVOi3Ypq8Kh0+GPpNVRDKHMjDSLlFxmmCxhGnlfW/8fu/HWWxIAsQ== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 198d7a41-6859-4a50-4452-08d7e73f88c3 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Apr 2020 04:33:56.3406 (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: ep0F2jw4ViSPlwA3QOdjsQuyyspJNWiDkbNZ0RNLKOAMf6cuYzks77P8IGrqh3PYGNBybpK7h/DJfHRKgdL1YA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3228 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: snhhR95rhtojZElEv1QhHvALx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1587616439; bh=3nXe9qVNx99Ojd/xN7Rf3Gb80upou+8Ff/HbWUpYldk=; h=Content-Type:Date:From:Reply-To:Subject:To; b=QX3BXLoHvpsBP+MfvcEL5KMpqz8uz4P+2uNXe813XM5gjXMVOUhTGTyEQGZo+VQXBBs 102ooXVqHmTQ/E3ua0hTb7ypeaKAmR7rb0puwt7sSlpQZNCVfI2DPL73YqyBNVKsb/AJb +ULkUhZ4Qc+TzB6fONYYym4iPrhs+jhmlJU= 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 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.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 (#57907): https://edk2.groups.io/g/devel/message/57907 Mute This Topic: https://groups.io/mt/73212757/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-