vserver 2.0 rc7
[linux-2.6.git] / arch / ppc64 / kernel / pSeries_iommu.c
index 5f05d60..6913052 100644 (file)
@@ -43,6 +43,7 @@
 #include <asm/machdep.h>
 #include <asm/abs_addr.h>
 #include <asm/plpar_wrappers.h>
+#include <asm/pSeries_reconfig.h>
 #include <asm/systemcfg.h>
 #include "pci.h"
 
@@ -457,6 +458,28 @@ static void iommu_dev_setup_pSeries(struct pci_dev *dev)
        }
 }
 
+static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
+{
+       int err = NOTIFY_OK;
+       struct device_node *np = node;
+
+       switch (action) {
+       case PSERIES_RECONFIG_REMOVE:
+               if (np->iommu_table &&
+                   get_property(np, "ibm,dma-window", NULL))
+                       iommu_free_table(np);
+               break;
+       default:
+               err = NOTIFY_DONE;
+               break;
+       }
+       return err;
+}
+
+static struct notifier_block iommu_reconfig_nb = {
+       .notifier_call = iommu_reconfig_notifier,
+};
+
 static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
 {
        struct device_node *pdn, *dn;
@@ -540,6 +563,8 @@ void iommu_init_early_pSeries(void)
        }
 
 
+       pSeries_reconfig_notifier_register(&iommu_reconfig_nb);
+
        pci_iommu_init();
 }