From nobody Tue Nov 26 00:28:47 2024 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+63886+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+63886+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 159683728799311.64146777886458; Fri, 7 Aug 2020 14:54:47 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 6NTsYY1788612xzh6x5RKhZd; Fri, 07 Aug 2020 14:54:47 -0700 X-Received: from NAM04-BN3-obe.outbound.protection.outlook.com (NAM04-BN3-obe.outbound.protection.outlook.com [40.107.68.62]) by mx.groups.io with SMTP id smtpd.web11.6708.1596837282771828724 for ; Fri, 07 Aug 2020 14:54:43 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AQHaCl9CUs7wddw4fwqoYGYXkp8V5iIpAUUH4HbClk1zY4z5zici6cY8pImST4OOfi17P4Vzwt7+mnBmK+P6llqoQxTffceDFacu68f7/w6k7VepVeNW+7Tn+R0NC6nJSxKZ/plNM9tn5SnJ+GJXY+jmgvr8hquv/aH0tY6XbzOuVK8QiCGsaF/YhhKazoWk51mmZYsomeoRA4VFi0xVWUIIPkdXGR5K1AeT2Nv/bIY/kgo/A6uHp5fyOwqT2N+WY00Hr/G79I8cJbasbGDxJyEayQh76dRR8DBs1gE6lIq/Nbq8j+cSlBBld7K8MgtSDGFfd5lHit6jnYfeuwTLiw== 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=n6hnA8jmtHoOEhBgFu4j2yY+VI32d9GKfQKM/B84o9I+t2tlUAEQuPtTmWgVmgV46C5Khdoma6MvrU7meDo/54z5wwhwaO9lvl7gnVYm/oc/pkdaujk+VNtDRnFUuJR6UouXPnIIUiTIk+3aLiliQxZlLX9N7kCAjABio6/WRmUICSHdvvQyvtYuAgEzXHrD4GeW+2pWakLa2FCrmYAfF+EvK9cVH6MZBNqottuqfRXOEF68oK4utwai8e/hwjFJpvnCbQLF72c3R3eiZj/HqQTuOof3HhYF6fND/ZIsAtcdELeG6S4Hr3HpQ8F9eNgIiWR/P9zwhD/hcq6GjUrgfQ== 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 CY4PR12MB1352.namprd12.prod.outlook.com (2603:10b6:903:3a::13) by CY4PR12MB1717.namprd12.prod.outlook.com (2603:10b6:903:11f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.20; Fri, 7 Aug 2020 21:54:41 +0000 X-Received: from CY4PR12MB1352.namprd12.prod.outlook.com ([fe80::9181:78bf:bf0:702b]) by CY4PR12MB1352.namprd12.prod.outlook.com ([fe80::9181:78bf:bf0:702b%5]) with mapi id 15.20.3239.024; Fri, 7 Aug 2020 21:54:41 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io Subject: [edk2-devel] [PATCH v14 44/46] OvmfPkg: Move the GHCB allocations into reserved memory Date: Fri, 7 Aug 2020 16:53:57 -0500 Message-ID: <1f7624e2bdaa880ceff2b49ba73bea955b36e1db.1596829170.git.thomas.lendacky@amd.com> In-Reply-To: References: X-ClientProxiedBy: DM6PR18CA0026.namprd18.prod.outlook.com (2603:10b6:5:15b::39) To CY4PR12MB1352.namprd12.prod.outlook.com (2603:10b6:903:3a::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from tlendack-t1.amd.com (165.204.77.1) by DM6PR18CA0026.namprd18.prod.outlook.com (2603:10b6:5:15b::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.19 via Frontend Transport; Fri, 7 Aug 2020 21:54:40 +0000 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 303d2840-872c-4521-737f-08d83b1c7cba X-MS-TrafficTypeDiagnostic: CY4PR12MB1717: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: oFuK7NiYZ+Hc3aTmvtCOXlHFu+El4KcvCVVayfnqO9x1hrdJFYIv6jnzF270GuKtYw/u8PsC8TBOk4PoVFuW/x9IVigqC7eR//Fvf02WCushTU/sH6HpKtE1RakQsSI0Ssl6bFJ7+bqww/Avw2edvPUIuhTo5sTruiQuQOP7AS/G4xRSp5SqojbPinqgWyuNL8DsIDkGZNbpQ1SSfprO2yhmyno7+r/UoW3Bo3Jj7BuFx2SntQ+0P9IHrX8Gmr21NFnkAcYHaiSqZaLGS8srZtDioApgsbuvgN4LkcZuCz170CMBUUzgi3pZg/1jLNaU9AwpW+c2GoTeOOih+lRQOQ+IQr0qXQFrBFnGJCLII2ZtW0dLmJGlmGVJmb5GggmInDuJ6jGyUi5oq8lAK/FdMlrlcgTTgGiikg30Sd9f46nV3pOYAm4ck3PKixVMAwqwpEIREyZ94cv0y2GKXmII/Q== X-MS-Exchange-AntiSpam-MessageData: PlC4BVZSyIgDnjWmpS0in69APm6Ohnt20o93e5JpUpPZuU4duIBsxPpHOOGuUFcr6ZWX99rUzwOeXd6iATiwoPGIAR6lFerMQDIgEmv9tZbISHgO2bdDqOPxx/OX29aAfgAu4gd8U4eg0kCdkEm/OJrzpeZcD2rb19ZIl6MABJqhh+tkNlDkcQ8Bwlnpj3elO+a8+5Gs51A0P/YWm3MrYPNzEY7SylFcDyjrZCzCSaeR8nu16CPrfX0j/gxcFv9vGB77wWOP87jhso5vmBgdENGnu4ji4sYcnmFJxcpTojgkYhXwxSAWg2NP8RLP1TBj2JpcwlsYveo5AFxmh7cEdPfYHw/DbT7A84PUbOLfkbazuKNE+FTSaoYLfJxzC/qLj5YhQC2AWmljzeU6j6okdss9CbjY1/15/vWrKcwAWKvJxnuIMM2Ff42cjUQPUZ5bZ6DTN1L6zjQBwXiDMgQI16UrNuecSulo7DdpJl+9Yimqe6rRpCtaa4Y227Yb/97FJVeNVh18ZgMSE63i/Cf30E184LmMZ9a2qhSyyEuHfXT5wFAwruEJnlBjRk3uQ2R3O0785DhILaj0T7cJZg4QFhwx7whbnv4ZyWKFL2inIcefX0saClojTLNHKt8GH+gxny6PzFaNfCTROCCyd2Fzsw== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 303d2840-872c-4521-737f-08d83b1c7cba X-MS-Exchange-CrossTenant-AuthSource: CY4PR12MB1352.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 21:54:41.2511 (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: YwtyOmsvQR8Ha+prs3FXvvgnp57BXVHwWifJ9u2Y0JcinCsH9WLyvyGsmj5d+h2WCwmEg/Gdk7JMKZVR7uUK6g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1717 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: GOBiU0GhTOt7Chahb9qX9MPGx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1596837287; bh=U65IH6ZmXjbYI0nF/MgI8/igreRDNabLxljAM4Q3nUg=; h=Content-Type:Date:From:Reply-To:Subject:To; b=oUe0gTAwF/Jkyg6goTIuunl07d9RNOs80s3R1lMVeqpUMF+e58CzU5XmlTqSf+RYfqO SbXLs3gOdfC1K5cvoo5ussgXikuOxnO0V9d/QSnNKhVTAA5E83RUw2kp3B0gVS1RT7+UK hlNdTtt7yQahr0d4njgCA//JeoQ6x3H7stk= 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 (#63886): https://edk2.groups.io/g/devel/message/63886 Mute This Topic: https://groups.io/mt/76058845/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-