Loading arch/arm64/mm/dma-mapping.c +23 −9 Original line number Diff line number Diff line Loading @@ -1915,20 +1915,34 @@ iommu_init_mapping(struct device *dev, struct dma_iommu_mapping *mapping) struct iommu_domain *domain = mapping->domain; dma_addr_t dma_base = mapping->base; u64 size = mapping->bits << PAGE_SHIFT; int ret; bool own_cookie; /* Prepare the domain */ if (iommu_get_dma_cookie(domain)) return -EINVAL; /* * if own_cookie is false, then we are sharing the iova_cookie with * another driver, and should not free it on error. Cleanup will be * done when the iommu_domain is freed. */ own_cookie = !domain->iova_cookie; if (iommu_dma_init_domain(domain, dma_base, size, dev)) goto out_put_cookie; if (own_cookie) { ret = iommu_get_dma_cookie(domain); if (ret) { dev_err(dev, "iommu_get_dma_cookie failed: %d\n", ret); return ret; } } ret = iommu_dma_init_domain(domain, dma_base, size, dev); if (ret) { dev_err(dev, "iommu_dma_init_domain failed: %d\n", ret); if (own_cookie) iommu_put_dma_cookie(domain); return ret; } mapping->ops = &iommu_dma_ops; return 0; out_put_cookie: iommu_put_dma_cookie(domain); return -EINVAL; } static int Loading drivers/iommu/dma-iommu.c +4 −0 Original line number Diff line number Diff line Loading @@ -267,6 +267,10 @@ static int iommu_dma_arm_smmu_errata_init(struct iommu_domain *domain) int vmid = VMID_HLOS; int min_iova_align = 0; /* Called for each device in the iommu group */ if (cookie->guard_page) return 0; iommu_domain_get_attr(domain, DOMAIN_ATTR_QCOM_MMU500_ERRATA_MIN_IOVA_ALIGN, &min_iova_align); Loading Loading
arch/arm64/mm/dma-mapping.c +23 −9 Original line number Diff line number Diff line Loading @@ -1915,20 +1915,34 @@ iommu_init_mapping(struct device *dev, struct dma_iommu_mapping *mapping) struct iommu_domain *domain = mapping->domain; dma_addr_t dma_base = mapping->base; u64 size = mapping->bits << PAGE_SHIFT; int ret; bool own_cookie; /* Prepare the domain */ if (iommu_get_dma_cookie(domain)) return -EINVAL; /* * if own_cookie is false, then we are sharing the iova_cookie with * another driver, and should not free it on error. Cleanup will be * done when the iommu_domain is freed. */ own_cookie = !domain->iova_cookie; if (iommu_dma_init_domain(domain, dma_base, size, dev)) goto out_put_cookie; if (own_cookie) { ret = iommu_get_dma_cookie(domain); if (ret) { dev_err(dev, "iommu_get_dma_cookie failed: %d\n", ret); return ret; } } ret = iommu_dma_init_domain(domain, dma_base, size, dev); if (ret) { dev_err(dev, "iommu_dma_init_domain failed: %d\n", ret); if (own_cookie) iommu_put_dma_cookie(domain); return ret; } mapping->ops = &iommu_dma_ops; return 0; out_put_cookie: iommu_put_dma_cookie(domain); return -EINVAL; } static int Loading
drivers/iommu/dma-iommu.c +4 −0 Original line number Diff line number Diff line Loading @@ -267,6 +267,10 @@ static int iommu_dma_arm_smmu_errata_init(struct iommu_domain *domain) int vmid = VMID_HLOS; int min_iova_align = 0; /* Called for each device in the iommu group */ if (cookie->guard_page) return 0; iommu_domain_get_attr(domain, DOMAIN_ATTR_QCOM_MMU500_ERRATA_MIN_IOVA_ALIGN, &min_iova_align); Loading