Skip to content

Commit 186f50f

Browse files
gerald-schaeferMartin Schwidefsky
authored andcommitted
s390/pci: return correct dma address for offset > PAGE_SIZE
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]>
1 parent 63dd9b4 commit 186f50f

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

arch/s390/pci/pci_dma.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,6 @@ static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page,
269269
int flags = ZPCI_PTE_VALID;
270270
dma_addr_t dma_addr;
271271

272-
WARN_ON_ONCE(offset > PAGE_SIZE);
273-
274272
/* This rounds up number of pages based on size and offset */
275273
nr_pages = iommu_num_pages(pa, size, PAGE_SIZE);
276274
iommu_page_index = dma_alloc_iommu(zdev, nr_pages);
@@ -292,7 +290,7 @@ static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page,
292290

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

298296
out_free:

0 commit comments

Comments
 (0)