Skip to content

Commit

Permalink
ARM/dma-mapping: drop .dma_supported for IOMMU ops
Browse files Browse the repository at this point in the history
When an IOMMU is present, we trust that it should be capable
of remapping any physical memory, and since the device masks
represent the input (virtual) addresses to the IOMMU it makes
no sense to validate them against physical PFNs anyway.

Signed-off-by: Robin Murphy <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Tested-by: Marc Zyngier <[email protected]>
  • Loading branch information
rmurphy-arm authored and Christoph Hellwig committed Jul 7, 2022
1 parent ae626eb commit 42998ef
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions arch/arm/mm/dma-mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,25 +104,6 @@ static struct arm_dma_buffer *arm_dma_buffer_find(void *virt)
*
*/

#ifdef CONFIG_ARM_DMA_USE_IOMMU
/*
* Return whether the given device DMA address mask can be supported
* properly. For example, if your device can only drive the low 24-bits
* during bus mastering, then you would pass 0x00ffffff as the mask
* to this function.
*/
static int arm_dma_supported(struct device *dev, u64 mask)
{
unsigned long max_dma_pfn = min(max_pfn - 1, arm_dma_pfn_limit);

/*
* Translate the device's DMA mask to a PFN limit. This
* PFN number includes the page which we can DMA to.
*/
return PHYS_PFN(dma_to_phys(dev, mask)) >= max_dma_pfn;
}
#endif

static void __dma_clear_buffer(struct page *page, size_t size, int coherent_flag)
{
/*
Expand Down Expand Up @@ -1681,8 +1662,6 @@ static const struct dma_map_ops iommu_ops = {

.map_resource = arm_iommu_map_resource,
.unmap_resource = arm_iommu_unmap_resource,

.dma_supported = arm_dma_supported,
};

static const struct dma_map_ops iommu_coherent_ops = {
Expand All @@ -1699,8 +1678,6 @@ static const struct dma_map_ops iommu_coherent_ops = {

.map_resource = arm_iommu_map_resource,
.unmap_resource = arm_iommu_unmap_resource,

.dma_supported = arm_dma_supported,
};

/**
Expand Down

0 comments on commit 42998ef

Please sign in to comment.