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 <gerald.schaefer@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
63dd9b44ac
commit
186f50fa56
|
@ -269,8 +269,6 @@ static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page,
|
||||||
int flags = ZPCI_PTE_VALID;
|
int flags = ZPCI_PTE_VALID;
|
||||||
dma_addr_t dma_addr;
|
dma_addr_t dma_addr;
|
||||||
|
|
||||||
WARN_ON_ONCE(offset > PAGE_SIZE);
|
|
||||||
|
|
||||||
/* This rounds up number of pages based on size and offset */
|
/* This rounds up number of pages based on size and offset */
|
||||||
nr_pages = iommu_num_pages(pa, size, PAGE_SIZE);
|
nr_pages = iommu_num_pages(pa, size, PAGE_SIZE);
|
||||||
iommu_page_index = dma_alloc_iommu(zdev, nr_pages);
|
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,
|
||||||
|
|
||||||
if (!dma_update_trans(zdev, pa, dma_addr, size, flags)) {
|
if (!dma_update_trans(zdev, pa, dma_addr, size, flags)) {
|
||||||
atomic64_add(nr_pages, (atomic64_t *) &zdev->fmb->mapped_pages);
|
atomic64_add(nr_pages, (atomic64_t *) &zdev->fmb->mapped_pages);
|
||||||
return dma_addr + offset;
|
return dma_addr + (offset & ~PAGE_MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
out_free:
|
out_free:
|
||||||
|
|
Loading…
Reference in New Issue