diff options
author | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 2017-05-27 09:47:44 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2017-05-30 05:31:33 -0400 |
commit | 4dac3210c54a04be9c187dd31b4debb46e3d792b (patch) | |
tree | 7b1cef9d31c8af430ec7bd066cd7ddc60204d4b2 | |
parent | a93a121a96531b99d6feb8db96417b49e1bb28e8 (diff) |
ACPI/IORT: Move the check to get iommu_ops from translated fwspec
With IOMMU probe deferral, iort_iommu_configure can be called
multiple times for the same device. Hence we have a check
to see if the device's fwspec is already translated and return
the iommu_ops from that directly. But the check is wrongly
placed in iort_iommu_xlate, which breaks devices with multiple
sids. Move the check to iort_iommu_configure.
Fixes: 5a1bb638d567 ("drivers: acpi: Handle IOMMU lookup failure with deferred probing or error")
Tested-by: Nate Watterson <nwatters@codeaurora.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r-- | drivers/acpi/arm64/iort.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index 16e101f1f69d..797b28dc7b34 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c | |||
@@ -666,14 +666,6 @@ static const struct iommu_ops *iort_iommu_xlate(struct device *dev, | |||
666 | int ret = -ENODEV; | 666 | int ret = -ENODEV; |
667 | struct fwnode_handle *iort_fwnode; | 667 | struct fwnode_handle *iort_fwnode; |
668 | 668 | ||
669 | /* | ||
670 | * If we already translated the fwspec there | ||
671 | * is nothing left to do, return the iommu_ops. | ||
672 | */ | ||
673 | ops = iort_fwspec_iommu_ops(dev->iommu_fwspec); | ||
674 | if (ops) | ||
675 | return ops; | ||
676 | |||
677 | if (node) { | 669 | if (node) { |
678 | iort_fwnode = iort_get_fwnode(node); | 670 | iort_fwnode = iort_get_fwnode(node); |
679 | if (!iort_fwnode) | 671 | if (!iort_fwnode) |
@@ -735,6 +727,14 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev) | |||
735 | u32 streamid = 0; | 727 | u32 streamid = 0; |
736 | int err; | 728 | int err; |
737 | 729 | ||
730 | /* | ||
731 | * If we already translated the fwspec there | ||
732 | * is nothing left to do, return the iommu_ops. | ||
733 | */ | ||
734 | ops = iort_fwspec_iommu_ops(dev->iommu_fwspec); | ||
735 | if (ops) | ||
736 | return ops; | ||
737 | |||
738 | if (dev_is_pci(dev)) { | 738 | if (dev_is_pci(dev)) { |
739 | struct pci_bus *bus = to_pci_dev(dev)->bus; | 739 | struct pci_bus *bus = to_pci_dev(dev)->bus; |
740 | u32 rid; | 740 | u32 rid; |