powerpc/viobus: Free TCE table on device release

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>

authored by Nishanth Aravamudan and committed by Benjamin Herrenschmidt 45848e0f edea8f6f

+6 -1
+6 -1
arch/powerpc/kernel/vio.c
··· 1184 /* vio_dev refcount hit 0 */ 1185 static void __devinit vio_dev_release(struct device *dev) 1186 { 1187 - /* XXX should free TCE table */ 1188 of_node_put(dev->of_node); 1189 kfree(to_vio_dev(dev)); 1190 }
··· 1184 /* vio_dev refcount hit 0 */ 1185 static void __devinit vio_dev_release(struct device *dev) 1186 { 1187 + struct iommu_table *tbl = get_iommu_table_base(dev); 1188 + 1189 + /* iSeries uses a common table for all vio devices */ 1190 + if (!firmware_has_feature(FW_FEATURE_ISERIES) && tbl) 1191 + iommu_free_table(tbl, dev->of_node ? 1192 + dev->of_node->full_name : dev_name(dev)); 1193 of_node_put(dev->of_node); 1194 kfree(to_vio_dev(dev)); 1195 }