From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (NAM02-SN1-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web09.17380.1614379961341717711 for ; Fri, 26 Feb 2021 14:52:42 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=E/uN4/Rr; spf=softfail (domain: outlook.com, ip: , mailfrom: kun.q@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=giBqH3ELbpe2ijWjIkzk1+W4vcOOb7xvOLPjHLiM83Ub0wJvQspnXc5yxJSDDK6dHLAD1RhgnjvYcur0zta5asgmyhkfUhmcAYDmWiWygddVH2yMqtduzJWHm9o08fngySz6g+7tjyOhh1JPBnulSESn1HS3/D2JMrGtigNaA9ypcesvhdAz/juX+wzrFo3MNOQSvzasTbU91BF9r4nBbNOSt1l4jRKSWv9046eeBEIz6hgdn4IST/gXL30QVoSxz6NXNZ0L5deHvZZHbo5CMzfmALROxxtxldCv4sTu0m/H5fVK62ukKvXJPX0jyRY0mf5LEDD4ul3sNnia4ydkgQ== 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=5IW7VeeSSGrT6wmKrStBzf0tO4xWD5cwU31VgQMVXSw=; b=hWCDc0Lvu1EBOBXZkQrH4p5l2z95geQIDtKDzdSh8d39+RZN5NyyyfMj848o5fOJ06xpuxqxJJqKmJ2IrgmYfNvfF88hTQpMzLwAKBP+5Jmt4O5dNAFhFLgAzqrdowRb5QQo4/Ffi8pRALAeIiJpf3vPTHN/uZzRXMGwDw06gPe/MaEcnEIFn3T7G/43Vlg8S5T8/5u+2bLmBtdTUHhE8UuWHnPDrH1ruK3CWK+k9iAXLiRs7MiWbVrJVMQdb49XIthewB/ToKbSKvHL5YrE+DR6nCP850ciwXwpxw2hkn/6e67KPx3/5AI762x/urinIGa49x2YI8FVBtEHEerKOg== 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=5IW7VeeSSGrT6wmKrStBzf0tO4xWD5cwU31VgQMVXSw=; b=E/uN4/RrUDxVGOoTvOlgnLE3cUv6oTWRqFrGqkxHRGJ80B0jzZAtQZ4EkZwjyYeHCrQPTgUlLVd5f4S5p4mBm+PKdtuzKnzRpbrBHkk+b80Qew/H5YtYPNepwwccWWILS2FDj+GLpZmHJpOMubA2BGjsaIuVwo6G+FTMYL3MJ0bG2Y1qdOAbPOqqBAsn1PHYOINKEfbaWsmT0znIk5F1sN2LdwE7c++tmekBQGVIxz6aANj7uhbzrjVCdg8kDSvNYIv9VhzfI08GG4hZw16/xzXZVzWfmXBPHlJ73mpFgPf3QC2XIL6TuUBi8l95jFp8WZBUGkHgkmyykk2R2R34Xg== Received: from BL2NAM02FT003.eop-nam02.prod.protection.outlook.com (10.152.76.51) by BL2NAM02HT201.eop-nam02.prod.protection.outlook.com (10.152.76.251) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19; Fri, 26 Feb 2021 22:52:41 +0000 Received: from MWHPR06MB3102.namprd06.prod.outlook.com (2a01:111:e400:7e46::4a) by BL2NAM02FT003.mail.protection.outlook.com (2a01:111:e400:7e46::204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Fri, 26 Feb 2021 22:52:40 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:7834D9937CDBE966700A50ED7575A4E7C501FB3CBAF496340F4A6E037DA9BEB5;UpperCasedChecksum:403599459B6DC06C287416AD6B8A3B22B447BFAE5048F2DA4B09771698E740A4;SizeAsReceived:7556;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.3868.032; Fri, 26 Feb 2021 22:52:40 +0000 From: "Kun Qin" To: devel@edk2.groups.io CC: Jiewen Yao , Jian J Wang , Qi Zhang , Rahul Kumar , Jiewen Yao Subject: [PATCH v3 7/7] SecurityPkg: Tcg2Acpi: Added unblock memory interface for NVS region Date: Fri, 26 Feb 2021 14:51:58 -0800 Message-ID: X-Mailer: git-send-email 2.30.0.windows.1 In-Reply-To: <20210226225158.1378-1-kun.q@outlook.com> References: <20210226225158.1378-1-kun.q@outlook.com> X-TMN: [DijSDlak8amVqL503l6ZoUSwqRae8QLU] X-ClientProxiedBy: MWHPR12CA0053.namprd12.prod.outlook.com (2603:10b6:300:103::15) To MWHPR06MB3102.namprd06.prod.outlook.com (2603:10b6:301:3e::35) Return-Path: kun.q@outlook.com X-Microsoft-Original-Message-ID: <20210226225158.1378-8-kun.q@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (50.35.88.161) by MWHPR12CA0053.namprd12.prod.outlook.com (2603:10b6:300:103::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.20 via Frontend Transport; Fri, 26 Feb 2021 22:52:38 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 3f5dd968-f159-4780-af23-08d8daa9375c X-MS-TrafficTypeDiagnostic: BL2NAM02HT201: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n1AWJApB1XgOZ79b3M0lkFS6kKzfd2TOBoPlIP3tKOMiL55mfdy/VF31vWAt75qrVbgruCB2sBEWlLzm5d12XfGSZmiLE6+LpQllOpAN4HJrD6mHvtLFC3pnQ1yU5Oofo5XUzbOkNfkVsk4EhIJKtU6f2XV6voGsqbPBY12/Mftm6VL2hxYLNUAkUzaeVP3HZCcLXIVfCbkzv6OFtYaEVHRnP7cUXNLoAxQpzmq2mr1SbdlloJWkLhjSV81zfJFfY5WZG0xDJkxIWeco0dKNPBShsg6nA4iMtfcZiQTzqGm09f/rjjeT2Yg32jH1xXtdTEXcfsLtbxqavaid9xg1ks2xjOprddql7+Cp/pSvy0xAQZnQS/fP54EZJSbCUfQW+uNAR5M9fFr0G9W0aKReQA== X-MS-Exchange-AntiSpam-MessageData: lKZfMMBe/0sQhuIWxlbz4EFWQgY0/99xjWwlbhIYs1Pt3+efU8tPEQDybLBvCDcTRljQu6zxP6BlGVr651n9meRBHVvNXBwnb7qpICnM3x53loErR4TSitaKVr1aAD0nDmo+f5qf7aIwmzn2oDqZtA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f5dd968-f159-4780-af23-08d8daa9375c X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2021 22:52:38.8569 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: BL2NAM02FT003.eop-nam02.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: BL2NAM02HT201 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain This changes added usage of MmUnblockMemoryLib 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 Reviewed-by: Jiewen Yao --- Notes: v3: - Added review-by tag. [Jiewen] - Remove Dxe prefix to match interface update. [Jiewen] =20 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 9d6bc09bdc0d..db2e56b6122c 100644 --- a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c +++ b/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c @@ -38,6 +38,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include =20 // // Physical Presence Interface Version supported by Platform @@ -147,6 +148,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 MmUnblockMemoryRequest (MemoryAddress, EFI_SIZE_TO_PAGES = (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..c36b131b5aa5 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 + MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibN= ull.inf =20 [LibraryClasses.ARM] # diff --git a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf b/SecurityPkg/Tcg/Tcg2Ac= pi/Tcg2Acpi.inf index 42ddb4bd1f39..f1c6ae5b1cb4 100644 --- a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf +++ b/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf @@ -57,6 +57,7 @@ [LibraryClasses] Tpm2CommandLib Tcg2PhysicalPresenceLib PcdLib + MmUnblockMemoryLib =20 [Guids] gEfiTpmDeviceInstanceTpm20DtpmGuid ## PRODUCE= S ## GUID # TPM device identifier --=20 2.30.0.windows.1