Lines Matching refs:zdev

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