Skip to content

Commit

Permalink
s390/pci: ensure to not cross a dma segment boundary
Browse files Browse the repository at this point in the history
When we use the iommu_area_alloc helper to get dma addresses
we specify the boundary_size parameter but not the offset (called
shift in this context).

As long as the offset (start_dma) is a multiple of the boundary
we're ok (on current machines start_dma always seems to be 4GB).

Don't leave this to chance and specify the offset for iommu_area_alloc.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Sebastian Ott authored and Martin Schwidefsky committed Jun 13, 2016
1 parent 53b1bc9 commit 8ee2db3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/s390/pci/pci_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ static unsigned long __dma_alloc_iommu(struct device *dev,
boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1,
PAGE_SIZE) >> PAGE_SHIFT;
return iommu_area_alloc(zdev->iommu_bitmap, zdev->iommu_pages,
start, size, 0, boundary_size, 0);
start, size, zdev->start_dma >> PAGE_SHIFT,
boundary_size, 0);
}

static unsigned long dma_alloc_iommu(struct device *dev, int size)
Expand Down

0 comments on commit 8ee2db3

Please sign in to comment.