]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
powerpc/viobus: Free TCE table on device release
authorNishanth Aravamudan <nacc@us.ibm.com>
Wed, 15 Sep 2010 08:05:48 +0000 (08:05 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 13 Oct 2010 05:19:21 +0000 (16:19 +1100)
Release the TCE table as the XXX suggests, except on FW_FEATURE_ISERIES,
where the tables are allocated globally and reused.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/vio.c

index 72db4b0217624c1484b3fd08f4f7d48212e0503b..d692989a4318273c06fc1fdc024448afd15d322d 100644 (file)
@@ -1184,7 +1184,12 @@ EXPORT_SYMBOL(vio_unregister_driver);
 /* vio_dev refcount hit 0 */
 static void __devinit vio_dev_release(struct device *dev)
 {
-       /* XXX should free TCE table */
+       struct iommu_table *tbl = get_iommu_table_base(dev);
+
+       /* iSeries uses a common table for all vio devices */
+       if (!firmware_has_feature(FW_FEATURE_ISERIES) && tbl)
+               iommu_free_table(tbl, dev->of_node ?
+                       dev->of_node->full_name : dev_name(dev));
        of_node_put(dev->of_node);
        kfree(to_vio_dev(dev));
 }