hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/iommu/s390-iommu.c
....@@ -87,7 +87,7 @@
8787 struct device *dev)
8888 {
8989 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);
9191 struct s390_domain_device *domain_device;
9292 unsigned long flags;
9393 int rc;
....@@ -139,7 +139,7 @@
139139 struct device *dev)
140140 {
141141 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);
143143 struct s390_domain_device *domain_device, *tmp;
144144 unsigned long flags;
145145 int found = 0;
....@@ -166,23 +166,16 @@
166166 }
167167 }
168168
169
-static int s390_iommu_add_device(struct device *dev)
169
+static struct iommu_device *s390_iommu_probe_device(struct device *dev)
170170 {
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);
173172
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;
181174 }
182175
183
-static void s390_iommu_remove_device(struct device *dev)
176
+static void s390_iommu_release_device(struct device *dev)
184177 {
185
- struct zpci_dev *zdev = to_pci_dev(dev)->sysdata;
178
+ struct zpci_dev *zdev = to_zpci_dev(dev);
186179 struct iommu_domain *domain;
187180
188181 /*
....@@ -191,7 +184,7 @@
191184 * to vfio-pci and completing the VFIO_SET_IOMMU ioctl (which triggers
192185 * the attach_dev), removing the device via
193186 * "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
195188 * notifier.
196189 *
197190 * So let's call detach_dev from here if it hasn't been called before.
....@@ -201,9 +194,6 @@
201194 if (domain)
202195 s390_iommu_detach_device(domain, dev);
203196 }
204
-
205
- iommu_device_unlink(&zdev->iommu_dev, dev);
206
- iommu_group_remove_device(dev);
207197 }
208198
209199 static int s390_iommu_update_trans(struct s390_domain *s390_domain,
....@@ -265,7 +255,7 @@
265255 }
266256
267257 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)
269259 {
270260 struct s390_domain *s390_domain = to_s390_domain(domain);
271261 int flags = ZPCI_PTE_VALID, rc = 0;
....@@ -314,7 +304,8 @@
314304 }
315305
316306 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)
318309 {
319310 struct s390_domain *s390_domain = to_s390_domain(domain);
320311 int flags = ZPCI_PTE_INVALID;
....@@ -372,8 +363,8 @@
372363 .map = s390_iommu_map,
373364 .unmap = s390_iommu_unmap,
374365 .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,
377368 .device_group = generic_device_group,
378369 .pgsize_bitmap = S390_IOMMU_PGSIZES,
379370 };