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

Commit eb2c2d6f authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "arm: dma-mapping: don't attach the clients to smmu device by default"

parents a30b19dd ef027fed
Loading
Loading
Loading
Loading
+21 −9
Original line number Diff line number Diff line
@@ -2470,10 +2470,21 @@ static bool arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size,
				    const struct iommu_ops *iommu)
{
	struct dma_iommu_mapping *mapping;
	struct iommu_domain *domain;

	if (!iommu)
		return false;

	/*
	 * Adding this to not to attach to smmu device by default as any way
	 * clients call the arm_iommu_create_mapping() in their use cases.
	 */
	domain = iommu_get_domain_for_dev(dev);

	if (!domain)
		return false;

	if (domain->type == IOMMU_DOMAIN_DMA) {
		mapping = arm_iommu_create_mapping(dev->bus, dma_base, size);
		if (IS_ERR(mapping)) {
			pr_warn("Failed to create %llu-byte IOMMU mapping for device %s\n",
@@ -2487,6 +2498,7 @@ static bool arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size,
			arm_iommu_release_mapping(mapping);
			return false;
		}
	}

	return true;
}