Lines Matching refs:dma_domain
58 static int update_liodn_stash(int liodn, struct fsl_dma_domain *dma_domain, in update_liodn_stash() argument
78 static int pamu_set_liodn(struct fsl_dma_domain *dma_domain, struct device *dev, in pamu_set_liodn() argument
96 ret = pamu_config_ppaace(liodn, omi_index, dma_domain->stash_id, 0); in pamu_set_liodn()
99 ret = pamu_config_ppaace(liodn, ~(u32)0, dma_domain->stash_id, in pamu_set_liodn()
124 static void detach_device(struct device *dev, struct fsl_dma_domain *dma_domain) in detach_device() argument
129 spin_lock_irqsave(&dma_domain->domain_lock, flags); in detach_device()
131 list_for_each_entry_safe(info, tmp, &dma_domain->devices, link) { in detach_device()
135 spin_unlock_irqrestore(&dma_domain->domain_lock, flags); in detach_device()
138 static void attach_device(struct fsl_dma_domain *dma_domain, int liodn, struct device *dev) in attach_device() argument
149 if (old_domain_info && old_domain_info->domain != dma_domain) { in attach_device()
159 info->domain = dma_domain; in attach_device()
161 list_add(&info->link, &dma_domain->devices); in attach_device()
188 struct fsl_dma_domain *dma_domain = to_fsl_dma_domain(domain); in fsl_pamu_domain_free() local
191 detach_device(NULL, dma_domain); in fsl_pamu_domain_free()
192 kmem_cache_free(fsl_pamu_domain_cache, dma_domain); in fsl_pamu_domain_free()
197 struct fsl_dma_domain *dma_domain; in fsl_pamu_domain_alloc() local
209 dma_domain = kmem_cache_zalloc(fsl_pamu_domain_cache, GFP_KERNEL); in fsl_pamu_domain_alloc()
210 if (!dma_domain) in fsl_pamu_domain_alloc()
213 dma_domain->stash_id = ~(u32)0; in fsl_pamu_domain_alloc()
214 INIT_LIST_HEAD(&dma_domain->devices); in fsl_pamu_domain_alloc()
215 spin_lock_init(&dma_domain->domain_lock); in fsl_pamu_domain_alloc()
218 dma_domain->iommu_domain. geometry.aperture_start = 0; in fsl_pamu_domain_alloc()
219 dma_domain->iommu_domain.geometry.aperture_end = (1ULL << 36) - 1; in fsl_pamu_domain_alloc()
220 dma_domain->iommu_domain.geometry.force_aperture = true; in fsl_pamu_domain_alloc()
222 return &dma_domain->iommu_domain; in fsl_pamu_domain_alloc()
226 static int update_domain_stash(struct fsl_dma_domain *dma_domain, u32 val) in update_domain_stash() argument
231 list_for_each_entry(info, &dma_domain->devices, link) { in update_domain_stash()
232 ret = update_liodn_stash(info->liodn, dma_domain, val); in update_domain_stash()
243 struct fsl_dma_domain *dma_domain = to_fsl_dma_domain(domain); in fsl_pamu_attach_device() local
271 spin_lock_irqsave(&dma_domain->domain_lock, flags); in fsl_pamu_attach_device()
281 attach_device(dma_domain, liodn[i], dev); in fsl_pamu_attach_device()
282 ret = pamu_set_liodn(dma_domain, dev, liodn[i]); in fsl_pamu_attach_device()
289 spin_unlock_irqrestore(&dma_domain->domain_lock, flags); in fsl_pamu_attach_device()
304 struct fsl_dma_domain *dma_domain; in fsl_pamu_platform_attach() local
318 dma_domain = to_fsl_dma_domain(domain); in fsl_pamu_platform_attach()
337 detach_device(dev, dma_domain); in fsl_pamu_platform_attach()
355 struct fsl_dma_domain *dma_domain = to_fsl_dma_domain(domain); in fsl_pamu_configure_l1_stash() local
359 spin_lock_irqsave(&dma_domain->domain_lock, flags); in fsl_pamu_configure_l1_stash()
360 dma_domain->stash_id = get_stash_id(PAMU_ATTR_CACHE_L1, cpu); in fsl_pamu_configure_l1_stash()
361 if (dma_domain->stash_id == ~(u32)0) { in fsl_pamu_configure_l1_stash()
363 spin_unlock_irqrestore(&dma_domain->domain_lock, flags); in fsl_pamu_configure_l1_stash()
366 ret = update_domain_stash(dma_domain, dma_domain->stash_id); in fsl_pamu_configure_l1_stash()
367 spin_unlock_irqrestore(&dma_domain->domain_lock, flags); in fsl_pamu_configure_l1_stash()