From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web12.727.1614884403369891368 for ; Thu, 04 Mar 2021 11:00:03 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=IZjh7uz4; 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=IPspzGqTfPFc0uDn7UjJgPUk+UBO3WfQpTziM/s0cMZtn68e40PbFIopn2XzcISOX11IVmK8KMt5lFhYJjNd64AQFUmJGNhJyxmIqYaMu2FOoBVztWQuWC6LRlVvFCcY+kNS0OXOfl0HFTRp3RPEk3FHifObzdD3Zjx19GLCyPf1oYgFPZfrNDhtls+Rq1X1opeYeUVHKHZm7irRH0ZnOAf9A5cA0OmiHieQvx+cuEx8k8SBsgcfCJMBAiGByEc7Nmdreyr3e24kH9qZyQCcPdu+Umk8PZMZWpEy1hpP2QF5MZjURQ4u6moWv/tIDCRaWb8qPHH8EhpvOjFAjJ5ZXA== 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=SlAeg4dCdfJ9F54krnLZPX6iWNWSXrKKntLvUgVJmRk=; b=jybImh2letfb2/KKGuiElcyaVsy5OmWrHel/2o/6+3H/m6B0haja7s53UNHtKUEmGE3ZvDCtFL51fzZw/1CwtL32hlwDPO0LmUqm7xgafbvQirUn9lJBi1NnB4HitXdRAvTVGkBoUjYTAqyMhptAZIV+pZHHn4PuTQktC+zvRaHYL9qe358GtnFmT1FwkQXcfLjD+aFxj+lpBC4FNDwsnIBeTMEMnxs8kIm+SdGNLS38T6102iZyxhE+uyRpTXQfhv2n9mjzxUKwbH1i0gwYkjClq0NXElTpxsoZSxxsOr6v8onHMGrzRYa4J10IcF+awJZgQUAQPrL7jByRIzM0kQ== 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=SlAeg4dCdfJ9F54krnLZPX6iWNWSXrKKntLvUgVJmRk=; b=IZjh7uz42cQ5Jhmnov2UdDqYWNMrr5Aa7U4mQD0qXgSramSV1qx1Z/6uUpEAta++O6Qlqi9S457c+3iOkSqkgu6oJtsDhPpnbOxWtjhyhqzmcDpBjpXfry29CT3LE7ftdG3IvNcWvR0kHxJaQNapQupK1w6a9wcurZLxjBEAR0Lp5Qqi2iHpa/rzYh1aIB3xM+AQ6S7eAUxwOrW/WUG8s3cIr1rghslyfo27VPORDA1as64sidbYoQNz81DHlGuQZ0s3+L4TEnxOhot1WwH7BsrmdHhFZWqZJ6jIDRYsO65CxAxRByqHYd1P7ZbEzTh+P3d4CorygGRo5w0ZUSR8Lg== Received: from MW2NAM10FT057.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e87::44) by MW2NAM10HT003.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e87::277) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19; Thu, 4 Mar 2021 19:00:02 +0000 Received: from MWHPR06MB3102.namprd06.prod.outlook.com (2a01:111:e400:7e87::4c) by MW2NAM10FT057.mail.protection.outlook.com (2a01:111:e400:7e87::229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Thu, 4 Mar 2021 19:00:02 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:47E0115A4AB5B9A804ECDD1F5C375CDCA3D69A18B2404E79ACD4D6FB680E6964;UpperCasedChecksum:F50A3D16315D23A910E7F0F22DC064069BF7CC87B8B805A4D5A0BF0432EFBFF5;SizeAsReceived:7527;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; Thu, 4 Mar 2021 19:00:02 +0000 From: "Kun Qin" To: devel@edk2.groups.io CC: Jiewen Yao , Jian J Wang , Qi Zhang , Rahul Kumar , Jiewen Yao Subject: [PATCH v5 7/7] SecurityPkg: Tcg2Acpi: Added unblock memory interface for NVS region Date: Thu, 4 Mar 2021 10:59:44 -0800 Message-ID: X-Mailer: git-send-email 2.30.0.windows.1 In-Reply-To: <20210304185944.1716-1-kun.q@outlook.com> References: <20210304185944.1716-1-kun.q@outlook.com> X-TMN: [NAGN++heNtPX0wIHcTx6E7YNVQiJiOZg] X-ClientProxiedBy: CO2PR05CA0054.namprd05.prod.outlook.com (2603:10b6:102:2::22) To MWHPR06MB3102.namprd06.prod.outlook.com (2603:10b6:301:3e::35) Return-Path: kun.q@outlook.com X-Microsoft-Original-Message-ID: <20210304185944.1716-6-kun.q@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (50.35.88.161) by CO2PR05CA0054.namprd05.prod.outlook.com (2603:10b6:102:2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.16 via Frontend Transport; Thu, 4 Mar 2021 19:00:01 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: a57931e2-d3c2-4604-8d04-08d8df3fb6f8 X-MS-TrafficTypeDiagnostic: MW2NAM10HT003: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T3tiEsJdoHf+firMrMaH/HZ8wwj1Gkj+X6em4A4oUIy4cWN6DdVuN5BTniGLif0I+wcDDcizkDwdAfUqxJyhI3zCN4WWvR9xr6Ios7LnF+DedrcG//CWdUJH2ln84OX0eXiC4QNewU2TET/CxOPNhHVwg/0+9l0C+lsEG9VH26YdofYjvyIOiN1ANp9uad+g7eIoASopxOqhHypaufVUl9OmsIBSwwQEwJB9BRR3O/zTlhWGq5ewFbBZDS+qwrO985gncBAGdgyz+Ws6FF5TlFObT/WvUtPrM198HvdLvyonyWFhTnHpKgozNMVLhPVhd4+gaYwUUyHzoFUqAzCk2OwVZADi0GkfNNQgLpwWerw/SGHedFk9igIikxUOUNaJS+0Gy51bnCk/P00W3FZg+A== X-MS-Exchange-AntiSpam-MessageData: EkNMbtZdQZuvYGToz/qrnSY/GzuYABOCHPa/CbFFntvUVNVP7/idK2Fo0zvcO2QsLeydqKzGeKquMlcygjB3TDd4bNKNQHBakmpXrw+H67i4MEimobX2RbKhkSvThHEjDZ2iaoulvej7Bkrrs4rz9A== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a57931e2-d3c2-4604-8d04-08d8df3fb6f8 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Mar 2021 19:00:02.0799 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: MW2NAM10FT057.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: MW2NAM10HT003 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: v5: - Previously reviewed, no change. =20 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