Skip to content

Commit

Permalink
s390/pci: return correct dma address for offset > PAGE_SIZE
Browse files Browse the repository at this point in the history
For offset > PAGE_SIZE, s390_dma_map_pages() will issue a warning
and return a wrong dma address.

This patch removes the warning and fixes the dma return address
calculation.

Signed-off-by: Gerald Schaefer <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
  • Loading branch information
gerald-schaefer authored and Martin Schwidefsky committed Apr 23, 2013
1 parent 63dd9b4 commit 186f50f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions arch/s390/pci/pci_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@ static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page,
int flags = ZPCI_PTE_VALID;
dma_addr_t dma_addr;

WARN_ON_ONCE(offset > PAGE_SIZE);

/* This rounds up number of pages based on size and offset */
nr_pages = iommu_num_pages(pa, size, PAGE_SIZE);
iommu_page_index = dma_alloc_iommu(zdev, nr_pages);
Expand All @@ -292,7 +290,7 @@ static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page,

if (!dma_update_trans(zdev, pa, dma_addr, size, flags)) {
atomic64_add(nr_pages, (atomic64_t *) &zdev->fmb->mapped_pages);
return dma_addr + offset;
return dma_addr + (offset & ~PAGE_MASK);
}

out_free:
Expand Down

0 comments on commit 186f50f

Please sign in to comment.