Skip to content

Commit

Permalink
powerpc/dma: remove dma_nommu_get_required_mask
Browse files Browse the repository at this point in the history
This function is identical to the generic dma_direct_get_required_mask,
except that the generic version also takes the bus_dma_mask account,
which could lead to incorrect results in the powerpc version.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Christian Zigotzky <chzigotzky@xenosoft.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Christoph Hellwig authored and Michael Ellerman committed Feb 18, 2019
1 parent 6666cc1 commit 5a47910
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
1 change: 0 additions & 1 deletion arch/powerpc/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ dma_addr_t dma_nommu_map_page(struct device *dev, struct page *page,
unsigned long offset, size_t size,
enum dma_data_direction dir, unsigned long attrs);
int dma_nommu_dma_supported(struct device *dev, u64 mask);
u64 dma_nommu_get_required_mask(struct device *dev);

#ifdef CONFIG_NOT_COHERENT_CACHE
/*
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/dma-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ u64 dma_iommu_get_required_mask(struct device *dev)
return 0;

if (dev_is_pci(dev)) {
u64 bypass_mask = dma_nommu_get_required_mask(dev);
u64 bypass_mask = dma_direct_get_required_mask(dev);

if (dma_iommu_bypass_supported(dev, bypass_mask))
return bypass_mask;
Expand Down
14 changes: 1 addition & 13 deletions arch/powerpc/kernel/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,6 @@ static void dma_nommu_unmap_sg(struct device *dev, struct scatterlist *sgl,
__dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
}

u64 dma_nommu_get_required_mask(struct device *dev)
{
u64 end, mask;

end = memblock_end_of_DRAM() + get_dma_offset(dev);

mask = 1ULL << (fls64(end) - 1);
mask += mask - 1;

return mask;
}

dma_addr_t dma_nommu_map_page(struct device *dev, struct page *page,
unsigned long offset, size_t size,
enum dma_data_direction dir, unsigned long attrs)
Expand Down Expand Up @@ -205,7 +193,7 @@ const struct dma_map_ops dma_nommu_ops = {
.dma_supported = dma_nommu_dma_supported,
.map_page = dma_nommu_map_page,
.unmap_page = dma_nommu_unmap_page,
.get_required_mask = dma_nommu_get_required_mask,
.get_required_mask = dma_direct_get_required_mask,
#ifdef CONFIG_NOT_COHERENT_CACHE
.sync_single_for_cpu = dma_nommu_sync_single,
.sync_single_for_device = dma_nommu_sync_single,
Expand Down

0 comments on commit 5a47910

Please sign in to comment.