From nobody Sat Apr 27 23:35:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+64604+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+64604+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1598340637; cv=none; d=zohomail.com; s=zohoarc; b=gEznopHvAGl6PA1YV0uQk0Z1Xvjpp3gdO8nPoudK8g9MbZLjSI5GyMfxM5hpp8sv/gSlkF/+uUVQJP2CYnN/SND4mD+DZ8nSWuwoe0x7sOXksiKjNP68gWXGvFju5aQd9k3EX7Q2NVr/hA9IQTGlYm0BWM61E9Ig1hoBXAoSbg8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598340637; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=vJfSlSHLsKCIq1BC1IXAQwlJhncXD9y0yKHCtJF0eBo=; b=XYOde/CKe3zdSlVuN92t5xnbKAwvr7Th/Knh454W5YEXZ7Lq/1RdBwnTPBaJpNdhRULEcz3FiDvVzimAAt4kFRgbMyVZjqbuQn/et4jFe6sT5TQGGoYwAwpLtkGr5UTUUg8Qho8fpuWnF07UnEl6VvuniIN6peke2IkgF5Rrlr8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+64604+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1598340637930198.64057566565077; Tue, 25 Aug 2020 00:30:37 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 7smlYY1788612xK2zHPfxVjY; Tue, 25 Aug 2020 00:30:37 -0700 X-Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web12.8889.1598340636128887753 for ; Tue, 25 Aug 2020 00:30:36 -0700 IronPort-SDR: Qcb7ETSI3bYhi/ZldiqwU0K+QdDgbJyipiv7KtI3kjL7ICBJ+iUz4QCVG6X/TE9eHjYReCRxHh htA8tsA740vQ== X-IronPort-AV: E=McAfee;i="6000,8403,9723"; a="174099798" X-IronPort-AV: E=Sophos;i="5.76,351,1592895600"; d="scan'208";a="174099798" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2020 00:30:35 -0700 IronPort-SDR: I9x2K5cd59shxsu+C9kvNqr6n0cCiKHszmbV+k0c4LIBLPe+Fvs+n7I3H+sbcBtdGG9aFe8zAZ EDt/7tZ8714g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,351,1592895600"; d="scan'208";a="328774572" X-Received: from swei22-mobl1.ccr.corp.intel.com ([10.238.1.18]) by orsmga008.jf.intel.com with ESMTP; 25 Aug 2020 00:30:34 -0700 From: "Sheng Wei" To: devel@edk2.groups.io Cc: Ray Ni , Rangasai V Chaganty Subject: [edk2-devel] [PATCH v2 1/3] IntelSiliconPkg/VtdInfo: Add Null Root Entry Table PPI Date: Tue, 25 Aug 2020 15:27:58 +0800 Message-Id: <20200825072800.3288-2-w.sheng@intel.com> In-Reply-To: <20200825072800.3288-1-w.sheng@intel.com> References: <20200825072800.3288-1-w.sheng@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,w.sheng@intel.com X-Gm-Message-State: 8zk6PHVjOIJRYZc01s6VSf8Rx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1598340637; bh=qvPbTfvMLXXiChE6WEw5O3mlPvglIWeFPR7KR3JlRm0=; h=Cc:Date:From:Reply-To:Subject:To; b=oGB3pLl3UOkmqXTj8Da+QAXPe3PjcTNzA7EaVlG6qZ0dQ1K6Yx6Mzru6fw8ntyD6YRN RBpyNCyRkBztjXKNyS1agVL4SPFjRl7HwFWSYNfWKyoZ8rwXlHh84GDLA6xUBLHa2Ub7j 9aVkyX6bNydw0QdNLuxb7L9rnOjh3QqQutk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Null root entry table address is a fixed silicon reserved address, which is used to block the DMA transfer. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2867 Change-Id: I3aa2b2e7a11e0327857c6ed9bc92cd209d3ade9d Cc: Ray Ni Cc: Rangasai V Chaganty Signed-off-by: Sheng Wei --- Silicon/Intel/IntelSiliconPkg/Include/Ppi/VtdInfo.h | 13 +++++++++++++ Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec | 1 + 2 files changed, 14 insertions(+) diff --git a/Silicon/Intel/IntelSiliconPkg/Include/Ppi/VtdInfo.h b/Silicon/= Intel/IntelSiliconPkg/Include/Ppi/VtdInfo.h index f91dbc03..7d638b4f 100644 --- a/Silicon/Intel/IntelSiliconPkg/Include/Ppi/VtdInfo.h +++ b/Silicon/Intel/IntelSiliconPkg/Include/Ppi/VtdInfo.h @@ -33,5 +33,18 @@ typedef EFI_ACPI_DMAR_HEADER EDKII_VTD_INFO_PPI; =20 extern EFI_GUID gEdkiiVTdInfoPpiGuid; =20 +#define EDKII_VTD_NULL_ROOT_ENTRY_TABLE_PPI_GUID \ + { \ + 0x3de0593f, 0x6e3e, 0x4542, { 0xa1, 0xcb, 0xcb, 0xb2, 0xdb, 0xeb, 0x= d8, 0xff } \ + } + +// +// Null root entry table address is a fixed silicon reserved address, +// which is used to block the DMA transfer. +// +typedef UINT64 EDKII_VTD_NULL_ROOT_ENTRY_TABLE_PPI; + +extern EFI_GUID gEdkiiVTdNullRootEntryTableGuid; + #endif =20 diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec b/Silicon/In= tel/IntelSiliconPkg/IntelSiliconPkg.dec index e4a7fec3..284820af 100644 --- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec +++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec @@ -68,6 +68,7 @@ =20 [Ppis] gEdkiiVTdInfoPpiGuid =3D { 0x8a59fcb3, 0xf191, 0x400c, { 0x97, 0x67, 0x6= 7, 0xaf, 0x2b, 0x25, 0x68, 0x4a } } + gEdkiiVTdNullRootEntryTableGuid =3D { 0x3de0593f, 0x6e3e, 0x4542, { 0xa1= , 0xcb, 0xcb, 0xb2, 0xdb, 0xeb, 0xd8, 0xff } } =20 [Protocols] gEdkiiPlatformVTdPolicyProtocolGuid =3D { 0x3d17e448, 0x466, 0x4e20, { 0= x99, 0x9f, 0xb2, 0xe1, 0x34, 0x88, 0xee, 0x22 }} --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#64604): https://edk2.groups.io/g/devel/message/64604 Mute This Topic: https://groups.io/mt/76402531/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat Apr 27 23:35:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+64605+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+64605+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1598340638; cv=none; d=zohomail.com; s=zohoarc; b=UFfsKpAVxIzYS6d73Mbd7PrZ9bLFFrKFOCchacFwEUbEfMUgv9TjGtZLwFNJIlJqSLPWpRXfgNPUHhhWrzalYPPoQlrjEg1xy4ByWXlQtuCKvz+jf8TuTth+uDfYEbpxewZLdWkmxl6ldEdK4csla+qvMrh047tQRnj6BRYrPvI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598340638; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=DOIxn1aARPb6k/SeWRH77v9cpV6R8EUKAYBma3xqmS8=; b=e1To5tXSEJEjaPSt6wEvYBc+O6CTdXqWMZJQT6r1aD0vw5LcHoJPCgMohKWO5LT1doi1xY+sMTyz8fHSdX5acUpFRJzT6o/sNjlC+9iJqTtaWr8Z82pdwTOagzvVHXCLn7dHoAH9XRGQ5cWzbGKvfEzT88AWg8oWXlG5xrls124= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+64605+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 159834063843161.613825282367316; Tue, 25 Aug 2020 00:30:38 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id yPtgYY1788612xJwlbqWHuPS; Tue, 25 Aug 2020 00:30:38 -0700 X-Received: from mga01.intel.com (mga01.intel.com []) by mx.groups.io with SMTP id smtpd.web12.8889.1598340636128887753 for ; Tue, 25 Aug 2020 00:30:37 -0700 IronPort-SDR: /B2r/EisInwmCuPQ62FS+2OFqazBLGnJ3CJqMG+v9dX6RLi1Y/MWq21axUGrML/ogbqepS286T CVn3W8F6ozBg== X-IronPort-AV: E=McAfee;i="6000,8403,9723"; a="174099803" X-IronPort-AV: E=Sophos;i="5.76,351,1592895600"; d="scan'208";a="174099803" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2020 00:30:36 -0700 IronPort-SDR: u57CcaRP4AneO1Y29r7fQoQISuMTW1wPUvjZ+41fq4ed3QGUBpHGzD1kW/LZ9AnFR35OJh1VmZ aQ+3P2N78g6w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,351,1592895600"; d="scan'208";a="328774579" X-Received: from swei22-mobl1.ccr.corp.intel.com ([10.238.1.18]) by orsmga008.jf.intel.com with ESMTP; 25 Aug 2020 00:30:35 -0700 From: "Sheng Wei" To: devel@edk2.groups.io Cc: Ray Ni , Rangasai V Chaganty Subject: [edk2-devel] [PATCH v2 2/3] IntelSiliconPkg/IntelVTdPmrPei: Fix PMR enabling setting confilct Date: Tue, 25 Aug 2020 15:27:59 +0800 Message-Id: <20200825072800.3288-3-w.sheng@intel.com> In-Reply-To: <20200825072800.3288-1-w.sheng@intel.com> References: <20200825072800.3288-1-w.sheng@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,w.sheng@intel.com X-Gm-Message-State: V784UXjd8jpWekUhrM58JWTZx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1598340638; bh=BcrZJqqjsvklWBWGmnDUiY0rh3tKrqGQeCXZgRDgESw=; h=Cc:Date:From:Reply-To:Subject:To; b=lMzhFEoTCODMuk1oDV60T3bsRNioioJEflYgqiJCerpH7CzzpT1+xjQ0GtIPh8Y8QqD 1TwweHME0zxYb2Zda27BlZbD/P2OtQvByZQdim+3w+JWzBjJGlGTbOzew3nq6PeDVsF5l fOdTzD0POANt2WpuAkpfi0LemmCIPUZ/Osc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" PMR enabling set by pre-boot DMA protection is cleared by RC when boot guard is enabled. Pre-boot DMA protection should only reset VT-d BAR when it is 0 and reset PMR region when it is not programmed to protect all memory address. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2867 Change-Id: Ic5370f474a43a94903871782ace5cce186b4ddc0 Cc: Ray Ni Cc: Rangasai V Chaganty Signed-off-by: Sheng Wei --- .../Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.c | 14 +++++++ .../Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.h | 15 +++++++ .../Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf | 1 + .../Feature/VTd/IntelVTdPmrPei/VtdReg.c | 46 ++++++++++++++++++= ++++ 4 files changed, 76 insertions(+) diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/Intel= VTdPmrPei.c b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/Inte= lVTdPmrPei.c index ea944aa4..31a14f28 100644 --- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrP= ei.c +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrP= ei.c @@ -745,7 +745,21 @@ VTdInfoNotify ( // Protect all system memory // InitVTdInfo (); + + Hob =3D GetFirstGuidHob (&mVTdInfoGuid); + VTdInfo =3D GET_GUID_HOB_DATA(Hob); + + // + // NOTE: We need check if PMR is enabled or not. + // + EnabledEngineMask =3D GetDmaProtectionEnabledEngineMask (VTdInfo, VTdI= nfo->EngineMask); + if (EnabledEngineMask !=3D 0) { + Status =3D PreMemoryEnableVTdTranslationProtection (VTdInfo, Enabled= EngineMask); + } InitVTdPmrForAll (); + if (((EnabledEngineMask !=3D 0) && (!EFI_ERROR (Status)))) { + DisableVTdTranslationProtection (VTdInfo, EnabledEngineMask); + } =20 // // Install PPI. diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/Intel= VTdPmrPei.h b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/Inte= lVTdPmrPei.h index 58e6afad..ffed2c5b 100644 --- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrP= ei.h +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrP= ei.h @@ -97,6 +97,21 @@ GetHighMemoryAlignment ( IN UINT64 EngineMask ); =20 +/** + Enable VTd translation table protection in pre-memory phase. + + @param VTdInfo The VTd engine context information. + @param EngineMask The mask of the VTd engine to be accessed. + + @retval EFI_SUCCESS DMAR translation protection is enabled. + @retval EFI_UNSUPPORTED Null Root Entry Table is not supported. +**/ +EFI_STATUS +PreMemoryEnableVTdTranslationProtection ( + IN VTD_INFO *VTdInfo, + IN UINT64 EngineMask + ); + /** Enable VTd translation table protection. =20 diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/Intel= VTdPmrPei.inf b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/In= telVTdPmrPei.inf index 3eb2b510..1e613ddd 100644 --- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrP= ei.inf +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrP= ei.inf @@ -48,6 +48,7 @@ gEdkiiVTdInfoPpiGuid ## CONSUMES gEfiPeiMemoryDiscoveredPpiGuid ## CONSUMES gEfiEndOfPeiSignalPpiGuid ## CONSUMES + gEdkiiVTdNullRootEntryTableGuid ## PRODUCES =20 [Pcd] gIntelSiliconPkgTokenSpaceGuid.PcdVTdPolicyPropertyMask ## CONSUMES diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/VtdRe= g.c b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/VtdReg.c index c9669426..de76e44f 100644 --- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/VtdReg.c +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/VtdReg.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include =20 @@ -246,6 +247,51 @@ DisableDmar ( return EFI_SUCCESS; } =20 +/** + Enable VTd translation table protection in pre-memory phase. + + @param VTdInfo The VTd engine context information. + @param EngineMask The mask of the VTd engine to be accessed. + + @retval EFI_SUCCESS DMAR translation protection is enabled. + @retval EFI_UNSUPPORTED Null Root Entry Table is not supported. +**/ +EFI_STATUS +PreMemoryEnableVTdTranslationProtection ( + IN VTD_INFO *VTdInfo, + IN UINT64 EngineMask + ) +{ + EFI_STATUS Status; + UINTN Index; + EDKII_VTD_NULL_ROOT_ENTRY_TABLE_PPI *RootEntryTable; + + DEBUG ((DEBUG_INFO, "PreMemoryEnableVTdTranslationProtection - 0x%lx\n",= EngineMask)); + + Status =3D PeiServicesLocatePpi ( + &gEdkiiVTdNullRootEntryTableGuid, + 0, + NULL, + (VOID **)&RootEntryTable + ); + + if (EFI_ERROR(Status)) { + DEBUG((DEBUG_ERROR, "Locate NullRootEntryTable Ppi : %r\n", Status)); + return EFI_UNSUPPORTED; + } + + DEBUG ((DEBUG_INFO, "NullRootEntryTable - 0x%lx\n", (UINT64)*RootEntryTa= ble)); + + for (Index =3D 0; Index < VTdInfo->VTdEngineCount; Index++) { + if ((EngineMask & LShiftU64(1, Index)) =3D=3D 0) { + continue; + } + EnableDmar ((UINTN)VTdInfo->VTdEngineAddress[Index], (UINTN)*RootEntry= Table); + } + + return EFI_SUCCESS; +} + /** Enable VTd translation table protection. =20 --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#64605): https://edk2.groups.io/g/devel/message/64605 Mute This Topic: https://groups.io/mt/76402532/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat Apr 27 23:35:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+64606+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+64606+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1598340640; cv=none; d=zohomail.com; s=zohoarc; b=h1UrOQ9Q1RSsxR8kO9TQbBh9lFwpXrNkb09fjghn3FeIoebSDYExjRVlV4TsvpUCKnpbNqZAgi4rG4KYEDcVvDRfvZeGzQVV70YRKOE86AtHYczX9Qr3kTfhX9tr6WWe6hjQfNKkw5qEV9xWrFJm5E2GnLhbxqe/R763oscWHj0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598340640; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=X+P2dhDUCOZdpJufn/OwbY/5XwyUmAK2Xx0Lp9oZLrc=; b=A5Qeeos1Lo54G+8p/gtOxOTNM7KjHWXWuP++WG8eva08Q0tYZIEFXdscGWu2eCVGFtXYfPHKI/6LM01Wl8TovXfnQsOHyA+ah9sILe3ew8dV0k/G6KxOJkYpG56Yd95TfNhKHgsGYebll1LocH7ICpqzzk0odkdL3H4msmhI0p8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+64606+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1598340640488345.44453349699245; Tue, 25 Aug 2020 00:30:40 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 9B1iYY1788612xPf97lDhhXX; Tue, 25 Aug 2020 00:30:40 -0700 X-Received: from mga01.intel.com (mga01.intel.com []) by mx.groups.io with SMTP id smtpd.web12.8889.1598340636128887753 for ; Tue, 25 Aug 2020 00:30:39 -0700 IronPort-SDR: Raj21UpkZDsQCY9UOLkNPmqgD/LSUpAZ23Usjd/I1VAcME7t5OwKAalj93mj/yBb/f7nrhSD+t 7NARCBhfD0Xw== X-IronPort-AV: E=McAfee;i="6000,8403,9723"; a="174099813" X-IronPort-AV: E=Sophos;i="5.76,351,1592895600"; d="scan'208";a="174099813" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2020 00:30:39 -0700 IronPort-SDR: kbB1+UPLy4TmxiWprMDUinHCXWc3CY/k+aOc8p1ezKyEGc0H0msKiPkvXAe6BHdymhZ4uSdT5X v7LgnrebfZug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,351,1592895600"; d="scan'208";a="328774596" X-Received: from swei22-mobl1.ccr.corp.intel.com ([10.238.1.18]) by orsmga008.jf.intel.com with ESMTP; 25 Aug 2020 00:30:36 -0700 From: "Sheng Wei" To: devel@edk2.groups.io Cc: Ray Ni , Rangasai V Chaganty Subject: [edk2-devel] [PATCH v2 3/3] IntelSiliconPkg/PlatformVTdInfoSamplePei: Install Null Root Entry Table Date: Tue, 25 Aug 2020 15:28:00 +0800 Message-Id: <20200825072800.3288-4-w.sheng@intel.com> In-Reply-To: <20200825072800.3288-1-w.sheng@intel.com> References: <20200825072800.3288-1-w.sheng@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,w.sheng@intel.com X-Gm-Message-State: ivObZqdTTaqlUF9rtDVHDOAox1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1598340640; bh=s4q381zPQhOo1cE5QdgWNTuWGg/8IwaaNZRq7le5wtc=; h=Cc:Date:From:Reply-To:Subject:To; b=Cy/O0y88buh/ZoNzss4/wPMRQqU6qmfEx1BIn5s2Wf3UN7J3CWhIkVFSwl9SFAEhnuY gQrThAYRB98Gf+pyLZIAbsoGUFVc4EyfjYr0rsMelDPr0dankfTd/3D4tjzvN62J0KvrM d46fNZFv9Gjetc3xbYLsB8YPgOPF9wsXphE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" BIOS uses TE with a null root entry table to block VT-d engine access to block any DMA traffic in pre-memory phase. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2867 Change-Id: I6c086c1f26e60f781de79cc37677cc5717c5edec Cc: Ray Ni Cc: Rangasai V Chaganty Signed-off-by: Sheng Wei --- .../PlatformVTdInfoSamplePei/PlatformVTdInfoSamplePei.c | 15 +++++++++++= ++++ .../PlatformVTdInfoSamplePei/PlatformVTdInfoSamplePei.inf | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSampl= ePei/PlatformVTdInfoSamplePei.c b/Silicon/Intel/IntelSiliconPkg/Feature/VTd= /PlatformVTdInfoSamplePei/PlatformVTdInfoSamplePei.c index 6f6c14f7..465bc2a4 100644 --- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSamplePei/Pl= atformVTdInfoSamplePei.c +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSamplePei/Pl= atformVTdInfoSamplePei.c @@ -164,6 +164,15 @@ EFI_PEI_PPI_DESCRIPTOR mPlatformVTdNoIgdInfoSampleDesc= =3D { &mPlatformVTdNoIgdSample }; =20 +// BIOS uses TE with a null root entry table to block VT-d engine access t= o block any DMA traffic in pre-memory phase. +EDKII_VTD_NULL_ROOT_ENTRY_TABLE_PPI mNullRootEntryTable =3D 0xFED20000; + +EFI_PEI_PPI_DESCRIPTOR mPlatformNullRootEntryTableDesc =3D { + (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), + &gEdkiiVTdNullRootEntryTableGuid, + &mNullRootEntryTable +}; + /** Initialize VTd register. Initialize the VTd hardware unit which has INCLUDE_PCI_ALL set @@ -344,6 +353,12 @@ PlatformVTdInfoSampleInitialize ( if (!EFI_ERROR(Status)) { SiliconInitialized =3D TRUE; } + + Status =3D PeiServicesInstallPpi (&mPlatformNullRootEntryTableDesc); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR , "Failed to install the NullRootEntryTable ppi - = %r\n", Status)); + } + DEBUG ((DEBUG_INFO, "SiliconInitialized - %x\n", SiliconInitialized)); if (!SiliconInitialized) { Status =3D PeiServicesNotifyPpi (&mSiliconInitializedNotifyList); diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSampl= ePei/PlatformVTdInfoSamplePei.inf b/Silicon/Intel/IntelSiliconPkg/Feature/V= Td/PlatformVTdInfoSamplePei/PlatformVTdInfoSamplePei.inf index dacfdf5e..b35853b6 100644 --- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSamplePei/Pl= atformVTdInfoSamplePei.inf +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSamplePei/Pl= atformVTdInfoSamplePei.inf @@ -38,7 +38,8 @@ IoLib =20 [Ppis] - gEdkiiVTdInfoPpiGuid ## PRODUCES + gEdkiiVTdInfoPpiGuid ## PRODUCES + gEdkiiVTdNullRootEntryTableGuid ## PRODUCES =20 [Depex] gEfiPeiMasterBootModePpiGuid --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#64606): https://edk2.groups.io/g/devel/message/64606 Mute This Topic: https://groups.io/mt/76402533/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-