aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorOhad Ben-Cohen <ohad@wizery.com>2011-09-13 15:26:29 -0400
committerJoerg Roedel <joerg.roedel@amd.com>2011-09-14 09:36:35 -0400
commite7f10f02efca2e4c2372bbe4b785959533819919 (patch)
treeec739418369c0fbbf0eec1871f06bf25f984d0e0 /drivers
parent4f3f8d9db359bbc780d482849f2a9c8b12f910b6 (diff)
iommu/omap: Migrate to the generic fault report mechanism
Start using the generic fault report mechanism, as provided by the IOMMU core, and remove its now-redundant omap_iommu_set_isr API. Currently we're only interested in letting upper layers know about the fault, so in case the faulting device is a remote processor, they could restart it. Dynamic PTE/TLB loading is not supported. Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iommu/omap-iommu.c31
1 files changed, 3 insertions, 28 deletions
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index bd5f6064c74a..7e0188f5cdcd 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -775,6 +775,7 @@ static irqreturn_t iommu_fault_handler(int irq, void *data)
775 u32 da, errs; 775 u32 da, errs;
776 u32 *iopgd, *iopte; 776 u32 *iopgd, *iopte;
777 struct omap_iommu *obj = data; 777 struct omap_iommu *obj = data;
778 struct iommu_domain *domain = obj->domain;
778 779
779 if (!obj->refcount) 780 if (!obj->refcount)
780 return IRQ_NONE; 781 return IRQ_NONE;
@@ -786,7 +787,7 @@ static irqreturn_t iommu_fault_handler(int irq, void *data)
786 return IRQ_HANDLED; 787 return IRQ_HANDLED;
787 788
788 /* Fault callback or TLB/PTE Dynamic loading */ 789 /* Fault callback or TLB/PTE Dynamic loading */
789 if (obj->isr && !obj->isr(obj, da, errs, obj->isr_priv)) 790 if (!report_iommu_fault(domain, obj->dev, da, 0))
790 return IRQ_HANDLED; 791 return IRQ_HANDLED;
791 792
792 iommu_disable(obj); 793 iommu_disable(obj);
@@ -904,33 +905,6 @@ static void omap_iommu_detach(struct omap_iommu *obj)
904 dev_dbg(obj->dev, "%s: %s\n", __func__, obj->name); 905 dev_dbg(obj->dev, "%s: %s\n", __func__, obj->name);
905} 906}
906 907
907int omap_iommu_set_isr(const char *name,
908 int (*isr)(struct omap_iommu *obj, u32 da, u32 iommu_errs,
909 void *priv),
910 void *isr_priv)
911{
912 struct device *dev;
913 struct omap_iommu *obj;
914
915 dev = driver_find_device(&omap_iommu_driver.driver, NULL, (void *)name,
916 device_match_by_alias);
917 if (!dev)
918 return -ENODEV;
919
920 obj = to_iommu(dev);
921 spin_lock(&obj->iommu_lock);
922 if (obj->refcount != 0) {
923 spin_unlock(&obj->iommu_lock);
924 return -EBUSY;
925 }
926 obj->isr = isr;
927 obj->isr_priv = isr_priv;
928 spin_unlock(&obj->iommu_lock);
929
930 return 0;
931}
932EXPORT_SYMBOL_GPL(omap_iommu_set_isr);
933
934/* 908/*
935 * OMAP Device MMU(IOMMU) detection 909 * OMAP Device MMU(IOMMU) detection
936 */ 910 */
@@ -1115,6 +1089,7 @@ omap_iommu_attach_dev(struct iommu_domain *domain, struct device *dev)
1115 } 1089 }
1116 1090
1117 omap_domain->iommu_dev = oiommu; 1091 omap_domain->iommu_dev = oiommu;
1092 oiommu->domain = domain;
1118 1093
1119out: 1094out:
1120 spin_unlock(&omap_domain->lock); 1095 spin_unlock(&omap_domain->lock);