| .. | .. |
|---|
| 87 | 87 | struct device *dev) |
|---|
| 88 | 88 | { |
|---|
| 89 | 89 | struct s390_domain *s390_domain = to_s390_domain(domain); |
|---|
| 90 | | - struct zpci_dev *zdev = to_pci_dev(dev)->sysdata; |
|---|
| 90 | + struct zpci_dev *zdev = to_zpci_dev(dev); |
|---|
| 91 | 91 | struct s390_domain_device *domain_device; |
|---|
| 92 | 92 | unsigned long flags; |
|---|
| 93 | 93 | int rc; |
|---|
| .. | .. |
|---|
| 139 | 139 | struct device *dev) |
|---|
| 140 | 140 | { |
|---|
| 141 | 141 | struct s390_domain *s390_domain = to_s390_domain(domain); |
|---|
| 142 | | - struct zpci_dev *zdev = to_pci_dev(dev)->sysdata; |
|---|
| 142 | + struct zpci_dev *zdev = to_zpci_dev(dev); |
|---|
| 143 | 143 | struct s390_domain_device *domain_device, *tmp; |
|---|
| 144 | 144 | unsigned long flags; |
|---|
| 145 | 145 | int found = 0; |
|---|
| .. | .. |
|---|
| 166 | 166 | } |
|---|
| 167 | 167 | } |
|---|
| 168 | 168 | |
|---|
| 169 | | -static int s390_iommu_add_device(struct device *dev) |
|---|
| 169 | +static struct iommu_device *s390_iommu_probe_device(struct device *dev) |
|---|
| 170 | 170 | { |
|---|
| 171 | | - struct iommu_group *group = iommu_group_get_for_dev(dev); |
|---|
| 172 | | - struct zpci_dev *zdev = to_pci_dev(dev)->sysdata; |
|---|
| 171 | + struct zpci_dev *zdev = to_zpci_dev(dev); |
|---|
| 173 | 172 | |
|---|
| 174 | | - if (IS_ERR(group)) |
|---|
| 175 | | - return PTR_ERR(group); |
|---|
| 176 | | - |
|---|
| 177 | | - iommu_group_put(group); |
|---|
| 178 | | - iommu_device_link(&zdev->iommu_dev, dev); |
|---|
| 179 | | - |
|---|
| 180 | | - return 0; |
|---|
| 173 | + return &zdev->iommu_dev; |
|---|
| 181 | 174 | } |
|---|
| 182 | 175 | |
|---|
| 183 | | -static void s390_iommu_remove_device(struct device *dev) |
|---|
| 176 | +static void s390_iommu_release_device(struct device *dev) |
|---|
| 184 | 177 | { |
|---|
| 185 | | - struct zpci_dev *zdev = to_pci_dev(dev)->sysdata; |
|---|
| 178 | + struct zpci_dev *zdev = to_zpci_dev(dev); |
|---|
| 186 | 179 | struct iommu_domain *domain; |
|---|
| 187 | 180 | |
|---|
| 188 | 181 | /* |
|---|
| .. | .. |
|---|
| 191 | 184 | * to vfio-pci and completing the VFIO_SET_IOMMU ioctl (which triggers |
|---|
| 192 | 185 | * the attach_dev), removing the device via |
|---|
| 193 | 186 | * "echo 1 > /sys/bus/pci/devices/.../remove" won't trigger detach_dev, |
|---|
| 194 | | - * only remove_device will be called via the BUS_NOTIFY_REMOVED_DEVICE |
|---|
| 187 | + * only release_device will be called via the BUS_NOTIFY_REMOVED_DEVICE |
|---|
| 195 | 188 | * notifier. |
|---|
| 196 | 189 | * |
|---|
| 197 | 190 | * So let's call detach_dev from here if it hasn't been called before. |
|---|
| .. | .. |
|---|
| 201 | 194 | if (domain) |
|---|
| 202 | 195 | s390_iommu_detach_device(domain, dev); |
|---|
| 203 | 196 | } |
|---|
| 204 | | - |
|---|
| 205 | | - iommu_device_unlink(&zdev->iommu_dev, dev); |
|---|
| 206 | | - iommu_group_remove_device(dev); |
|---|
| 207 | 197 | } |
|---|
| 208 | 198 | |
|---|
| 209 | 199 | static int s390_iommu_update_trans(struct s390_domain *s390_domain, |
|---|
| .. | .. |
|---|
| 265 | 255 | } |
|---|
| 266 | 256 | |
|---|
| 267 | 257 | static int s390_iommu_map(struct iommu_domain *domain, unsigned long iova, |
|---|
| 268 | | - phys_addr_t paddr, size_t size, int prot) |
|---|
| 258 | + phys_addr_t paddr, size_t size, int prot, gfp_t gfp) |
|---|
| 269 | 259 | { |
|---|
| 270 | 260 | struct s390_domain *s390_domain = to_s390_domain(domain); |
|---|
| 271 | 261 | int flags = ZPCI_PTE_VALID, rc = 0; |
|---|
| .. | .. |
|---|
| 314 | 304 | } |
|---|
| 315 | 305 | |
|---|
| 316 | 306 | static size_t s390_iommu_unmap(struct iommu_domain *domain, |
|---|
| 317 | | - unsigned long iova, size_t size) |
|---|
| 307 | + unsigned long iova, size_t size, |
|---|
| 308 | + struct iommu_iotlb_gather *gather) |
|---|
| 318 | 309 | { |
|---|
| 319 | 310 | struct s390_domain *s390_domain = to_s390_domain(domain); |
|---|
| 320 | 311 | int flags = ZPCI_PTE_INVALID; |
|---|
| .. | .. |
|---|
| 372 | 363 | .map = s390_iommu_map, |
|---|
| 373 | 364 | .unmap = s390_iommu_unmap, |
|---|
| 374 | 365 | .iova_to_phys = s390_iommu_iova_to_phys, |
|---|
| 375 | | - .add_device = s390_iommu_add_device, |
|---|
| 376 | | - .remove_device = s390_iommu_remove_device, |
|---|
| 366 | + .probe_device = s390_iommu_probe_device, |
|---|
| 367 | + .release_device = s390_iommu_release_device, |
|---|
| 377 | 368 | .device_group = generic_device_group, |
|---|
| 378 | 369 | .pgsize_bitmap = S390_IOMMU_PGSIZES, |
|---|
| 379 | 370 | }; |
|---|