Lines Matching refs:zdev

87 static void __s390_iommu_detach_device(struct zpci_dev *zdev)  in __s390_iommu_detach_device()  argument
89 struct s390_domain *s390_domain = zdev->s390_domain; in __s390_iommu_detach_device()
96 list_del_rcu(&zdev->iommu_list); in __s390_iommu_detach_device()
99 zpci_unregister_ioat(zdev, 0); in __s390_iommu_detach_device()
100 zdev->s390_domain = NULL; in __s390_iommu_detach_device()
101 zdev->dma_table = NULL; in __s390_iommu_detach_device()
108 struct zpci_dev *zdev = to_zpci_dev(dev); in s390_iommu_attach_device() local
113 if (!zdev) in s390_iommu_attach_device()
116 if (WARN_ON(domain->geometry.aperture_start > zdev->end_dma || in s390_iommu_attach_device()
117 domain->geometry.aperture_end < zdev->start_dma)) in s390_iommu_attach_device()
120 if (zdev->s390_domain) in s390_iommu_attach_device()
121 __s390_iommu_detach_device(zdev); in s390_iommu_attach_device()
122 else if (zdev->dma_table) in s390_iommu_attach_device()
123 zpci_dma_exit_device(zdev); in s390_iommu_attach_device()
125 cc = zpci_register_ioat(zdev, 0, zdev->start_dma, zdev->end_dma, in s390_iommu_attach_device()
133 zdev->dma_table = s390_domain->dma_table; in s390_iommu_attach_device()
135 zdev->dma_table = s390_domain->dma_table; in s390_iommu_attach_device()
136 zdev->s390_domain = s390_domain; in s390_iommu_attach_device()
139 list_add_rcu(&zdev->iommu_list, &s390_domain->devices); in s390_iommu_attach_device()
147 struct zpci_dev *zdev = to_zpci_dev(dev); in s390_iommu_set_platform_dma() local
149 __s390_iommu_detach_device(zdev); in s390_iommu_set_platform_dma()
150 zpci_dma_init_device(zdev); in s390_iommu_set_platform_dma()
156 struct zpci_dev *zdev = to_zpci_dev(dev); in s390_iommu_get_resv_regions() local
159 if (zdev->start_dma) { in s390_iommu_get_resv_regions()
160 region = iommu_alloc_resv_region(0, zdev->start_dma, 0, in s390_iommu_get_resv_regions()
167 if (zdev->end_dma < ZPCI_TABLE_SIZE_RT - 1) { in s390_iommu_get_resv_regions()
168 region = iommu_alloc_resv_region(zdev->end_dma + 1, in s390_iommu_get_resv_regions()
169 ZPCI_TABLE_SIZE_RT - zdev->end_dma - 1, in s390_iommu_get_resv_regions()
179 struct zpci_dev *zdev; in s390_iommu_probe_device() local
184 zdev = to_zpci_dev(dev); in s390_iommu_probe_device()
186 if (zdev->start_dma > zdev->end_dma || in s390_iommu_probe_device()
187 zdev->start_dma > ZPCI_TABLE_SIZE_RT - 1) in s390_iommu_probe_device()
190 if (zdev->end_dma > ZPCI_TABLE_SIZE_RT - 1) in s390_iommu_probe_device()
191 zdev->end_dma = ZPCI_TABLE_SIZE_RT - 1; in s390_iommu_probe_device()
193 return &zdev->iommu_dev; in s390_iommu_probe_device()
198 struct zpci_dev *zdev = to_zpci_dev(dev); in s390_iommu_release_device() local
204 if (zdev) in s390_iommu_release_device()
205 __s390_iommu_detach_device(zdev); in s390_iommu_release_device()
211 struct zpci_dev *zdev; in s390_iommu_flush_iotlb_all() local
214 list_for_each_entry_rcu(zdev, &s390_domain->devices, iommu_list) { in s390_iommu_flush_iotlb_all()
215 zpci_refresh_trans((u64)zdev->fh << 32, zdev->start_dma, in s390_iommu_flush_iotlb_all()
216 zdev->end_dma - zdev->start_dma + 1); in s390_iommu_flush_iotlb_all()
226 struct zpci_dev *zdev; in s390_iommu_iotlb_sync() local
233 list_for_each_entry_rcu(zdev, &s390_domain->devices, iommu_list) { in s390_iommu_iotlb_sync()
234 zpci_refresh_trans((u64)zdev->fh << 32, gather->start, in s390_iommu_iotlb_sync()
244 struct zpci_dev *zdev; in s390_iommu_iotlb_sync_map() local
247 list_for_each_entry_rcu(zdev, &s390_domain->devices, iommu_list) { in s390_iommu_iotlb_sync_map()
248 if (!zdev->tlb_refresh) in s390_iommu_iotlb_sync_map()
250 zpci_refresh_trans((u64)zdev->fh << 32, in s390_iommu_iotlb_sync_map()
402 int zpci_init_iommu(struct zpci_dev *zdev) in zpci_init_iommu() argument
406 rc = iommu_device_sysfs_add(&zdev->iommu_dev, NULL, NULL, in zpci_init_iommu()
407 "s390-iommu.%08x", zdev->fid); in zpci_init_iommu()
411 rc = iommu_device_register(&zdev->iommu_dev, &s390_iommu_ops, NULL); in zpci_init_iommu()
418 iommu_device_sysfs_remove(&zdev->iommu_dev); in zpci_init_iommu()
424 void zpci_destroy_iommu(struct zpci_dev *zdev) in zpci_destroy_iommu() argument
426 iommu_device_unregister(&zdev->iommu_dev); in zpci_destroy_iommu()
427 iommu_device_sysfs_remove(&zdev->iommu_dev); in zpci_destroy_iommu()