From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.92.40.43]) by mx.groups.io with SMTP id smtpd.web11.1514.1614715503805422626 for ; Tue, 02 Mar 2021 12:05:03 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=YTM+MqxB; spf=pass (domain: outlook.com, ip: 40.92.40.43, mailfrom: kun.q@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mhxFvPl3X5TGAQxL14J/RsAdAffRtGN3ab9Ke32znGYlBJCk5dqUUkoI1kOZVOBeAC9t82s8yPpVEvv3cqk6wz59geFJoCHygOHM6DRH7wCoVN41dsGzIPyUmOJkkmaAdjNQj7jLAWxUcI2vR0Ji8cQsM4G1VBrjfQq11DoHPoHZI2noZVFZ0SEXkFLqSf9oFsRSltkkKt2eswxAnTQMdxgJngj06ma84iigLRD6+XOsFondv1pdVUIjaYmagWHs8o9AJXW7A4dXct21aUE509oOpwfj49eVOApFH/99+iorzFfDWzMCVTWs6qIHjRPlB/eD5gYXLsHhKL4AF09V3Q== 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=/DDjq/jO8+iYEWJBOv+68TzKHY07RcdxUhnZ9qjpWu8=; b=n8TkpNxSKd8LMD+nVTfhUzHZQBAgKum6NgSdtW4WCddGAjILy/bkKkkCP15kXvKl2W4k9sknJnDtpd4y77+jJTIezZdFfx36SxfhvVd5ZpRzNJbkGmKuR/KGG3+dHqkByAeCP57KxnLZf0tFq4atMtj8TCgf/nVc5JMZud8lbbE1t0Vldb6MPQiEkIGa1x+2GNoVSSTzFh4epHw3fTPi6sr214y8wD/Ezo7vSSdYOmzH/k7PufQREMvMccqbJrJpaycs2AX4pZpG/n9344oDL/8ckwgmmlr7J8bnfJWvdXfBBn8oqYqbZSeLlYC3kjDZz0hHxE5+Gn4RrBbk9xbe/w== 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=/DDjq/jO8+iYEWJBOv+68TzKHY07RcdxUhnZ9qjpWu8=; b=YTM+MqxBngoayJXzPGbDwu31FuSgIyQfGkXc5yXPO3KfWxyIv231VXa8VJXLd+x7w+NcFcMaOFR1s1t4r/T7nijSZ75V/7py93PKozKlq1qGHCo8nOXp6zu6iNt1ao0tgtx9rUnNHiHEwLQu0laqVIBZkpU3plZGsrYfrh74DspfmcKsAjI2k7RBPfOA00C85mnoqZ3b99BjTTm2SD7106lbOxjA4FouETr3arNMEyVqNhVH0mocxPXKy4tSWmGvrIabRVWg+GYeJjbMiB7cFR7qRoxXkHJ0mcE0g+qvLloCtXj9sIQ7yR4AtTCqT/0kg3we7dMtdGJV81SKtFsglg== Received: from BN7NAM10FT040.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e8f::48) by BN7NAM10HT165.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e8f::409) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19; Tue, 2 Mar 2021 20:05:02 +0000 Received: from MWHPR06MB3102.namprd06.prod.outlook.com (2a01:111:e400:7e8f::49) by BN7NAM10FT040.mail.protection.outlook.com (2a01:111:e400:7e8f::238) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Tue, 2 Mar 2021 20:05:02 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:F1E92BCE78167CD80CA5E958701B500C74533E0A8E6CA5F97548148F81D4BF9D;UpperCasedChecksum:7B597FBD7918D6E36180C833206D36A6C4F2E75273465EF40263B0158426A332;SizeAsReceived:7550;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.3890.028; Tue, 2 Mar 2021 20:05:02 +0000 From: "Kun Qin" To: devel@edk2.groups.io CC: Jiewen Yao , Jian J Wang , Qi Zhang , Rahul Kumar , Jiewen Yao Subject: [PATCH v4 7/7] SecurityPkg: Tcg2Acpi: Added unblock memory interface for NVS region Date: Tue, 2 Mar 2021 12:04:38 -0800 Message-ID: X-Mailer: git-send-email 2.30.0.windows.1 In-Reply-To: <20210302200438.1901-1-kun.q@outlook.com> References: <20210302200438.1901-1-kun.q@outlook.com> X-TMN: [3c9GMA/IfyiHIyP6yljcVnkurAuFVUJO] X-ClientProxiedBy: MWHPR19CA0063.namprd19.prod.outlook.com (2603:10b6:300:94::25) To MWHPR06MB3102.namprd06.prod.outlook.com (2603:10b6:301:3e::35) Return-Path: kun.q@outlook.com X-Microsoft-Original-Message-ID: <20210302200438.1901-8-kun.q@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (50.35.88.161) by MWHPR19CA0063.namprd19.prod.outlook.com (2603:10b6:300:94::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Tue, 2 Mar 2021 20:04:59 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 4e204816-0d1d-4532-f192-08d8ddb67544 X-MS-TrafficTypeDiagnostic: BN7NAM10HT165: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bXUe7QYmHg20ITJjopbr8jGwFELA4NL/CZEf/X5h2q6uu/a31nWGQgUGiiqOe3CS2dhdzr28m4qZbW89oZti7KCfnx083zgg96Fq+x54F5TpCl1h3wLUaVAMfUGUr/eJpVIhxLhunOMxHfGyr2dszft1Upt22oJC0epRqkLO0u6ReXBsMalIriA2lLG8oJFVvNUpeD2opkFIp2MUwOtg2++nOPwPs1GkKQrcl3hnU/XzWgsp9WGLEB2KN7qoMR9USpJy1j0ztcoaDRODuIs0Z0Lz13RMILHYJ51YdfLGVk7KDdUbNEfUFamFbcdQKIZLidcxWXhUh21XjgZvSNHlOk2MaEb/kM3C0mP62oQySbDWRDLyA4A7rS8HWI3y63BhkxLkZmcyOV7LLBbBIr6hgA== X-MS-Exchange-AntiSpam-MessageData: PGJv1/LBKp/ni3xTJu6VRlHu8OTs45TXse7YDHXmZyHhC2Fb1xvRmj84MrM+qCuI9+Pj3RPo2oi3K61NLjqrysdDaGjaabX4mAwhsnoo6/sBft8BSBarGCBjARWb0poOxyMslTy41236DoYLO5VmyQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e204816-0d1d-4532-f192-08d8ddb67544 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2021 20:04:59.8171 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: BN7NAM10FT040.eop-nam10.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: BN7NAM10HT165 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: v4: - Previously reviewed, no change. =20 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 74ec42966273..a77665518bdd 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