Skip to content

Commit b6f8887

Browse files
niklas88joergroedel
authored andcommitted
s390/pci: prepare is_passed_through() for dma-iommu
With the IOMMU always controlled through the IOMMU driver testing for zdev->s390_domain is not a valid indication of the device being passed-through. Instead test if zdev->kzdev is set. Reviewed-by: Pierre Morel <[email protected]> Reviewed-by: Matthew Rosato <[email protected]> Signed-off-by: Niklas Schnelle <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent fa4c450 commit b6f8887

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

arch/s390/pci/pci_event.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,16 @@ static inline bool ers_result_indicates_abort(pci_ers_result_t ers_res)
5959
}
6060
}
6161

62-
static bool is_passed_through(struct zpci_dev *zdev)
62+
static bool is_passed_through(struct pci_dev *pdev)
6363
{
64-
return zdev->s390_domain;
64+
struct zpci_dev *zdev = to_zpci(pdev);
65+
bool ret;
66+
67+
mutex_lock(&zdev->kzdev_lock);
68+
ret = !!zdev->kzdev;
69+
mutex_unlock(&zdev->kzdev_lock);
70+
71+
return ret;
6572
}
6673

6774
static bool is_driver_supported(struct pci_driver *driver)
@@ -176,7 +183,7 @@ static pci_ers_result_t zpci_event_attempt_error_recovery(struct pci_dev *pdev)
176183
}
177184
pdev->error_state = pci_channel_io_frozen;
178185

179-
if (is_passed_through(to_zpci(pdev))) {
186+
if (is_passed_through(pdev)) {
180187
pr_info("%s: Cannot be recovered in the host because it is a pass-through device\n",
181188
pci_name(pdev));
182189
goto out_unlock;
@@ -239,7 +246,7 @@ static void zpci_event_io_failure(struct pci_dev *pdev, pci_channel_state_t es)
239246
* we will inject the error event and let the guest recover the device
240247
* itself.
241248
*/
242-
if (is_passed_through(to_zpci(pdev)))
249+
if (is_passed_through(pdev))
243250
goto out;
244251
driver = to_pci_driver(pdev->dev.driver);
245252
if (driver && driver->err_handler && driver->err_handler->error_detected)

0 commit comments

Comments
 (0)