[edk2-devel] [PATCH] IntelSiliconPkg/VTd: Add PCD for VTd Abort DMA Mode Support

Sheng Wei posted 1 patch 1 week, 5 days ago
Failed in applying to current master (apply log)
.../Feature/VTd/IntelVTdDmarPei/IntelVTdDmar.c             | 7 +++++--
.../Feature/VTd/IntelVTdDmarPei/IntelVTdDmarPei.inf        | 3 ++-
Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec          | 6 ++++++
3 files changed, 13 insertions(+), 3 deletions(-)
[edk2-devel] [PATCH] IntelSiliconPkg/VTd: Add PCD for VTd Abort DMA Mode Support
Posted by Sheng Wei 1 week, 5 days ago
PcdVTdSupportAbortDmaMode is used to enable/disable VTd Abort DMA Mode.

Signed-off-by: Sheng Wei <w.sheng@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
Cc: Jenny Huang <jenny.huang@intel.com>
Cc: Robert Kowalewski <robert.kowalewski@intel.com>

---
 .../Feature/VTd/IntelVTdDmarPei/IntelVTdDmar.c             | 7 +++++--
 .../Feature/VTd/IntelVTdDmarPei/IntelVTdDmarPei.inf        | 3 ++-
 Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec          | 6 ++++++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/IntelVTdDmar.c b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/IntelVTdDmar.c
index b4c44d87..18c22316 100644
--- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/IntelVTdDmar.c
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/IntelVTdDmar.c
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -570,10 +570,12 @@ EnableVTdTranslationProtectionBlockDma (
 
   DEBUG ((DEBUG_INFO, "EnableVTdTranslationProtectionBlockDma - 0x%08x\n", VtdUnitBaseAddress));
 
+  DEBUG ((DEBUG_INFO, "PcdVTdSupportAbortDmaMode : %d\n", FeaturePcdGet (PcdVTdSupportAbortDmaMode)));
+
   ECapReg.Uint64 = MmioRead64 (VtdUnitBaseAddress + R_ECAP_REG);
   DEBUG ((DEBUG_INFO, "ECapReg : 0%016lx\n", ECapReg.Uint64));
 
-  if (ECapReg.Bits.ADMS == 1) {
+  if ((ECapReg.Bits.ADMS == 1) && FeaturePcdGet (PcdVTdSupportAbortDmaMode)) {
     //
     // Use Abort DMA Mode
     //
@@ -594,6 +596,7 @@ EnableVTdTranslationProtectionBlockDma (
       ASSERT (FALSE);
       return EFI_DEVICE_ERROR;
     }
+    DEBUG ((DEBUG_INFO, "Block All DMA by TE.\n"));
     Status = EnableDmarPreMem (VtdUnitBaseAddress, (UINT64) (*RootEntryTable));
   }
 
diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/IntelVTdDmarPei.inf b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/IntelVTdDmarPei.inf
index b97ff900..473665e9 100644
--- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/IntelVTdDmarPei.inf
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/IntelVTdDmarPei.inf
@@ -4,7 +4,7 @@
 # This driver initializes VTd engine based upon EDKII_VTD_INFO_PPI
 # and provide DMA protection in PEI.
 #
-# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -55,6 +55,7 @@
   gIntelSiliconPkgTokenSpaceGuid.PcdVTdPolicyPropertyMask   ## CONSUMES
   gIntelSiliconPkgTokenSpaceGuid.PcdVTdPeiDmaBufferSize     ## CONSUMES
   gIntelSiliconPkgTokenSpaceGuid.PcdVTdPeiDmaBufferSizeS3   ## CONSUMES
+  gIntelSiliconPkgTokenSpaceGuid.PcdVTdSupportAbortDmaMode  ## CONSUMES
 
 [Depex]
   gEfiPeiMasterBootModePpiGuid AND
diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
index e5b785ae..92d7fa3b 100644
--- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
+++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
@@ -172,3 +172,9 @@
   # @Prompt The VTd PEI DMA buffer size for S3.
   gIntelSiliconPkgTokenSpaceGuid.PcdVTdPeiDmaBufferSizeS3|0x00200000|UINT32|0x00000004
 
+  ## Indicates if VTd Abort DMA Mode is supported.<BR><BR>
+  #   TRUE  - Support VTd abort DMA mode.
+  #   FALSE - Not support VTd abort DMA mode.
+  # @Prompt VTd abort DMA mode support.
+  gIntelSiliconPkgTokenSpaceGuid.PcdVTdSupportAbortDmaMode|TRUE|BOOLEAN|0x0000000C
+
-- 
2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89681): https://edk2.groups.io/g/devel/message/89681
Mute This Topic: https://groups.io/mt/91031568/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] IntelSiliconPkg/VTd: Add PCD for VTd Abort DMA Mode Support
Posted by Kowalewski, Robert 5 days, 23 hours ago
Reviewed-by: Robert Kowalewski <robert.kowalewski@intel.com>

-----Original Message-----
From: Sheng, W <w.sheng@intel.com> 
Sent: Wednesday, May 11, 2022 11:03 AM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@intel.com>; Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Huang, Jenny <jenny.huang@intel.com>; Kowalewski, Robert <robert.kowalewski@intel.com>
Subject: [PATCH] IntelSiliconPkg/VTd: Add PCD for VTd Abort DMA Mode Support

PcdVTdSupportAbortDmaMode is used to enable/disable VTd Abort DMA Mode.

Signed-off-by: Sheng Wei <w.sheng@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
Cc: Jenny Huang <jenny.huang@intel.com>
Cc: Robert Kowalewski <robert.kowalewski@intel.com>

---
 .../Feature/VTd/IntelVTdDmarPei/IntelVTdDmar.c             | 7 +++++--
 .../Feature/VTd/IntelVTdDmarPei/IntelVTdDmarPei.inf        | 3 ++-
 Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec          | 6 ++++++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/IntelVTdDmar.c b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/IntelVTdDmar.c
index b4c44d87..18c22316 100644
--- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/IntelVTdDmar.c
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/IntelVTdDmar.c
@@ -1,6 +1,6 @@
 /** @file

 

-  Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR>

+  Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.<BR>

 

   SPDX-License-Identifier: BSD-2-Clause-Patent

 

@@ -570,10 +570,12 @@ EnableVTdTranslationProtectionBlockDma (
 

   DEBUG ((DEBUG_INFO, "EnableVTdTranslationProtectionBlockDma - 0x%08x\n", VtdUnitBaseAddress));

 

+  DEBUG ((DEBUG_INFO, "PcdVTdSupportAbortDmaMode : %d\n", FeaturePcdGet (PcdVTdSupportAbortDmaMode)));

+

   ECapReg.Uint64 = MmioRead64 (VtdUnitBaseAddress + R_ECAP_REG);

   DEBUG ((DEBUG_INFO, "ECapReg : 0%016lx\n", ECapReg.Uint64));

 

-  if (ECapReg.Bits.ADMS == 1) {

+  if ((ECapReg.Bits.ADMS == 1) && FeaturePcdGet (PcdVTdSupportAbortDmaMode)) {

     //

     // Use Abort DMA Mode

     //

@@ -594,6 +596,7 @@ EnableVTdTranslationProtectionBlockDma (
       ASSERT (FALSE);

       return EFI_DEVICE_ERROR;

     }

+    DEBUG ((DEBUG_INFO, "Block All DMA by TE.\n"));

     Status = EnableDmarPreMem (VtdUnitBaseAddress, (UINT64) (*RootEntryTable));

   }

 

diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/IntelVTdDmarPei.inf b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/IntelVTdDmarPei.inf
index b97ff900..473665e9 100644
--- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/IntelVTdDmarPei.inf
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/IntelVTdDmarPei.inf
@@ -4,7 +4,7 @@
 # This driver initializes VTd engine based upon EDKII_VTD_INFO_PPI

 # and provide DMA protection in PEI.

 #

-# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>

+# Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>

 # SPDX-License-Identifier: BSD-2-Clause-Patent

 #

 ##

@@ -55,6 +55,7 @@
   gIntelSiliconPkgTokenSpaceGuid.PcdVTdPolicyPropertyMask   ## CONSUMES

   gIntelSiliconPkgTokenSpaceGuid.PcdVTdPeiDmaBufferSize     ## CONSUMES

   gIntelSiliconPkgTokenSpaceGuid.PcdVTdPeiDmaBufferSizeS3   ## CONSUMES

+  gIntelSiliconPkgTokenSpaceGuid.PcdVTdSupportAbortDmaMode  ## CONSUMES

 

 [Depex]

   gEfiPeiMasterBootModePpiGuid AND

diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
index e5b785ae..92d7fa3b 100644
--- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
+++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
@@ -172,3 +172,9 @@
   # @Prompt The VTd PEI DMA buffer size for S3.

   gIntelSiliconPkgTokenSpaceGuid.PcdVTdPeiDmaBufferSizeS3|0x00200000|UINT32|0x00000004

 

+  ## Indicates if VTd Abort DMA Mode is supported.<BR><BR>

+  #   TRUE  - Support VTd abort DMA mode.

+  #   FALSE - Not support VTd abort DMA mode.

+  # @Prompt VTd abort DMA mode support.

+  gIntelSiliconPkgTokenSpaceGuid.PcdVTdSupportAbortDmaMode|TRUE|BOOLEAN|0x0000000C

+

-- 
2.26.2.windows.1

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89895): https://edk2.groups.io/g/devel/message/89895
Mute This Topic: https://groups.io/mt/91031568/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-