[edk2] [PATCH] IntelSiliconPkg IntelVTdDxe: Fix DMA does not work issue

Star Zeng posted 1 patch 6 years, 3 months ago
Failed in applying to current master (apply log)
IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
[edk2] [PATCH] IntelSiliconPkg IntelVTdDxe: Fix DMA does not work issue
Posted by Star Zeng 6 years, 3 months ago
Fix DMA does not work issue when system memory is not
greater than 4G.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c
index cecb5d23efbf..7f64d5e418f6 100644
--- a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c
+++ b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c
@@ -286,11 +286,14 @@ CreateSecondLevelPagingEntry (
   if (SecondLevelPagingEntry == NULL) {
     return NULL;
   }
-  SecondLevelPagingEntry = CreateSecondLevelPagingEntryTable (VtdIndex, SecondLevelPagingEntry, SIZE_4GB, mAbove4GMemoryLimit, IoMmuAccess);
-  if (SecondLevelPagingEntry == NULL) {
-    return NULL;
-  }
 
+  if (mAbove4GMemoryLimit != 0) {
+    ASSERT (mAbove4GMemoryLimit > BASE_4GB);
+    SecondLevelPagingEntry = CreateSecondLevelPagingEntryTable (VtdIndex, SecondLevelPagingEntry, SIZE_4GB, mAbove4GMemoryLimit, IoMmuAccess);
+    if (SecondLevelPagingEntry == NULL) {
+      return NULL;
+    }
+  }
   return SecondLevelPagingEntry;
 }
 
-- 
2.7.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] IntelSiliconPkg IntelVTdDxe: Fix DMA does not work issue
Posted by Yao, Jiewen 6 years, 3 months ago
Good catch.

Reviewed-by: Jiewen.yao@intel.com

> -----Original Message-----
> From: Zeng, Star
> Sent: Wednesday, January 17, 2018 7:57 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> Subject: [PATCH] IntelSiliconPkg IntelVTdDxe: Fix DMA does not work issue
> 
> Fix DMA does not work issue when system memory is not
> greater than 4G.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c
> b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c
> index cecb5d23efbf..7f64d5e418f6 100644
> --- a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c
> +++ b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c
> @@ -286,11 +286,14 @@ CreateSecondLevelPagingEntry (
>    if (SecondLevelPagingEntry == NULL) {
>      return NULL;
>    }
> -  SecondLevelPagingEntry = CreateSecondLevelPagingEntryTable (VtdIndex,
> SecondLevelPagingEntry, SIZE_4GB, mAbove4GMemoryLimit, IoMmuAccess);
> -  if (SecondLevelPagingEntry == NULL) {
> -    return NULL;
> -  }
> 
> +  if (mAbove4GMemoryLimit != 0) {
> +    ASSERT (mAbove4GMemoryLimit > BASE_4GB);
> +    SecondLevelPagingEntry = CreateSecondLevelPagingEntryTable (VtdIndex,
> SecondLevelPagingEntry, SIZE_4GB, mAbove4GMemoryLimit, IoMmuAccess);
> +    if (SecondLevelPagingEntry == NULL) {
> +      return NULL;
> +    }
> +  }
>    return SecondLevelPagingEntry;
>  }
> 
> --
> 2.7.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel