Skip to content

Commit 964f9cf

Browse files
committed
Merge tag 'dma-mapping-5.4-2' of git://git.infradead.org/users/hch/dma-mapping
Pull dma-mapping fix from Christoph Hellwig: "Fix a regression in the intel-iommu get_required_mask conversion (Arvind Sankar)" * tag 'dma-mapping-5.4-2' of git://git.infradead.org/users/hch/dma-mapping: iommu/vt-d: Return the correct dma mask when we are bypassing the IOMMU
2 parents 485fc4b + 9c24eaf commit 964f9cf

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/iommu/intel-iommu.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3471,7 +3471,7 @@ static bool iommu_need_mapping(struct device *dev)
34713471
if (dev->coherent_dma_mask && dev->coherent_dma_mask < dma_mask)
34723472
dma_mask = dev->coherent_dma_mask;
34733473

3474-
if (dma_mask >= dma_get_required_mask(dev))
3474+
if (dma_mask >= dma_direct_get_required_mask(dev))
34753475
return false;
34763476

34773477
/*
@@ -3775,6 +3775,13 @@ static int intel_map_sg(struct device *dev, struct scatterlist *sglist, int nele
37753775
return nelems;
37763776
}
37773777

3778+
static u64 intel_get_required_mask(struct device *dev)
3779+
{
3780+
if (!iommu_need_mapping(dev))
3781+
return dma_direct_get_required_mask(dev);
3782+
return DMA_BIT_MASK(32);
3783+
}
3784+
37783785
static const struct dma_map_ops intel_dma_ops = {
37793786
.alloc = intel_alloc_coherent,
37803787
.free = intel_free_coherent,
@@ -3787,6 +3794,7 @@ static const struct dma_map_ops intel_dma_ops = {
37873794
.dma_supported = dma_direct_supported,
37883795
.mmap = dma_common_mmap,
37893796
.get_sgtable = dma_common_get_sgtable,
3797+
.get_required_mask = intel_get_required_mask,
37903798
};
37913799

37923800
static void

0 commit comments

Comments
 (0)