From nobody Sat Nov 2 10:32:13 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; dkim=fail spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1492023648977438.87332151203043; Wed, 12 Apr 2017 12:00:48 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DAB0320D7B901; Wed, 12 Apr 2017 12:00:47 -0700 (PDT) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0618.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe45::618]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2D14E20D7B8FF for ; Wed, 12 Apr 2017 12:00:46 -0700 (PDT) Received: from leduran-Precision-WorkStation-T5400.amd.com (165.204.77.1) by BN6PR12MB1234.namprd12.prod.outlook.com (10.168.227.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.17; Wed, 12 Apr 2017 19:00:41 +0000 X-Original-To: edk2-devel@ml01.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=1EEeo19ViJvN8EuWYXML2NGGd5PicMd5ygbwVtRM6IY=; b=0EuQ8joFxJUt20lSus+GfrA8nLp8PRigCfRfbGEMR9jOJl2eMQKgrlvG2JjrlkH7+E8plSoaMSU8UzjIIiIF8l8+Ml2xtBTzIWC0M6gNmqWIp6MLeq7U/HTrTlIXkWmDW0/mC0OQOeov3dnhi3/V7K7nGmDy1TQU41zO0CQSeas= Authentication-Results: ml01.01.org; dkim=none (message not signed) header.d=none;ml01.01.org; dmarc=none action=none header.from=amd.com; From: Leo Duran To: Date: Wed, 12 Apr 2017 14:00:31 -0500 Message-ID: <1492023631-16252-2-git-send-email-leo.duran@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1492023631-16252-1-git-send-email-leo.duran@amd.com> References: <1492023631-16252-1-git-send-email-leo.duran@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: CY4PR13CA0011.namprd13.prod.outlook.com (10.168.161.149) To BN6PR12MB1234.namprd12.prod.outlook.com (10.168.227.20) X-MS-Office365-Filtering-Correlation-Id: 77b1c5ed-b4b1-4917-30b0-08d481d637d5 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(201703131423075)(201703031133081); SRVR:BN6PR12MB1234; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1234; 3:HqWaKEsWGym0EyGjH/qeHA7ahIElA2VTeQpu0vHrXOqpUiQusp31i9nGpJSA2Mn63o6N38o51lXUlRRlaFj8TDZRObKcmeaHhRqVmAQAEF9YXoCph50O882CZYySsoyOWkZu8qHkwQpS4iT1WSk9r/B1FaDLbtMS+95AAsrNASR2Zse/ylGuSrcKuLVenzsVUbS+eY+la4myGgGAcJRJrUVk2HdQrDM+a5eNcGClzN/h7fvhkzDEciCQdJP/c5bb8JdMKYFMS3KI0IR8h0gyPLMdWxa1LEtkC5mOmX3PTRzAWUBUp8JdtLE/MI93xoMPwry1I520uWgiWw4B2DedhkHBhoAbi67CA0hzoA4RQug=; 25:Izr6CDgIC4EeOIWTeG8IhlcgKS/M761MnYFJV/93SouvlOhofnGij/IJGSLA2BdJHj+mfYdNUMGhR7pwjWX6gT98BsdRSFJPfH9GnSa7vG6fRwCpEH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RG7a/2Pj0GMMZDBEJ/A4Tgad2AtFR7qe9WoI0RKQjRtUOkqwT05d1jec/F+Db7tiNxE1VOyx7j X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041248)(20161123564025)(20161123560025)(20161123555025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(6072148); SRVR:BN6PR12MB1234; BCL:0; PCL:0; RULEID:; SRVR:BN6PR12MB1234; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1234; 4:OamTCQ17pkeB7W7xLN3+uEVxgu829a/EYlf91RAGbfuNvLpgNsKhkTYeMOy94aKevF/046F0VpwFsfLg695TGMbb/lKh8mCBGvNINpKUSr+A/kJtmi2IUDfG2Y9bqYm7sUh3Vxwf3aZjcxGbjc723tZ0MwA3BjGOKDrbjcVFVuu4wOJhoTkNnNmCBCokWzp0U8Woi4AASZOwqaB7dvi5trsB/ZPJ5HlxBC2Beh58aGau/0egD5p53iOZOC1ExxrpjWuCyX/eqKXLZoT9wwCl2QJq2jh8Pvn1ippZzWad/NJa5+kqh+HPaQiEFx7qWDYhVnS6nYGKvymG4x8BV2dRus+jfXa6FBvpeuJTurwrNW/YAkTkQTjcHkHLPhl9kATHbwBIFAh/Dv6iHhY3RyQeP1AKZfajUETnsjWxXTDpOS5mXCSyAEFtXwfIsUF+flXKi/4s/ZVc0Iz2uN0f/OgJ0suDjmKW5DyhmhThErDYJZsb+1CldCNpArt2x/18p2oVcptgKg2rz4rKljpTfErRme+2vxtUgHP/zjWZHgPbLw+YcoduIFdHM+4ioKwOG2CXZylSIzr/LHNfbiaCygV/72nXCUfMsMoVaIt9icq3VKPsJje78QauX5kkcJbok6fq7mUBcy5xtMuTvjFfCikYTFIqwtaF8wwE8xYEDSQMKHGrjyjLN7AL7k8HSA5Fb1WJbseQJ40oimDdIxjBMUHGqSTd8Dc4lT/8UF18Y5Cm8XjxaIeBBXt8ijrxkf0wOBsPAJgOPolZTvsJacLCY6oSvDBzWI0wmNta7srhCMgZHZCtg6gGobwRgKhxubP8m6fT X-Forefront-PRVS: 027578BB13 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(979002)(6009001)(39450400003)(39840400002)(39400400002)(39850400002)(39860400002)(39410400002)(36756003)(50466002)(189998001)(2906002)(6916009)(6306002)(305945005)(6666003)(5003940100001)(6486002)(86362001)(48376002)(7736002)(53936002)(54906002)(966004)(50986999)(76176999)(66066001)(25786009)(50226002)(4326008)(15188155005)(2950100002)(6116002)(3846002)(16799955002)(8676002)(81166006)(33646002)(2351001)(47776003)(38730400002)(42186005)(110136004)(53416004)(5660300001)(53376002)(19627235001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1234; H:leduran-Precision-WorkStation-T5400.amd.com; FPR:; SPF:None; MLV:ovrnspm; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR12MB1234; 23:yV/VPZsd0lVDTcgCvGS81F/pRt6+wPebUJ8H2vLJD?= =?us-ascii?Q?DRglnEJCzAx5G9vir2Q8ZnOO1IaqCb8JIpuuVvXJ2fxGpUDI35pKphucwPVd?= =?us-ascii?Q?R+OSZt9/Ht+f+FI9rHR4MjbKdXWJkU/IsvxvvS1iSzy48SvkHjZv4NJypUFE?= =?us-ascii?Q?YLbLP8UibZcvCuB4JqyPFUdWdfdVzymuitIEzU3VRideRp7J6ZnaolE2xsFa?= =?us-ascii?Q?lXMnUJCsafpfR3MNbbcjEmgH9OFnju3JoXlMaornhSY0wJVGnzYkq3kC7+Ge?= =?us-ascii?Q?FplyiXM20OAqK9DMsZrRr4IXo1j3fsg4HhMtTeKwI+zqpXV1EfA/rmRX1kdI?= =?us-ascii?Q?/jFcPVeQe/Jv9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x0MmS7VGgKPAJOqLJD7zg8xGpYvLWE8nMRnx2vCBrrP1z9RPiY9cBx2UgZW6Gx5wCJX+tRW4G9kAKJK657OFsAxaNNawedF137an+8C++x8s+8rGqHkmzNXDcitIVB+Jq6yh6mL336/wo3uX0TGoLDHzKqTrj5G+nKII701/MnKDir1BpMCu5QFvtt+tJvLjVhXM2RtG4hYkCgRxtSe+7b/4S/D1oemFJ+v9FeaPkSv9cSJayTmug==; 20:DMrXuLvWfpGF6IqWftflU0RdPtmKuhKEWxcWY6tYhAqbieguchXj12KAGvNiRNLWROJthmM3sP7jPJbu60PINn53ob1ByNO6+e8CQVFt6LAwRHwe3mbXxijqLeC9CPkI1+KDy6D2LBMOXoFiA/sEFbm/IPIrELK2dFF8osc0hFUbiOLpwAQCvJd22Q6p0KwdMJCFKDi7oShgPQiC29DbRc2GAvvpZZqFIT/26/RmAk8f3K4dI9c42NRJzkEXtTST X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2017 19:00:41.9510 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1234 Subject: [edk2] [PATCH] OvmfPkg/GcdNotifyDxe: Install EFI_GCD_MEMORY_SPACE_NOTIFY_PROTOCOL X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laszlo Ersek , Feng Tian , Leo Duran , Star Zeng Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" On entry, GcdNotifyDxe scans the GCD MemmorySpace map and produces this protocol to get notifications from GCD on MemorySpace Add/Remove operations. This patch illustrates how OvmfPkg could take actions on GCD notifications. For example: updating the SEV mask on page-table entries for MMIO ranges. Cc: Laszlo Ersek Cc: Feng Tian Cc: Star Zeng Cc: Brijesh Singh Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Leo Duran --- OvmfPkg/GcdNotifyDxe/GcdNotifyDxe.c | 148 ++++++++++++++++++++++++++++++= ++++ OvmfPkg/GcdNotifyDxe/GcdNotifyDxe.inf | 44 ++++++++++ OvmfPkg/OvmfPkgIa32X64.dsc | 2 + OvmfPkg/OvmfPkgIa32X64.fdf | 3 + 4 files changed, 197 insertions(+) create mode 100644 OvmfPkg/GcdNotifyDxe/GcdNotifyDxe.c create mode 100644 OvmfPkg/GcdNotifyDxe/GcdNotifyDxe.inf diff --git a/OvmfPkg/GcdNotifyDxe/GcdNotifyDxe.c b/OvmfPkg/GcdNotifyDxe/Gcd= NotifyDxe.c new file mode 100644 index 0000000..1b54584 --- /dev/null +++ b/OvmfPkg/GcdNotifyDxe/GcdNotifyDxe.c @@ -0,0 +1,148 @@ +/** @file + + GCD Memory Space Map notification protocol handler. + + Copyright (c) 2017, AMD Inc. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ + +#include + +#include +#include +#include +#include +#include +#include + +#include + +// +// GCD Memory Space Map notification protocol +// +STATIC EFI_GCD_MEMORY_SPACE_NOTIFY_PROTOCOL mGcdMemorySpaceNotifyProtocol; + +/// +/// Lookup table used to print GCD Memory Space Map +/// +GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *mGcdMemoryTypeNames[] =3D { + "EfiGcdMemoryTypeNonExistent", + "EfiGcdMemoryTypeReserved", + "EfiGcdMemoryTypeSystemMemory", + "EfiGcdMemoryTypeMemoryMappedIo", + "EfiGcdMemoryTypePersistentMemory", + "EfiGcdMemoryTypeMoreReliable", + "EfiGcdMemoryTypeMaximum" +}; + + +/** +Notify on: Add a segment of memory to GCD map. + +@param GcdMemoryType Memory type of the segment. +@param BaseAddress Base address of the segment. +@param Length Length of the segment. +@param Capabilities Alterable attributes of the segment. + +**/ +STATIC +VOID +EFIAPI +GcdMemorySpaceAddNotify ( +IN EFI_GCD_MEMORY_TYPE GcdMemoryType, +IN EFI_PHYSICAL_ADDRESS BaseAddress, +IN UINT64 Length, +IN UINT64 Capabilities +) +{ + DEBUG ((EFI_D_INFO, "%a()\n", __FUNCTION__)); + + if (GcdMemoryType >=3D EfiGcdMemoryTypeNonExistent && GcdMemoryType <=3D= EfiGcdMemoryTypeMaximum) { + DEBUG ((EFI_D_INFO, " GcdMemoryType =3D 0x%X (%a)\n", GcdMemoryType, m= GcdMemoryTypeNames[GcdMemoryType])); + DEBUG ((EFI_D_INFO, " BaseAddress =3D 0x%p\n", BaseAddress)); + DEBUG ((EFI_D_INFO, " Length =3D 0x%lX\n", Length)); + + if (GcdMemoryType =3D=3D EfiGcdMemoryTypeMemoryMappedIo) { + DEBUG ((EFI_D_INFO, " MMIO: Start =3D 0x%p, Length =3D 0x%lX\n", Bas= eAddress, Length)); + } + } + else { + DEBUG ((EFI_D_INFO, " Invalid GcdMemoryType =3D 0x%X\n", GcdMemoryType= )); + } +} + + +/** +Notify on: Remove a segment of memory to GCD map. + +@param BaseAddress Base address of the segment. +@param Length Length of the segment. + +**/ +STATIC +VOID +EFIAPI +GcdMemorySpaceRemoveNotify ( +IN EFI_PHYSICAL_ADDRESS BaseAddress, +IN UINT64 Length +) +{ + DEBUG ((EFI_D_INFO, "%a()\n", __FUNCTION__)); + DEBUG ((EFI_D_INFO, " BaseAddress =3D 0x%p\n", BaseAddress)); + DEBUG ((EFI_D_INFO, " Length =3D 0x%lX\n", Length)); +} + + +EFI_STATUS +EFIAPI +GcdNotifyDxeEntry ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap; + UINTN NumEntries; + UINTN Index; + EFI_STATUS Status; + EFI_HANDLE Handle; + + DEBUG((EFI_D_INFO, "%a - ENTRY\n", __FUNCTION__)); + + // + // Iterate through the current MemorySpace Map=20 + // + MemorySpaceMap =3D NULL; + Status =3D gDS->GetMemorySpaceMap (&NumEntries, &MemorySpaceMap); + ASSERT_EFI_ERROR (Status); + + for (Index =3D 0; Index < NumEntries; ++Index) { + if (MemorySpaceMap[Index].GcdMemoryType =3D=3D EfiGcdMemoryTypeMemoryM= appedIo) { + DEBUG ((DEBUG_INFO, " MMIO: Start =3D 0x%p, Length =3D 0x%lX\n", + MemorySpaceMap[Index].BaseAddress, MemorySpaceMap[Index].Length)); + } =20 + } +=20 + // + // Install GCD Memory Space Map notification protocol + // + mGcdMemorySpaceNotifyProtocol.MemorySpaceAddNotify =3D GcdMemorySpaceAdd= Notify; + mGcdMemorySpaceNotifyProtocol.MemorySpaceRemoveNotify =3D GcdMemorySpace= RemoveNotify; + Handle =3D NULL; + Status =3D gBS->InstallProtocolInterface ( + &Handle, + &gEfiGcdMemorySpaceNotifyProtocolGuid, + EFI_NATIVE_INTERFACE, + &mGcdMemorySpaceNotifyProtocol); + ASSERT_EFI_ERROR (Status); + + DEBUG((EFI_D_INFO, "%a - EXIT (Status =3D %r)\n", __FUNCTION__, Status)); + return Status; +} diff --git a/OvmfPkg/GcdNotifyDxe/GcdNotifyDxe.inf b/OvmfPkg/GcdNotifyDxe/G= cdNotifyDxe.inf new file mode 100644 index 0000000..a4c8445 --- /dev/null +++ b/OvmfPkg/GcdNotifyDxe/GcdNotifyDxe.inf @@ -0,0 +1,44 @@ +#/** @file +# +# Component description file for GcdNotifyDxe module +# +# Copyright (c) 2017, AMD Inc. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD License +# which accompanies this distribution. The full text of the license may = be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. +# +#**/ + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D GcdNotifyDxe + FILE_GUID =3D 2ec9da37-ee35-4de9-86c5-6d9a81dc38a7 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D GcdNotifyDxeEntry + +[Sources] + GcdNotifyDxe.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + BaseLib + UefiLib + UefiDriverEntryPoint + UefiBootServicesTableLib + DxeServicesTableLib + DebugLib + +[Protocols] + gEfiGcdMemorySpaceNotifyProtocolGuid ## PRODUCES + +[Depex] + TRUE diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 71ac62f..441d7cc 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -3,6 +3,7 @@ # # Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
+# Copyright (c) 2017, AMD Inc. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the B= SD License @@ -798,6 +799,7 @@ !endif =20 OvmfPkg/PlatformDxe/Platform.inf + OvmfPkg/GcdNotifyDxe/GcdNotifyDxe.inf =20 !if $(SMM_REQUIRE) =3D=3D TRUE OvmfPkg/SmmAccess/SmmAccess2Dxe.inf diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf index 5233314..71b118a 100644 --- a/OvmfPkg/OvmfPkgIa32X64.fdf +++ b/OvmfPkg/OvmfPkgIa32X64.fdf @@ -3,6 +3,7 @@ # # Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
+# Copyright (c) 2017, AMD Inc. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the B= SD License @@ -193,6 +194,7 @@ APRIORI DXE { !if $(SMM_REQUIRE) =3D=3D FALSE INF OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf !endif + INF OvmfPkg/GcdNotifyDxe/GcdNotifyDxe.inf } =20 # @@ -351,6 +353,7 @@ INF RuleOverride=3DCSM OvmfPkg/Csm/Csm16/Csm16.inf INF OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf INF OvmfPkg/VirtioGpuDxe/VirtioGpu.inf INF OvmfPkg/PlatformDxe/Platform.inf +INF OvmfPkg/GcdNotifyDxe/GcdNotifyDxe.inf =20 !if $(SMM_REQUIRE) =3D=3D TRUE INF OvmfPkg/SmmAccess/SmmAccess2Dxe.inf --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel