From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.92.23.82]) by mx.groups.io with SMTP id smtpd.web09.1451.1612920317500866232 for ; Tue, 09 Feb 2021 17:25:17 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=lZDUN7W/; spf=pass (domain: outlook.com, ip: 40.92.23.82, mailfrom: kun.q@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FsLS1J+3I33SM0nMd56Qns9c7hhNXSvhjT/6vXWxC0Vb7QjstmC78FGN9KYuOfuJFHMpzfoMC39X123hWLxqZKToiO9qowIMiSbJFuKzzukA3Ka/NS3Eq4J4FJb8JozzimL2ERaLSWCi9Y+lspNKhMthb9Q39v6NlL81b5FxwjrJo5uSvLXv1HE17OF4S6wA0mnhdFvxYDnvPGoPXJZ4lV9aY3N/oq0db8wGpWl4w0GSOrpqKK6KPwuSiwWgFnihYXZdfNItQtrewzov5NMFjkjeG0EtgKWhCnMEk2k0QU/cSbrm7cskZvMfi1Rnjaz7M0n1uEVtp6Jc59BlLagfYg== 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=r3bKo3hqeARl2B+B+IJLh0dGvoOXjLEz/YzAaBJJwFs=; b=GDuSRw6VXbv0JHgTYtZtBApp/jdIpeqKRskTfBc1a2LssC4/f35CQs9LwOp6vQylL1j67n9VGDWXyWqKphK2ymlBJPrz7qi1FQuEYZCe7L6RGcKRyaA4Y/q9oQV9u8Y0YEP8aKQzj+pjQ9VdXLlZth08rTzMnaN4unHR/x75PPGqO2n6bZIur4A8INu0Z4xkIsmqr5GCLif+H+TaTiSr+lXln/wGc2lyVxFGUXjTsf8pDqg09cQsGRTHWa9OXFFnLcTM1xBMbn1cbkLmVe6TpslV5RZRpJyUYCKx2poLoxE2W2R6g9T0Fk8DVYPkng5Uq5uq7g35L6VdRwMUYfqOKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r3bKo3hqeARl2B+B+IJLh0dGvoOXjLEz/YzAaBJJwFs=; b=lZDUN7W/hRfS/4ROm02vAmnHz1u/wp/odgEPMOeMPMIECwcX/de6ekUEuf5sjNGF57rbd+oeXZbFAYRgVU8TMX2FMEZ/pnQAme5nE0v78yjAfjTjErqhFUZdG1+d2JhXUddddYCu6OxCgwq4mzZXXJCXgffiADwYys493pAo7Yt7CUqohkPn9xaezHd904xgh6yH482E/Kp/+YxSybjBw3Kvza+hZ8tUgTWoU7+5nCTnClqsneBkxI2nVcQgrt5YBv/3tUYR6NoomiqDwzarO3rWU4THmhxtbm0e9g3Qg7j/GObQvtTkUJvIGOtpSVYxqdl9nOidNIZHRwDOoV9d9Q== Received: from MW2NAM12FT030.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc65::40) by MW2NAM12HT033.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc65::111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Wed, 10 Feb 2021 01:25:16 +0000 Received: from MWHPR06MB3102.namprd06.prod.outlook.com (2a01:111:e400:fc65::4b) by MW2NAM12FT030.mail.protection.outlook.com (2a01:111:e400:fc65::278) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Wed, 10 Feb 2021 01:25:16 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:44862263FDDD8F34FC6F41B1F2B87C22C8F39ECA2A2B746E00C461386EF972D6;UpperCasedChecksum:416C7C0543B89CF62D51D9617A8D0D9AC506D75529AF4CEF8FA54F2B1B54D173;SizeAsReceived:7488;Count:47 Received: from MWHPR06MB3102.namprd06.prod.outlook.com ([fe80::d4ee:1260:6f53:3f7b]) by MWHPR06MB3102.namprd06.prod.outlook.com ([fe80::d4ee:1260:6f53:3f7b%7]) with mapi id 15.20.3825.024; Wed, 10 Feb 2021 01:25:16 +0000 From: "Kun Qin" To: devel@edk2.groups.io CC: Jiewen Yao , Jian J Wang , Qi Zhang , Rahul Kumar Subject: [PATCH v2 6/6] SecurityPkg: Tcg2Acpi: Added unblock memory interface for NVS region Date: Tue, 9 Feb 2021 17:24:57 -0800 Message-ID: X-Mailer: git-send-email 2.30.0.windows.1 In-Reply-To: <20210210012457.315-1-kun.q@outlook.com> References: <20210210012457.315-1-kun.q@outlook.com> X-TMN: [2AjY8zBBygwterJVDSD6e1OOYkbEpqly] X-ClientProxiedBy: MW4PR04CA0051.namprd04.prod.outlook.com (2603:10b6:303:6a::26) To MWHPR06MB3102.namprd06.prod.outlook.com (2603:10b6:301:3e::35) Return-Path: kun.q@outlook.com X-Microsoft-Original-Message-ID: <20210210012457.315-7-kun.q@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (50.35.88.161) by MW4PR04CA0051.namprd04.prod.outlook.com (2603:10b6:303:6a::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.20 via Frontend Transport; Wed, 10 Feb 2021 01:25:15 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: b10bc8c2-215a-4950-d2c4-08d8cd62b876 X-MS-TrafficTypeDiagnostic: MW2NAM12HT033: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vXS24Jia1ez0CcwuWCeAW3sxe4jSh69TJ9VTIdL63TxH6MTMC9LwBwLWpOmJxgG97ulQPk32N4MBXpNXheDCSBnpxqHlLliAWKgYOHOGek+fFnIGDVJXqCWAFaM95/fXX7LT0hGi1xKKKH0Gjde0nPEtnPe7D1h10LbvXSFUUYLiHPiVrNWt7oDmwAq/qeb3mhF+/lBmB9rv/z0ECLfUysUl03v+rKjVmOerekY1jQiMbIfM3XLfE8huO3Gq/v8xpwQDM2j1U+hRQiZPbfTXaGGgsg062X6iG4OXzdBXRlE+U3MXr3yqLTQrTuKPoxL7qvp+hhZaVJqxRV0Nm2AwIOxOYctu3p1b5jvT6EuZxDjR7vjCSJdWvWhwBAZi122054wyS/XJd5SiqKcN678qGQ== X-MS-Exchange-AntiSpam-MessageData: lKeFEGHl3jKKMaXK+dlC7lMZ0vC572rV53ub7j1pr4Bh8ag4Dc6yzEb/FB0yiX4g8E5mx/koozJKImqP21GYEBeT1XqIlL9vg7ijVKY+Na4xbV8igUnvJZ6QZmmmIhfjBfqNxVCrX8n6vMfbBgSi5A== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b10bc8c2-215a-4950-d2c4-08d8cd62b876 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Feb 2021 01:25:15.9960 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: MW2NAM12FT030.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2NAM12HT033 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain This changes added usage of DxeMmUnblockMemoryLib to explicitly request allocated NVS region to be accessible from MM environment. It will bring in compatibility with architectures that supports full memory blockage inside MM. Cc: Jiewen Yao Cc: Jian J Wang Cc: Qi Zhang Cc: Rahul Kumar Signed-off-by: Kun Qin --- Notes: v2: - Newly added in v2. SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c | 6 ++++++ SecurityPkg/SecurityPkg.dsc | 1 + SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf | 1 + 3 files changed, 8 insertions(+) diff --git a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c b/SecurityPkg/Tcg/Tcg2Acpi= /Tcg2Acpi.c index 7080df81efe7..cc37a8d5b9d9 100644 --- a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c +++ b/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c @@ -36,6 +36,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include =20 // // Physical Presence Interface Version supported by Platform @@ -145,6 +146,11 @@ AssignOpRegion ( ZeroMem ((VOID *)(UINTN)MemoryAddress, Size); OpRegion->RegionOffset =3D (UINT32) (UINTN) MemoryAddress; OpRegion->RegionLen =3D (UINT8) Size; + // Request to unblock this region from MM core + Status =3D DxeMmUnblockMemoryRequest (MemoryAddress, EFI_SIZE_TO_PAG= ES (Size)); + if (Status !=3D EFI_UNSUPPORTED && EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + } break; } } diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc index 37242da93f3d..d937521db388 100644 --- a/SecurityPkg/SecurityPkg.dsc +++ b/SecurityPkg/SecurityPkg.dsc @@ -67,6 +67,7 @@ [LibraryClasses] VariableKeyLib|SecurityPkg/Library/VariableKeyLibNull/VariableKeyLibNull= .inf RpmcLib|SecurityPkg/Library/RpmcLibNull/RpmcLibNull.inf TcgEventLogRecordLib|SecurityPkg/Library/TcgEventLogRecordLib/TcgEventLo= gRecordLib.inf + DxeMmUnblockMemoryLib|MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUn= blockMemoryLibNull.inf =20 [LibraryClasses.ARM] # diff --git a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf b/SecurityPkg/Tcg/Tcg2Ac= pi/Tcg2Acpi.inf index d8e06881c01d..60455610f9f6 100644 --- a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf +++ b/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf @@ -55,6 +55,7 @@ [LibraryClasses] Tpm2CommandLib Tcg2PhysicalPresenceLib PcdLib + DxeMmUnblockMemoryLib =20 [Guids] gEfiTpmDeviceInstanceTpm20DtpmGuid ## PRODUCE= S ## GUID # TPM device identifier --=20 2.30.0.windows.1