Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df310656 authored by Anton Blanchard's avatar Anton Blanchard Committed by Paul Mackerras
Browse files

[POWERPC] cleanup dma_mapping_ops



For pseries IOMMU bypass I want to be able to fall back to the regular
IOMMU ops. Do this by creating a dma_mapping_ops struct, and convert
the others while at it.

Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent ca1588e7
Loading
Loading
Loading
Loading
+11 −7
Original line number Original line Diff line number Diff line
@@ -82,13 +82,17 @@ static int pci_direct_dma_supported(struct device *dev, u64 mask)
	return mask < 0x100000000ull;
	return mask < 0x100000000ull;
}
}


static struct dma_mapping_ops pci_direct_ops = {
	.alloc_coherent = pci_direct_alloc_coherent,
	.free_coherent = pci_direct_free_coherent,
	.map_single = pci_direct_map_single,
	.unmap_single = pci_direct_unmap_single,
	.map_sg = pci_direct_map_sg,
	.unmap_sg = pci_direct_unmap_sg,
	.dma_supported = pci_direct_dma_supported,
};

void __init pci_direct_iommu_init(void)
void __init pci_direct_iommu_init(void)
{
{
	pci_dma_ops.alloc_coherent = pci_direct_alloc_coherent;
	pci_dma_ops = pci_direct_ops;
	pci_dma_ops.free_coherent = pci_direct_free_coherent;
	pci_dma_ops.map_single = pci_direct_map_single;
	pci_dma_ops.unmap_single = pci_direct_unmap_single;
	pci_dma_ops.map_sg = pci_direct_map_sg;
	pci_dma_ops.unmap_sg = pci_direct_unmap_sg;
	pci_dma_ops.dma_supported = pci_direct_dma_supported;
}
}
+11 −7
Original line number Original line Diff line number Diff line
@@ -148,13 +148,17 @@ static int pci_iommu_dma_supported(struct device *dev, u64 mask)
		return 1;
		return 1;
}
}


struct dma_mapping_ops pci_iommu_ops = {
	.alloc_coherent = pci_iommu_alloc_coherent,
	.free_coherent = pci_iommu_free_coherent,
	.map_single = pci_iommu_map_single,
	.unmap_single = pci_iommu_unmap_single,
	.map_sg = pci_iommu_map_sg,
	.unmap_sg = pci_iommu_unmap_sg,
	.dma_supported = pci_iommu_dma_supported,
};

void pci_iommu_init(void)
void pci_iommu_init(void)
{
{
	pci_dma_ops.alloc_coherent = pci_iommu_alloc_coherent;
	pci_dma_ops = pci_iommu_ops;
	pci_dma_ops.free_coherent = pci_iommu_free_coherent;
	pci_dma_ops.map_single = pci_iommu_map_single;
	pci_dma_ops.unmap_single = pci_iommu_unmap_single;
	pci_dma_ops.map_sg = pci_iommu_map_sg;
	pci_dma_ops.unmap_sg = pci_iommu_unmap_sg;
	pci_dma_ops.dma_supported = pci_iommu_dma_supported;
}
}
+11 −7
Original line number Original line Diff line number Diff line
@@ -473,6 +473,16 @@ static int cell_dma_supported(struct device *dev, u64 mask)
	return mask < 0x100000000ull;
	return mask < 0x100000000ull;
}
}


static struct dma_mapping_ops cell_iommu_ops = {
	.alloc_coherent = cell_alloc_coherent,
	.free_coherent = cell_free_coherent,
	.map_single = cell_map_single,
	.unmap_single = cell_unmap_single,
	.map_sg = cell_map_sg,
	.unmap_sg = cell_unmap_sg,
	.dma_supported = cell_dma_supported,
};

void cell_init_iommu(void)
void cell_init_iommu(void)
{
{
	int setup_bus = 0;
	int setup_bus = 0;
@@ -498,11 +508,5 @@ void cell_init_iommu(void)
		}
		}
	}
	}


	pci_dma_ops.alloc_coherent = cell_alloc_coherent;
	pci_dma_ops = cell_iommu_ops;
	pci_dma_ops.free_coherent = cell_free_coherent;
	pci_dma_ops.map_single = cell_map_single;
	pci_dma_ops.unmap_single = cell_unmap_single;
	pci_dma_ops.map_sg = cell_map_sg;
	pci_dma_ops.unmap_sg = cell_unmap_sg;
	pci_dma_ops.dma_supported = cell_dma_supported;
}
}