From: Star Zeng Date: Wed, 17 Jan 2018 11:33:30 +0000 (+0800) Subject: IntelSiliconPkg IntelVTdDxe: Fix DMA does not work issue X-Git-Tag: edk2-stable201903~2586 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=1d4c17a6ef1a06023cb533d108556c419bdb1fed 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 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng Reviewed-by: Jiewen Yao --- diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c index cecb5d23ef..7bdc4a5146 100644 --- a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c +++ b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c @@ -286,9 +286,13 @@ 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;