From nobody Sat Apr 27 02:09:56 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+64816+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+64816+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1598855964; cv=none; d=zohomail.com; s=zohoarc; b=g3ZAzW24Wj22G4hMNmCO65bLYXfciYQGfq15dgi/0I5MIDP7ZPZ3g27M0CPofNDzH9V3dkpFmsgJV5qFqf2L1ZCLctReYjF0nTlzyIL6cLo1R4W75f76FpP2x2fyQ8mzv8+jRQTvjaYiHI1jxjdvVyaD3xmv05qOcywAobhgTlA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598855964; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=HTC9hmSlsViyfM+CWUEXLjeJuyqFzhq+uII4v3QhEN0=; b=hV7PNzKrfxUWLTudnmjs3qNRdqUTFIssOiaf4peL1RZs7RT0Fp+mB+EssgkRo0NiM8eGA7sTK50k9y0WSzO8Tzxu1ehYipHw9UXdaYvzAaVG6qLTC7p7yVhZEm51zHDaoDbc+yVT6YNzl36e1ydr0pvgP8jSrCpnnvrDxnMSm44= 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+64816+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 1598855964041564.7231359361656; Sun, 30 Aug 2020 23:39:24 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 0RNNYY1788612xSFgvRaUJWs; Sun, 30 Aug 2020 23:39:23 -0700 X-Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.47945.1598855961350389633 for ; Sun, 30 Aug 2020 23:39:21 -0700 IronPort-SDR: NweFSiuHzaLGY7QqtK81FE0HF79qz1O/m7APlJrKPwPBJ/k5jETQz6UwX7AyjzHw3SaGPQ6ZJb af3nfLR4iwVw== X-IronPort-AV: E=McAfee;i="6000,8403,9729"; a="174966597" X-IronPort-AV: E=Sophos;i="5.76,374,1592895600"; d="scan'208";a="174966597" 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; 30 Aug 2020 23:39:21 -0700 IronPort-SDR: Ek5mNTYC0rdvV/8pmhsw/gqq9YIpPMDVoEOjdLuqrnVaiXxN80F/dPK3b4A0NVTuQCrvm8KoEq G9XhBT9IYmpA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,374,1592895600"; d="scan'208";a="330596418" X-Received: from swei22-mobl1.ccr.corp.intel.com ([10.238.1.18]) by orsmga008.jf.intel.com with ESMTP; 30 Aug 2020 23:39:19 -0700 From: "Sheng Wei" To: devel@edk2.groups.io Cc: Ray Ni , Rangasai V Chaganty Subject: [edk2-devel] [PATCH v3 1/3] IntelSiliconPkg/VtdInfo: Add Null Root Entry Table PPI Date: Mon, 31 Aug 2020 14:38:02 +0800 Message-Id: <20200831063804.8208-2-w.sheng@intel.com> In-Reply-To: <20200831063804.8208-1-w.sheng@intel.com> References: <20200831063804.8208-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: 4BZiEoBxnc5wvecjG1iTX3dKx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1598855963; bh=V00wtwGuvP6HSEGb0hKSiJAJEufI8Yk/FoFEfssOnLM=; h=Cc:Date:From:Reply-To:Subject:To; b=HlFGVc/DiahcyRVB3L3lolAtnXzBtNHT1qzLjauphJwldzkpW1Ord9OEVCE+2gzeMht pNhkCQD0AL9cXVwiFbymLKOhoUhkoHjqiQaKqLmK6OqkNSMajt064yGW6jnLKE/55oQI1 NQ0LjT980S3TBjicOFXFBorMIwrc8XGZqbU= 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 Reviewed-by: Ray Ni Reviewed-by: Sai Chaganty --- .../Include/Ppi/VtdNullRootEntryTable.h | 28 ++++++++++++++++++= ++++ Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec | 1 + 2 files changed, 29 insertions(+) create mode 100644 Silicon/Intel/IntelSiliconPkg/Include/Ppi/VtdNullRootEn= tryTable.h diff --git a/Silicon/Intel/IntelSiliconPkg/Include/Ppi/VtdNullRootEntryTabl= e.h b/Silicon/Intel/IntelSiliconPkg/Include/Ppi/VtdNullRootEntryTable.h new file mode 100644 index 00000000..d79b5fd9 --- /dev/null +++ b/Silicon/Intel/IntelSiliconPkg/Include/Ppi/VtdNullRootEntryTable.h @@ -0,0 +1,28 @@ +/** @file + The definition for VTD Null Root Entry Table PPI. + + This is a lightweight VTd null root entry table report in PEI phase. + + Copyright (c) 2020, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __VTD_NULL_ROOT_ENTRY_TABLE_PPI_H__ +#define __VTD_NULL_ROOT_ENTRY_TABLE_PPI_H__ + +#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 + 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 (#64816): https://edk2.groups.io/g/devel/message/64816 Mute This Topic: https://groups.io/mt/76529333/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 02:09:56 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+64817+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+64817+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1598855964; cv=none; d=zohomail.com; s=zohoarc; b=UGYJqw+BBIB8aIErnUdjQhFMZEBhwM8bl/c3ASCltHf4BPXnuo6o7artqg10MFub3m+xcNiHuXdPckyUPsjYObE2Tz+RUudY0pQ+2lhRsd1Qa5nStt0zl7a0w1WcubeZ1EczC94DpGPa8HS26PNUrEgese8UN0B2pHaf0HgRT5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598855964; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=6J15rIGdh+nrqrNqp16ALlfJnZujFQ9FnP70FfbWlDU=; b=VXniR6vAXOP4dmOnK9umXkDjDDOHuKTtvs/hfCjbBTrX9IYbqslCLS9U9TH3QeNHFgbFzl0kX+vJz6NdEK7Pk0fZuPOlk//2AQpM/NRzWKy9FPRIfJuqT627wmba3Fibt5cSuXIvgbZoL4EmtgqZjpOKJTffiVQ+fKNf3XsjoOQ= 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+64817+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 1598855964532103.24957906378745; Sun, 30 Aug 2020 23:39:24 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ppvbYY1788612x54B7KytnF1; Sun, 30 Aug 2020 23:39:24 -0700 X-Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web10.48252.1598855963030649264 for ; Sun, 30 Aug 2020 23:39:23 -0700 IronPort-SDR: KsTpRM+D+h+qrEpQim/KrukMz28oVaw9OGesYdMaxH+0ZhQT3Z8sWXf9CQtH9n9tbsHmNPSgik IIedKP5KXrZw== X-IronPort-AV: E=McAfee;i="6000,8403,9729"; a="174966603" X-IronPort-AV: E=Sophos;i="5.76,374,1592895600"; d="scan'208";a="174966603" 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; 30 Aug 2020 23:39:22 -0700 IronPort-SDR: NJVPyVj6PTMXmCGBI4gW5lBLlTul0iB8QhyZGGjb3mkwQNLx7qFrfXUmkqJ1mwEC6Mk6FbPsw4 dKNhS1Puq0Fw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,374,1592895600"; d="scan'208";a="330596433" X-Received: from swei22-mobl1.ccr.corp.intel.com ([10.238.1.18]) by orsmga008.jf.intel.com with ESMTP; 30 Aug 2020 23:39:21 -0700 From: "Sheng Wei" To: devel@edk2.groups.io Cc: Ray Ni , Rangasai V Chaganty Subject: [edk2-devel] [PATCH v3 2/3] IntelSiliconPkg/IntelVTdPmrPei: Fix PMR enabling setting confilct Date: Mon, 31 Aug 2020 14:38:03 +0800 Message-Id: <20200831063804.8208-3-w.sheng@intel.com> In-Reply-To: <20200831063804.8208-1-w.sheng@intel.com> References: <20200831063804.8208-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: 3fQDLxrxqQLmjP9x5A7u9ZZex1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1598855964; bh=fgv0SxnbcSo43yXGpNcKm8TaSU5B8tb4hyBehybOpOA=; h=Cc:Date:From:Reply-To:Subject:To; b=xOYS8usPjQauCm4UvlXfwdhWt3Ou5r3AfeMCpZKaDAKCULYHT6JypLdfR+Tu7UCOayh oxxMk/M5y2w3QzAxw6KuEwUVG/GS0Bv3KNOE+hUuzzgIXGBaA0WCyqu04Cjj0g1kg+1Yg 4plUWH8V8RlKK4AKDtNyEkuTAJfTUhkHjo8= 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 Reviewed-by: Ray Ni Reviewed-by: Sai Chaganty --- .../Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.c | 14 +++++++ .../Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.h | 15 +++++++ .../Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf | 1 + .../Feature/VTd/IntelVTdPmrPei/VtdReg.c | 47 ++++++++++++++++++= ++++ 4 files changed, 77 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..2e252fe5 100644 --- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/VtdReg.c +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/VtdReg.c @@ -13,8 +13,10 @@ #include #include #include +#include #include #include +#include =20 #include "IntelVTdPmrPei.h" =20 @@ -246,6 +248,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", *RootEntryTable)); + + 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 (#64817): https://edk2.groups.io/g/devel/message/64817 Mute This Topic: https://groups.io/mt/76529334/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 02:09:56 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+64818+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+64818+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1598855966; cv=none; d=zohomail.com; s=zohoarc; b=X3RJdI0JKOFoBoHWJLqpD9ES7o08Yd4tICG0aUtaZiwrtabzMcU/i852hVZE3FzOttR4xidqoyPNccBjbfwc/MTfq6oeQqbvox+W/8jsY2JoNiYrG4Jb8mnUIamkXSeLFBesEpZ4OVlTyU/1r6w+BRJxvu4Vwoior2+xLPlOMXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598855966; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=KIXIteu/sTOtI515gkrSw20lLfcinnIiPKgsKmYmpJg=; b=f0EdCShphDMNTygFKui65jEsHf/rjijWC96gRJ5s8bEgb2cfuCRem30e/0ckX+gCeMnOcLJ+kjmXQraZJBbhlTMdFFuX00E2mx60StRw0yP6Q941djpinJRccOErsHZbq3uLlCD5BPxv+C5kVQKm0QguX2PPpmc/pVvd3TL80MU= 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+64818+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 159885596639779.27964530631436; Sun, 30 Aug 2020 23:39:26 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id jqFpYY1788612xdGY4kVybu2; Sun, 30 Aug 2020 23:39:25 -0700 X-Received: from mga01.intel.com (mga01.intel.com []) by mx.groups.io with SMTP id smtpd.web10.48252.1598855963030649264 for ; Sun, 30 Aug 2020 23:39:24 -0700 IronPort-SDR: Wumc4vZxy/pVenOBMOd996MdkZCxvCxmncGNpLRSIs8cHmoNEh+Ni3mw/7oYG/lWZwSo+TQhal g3deiX9LlmCA== X-IronPort-AV: E=McAfee;i="6000,8403,9729"; a="174966614" X-IronPort-AV: E=Sophos;i="5.76,374,1592895600"; d="scan'208";a="174966614" 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; 30 Aug 2020 23:39:24 -0700 IronPort-SDR: S8NB0S+ONh3P90GE3SJsA4ogGQpvv/4EU1KMprKdNbVLmf6GscyTcXacegymxmrPufwOXv+ARm gwN5TWvk2Jrw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,374,1592895600"; d="scan'208";a="330596445" X-Received: from swei22-mobl1.ccr.corp.intel.com ([10.238.1.18]) by orsmga008.jf.intel.com with ESMTP; 30 Aug 2020 23:39:23 -0700 From: "Sheng Wei" To: devel@edk2.groups.io Cc: Ray Ni , Rangasai V Chaganty Subject: [edk2-devel] [PATCH v3 3/3] IntelSiliconPkg/PlatformVTdInfoSamplePei: Install Null Root Entry Table Date: Mon, 31 Aug 2020 14:38:04 +0800 Message-Id: <20200831063804.8208-4-w.sheng@intel.com> In-Reply-To: <20200831063804.8208-1-w.sheng@intel.com> References: <20200831063804.8208-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: dz6kcq29UbP1Q6bPuiI7aN9Bx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1598855965; bh=Gw5hvF8bE3tqIpiy5oAov7PKBobYE88uNu/A79MXmCA=; h=Cc:Date:From:Reply-To:Subject:To; b=Om1YxJI/JooG9eO0rHCgn4uuQxgs0Al9NMX4KISRG0zmuE2m2nQhgKwNmBkOiMOamlZ H0kjO7Zg0/KpItBETy+OftyzKFnabCmLzJTbBobfoTWFdQNR2DgpSkEWt/ie1LiWMzqDm YoDYMuBoeePl/oaAdy2Sq6mMnP78UZFm6Oo= 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 Reviewed-by: Ray Ni Reviewed-by: Sai Chaganty --- .../PlatformVTdInfoSamplePei/PlatformVTdInfoSamplePei.c | 16 ++++++++++++= ++++ .../PlatformVTdInfoSamplePei.inf | 3 ++- 2 files changed, 18 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..616a96ce 100644 --- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSamplePei/Pl= atformVTdInfoSamplePei.c +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSamplePei/Pl= atformVTdInfoSamplePei.c @@ -9,6 +9,7 @@ #include =20 #include +#include =20 #include #include @@ -164,6 +165,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 +354,12 @@ PlatformVTdInfoSampleInitialize ( if (!EFI_ERROR(Status)) { SiliconInitialized =3D TRUE; } + + Status =3D PeiServicesInstallPpi (&mPlatformNullRootEntryTableDesc); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (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 (#64818): https://edk2.groups.io/g/devel/message/64818 Mute This Topic: https://groups.io/mt/76529335/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-