The DMA API debug code has hooks to verify all DMA entries have been
freed at time of hot unplug. We need to call dma_debug_add_bus for
this to work.

Signed-off-by: Anton Blanchard <an...@samba.org>  
---

Index: linux-build/arch/powerpc/kernel/vio.c
===================================================================
--- linux-build.orig/arch/powerpc/kernel/vio.c  2012-06-08 09:16:53.856359566 
+1000
+++ linux-build/arch/powerpc/kernel/vio.c       2012-06-08 09:17:43.625089518 
+1000
@@ -37,8 +37,6 @@
 #include <asm/page.h>
 #include <asm/hvcall.h>
 
-static struct bus_type vio_bus_type;
-
 static struct vio_dev vio_bus_device  = { /* fake "parent" device */
        .name = "vio",
        .type = "",
@@ -1580,7 +1578,7 @@ static int vio_hotplug(struct device *de
        return 0;
 }
 
-static struct bus_type vio_bus_type = {
+struct bus_type vio_bus_type = {
        .name = "vio",
        .dev_attrs = vio_dev_attrs,
        .uevent = vio_hotplug,
Index: linux-build/arch/powerpc/kernel/dma.c
===================================================================
--- linux-build.orig/arch/powerpc/kernel/dma.c  2012-06-08 09:12:47.356758198 
+1000
+++ linux-build/arch/powerpc/kernel/dma.c       2012-06-08 09:17:43.625089518 
+1000
@@ -11,6 +11,8 @@
 #include <linux/gfp.h>
 #include <linux/memblock.h>
 #include <linux/export.h>
+#include <linux/pci.h>
+#include <asm/vio.h>
 #include <asm/bug.h>
 #include <asm/abs_addr.h>
 #include <asm/machdep.h>
@@ -205,7 +207,13 @@ EXPORT_SYMBOL_GPL(dma_get_required_mask)
 
 static int __init dma_init(void)
 {
-       dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
+       dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
+#ifdef CONFIG_PCI
+       dma_debug_add_bus(&pci_bus_type);
+#endif
+#ifdef CONFIG_IBMVIO
+       dma_debug_add_bus(&vio_bus_type);
+#endif
 
        return 0;
 }
Index: linux-build/arch/powerpc/include/asm/vio.h
===================================================================
--- linux-build.orig/arch/powerpc/include/asm/vio.h     2012-06-08 
09:12:47.344758025 +1000
+++ linux-build/arch/powerpc/include/asm/vio.h  2012-06-08 09:17:43.625089518 
+1000
@@ -44,6 +44,8 @@
  */
 #define VIO_CMO_MIN_ENT 1562624
 
+extern struct bus_type vio_bus_type;
+
 struct iommu_table;
 
 /*
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to