diff options
-rw-r--r-- | drivers/pci/intel-iommu.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 4eaec2fa1369..dcf051d53b74 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -2316,8 +2316,19 @@ static int iommu_should_identity_map(struct pci_dev *pdev, int startup) | |||
2316 | * Assume that they will -- if they turn out not to be, then we can | 2316 | * Assume that they will -- if they turn out not to be, then we can |
2317 | * take them out of the 1:1 domain later. | 2317 | * take them out of the 1:1 domain later. |
2318 | */ | 2318 | */ |
2319 | if (!startup) | 2319 | if (!startup) { |
2320 | return pdev->dma_mask > DMA_BIT_MASK(32); | 2320 | /* |
2321 | * If the device's dma_mask is less than the system's memory | ||
2322 | * size then this is not a candidate for identity mapping. | ||
2323 | */ | ||
2324 | u64 dma_mask = pdev->dma_mask; | ||
2325 | |||
2326 | if (pdev->dev.coherent_dma_mask && | ||
2327 | pdev->dev.coherent_dma_mask < dma_mask) | ||
2328 | dma_mask = pdev->dev.coherent_dma_mask; | ||
2329 | |||
2330 | return dma_mask >= dma_get_required_mask(&pdev->dev); | ||
2331 | } | ||
2321 | 2332 | ||
2322 | return 1; | 2333 | return 1; |
2323 | } | 2334 | } |