Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iommu/fsl_pamu: merge iommu_alloc_dma_domain into fsl_pamu_domain_alloc

Keep the functionality to allocate the domain together.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Will Deacon <will@kernel.org>
Acked-by: Li Yang <leoyang.li@nxp.com>
Link: https://lore.kernel.org/r/20210401155256.298656-5-hch@lst.de
Signed-off-by: Joerg Roedel <jroedel@suse.de>

authored by

Christoph Hellwig and committed by
Joerg Roedel
c8224508 f7641bb7

+10 -24
+10 -24
drivers/iommu/fsl_pamu_domain.c
··· 292 292 return 0; 293 293 } 294 294 295 - static struct fsl_dma_domain *iommu_alloc_dma_domain(void) 296 - { 297 - struct fsl_dma_domain *domain; 298 - 299 - domain = kmem_cache_zalloc(fsl_pamu_domain_cache, GFP_KERNEL); 300 - if (!domain) 301 - return NULL; 302 - 303 - domain->stash_id = ~(u32)0; 304 - domain->snoop_id = ~(u32)0; 305 - domain->win_cnt = pamu_get_max_subwin_cnt(); 306 - 307 - INIT_LIST_HEAD(&domain->devices); 308 - 309 - spin_lock_init(&domain->domain_lock); 310 - 311 - return domain; 312 - } 313 - 314 295 static void remove_device_ref(struct device_domain_info *info, u32 win_cnt) 315 296 { 316 297 unsigned long flags; ··· 393 412 if (type != IOMMU_DOMAIN_UNMANAGED) 394 413 return NULL; 395 414 396 - dma_domain = iommu_alloc_dma_domain(); 397 - if (!dma_domain) { 398 - pr_debug("dma_domain allocation failed\n"); 415 + dma_domain = kmem_cache_zalloc(fsl_pamu_domain_cache, GFP_KERNEL); 416 + if (!dma_domain) 399 417 return NULL; 400 - } 401 - /* defaul geometry 64 GB i.e. maximum system address */ 418 + 419 + dma_domain->stash_id = ~(u32)0; 420 + dma_domain->snoop_id = ~(u32)0; 421 + dma_domain->win_cnt = pamu_get_max_subwin_cnt(); 422 + INIT_LIST_HEAD(&dma_domain->devices); 423 + spin_lock_init(&dma_domain->domain_lock); 424 + 425 + /* default geometry 64 GB i.e. maximum system address */ 402 426 dma_domain->iommu_domain. geometry.aperture_start = 0; 403 427 dma_domain->iommu_domain.geometry.aperture_end = (1ULL << 36) - 1; 404 428 dma_domain->iommu_domain.geometry.force_aperture = true;