Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1651880

[PATCH v6 5/6] ACPI/IORT: Move the check to get iommu_ops from translated fwspec

From Sricharan R <sricharan@codeaurora.org>
Newsgroups linux.kernel
Subject [PATCH v6 5/6] ACPI/IORT: Move the check to get iommu_ops from translated fwspec
Date 2017-05-27 15:50 +0200
Message-ID <tLKgp-4Gs-9@gated-at.bofh.it> (permalink)
References <tLKgp-4Gs-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

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>
---
 drivers/acpi/arm64/iort.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index 16e101f..797b28d 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,
 	int ret = -ENODEV;
 	struct fwnode_handle *iort_fwnode;
 
-	/*
-	 * If we already translated the fwspec there
-	 * is nothing left to do, return the iommu_ops.
-	 */
-	ops = iort_fwspec_iommu_ops(dev->iommu_fwspec);
-	if (ops)
-		return ops;
-
 	if (node) {
 		iort_fwnode = iort_get_fwnode(node);
 		if (!iort_fwnode)
@@ -735,6 +727,14 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev)
 	u32 streamid = 0;
 	int err;
 
+	/*
+	 * If we already translated the fwspec there
+	 * is nothing left to do, return the iommu_ops.
+	 */
+	ops = iort_fwspec_iommu_ops(dev->iommu_fwspec);
+	if (ops)
+		return ops;
+
 	if (dev_is_pci(dev)) {
 		struct pci_bus *bus = to_pci_dev(dev)->bus;
 		u32 rid;
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v6 1/6] iommu: of: Fix check for returning EPROBE_DEFER Sricharan R <sricharan@codeaurora.org> - 2017-05-27 15:50 +0200
  [PATCH v6 5/6] ACPI/IORT: Move the check to get iommu_ops from translated fwspec Sricharan R <sricharan@codeaurora.org> - 2017-05-27 15:50 +0200
  [PATCH v6 3/6] ACPI/IORT: Ignore all errors except EPROBE_DEFER Sricharan R <sricharan@codeaurora.org> - 2017-05-27 15:50 +0200
    Re: [PATCH v6 3/6] ACPI/IORT: Ignore all errors except EPROBE_DEFER "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-05-27 21:30 +0200
      Re: [PATCH v6 3/6] ACPI/IORT: Ignore all errors except EPROBE_DEFER Sricharan R <sricharan@codeaurora.org> - 2017-05-29 07:10 +0200
        Re: [PATCH v6 3/6] ACPI/IORT: Ignore all errors except EPROBE_DEFER Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2017-05-30 11:10 +0200
  [PATCH v6 6/6] arm: dma-mapping: Reset the device's dma_ops Sricharan R <sricharan@codeaurora.org> - 2017-05-27 15:50 +0200
  [PATCH v6 4/6] ARM: dma-mapping: Don't tear down third-party mappings Sricharan R <sricharan@codeaurora.org> - 2017-05-27 15:50 +0200
  [PATCH v6 2/6] iommu: of: Ignore all errors except EPROBE_DEFER Sricharan R <sricharan@codeaurora.org> - 2017-05-27 16:00 +0200
  Re: [PATCH v6 1/6] iommu: of: Fix check for returning EPROBE_DEFER Joerg Roedel <joro@8bytes.org> - 2017-05-30 11:40 +0200

csiph-web