All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 02/15] ppc64: fix dma_iommu_dma_supported compare
       [not found] <1284573958-8397-1-git-send-email-nacc@us.ibm.com>
@ 2010-09-15 18:05 ` Nishanth Aravamudan
  2010-09-15 18:05 ` [PATCH 03/15] ppc64 iommu: fix check for direct DMA support Nishanth Aravamudan
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 33+ messages in thread
From: Nishanth Aravamudan @ 2010-09-15 18:05 UTC (permalink / raw)
  To: nacc; +Cc: linuxppc-dev, Paul Mackerras, Milton Miller

The table offset is in entries, each of which imply a dma address of
an IOMMU page.

Also, we should check the device can reach the whole IOMMU table.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
 arch/powerpc/kernel/dma-iommu.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
index 37771a5..6e54a0f 100644
--- a/arch/powerpc/kernel/dma-iommu.c
+++ b/arch/powerpc/kernel/dma-iommu.c
@@ -74,16 +74,17 @@ static int dma_iommu_dma_supported(struct device *dev, u64 mask)
 {
 	struct iommu_table *tbl = get_iommu_table_base(dev);
 
-	if (!tbl || tbl->it_offset > mask) {
-		printk(KERN_INFO
-		       "Warning: IOMMU offset too big for device mask\n");
-		if (tbl)
-			printk(KERN_INFO
-			       "mask: 0x%08llx, table offset: 0x%08lx\n",
-				mask, tbl->it_offset);
-		else
-			printk(KERN_INFO "mask: 0x%08llx, table unavailable\n",
-				mask);
+	if (!tbl) {
+		dev_info(dev, "Warning: IOMMU dma not supported: mask 0x%08llx"
+			", table unavailable\n", mask);
+		return 0;
+	}
+
+	if ((tbl->it_offset + tbl->it_size) > (mask >> IOMMU_PAGE_SHIFT)) {
+		dev_info(dev, "Warning: IOMMU window too big for device mask\n");
+		dev_info(dev, "mask: 0x%08llx, table end: 0x%08lx\n",
+				mask, (tbl->it_offset + tbl->it_size) <<
+				IOMMU_PAGE_SHIFT);
 		return 0;
 	} else
 		return 1;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 03/15] ppc64 iommu: fix check for direct DMA support
       [not found] <1284573958-8397-1-git-send-email-nacc@us.ibm.com>
  2010-09-15 18:05 ` [PATCH 02/15] ppc64: fix dma_iommu_dma_supported compare Nishanth Aravamudan
@ 2010-09-15 18:05 ` Nishanth Aravamudan
  2010-09-15 18:05 ` [PATCH 04/15] vio: put device on device_register failure Nishanth Aravamudan
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 33+ messages in thread
From: Nishanth Aravamudan @ 2010-09-15 18:05 UTC (permalink / raw)
  To: nacc
  Cc: Milton Miller, FUJITA Tomonori, Paul Mackerras, H. Peter Anvin,
	Andrew Morton, linuxppc-dev

The current check is wrong because it does not take the DMA offset intot
account, and in the case of a driver which doesn't actually support
64bits would falsely report that device as working.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
 arch/powerpc/kernel/dma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index 84d6367..494ab12 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -89,7 +89,7 @@ static int dma_direct_dma_supported(struct device *dev, u64 mask)
 	/* Could be improved so platforms can set the limit in case
 	 * they have limited DMA windows
 	 */
-	return mask >= (memblock_end_of_DRAM() - 1);
+	return mask >= get_dma_offset(dev) + (memblock_end_of_DRAM() - 1);
 #else
 	return 1;
 #endif
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 04/15] vio: put device on device_register failure
       [not found] <1284573958-8397-1-git-send-email-nacc@us.ibm.com>
  2010-09-15 18:05 ` [PATCH 02/15] ppc64: fix dma_iommu_dma_supported compare Nishanth Aravamudan
  2010-09-15 18:05 ` [PATCH 03/15] ppc64 iommu: fix check for direct DMA support Nishanth Aravamudan
@ 2010-09-15 18:05 ` Nishanth Aravamudan
  2010-09-15 18:29   ` Grant Likely
  2010-09-15 18:05 ` [PATCH 05/15] viobus: free TCE table on device release Nishanth Aravamudan
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 33+ messages in thread
From: Nishanth Aravamudan @ 2010-09-15 18:05 UTC (permalink / raw)
  To: nacc; +Cc: Milton Miller, Paul Mackerras, Brian King, linuxppc-dev

The kernel doc for device_register (and device_initialize) very clearly
state to call put_device not kfree after calling, even on error.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
 arch/powerpc/kernel/vio.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index fa3469d..72db4b0 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -1254,8 +1254,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
 	if (device_register(&viodev->dev)) {
 		printk(KERN_ERR "%s: failed to register device %s\n",
 				__func__, dev_name(&viodev->dev));
-		/* XXX free TCE table */
-		kfree(viodev);
+		put_device(&viodev->dev);
 		return NULL;
 	}
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 05/15] viobus: free TCE table on device release
       [not found] <1284573958-8397-1-git-send-email-nacc@us.ibm.com>
                   ` (2 preceding siblings ...)
  2010-09-15 18:05 ` [PATCH 04/15] vio: put device on device_register failure Nishanth Aravamudan
@ 2010-09-15 18:05 ` Nishanth Aravamudan
  2010-09-15 18:05 ` [PATCH 06/15] pseries/dlpar: use kmemdup Nishanth Aravamudan
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 33+ messages in thread
From: Nishanth Aravamudan @ 2010-09-15 18:05 UTC (permalink / raw)
  To: nacc; +Cc: Milton Miller, Paul Mackerras, Brian King, linuxppc-dev

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>
---
 arch/powerpc/kernel/vio.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 72db4b0..d692989 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -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));
 }
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 06/15] pseries/dlpar: use kmemdup
       [not found] <1284573958-8397-1-git-send-email-nacc@us.ibm.com>
                   ` (3 preceding siblings ...)
  2010-09-15 18:05 ` [PATCH 05/15] viobus: free TCE table on device release Nishanth Aravamudan
@ 2010-09-15 18:05 ` Nishanth Aravamudan
  2010-09-15 18:05 ` [PATCH 07/15] ppc: pci-common cleanup Nishanth Aravamudan
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 33+ messages in thread
From: Nishanth Aravamudan @ 2010-09-15 18:05 UTC (permalink / raw)
  To: nacc
  Cc: Gautham R Shenoy, Milton Miller, Julia Lawall, Paul Mackerras,
	linuxppc-dev

While looking at some code paths I came across this code that zeros
memory then copies over the entire length.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
 arch/powerpc/platforms/pseries/dlpar.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 72d8054..6004c81 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -55,13 +55,12 @@ static struct property *dlpar_parse_cc_property(struct cc_workarea *ccwa)
 
 	prop->length = ccwa->prop_length;
 	value = (char *)ccwa + ccwa->prop_offset;
-	prop->value = kzalloc(prop->length, GFP_KERNEL);
+	prop->value = kmemdup(value, prop->length, GFP_KERNEL);
 	if (!prop->value) {
 		dlpar_free_cc_property(prop);
 		return NULL;
 	}
 
-	memcpy(prop->value, value, prop->length);
 	return prop;
 }
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 07/15] ppc: pci-common cleanup
       [not found] <1284573958-8397-1-git-send-email-nacc@us.ibm.com>
                   ` (4 preceding siblings ...)
  2010-09-15 18:05 ` [PATCH 06/15] pseries/dlpar: use kmemdup Nishanth Aravamudan
@ 2010-09-15 18:05 ` Nishanth Aravamudan
  2010-09-15 18:30   ` Grant Likely
  2010-09-15 18:05 ` [PATCH 09/15] ppc/vio: use dma ops helpers Nishanth Aravamudan
                   ` (7 subsequent siblings)
  13 siblings, 1 reply; 33+ messages in thread
From: Nishanth Aravamudan @ 2010-09-15 18:05 UTC (permalink / raw)
  To: nacc
  Cc: Dominik Brodowski, Milton Miller, Paul Mackerras, Jesse Barnes,
	linuxppc-dev, Bjorn Helgaas

Use set_dma_ops and remove unused oddly-named temp pointer sd.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
 arch/powerpc/kernel/pci-common.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 9021c4a..10a44e6 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1090,8 +1090,6 @@ void __devinit pcibios_setup_bus_devices(struct pci_bus *bus)
 		 bus->number, bus->self ? pci_name(bus->self) : "PHB");
 
 	list_for_each_entry(dev, &bus->devices, bus_list) {
-		struct dev_archdata *sd = &dev->dev.archdata;
-
 		/* Cardbus can call us to add new devices to a bus, so ignore
 		 * those who are already fully discovered
 		 */
@@ -1107,7 +1105,7 @@ void __devinit pcibios_setup_bus_devices(struct pci_bus *bus)
 		set_dev_node(&dev->dev, pcibus_to_node(dev->bus));
 
 		/* Hook up default DMA ops */
-		sd->dma_ops = pci_dma_ops;
+		set_dma_ops(&dev->dev, pci_dma_ops);
 		set_dma_offset(&dev->dev, PCI_DRAM_OFFSET);
 
 		/* Additional platform DMA/iommu setup */
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 09/15] ppc/vio: use dma ops helpers
       [not found] <1284573958-8397-1-git-send-email-nacc@us.ibm.com>
                   ` (5 preceding siblings ...)
  2010-09-15 18:05 ` [PATCH 07/15] ppc: pci-common cleanup Nishanth Aravamudan
@ 2010-09-15 18:05 ` Nishanth Aravamudan
  2010-09-15 18:33   ` Grant Likely
  2010-09-15 18:05 ` [PATCH 10/15] ppc/pasemi: clean up pasemi iommu table initializations Nishanth Aravamudan
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 33+ messages in thread
From: Nishanth Aravamudan @ 2010-09-15 18:05 UTC (permalink / raw)
  To: nacc; +Cc: Milton Miller, Paul Mackerras, Brian King, linuxppc-dev

Use the set_dma_ops helper. Instead of modifying vio_dma_mapping_ops,
just create a trivial wrapper for dma_supported.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
 arch/powerpc/kernel/vio.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index d692989..3c3083f 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -602,6 +602,11 @@ static void vio_dma_iommu_unmap_sg(struct device *dev,
 	vio_cmo_dealloc(viodev, alloc_size);
 }
 
+static int vio_dma_iommu_dma_supported(struct device *dev, u64 mask)
+{
+        return dma_iommu_ops.dma_supported(dev, mask);
+}
+
 struct dma_map_ops vio_dma_mapping_ops = {
 	.alloc_coherent = vio_dma_iommu_alloc_coherent,
 	.free_coherent  = vio_dma_iommu_free_coherent,
@@ -609,6 +614,7 @@ struct dma_map_ops vio_dma_mapping_ops = {
 	.unmap_sg       = vio_dma_iommu_unmap_sg,
 	.map_page       = vio_dma_iommu_map_page,
 	.unmap_page     = vio_dma_iommu_unmap_page,
+	.dma_supported  = vio_dma_iommu_dma_supported,
 
 };
 
@@ -860,8 +866,7 @@ static void vio_cmo_bus_remove(struct vio_dev *viodev)
 
 static void vio_cmo_set_dma_ops(struct vio_dev *viodev)
 {
-	vio_dma_mapping_ops.dma_supported = dma_iommu_ops.dma_supported;
-	viodev->dev.archdata.dma_ops = &vio_dma_mapping_ops;
+	set_dma_ops(&viodev->dev, &vio_dma_mapping_ops);
 }
 
 /**
@@ -1246,7 +1251,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
 	if (firmware_has_feature(FW_FEATURE_CMO))
 		vio_cmo_set_dma_ops(viodev);
 	else
-		viodev->dev.archdata.dma_ops = &dma_iommu_ops;
+		set_dma_ops(&viodev->dev, &dma_iommu_ops);
 	set_iommu_table_base(&viodev->dev, vio_build_iommu_table(viodev));
 	set_dev_node(&viodev->dev, of_node_to_nid(of_node));
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 10/15] ppc/pasemi: clean up pasemi iommu table initializations
       [not found] <1284573958-8397-1-git-send-email-nacc@us.ibm.com>
                   ` (6 preceding siblings ...)
  2010-09-15 18:05 ` [PATCH 09/15] ppc/vio: use dma ops helpers Nishanth Aravamudan
@ 2010-09-15 18:05 ` Nishanth Aravamudan
  2010-09-15 18:29   ` Olof Johansson
  2010-09-15 18:05 ` [PATCH 11/15] ppc/cell: beat dma ops cleanup Nishanth Aravamudan
                   ` (5 subsequent siblings)
  13 siblings, 1 reply; 33+ messages in thread
From: Nishanth Aravamudan @ 2010-09-15 18:05 UTC (permalink / raw)
  To: nacc
  Cc: linuxppc-dev, Milton Miller, Paul Mackerras, Olof Johansson, Yinghai Lu

No need for empty helpers with iommu off, the ppc_md hooks are optional.

The direct_dma_ops are the default pci_dma_ops, so no need to set in the
them iommu off case.

No need to set the device tree device_node pci node iommu pointer, its
only used for dlpar remove.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
 arch/powerpc/platforms/pasemi/iommu.c |   19 +------------------
 1 files changed, 1 insertions(+), 18 deletions(-)

diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c
index 1f9fb2c..14943ef 100644
--- a/arch/powerpc/platforms/pasemi/iommu.c
+++ b/arch/powerpc/platforms/pasemi/iommu.c
@@ -156,20 +156,12 @@ static void iommu_table_iobmap_setup(void)
 
 static void pci_dma_bus_setup_pasemi(struct pci_bus *bus)
 {
-	struct device_node *dn;
-
 	pr_debug("pci_dma_bus_setup, bus %p, bus->self %p\n", bus, bus->self);
 
 	if (!iommu_table_iobmap_inited) {
 		iommu_table_iobmap_inited = 1;
 		iommu_table_iobmap_setup();
 	}
-
-	dn = pci_bus_to_OF_node(bus);
-
-	if (dn)
-		PCI_DN(dn)->iommu_table = &iommu_table_iobmap;
-
 }
 
 
@@ -192,9 +184,6 @@ static void pci_dma_dev_setup_pasemi(struct pci_dev *dev)
 	set_iommu_table_base(&dev->dev, &iommu_table_iobmap);
 }
 
-static void pci_dma_bus_setup_null(struct pci_bus *b) { }
-static void pci_dma_dev_setup_null(struct pci_dev *d) { }
-
 int __init iob_init(struct device_node *dn)
 {
 	unsigned long tmp;
@@ -251,14 +240,8 @@ void __init iommu_init_early_pasemi(void)
 	iommu_off = of_chosen &&
 			of_get_property(of_chosen, "linux,iommu-off", NULL);
 #endif
-	if (iommu_off) {
-		/* Direct I/O, IOMMU off */
-		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_null;
-		ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_null;
-		set_pci_dma_ops(&dma_direct_ops);
-
+	if (iommu_off)
 		return;
-	}
 
 	iob_init(NULL);
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 11/15] ppc/cell: beat dma ops cleanup
       [not found] <1284573958-8397-1-git-send-email-nacc@us.ibm.com>
                   ` (7 preceding siblings ...)
  2010-09-15 18:05 ` [PATCH 10/15] ppc/pasemi: clean up pasemi iommu table initializations Nishanth Aravamudan
@ 2010-09-15 18:05 ` Nishanth Aravamudan
  2010-09-16 11:23   ` Arnd Bergmann
  2010-09-15 18:05 ` [PATCH 12/15] ppc/dart: iommu table cleanup Nishanth Aravamudan
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 33+ messages in thread
From: Nishanth Aravamudan @ 2010-09-15 18:05 UTC (permalink / raw)
  To: nacc
  Cc: cbe-oss-dev, Arnd Bergmann, Milton Miller, Paul Mackerras,
	linuxppc-dev, David S. Miller

direct_dma_ops is the default pci dma ops.

No need to call a function to get the pci dma ops, we know they are the
dma_direct_ops.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
 arch/powerpc/platforms/cell/beat_iommu.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/cell/beat_iommu.c b/arch/powerpc/platforms/cell/beat_iommu.c
index beec405..3ce6855 100644
--- a/arch/powerpc/platforms/cell/beat_iommu.c
+++ b/arch/powerpc/platforms/cell/beat_iommu.c
@@ -76,7 +76,7 @@ static void __init celleb_init_direct_mapping(void)
 
 static void celleb_dma_dev_setup(struct device *dev)
 {
-	dev->archdata.dma_ops = get_pci_dma_ops();
+	set_dma_ops(dev, &dma_direct_ops);
 	set_dma_offset(dev, celleb_dma_direct_offset);
 }
 
@@ -106,7 +106,6 @@ static struct notifier_block celleb_of_bus_notifier = {
 static int __init celleb_init_iommu(void)
 {
 	celleb_init_direct_mapping();
-	set_pci_dma_ops(&dma_direct_ops);
 	ppc_md.pci_dma_dev_setup = celleb_pci_dma_dev_setup;
 	bus_register_notifier(&platform_bus_type, &celleb_of_bus_notifier);
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 12/15] ppc/dart: iommu table cleanup
       [not found] <1284573958-8397-1-git-send-email-nacc@us.ibm.com>
                   ` (8 preceding siblings ...)
  2010-09-15 18:05 ` [PATCH 11/15] ppc/cell: beat dma ops cleanup Nishanth Aravamudan
@ 2010-09-15 18:05 ` Nishanth Aravamudan
  2010-09-15 18:05 ` [PATCH 13/15] ppc/pseries: iommu cleanup Nishanth Aravamudan
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 33+ messages in thread
From: Nishanth Aravamudan @ 2010-09-15 18:05 UTC (permalink / raw)
  To: nacc
  Cc: Jiri Kosina, Milton Miller, André Goddard Rosa,
	Paul Mackerras, H. Peter Anvin, linuxppc-dev

No need to set the device tree device_node pci node iommu pointer, its
only used for dlpar remove.

direct_dma_ops are the default, no need to restore them or dma bus ops
if we haven't set them in the error paths.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
 arch/powerpc/sysdev/dart_iommu.c |   18 +-----------------
 1 files changed, 1 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 559db2b..64fe9c7 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -302,17 +302,10 @@ static void pci_dma_dev_setup_dart(struct pci_dev *dev)
 
 static void pci_dma_bus_setup_dart(struct pci_bus *bus)
 {
-	struct device_node *dn;
-
 	if (!iommu_table_dart_inited) {
 		iommu_table_dart_inited = 1;
 		iommu_table_dart_setup();
 	}
-
-	dn = pci_bus_to_OF_node(bus);
-
-	if (dn)
-		PCI_DN(dn)->iommu_table = &iommu_table_dart;
 }
 
 void __init iommu_init_early_dart(void)
@@ -324,7 +317,7 @@ void __init iommu_init_early_dart(void)
 	if (dn == NULL) {
 		dn = of_find_compatible_node(NULL, "dart", "u4-dart");
 		if (dn == NULL)
-			goto bail;
+			return;	/* use default direct_dma_ops */
 		dart_is_u4 = 1;
 	}
 
@@ -340,16 +333,7 @@ void __init iommu_init_early_dart(void)
 
 		/* Setup pci_dma ops */
 		set_pci_dma_ops(&dma_iommu_ops);
-		return;
 	}
-
- bail:
-	/* If init failed, use direct iommu and null setup functions */
-	ppc_md.pci_dma_dev_setup = NULL;
-	ppc_md.pci_dma_bus_setup = NULL;
-
-	/* Setup pci_dma ops */
-	set_pci_dma_ops(&dma_direct_ops);
 }
 
 #ifdef CONFIG_PM
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 13/15] ppc/pseries: iommu cleanup
       [not found] <1284573958-8397-1-git-send-email-nacc@us.ibm.com>
                   ` (9 preceding siblings ...)
  2010-09-15 18:05 ` [PATCH 12/15] ppc/dart: iommu table cleanup Nishanth Aravamudan
@ 2010-09-15 18:05 ` Nishanth Aravamudan
       [not found]   ` <1284573958-8397-14-git-send-email-nacc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
  2010-09-15 18:05 ` [PATCH 14/15] ppc64 iommu: use coherent_dma_mask for alloc_coherent Nishanth Aravamudan
                   ` (2 subsequent siblings)
  13 siblings, 1 reply; 33+ messages in thread
From: Nishanth Aravamudan @ 2010-09-15 18:05 UTC (permalink / raw)
  To: nacc
  Cc: devicetree-discuss, Milton Miller, Paul Mackerras,
	Anton Blanchard, linuxppc-dev

No need to initialize per-cpu pointer to NULL, it is the default.

Direct dma ops and no setup are the defaults, no need to set for
iommu-off.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
 arch/powerpc/platforms/pseries/iommu.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index a77bcae..9184db3 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -140,7 +140,7 @@ static int tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum,
 	return ret;
 }
 
-static DEFINE_PER_CPU(u64 *, tce_page) = NULL;
+static DEFINE_PER_CPU(u64 *, tce_page);
 
 static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
 				     long npages, unsigned long uaddr,
@@ -589,13 +589,8 @@ static struct notifier_block iommu_reconfig_nb = {
 /* These are called very early. */
 void iommu_init_early_pSeries(void)
 {
-	if (of_chosen && of_get_property(of_chosen, "linux,iommu-off", NULL)) {
-		/* Direct I/O, IOMMU off */
-		ppc_md.pci_dma_dev_setup = NULL;
-		ppc_md.pci_dma_bus_setup = NULL;
-		set_pci_dma_ops(&dma_direct_ops);
+	if (of_chosen && of_get_property(of_chosen, "linux,iommu-off", NULL))
 		return;
-	}
 
 	if (firmware_has_feature(FW_FEATURE_LPAR)) {
 		if (firmware_has_feature(FW_FEATURE_MULTITCE)) {
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 14/15] ppc64 iommu: use coherent_dma_mask for alloc_coherent
       [not found] <1284573958-8397-1-git-send-email-nacc@us.ibm.com>
                   ` (10 preceding siblings ...)
  2010-09-15 18:05 ` [PATCH 13/15] ppc/pseries: iommu cleanup Nishanth Aravamudan
@ 2010-09-15 18:05 ` Nishanth Aravamudan
  2010-11-29  0:58   ` Benjamin Herrenschmidt
  2010-09-15 18:05 ` [PATCH 15/15] ppc/vio: ensure dma_coherent_mask is set Nishanth Aravamudan
  2010-09-15 18:13 ` [PATCH 01/15] ppc: fix return type of BUID_{HI,LO} macros Nishanth Aravamudan
  13 siblings, 1 reply; 33+ messages in thread
From: Nishanth Aravamudan @ 2010-09-15 18:05 UTC (permalink / raw)
  To: nacc; +Cc: linuxppc-dev, Paul Mackerras, Milton Miller

The IOMMU code has been passing the dma-mask instead of the
coherent_dma_mask to the iommu allocator.  Coherent allocations should
be made using the coherent_dma_mask.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
We currently don't check the mask other than to warn when its being set,
so I don't think this is stable material.
---
 arch/powerpc/kernel/dma-iommu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
index 6e54a0f..e755415 100644
--- a/arch/powerpc/kernel/dma-iommu.c
+++ b/arch/powerpc/kernel/dma-iommu.c
@@ -19,7 +19,7 @@ static void *dma_iommu_alloc_coherent(struct device *dev, size_t size,
 				      dma_addr_t *dma_handle, gfp_t flag)
 {
 	return iommu_alloc_coherent(dev, get_iommu_table_base(dev), size,
-				    dma_handle, device_to_mask(dev), flag,
+				    dma_handle, dev->coherent_dma_mask, flag,
 				    dev_to_node(dev));
 }
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 15/15] ppc/vio: ensure dma_coherent_mask is set
       [not found] <1284573958-8397-1-git-send-email-nacc@us.ibm.com>
                   ` (11 preceding siblings ...)
  2010-09-15 18:05 ` [PATCH 14/15] ppc64 iommu: use coherent_dma_mask for alloc_coherent Nishanth Aravamudan
@ 2010-09-15 18:05 ` Nishanth Aravamudan
  2010-09-15 18:37   ` Grant Likely
  2010-11-29  1:02   ` Benjamin Herrenschmidt
  2010-09-15 18:13 ` [PATCH 01/15] ppc: fix return type of BUID_{HI,LO} macros Nishanth Aravamudan
  13 siblings, 2 replies; 33+ messages in thread
From: Nishanth Aravamudan @ 2010-09-15 18:05 UTC (permalink / raw)
  To: nacc; +Cc: Milton Miller, Paul Mackerras, Brian King, linuxppc-dev

Without this change drivers, such as ibmvscsi, fail to load with the
previous change.
---
 arch/powerpc/kernel/vio.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 3c3083f..e8d73de 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -1259,6 +1259,9 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
 	viodev->dev.parent = &vio_bus_device.dev;
 	viodev->dev.bus = &vio_bus_type;
 	viodev->dev.release = vio_dev_release;
+        /* needed to ensure proper operation of coherent allocations
+         * later, in case driver doesn't set it explicitly */
+        dma_set_coherent_mask(&viodev->dev, DMA_BIT_MASK(64));
 
 	/* register with generic device framework */
 	if (device_register(&viodev->dev)) {
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 01/15] ppc: fix return type of BUID_{HI,LO} macros
       [not found] <1284573958-8397-1-git-send-email-nacc@us.ibm.com>
                   ` (12 preceding siblings ...)
  2010-09-15 18:05 ` [PATCH 15/15] ppc/vio: ensure dma_coherent_mask is set Nishanth Aravamudan
@ 2010-09-15 18:13 ` Nishanth Aravamudan
  2010-09-16 22:54   ` Linas Vepstas
  13 siblings, 1 reply; 33+ messages in thread
From: Nishanth Aravamudan @ 2010-09-15 18:13 UTC (permalink / raw)
  To: nacc
  Cc: Milton Miller, Paul Mackerras, Linas Vepstas, linuxppc-dev, Breno Leitao

BUID_HI and BUID_LO are used to pass data to call_rtas, which expects
ints or u32s. But the macro doesn't cast the return, so the result is
still u64. Use the upper_32_bits and lower_32_bits macros that have been
added to kernel.h.

Found by getting printf format errors trying to debug print the args, no
actual code change for 64 bit kernels where the macros are actually
used.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
 arch/powerpc/include/asm/ppc-pci.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h
index 42fdff0..43268f1 100644
--- a/arch/powerpc/include/asm/ppc-pci.h
+++ b/arch/powerpc/include/asm/ppc-pci.h
@@ -28,8 +28,8 @@ extern void find_and_init_phbs(void);
 extern struct pci_dev *isa_bridge_pcidev;	/* may be NULL if no ISA bus */

 /** Bus Unit ID macros; get low and hi 32-bits of the 64-bit BUID */
-#define BUID_HI(buid) ((buid) >> 32)
-#define BUID_LO(buid) ((buid) & 0xffffffff)
+#define BUID_HI(buid) upper_32_bits(buid)
+#define BUID_LO(buid) lower_32_bits(buid)

 /* PCI device_node operations */
 struct device_node;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* Re: [PATCH 10/15] ppc/pasemi: clean up pasemi iommu table initializations
  2010-09-15 18:05 ` [PATCH 10/15] ppc/pasemi: clean up pasemi iommu table initializations Nishanth Aravamudan
@ 2010-09-15 18:29   ` Olof Johansson
  0 siblings, 0 replies; 33+ messages in thread
From: Olof Johansson @ 2010-09-15 18:29 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: linuxppc-dev, Milton Miller, Paul Mackerras, Yinghai Lu

On Wed, Sep 15, 2010 at 11:05:53AM -0700, Nishanth Aravamudan wrote:
> No need for empty helpers with iommu off, the ppc_md hooks are optional.

Not any more, they used to be needed. :-)

> The direct_dma_ops are the default pci_dma_ops, so no need to set in the
> them iommu off case.
> 
> No need to set the device tree device_node pci node iommu pointer, its
> only used for dlpar remove.
> 
> Signed-off-by: Milton Miller <miltonm@bga.com>
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>

Acked-by: Olof Johansson <olof@lixom.net>


-Olof

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 04/15] vio: put device on device_register failure
  2010-09-15 18:05 ` [PATCH 04/15] vio: put device on device_register failure Nishanth Aravamudan
@ 2010-09-15 18:29   ` Grant Likely
  0 siblings, 0 replies; 33+ messages in thread
From: Grant Likely @ 2010-09-15 18:29 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: Brian King, Paul Mackerras, linuxppc-dev, Milton Miller

On Wed, Sep 15, 2010 at 12:05 PM, Nishanth Aravamudan <nacc@us.ibm.com> wro=
te:
> The kernel doc for device_register (and device_initialize) very clearly
> state to call put_device not kfree after calling, even on error.
>
> Signed-off-by: Milton Miller <miltonm@bga.com>
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
> =A0arch/powerpc/kernel/vio.c | =A0 =A03 +--
> =A01 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
> index fa3469d..72db4b0 100644
> --- a/arch/powerpc/kernel/vio.c
> +++ b/arch/powerpc/kernel/vio.c
> @@ -1254,8 +1254,7 @@ struct vio_dev *vio_register_device_node(struct dev=
ice_node *of_node)
> =A0 =A0 =A0 =A0if (device_register(&viodev->dev)) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0printk(KERN_ERR "%s: failed to register de=
vice %s\n",
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0__func__, =
dev_name(&viodev->dev));
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* XXX free TCE table */
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 kfree(viodev);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 put_device(&viodev->dev);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return NULL;
> =A0 =A0 =A0 =A0}
>
> --
> 1.7.0.4
>
>



--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 07/15] ppc: pci-common cleanup
  2010-09-15 18:05 ` [PATCH 07/15] ppc: pci-common cleanup Nishanth Aravamudan
@ 2010-09-15 18:30   ` Grant Likely
  0 siblings, 0 replies; 33+ messages in thread
From: Grant Likely @ 2010-09-15 18:30 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: Dominik Brodowski, Milton Miller, Paul Mackerras, Jesse Barnes,
	linuxppc-dev, Bjorn Helgaas

On Wed, Sep 15, 2010 at 12:05 PM, Nishanth Aravamudan <nacc@us.ibm.com> wro=
te:
> Use set_dma_ops and remove unused oddly-named temp pointer sd.
>
> Signed-off-by: Milton Miller <miltonm@bga.com>
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
> =A0arch/powerpc/kernel/pci-common.c | =A0 =A04 +---
> =A01 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-c=
ommon.c
> index 9021c4a..10a44e6 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -1090,8 +1090,6 @@ void __devinit pcibios_setup_bus_devices(struct pci=
_bus *bus)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 bus->number, bus->self ? pci_name(bus->se=
lf) : "PHB");
>
> =A0 =A0 =A0 =A0list_for_each_entry(dev, &bus->devices, bus_list) {
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct dev_archdata *sd =3D &dev->dev.archd=
ata;
> -
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Cardbus can call us to add new devices =
to a bus, so ignore
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 * those who are already fully discovered
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 */
> @@ -1107,7 +1105,7 @@ void __devinit pcibios_setup_bus_devices(struct pci=
_bus *bus)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0set_dev_node(&dev->dev, pcibus_to_node(dev=
->bus));
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Hook up default DMA ops */
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 sd->dma_ops =3D pci_dma_ops;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 set_dma_ops(&dev->dev, pci_dma_ops);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0set_dma_offset(&dev->dev, PCI_DRAM_OFFSET)=
;
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Additional platform DMA/iommu setup */
> --
> 1.7.0.4
>
>



--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 09/15] ppc/vio: use dma ops helpers
  2010-09-15 18:05 ` [PATCH 09/15] ppc/vio: use dma ops helpers Nishanth Aravamudan
@ 2010-09-15 18:33   ` Grant Likely
  2010-10-13  4:56     ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 33+ messages in thread
From: Grant Likely @ 2010-09-15 18:33 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: Brian King, Paul Mackerras, linuxppc-dev, Milton Miller

On Wed, Sep 15, 2010 at 12:05 PM, Nishanth Aravamudan <nacc@us.ibm.com> wro=
te:
> Use the set_dma_ops helper. Instead of modifying vio_dma_mapping_ops,
> just create a trivial wrapper for dma_supported.
>
> Signed-off-by: Milton Miller <miltonm@bga.com>
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>

Looks right to me.

> ---
> =A0arch/powerpc/kernel/vio.c | =A0 11 ++++++++---
> =A01 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
> index d692989..3c3083f 100644
> --- a/arch/powerpc/kernel/vio.c
> +++ b/arch/powerpc/kernel/vio.c
> @@ -602,6 +602,11 @@ static void vio_dma_iommu_unmap_sg(struct device *de=
v,
> =A0 =A0 =A0 =A0vio_cmo_dealloc(viodev, alloc_size);
> =A0}
>
> +static int vio_dma_iommu_dma_supported(struct device *dev, u64 mask)
> +{
> + =A0 =A0 =A0 =A0return dma_iommu_ops.dma_supported(dev, mask);
> +}
> +
> =A0struct dma_map_ops vio_dma_mapping_ops =3D {
> =A0 =A0 =A0 =A0.alloc_coherent =3D vio_dma_iommu_alloc_coherent,
> =A0 =A0 =A0 =A0.free_coherent =A0=3D vio_dma_iommu_free_coherent,
> @@ -609,6 +614,7 @@ struct dma_map_ops vio_dma_mapping_ops =3D {
> =A0 =A0 =A0 =A0.unmap_sg =A0 =A0 =A0 =3D vio_dma_iommu_unmap_sg,
> =A0 =A0 =A0 =A0.map_page =A0 =A0 =A0 =3D vio_dma_iommu_map_page,
> =A0 =A0 =A0 =A0.unmap_page =A0 =A0 =3D vio_dma_iommu_unmap_page,
> + =A0 =A0 =A0 .dma_supported =A0=3D vio_dma_iommu_dma_supported,
>
> =A0};
>
> @@ -860,8 +866,7 @@ static void vio_cmo_bus_remove(struct vio_dev *viodev=
)
>
> =A0static void vio_cmo_set_dma_ops(struct vio_dev *viodev)
> =A0{
> - =A0 =A0 =A0 vio_dma_mapping_ops.dma_supported =3D dma_iommu_ops.dma_sup=
ported;
> - =A0 =A0 =A0 viodev->dev.archdata.dma_ops =3D &vio_dma_mapping_ops;
> + =A0 =A0 =A0 set_dma_ops(&viodev->dev, &vio_dma_mapping_ops);
> =A0}
>
> =A0/**
> @@ -1246,7 +1251,7 @@ struct vio_dev *vio_register_device_node(struct dev=
ice_node *of_node)
> =A0 =A0 =A0 =A0if (firmware_has_feature(FW_FEATURE_CMO))
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0vio_cmo_set_dma_ops(viodev);
> =A0 =A0 =A0 =A0else
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 viodev->dev.archdata.dma_ops =3D &dma_iommu=
_ops;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 set_dma_ops(&viodev->dev, &dma_iommu_ops);
> =A0 =A0 =A0 =A0set_iommu_table_base(&viodev->dev, vio_build_iommu_table(v=
iodev));
> =A0 =A0 =A0 =A0set_dev_node(&viodev->dev, of_node_to_nid(of_node));
>
> --
> 1.7.0.4
>
>



--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 13/15] ppc/pseries: iommu cleanup
  2010-09-15 18:05 ` [PATCH 13/15] ppc/pseries: iommu cleanup Nishanth Aravamudan
@ 2010-09-15 18:34       ` Grant Likely
  0 siblings, 0 replies; 33+ messages in thread
From: Grant Likely @ 2010-09-15 18:34 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Milton Miller,
	Anton Blanchard, linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ

On Wed, Sep 15, 2010 at 12:05 PM, Nishanth Aravamudan <nacc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> wrote:
> No need to initialize per-cpu pointer to NULL, it is the default.
>
> Direct dma ops and no setup are the defaults, no need to set for
> iommu-off.
>
> Signed-off-by: Milton Miller <miltonm-ogEGBHC/i9Y@public.gmane.org>
> Signed-off-by: Nishanth Aravamudan <nacc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

Also looks correct.

Reviewed-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

g.

> ---
>  arch/powerpc/platforms/pseries/iommu.c |    9 ++-------
>  1 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
> index a77bcae..9184db3 100644
> --- a/arch/powerpc/platforms/pseries/iommu.c
> +++ b/arch/powerpc/platforms/pseries/iommu.c
> @@ -140,7 +140,7 @@ static int tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum,
>        return ret;
>  }
>
> -static DEFINE_PER_CPU(u64 *, tce_page) = NULL;
> +static DEFINE_PER_CPU(u64 *, tce_page);
>
>  static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
>                                     long npages, unsigned long uaddr,
> @@ -589,13 +589,8 @@ static struct notifier_block iommu_reconfig_nb = {
>  /* These are called very early. */
>  void iommu_init_early_pSeries(void)
>  {
> -       if (of_chosen && of_get_property(of_chosen, "linux,iommu-off", NULL)) {
> -               /* Direct I/O, IOMMU off */
> -               ppc_md.pci_dma_dev_setup = NULL;
> -               ppc_md.pci_dma_bus_setup = NULL;
> -               set_pci_dma_ops(&dma_direct_ops);
> +       if (of_chosen && of_get_property(of_chosen, "linux,iommu-off", NULL))
>                return;
> -       }
>
>        if (firmware_has_feature(FW_FEATURE_LPAR)) {
>                if (firmware_has_feature(FW_FEATURE_MULTITCE)) {
> --
> 1.7.0.4
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 13/15] ppc/pseries: iommu cleanup
@ 2010-09-15 18:34       ` Grant Likely
  0 siblings, 0 replies; 33+ messages in thread
From: Grant Likely @ 2010-09-15 18:34 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: devicetree-discuss, Milton Miller, Paul Mackerras,
	Anton Blanchard, linuxppc-dev

On Wed, Sep 15, 2010 at 12:05 PM, Nishanth Aravamudan <nacc@us.ibm.com> wro=
te:
> No need to initialize per-cpu pointer to NULL, it is the default.
>
> Direct dma ops and no setup are the defaults, no need to set for
> iommu-off.
>
> Signed-off-by: Milton Miller <miltonm@bga.com>
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>

Also looks correct.

Reviewed-by: Grant Likely <grant.likely@secretlab.ca>

g.

> ---
> =A0arch/powerpc/platforms/pseries/iommu.c | =A0 =A09 ++-------
> =A01 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platfo=
rms/pseries/iommu.c
> index a77bcae..9184db3 100644
> --- a/arch/powerpc/platforms/pseries/iommu.c
> +++ b/arch/powerpc/platforms/pseries/iommu.c
> @@ -140,7 +140,7 @@ static int tce_build_pSeriesLP(struct iommu_table *tb=
l, long tcenum,
> =A0 =A0 =A0 =A0return ret;
> =A0}
>
> -static DEFINE_PER_CPU(u64 *, tce_page) =3D NULL;
> +static DEFINE_PER_CPU(u64 *, tce_page);
>
> =A0static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcen=
um,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 l=
ong npages, unsigned long uaddr,
> @@ -589,13 +589,8 @@ static struct notifier_block iommu_reconfig_nb =3D {
> =A0/* These are called very early. */
> =A0void iommu_init_early_pSeries(void)
> =A0{
> - =A0 =A0 =A0 if (of_chosen && of_get_property(of_chosen, "linux,iommu-of=
f", NULL)) {
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Direct I/O, IOMMU off */
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 ppc_md.pci_dma_dev_setup =3D NULL;
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 ppc_md.pci_dma_bus_setup =3D NULL;
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 set_pci_dma_ops(&dma_direct_ops);
> + =A0 =A0 =A0 if (of_chosen && of_get_property(of_chosen, "linux,iommu-of=
f", NULL))
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return;
> - =A0 =A0 =A0 }
>
> =A0 =A0 =A0 =A0if (firmware_has_feature(FW_FEATURE_LPAR)) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (firmware_has_feature(FW_FEATURE_MULTIT=
CE)) {
> --
> 1.7.0.4
>
>



--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 15/15] ppc/vio: ensure dma_coherent_mask is set
  2010-09-15 18:05 ` [PATCH 15/15] ppc/vio: ensure dma_coherent_mask is set Nishanth Aravamudan
@ 2010-09-15 18:37   ` Grant Likely
  2010-09-15 18:44     ` Nishanth Aravamudan
  2010-11-29  1:02   ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 33+ messages in thread
From: Grant Likely @ 2010-09-15 18:37 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: Brian King, Paul Mackerras, linuxppc-dev, Milton Miller

On Wed, Sep 15, 2010 at 12:05 PM, Nishanth Aravamudan <nacc@us.ibm.com> wro=
te:
> Without this change drivers, such as ibmvscsi, fail to load with the
> previous change.

Shouldn't this patch be ordered before the previous change then to
preserve bisectability?

Also, patch descriptions should be explicit about what the "previous
change" refers to.  Once this is committed, git log may very well
insert other changes from other branches between this commit and
whatever "previous change" refers to.

g.

> ---
> =A0arch/powerpc/kernel/vio.c | =A0 =A03 +++
> =A01 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
> index 3c3083f..e8d73de 100644
> --- a/arch/powerpc/kernel/vio.c
> +++ b/arch/powerpc/kernel/vio.c
> @@ -1259,6 +1259,9 @@ struct vio_dev *vio_register_device_node(struct dev=
ice_node *of_node)
> =A0 =A0 =A0 =A0viodev->dev.parent =3D &vio_bus_device.dev;
> =A0 =A0 =A0 =A0viodev->dev.bus =3D &vio_bus_type;
> =A0 =A0 =A0 =A0viodev->dev.release =3D vio_dev_release;
> + =A0 =A0 =A0 =A0/* needed to ensure proper operation of coherent allocat=
ions
> + =A0 =A0 =A0 =A0 * later, in case driver doesn't set it explicitly */
> + =A0 =A0 =A0 =A0dma_set_coherent_mask(&viodev->dev, DMA_BIT_MASK(64));
>
> =A0 =A0 =A0 =A0/* register with generic device framework */
> =A0 =A0 =A0 =A0if (device_register(&viodev->dev)) {
> --
> 1.7.0.4
>
>



--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 15/15] ppc/vio: ensure dma_coherent_mask is set
  2010-09-15 18:37   ` Grant Likely
@ 2010-09-15 18:44     ` Nishanth Aravamudan
  2010-09-15 18:49       ` Grant Likely
  0 siblings, 1 reply; 33+ messages in thread
From: Nishanth Aravamudan @ 2010-09-15 18:44 UTC (permalink / raw)
  To: Grant Likely; +Cc: Brian King, Paul Mackerras, linuxppc-dev, Milton Miller

On 15.09.2010 [12:37:58 -0600], Grant Likely wrote:
> On Wed, Sep 15, 2010 at 12:05 PM, Nishanth Aravamudan <nacc@us.ibm.com> wrote:
> > Without this change drivers, such as ibmvscsi, fail to load with the
> > previous change.
> 
> Shouldn't this patch be ordered before the previous change then to
> preserve bisectability?

You are probably right. I wasn't sure if I should fold it in or keep it
separate. I should have changed the order, though. Sorry about that!

> Also, patch descriptions should be explicit about what the "previous
> change" refers to.  Once this is committed, git log may very well
> insert other changes from other branches between this commit and
> whatever "previous change" refers to.

Yep -- what's the best way to make the reference? By subject from the
patch? Obviously I don't have the SHA1 with which the commit will go
upstream.

Thanks,
Nish

-- 
Nishanth Aravamudan <nacc@us.ibm.com>
IBM Linux Technology Center

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 15/15] ppc/vio: ensure dma_coherent_mask is set
  2010-09-15 18:44     ` Nishanth Aravamudan
@ 2010-09-15 18:49       ` Grant Likely
  0 siblings, 0 replies; 33+ messages in thread
From: Grant Likely @ 2010-09-15 18:49 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: Brian King, Paul Mackerras, linuxppc-dev, Milton Miller

On Wed, Sep 15, 2010 at 11:44:56AM -0700, Nishanth Aravamudan wrote:
> On 15.09.2010 [12:37:58 -0600], Grant Likely wrote:
> > On Wed, Sep 15, 2010 at 12:05 PM, Nishanth Aravamudan <nacc@us.ibm.com> wrote:
> > > Without this change drivers, such as ibmvscsi, fail to load with the
> > > previous change.
> > 
> > Shouldn't this patch be ordered before the previous change then to
> > preserve bisectability?
> 
> You are probably right. I wasn't sure if I should fold it in or keep it
> separate. I should have changed the order, though. Sorry about that!

It's such a small patch I would just fold it in.

> 
> > Also, patch descriptions should be explicit about what the "previous
> > change" refers to.  Once this is committed, git log may very well
> > insert other changes from other branches between this commit and
> > whatever "previous change" refers to.
> 
> Yep -- what's the best way to make the reference? By subject from the
> patch? Obviously I don't have the SHA1 with which the commit will go
> upstream.

By name should be good.  As long as a reader doesn't need background
information from your head to figure out why the change was made then
it should be okay.

g.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 11/15] ppc/cell: beat dma ops cleanup
  2010-09-15 18:05 ` [PATCH 11/15] ppc/cell: beat dma ops cleanup Nishanth Aravamudan
@ 2010-09-16 11:23   ` Arnd Bergmann
  0 siblings, 0 replies; 33+ messages in thread
From: Arnd Bergmann @ 2010-09-16 11:23 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: cbe-oss-dev, Milton Miller, Paul Mackerras, linuxppc-dev,
	David S. Miller

On Wednesday 15 September 2010, Nishanth Aravamudan wrote:
> direct_dma_ops is the default pci dma ops.
> 
> No need to call a function to get the pci dma ops, we know they are the
> dma_direct_ops.
> 
> Signed-off-by: Milton Miller <miltonm@bga.com>
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 01/15] ppc: fix return type of BUID_{HI,LO} macros
  2010-09-15 18:13 ` [PATCH 01/15] ppc: fix return type of BUID_{HI,LO} macros Nishanth Aravamudan
@ 2010-09-16 22:54   ` Linas Vepstas
  2010-09-16 23:04     ` Scott Wood
  0 siblings, 1 reply; 33+ messages in thread
From: Linas Vepstas @ 2010-09-16 22:54 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: linuxppc-dev, Paul Mackerras, Breno Leitao, Milton Miller

Acked-by: Linas Vepstas <linasvepstas@gmail.com>

I'm guessing this worked up til now because the rtas_call function prototyp=
e
was telling compiler to cast these to 32-bit before passing them as args.
(and since these would still get passed as one arg per 64-bit reg, it
still wouldn't go wrong.)

What I'm wondering about is why there was no compiler warning about an
implicit cast of a 64-bit int to a 32-bit int?  Surely, this is something t=
hat
should be warned about!

-- Linas

On 15 September 2010 13:13, Nishanth Aravamudan <nacc@us.ibm.com> wrote:
> BUID_HI and BUID_LO are used to pass data to call_rtas, which expects
> ints or u32s. But the macro doesn't cast the return, so the result is
> still u64. Use the upper_32_bits and lower_32_bits macros that have been
> added to kernel.h.
>
> Found by getting printf format errors trying to debug print the args, no
> actual code change for 64 bit kernels where the macros are actually
> used.
>
> Signed-off-by: Milton Miller <miltonm@bga.com>
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> ---
> =C2=A0arch/powerpc/include/asm/ppc-pci.h | =C2=A0 =C2=A04 ++--
> =C2=A01 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/as=
m/ppc-pci.h
> index 42fdff0..43268f1 100644
> --- a/arch/powerpc/include/asm/ppc-pci.h
> +++ b/arch/powerpc/include/asm/ppc-pci.h
> @@ -28,8 +28,8 @@ extern void find_and_init_phbs(void);
> =C2=A0extern struct pci_dev *isa_bridge_pcidev; =C2=A0 =C2=A0 =C2=A0/* ma=
y be NULL if no ISA bus */
>
> =C2=A0/** Bus Unit ID macros; get low and hi 32-bits of the 64-bit BUID *=
/
> -#define BUID_HI(buid) ((buid) >> 32)
> -#define BUID_LO(buid) ((buid) & 0xffffffff)
> +#define BUID_HI(buid) upper_32_bits(buid)
> +#define BUID_LO(buid) lower_32_bits(buid)
>
> =C2=A0/* PCI device_node operations */
> =C2=A0struct device_node;
> --
> 1.7.0.4
>
>

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 01/15] ppc: fix return type of BUID_{HI,LO} macros
  2010-09-16 22:54   ` Linas Vepstas
@ 2010-09-16 23:04     ` Scott Wood
  0 siblings, 0 replies; 33+ messages in thread
From: Scott Wood @ 2010-09-16 23:04 UTC (permalink / raw)
  To: linasvepstas
  Cc: Nishanth Aravamudan, linuxppc-dev, Breno Leitao, Paul Mackerras,
	Milton Miller

On Thu, 16 Sep 2010 17:54:46 -0500
Linas Vepstas <linasvepstas@gmail.com> wrote:

> Acked-by: Linas Vepstas <linasvepstas@gmail.com>
> 
> I'm guessing this worked up til now because the rtas_call function prototype
> was telling compiler to cast these to 32-bit before passing them as args.
> (and since these would still get passed as one arg per 64-bit reg, it
> still wouldn't go wrong.)
> 
> What I'm wondering about is why there was no compiler warning about an
> implicit cast of a 64-bit int to a 32-bit int?  Surely, this is something that
> should be warned about!

-Wconversion enables this.

There'd be a lot of false positives to squash with that enabled --
and it might not be worth the resulting explosion in casts.

-Scott

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 09/15] ppc/vio: use dma ops helpers
  2010-09-15 18:33   ` Grant Likely
@ 2010-10-13  4:56     ` Benjamin Herrenschmidt
  2010-10-13 17:43       ` Nishanth Aravamudan
  0 siblings, 1 reply; 33+ messages in thread
From: Benjamin Herrenschmidt @ 2010-10-13  4:56 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: Brian King, linuxppc-dev, Paul Mackerras, Milton Miller

On Wed, 2010-09-15 at 12:33 -0600, Grant Likely wrote:
> On Wed, Sep 15, 2010 at 12:05 PM, Nishanth Aravamudan <nacc@us.ibm.com> wrote:
> > Use the set_dma_ops helper. Instead of modifying vio_dma_mapping_ops,
> > just create a trivial wrapper for dma_supported.
> >
> > Signed-off-by: Milton Miller <miltonm@bga.com>
> > Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> 
> Looks right to me.

I never saw 8/15 btw ... I'm applying up to 7, please resend the rest.

Cheers,
Ben.

> > ---
> >  arch/powerpc/kernel/vio.c |   11 ++++++++---
> >  1 files changed, 8 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
> > index d692989..3c3083f 100644
> > --- a/arch/powerpc/kernel/vio.c
> > +++ b/arch/powerpc/kernel/vio.c
> > @@ -602,6 +602,11 @@ static void vio_dma_iommu_unmap_sg(struct device *dev,
> >        vio_cmo_dealloc(viodev, alloc_size);
> >  }
> >
> > +static int vio_dma_iommu_dma_supported(struct device *dev, u64 mask)
> > +{
> > +        return dma_iommu_ops.dma_supported(dev, mask);
> > +}
> > +
> >  struct dma_map_ops vio_dma_mapping_ops = {
> >        .alloc_coherent = vio_dma_iommu_alloc_coherent,
> >        .free_coherent  = vio_dma_iommu_free_coherent,
> > @@ -609,6 +614,7 @@ struct dma_map_ops vio_dma_mapping_ops = {
> >        .unmap_sg       = vio_dma_iommu_unmap_sg,
> >        .map_page       = vio_dma_iommu_map_page,
> >        .unmap_page     = vio_dma_iommu_unmap_page,
> > +       .dma_supported  = vio_dma_iommu_dma_supported,
> >
> >  };
> >
> > @@ -860,8 +866,7 @@ static void vio_cmo_bus_remove(struct vio_dev *viodev)
> >
> >  static void vio_cmo_set_dma_ops(struct vio_dev *viodev)
> >  {
> > -       vio_dma_mapping_ops.dma_supported = dma_iommu_ops.dma_supported;
> > -       viodev->dev.archdata.dma_ops = &vio_dma_mapping_ops;
> > +       set_dma_ops(&viodev->dev, &vio_dma_mapping_ops);
> >  }
> >
> >  /**
> > @@ -1246,7 +1251,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
> >        if (firmware_has_feature(FW_FEATURE_CMO))
> >                vio_cmo_set_dma_ops(viodev);
> >        else
> > -               viodev->dev.archdata.dma_ops = &dma_iommu_ops;
> > +               set_dma_ops(&viodev->dev, &dma_iommu_ops);
> >        set_iommu_table_base(&viodev->dev, vio_build_iommu_table(viodev));
> >        set_dev_node(&viodev->dev, of_node_to_nid(of_node));
> >
> > --
> > 1.7.0.4
> >
> >
> 
> 
> 

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 09/15] ppc/vio: use dma ops helpers
  2010-10-13  4:56     ` Benjamin Herrenschmidt
@ 2010-10-13 17:43       ` Nishanth Aravamudan
  0 siblings, 0 replies; 33+ messages in thread
From: Nishanth Aravamudan @ 2010-10-13 17:43 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Brian King, linuxppc-dev, Paul Mackerras, Milton Miller

On 13.10.2010 [15:56:00 +1100], Benjamin Herrenschmidt wrote:
> On Wed, 2010-09-15 at 12:33 -0600, Grant Likely wrote:
> > On Wed, Sep 15, 2010 at 12:05 PM, Nishanth Aravamudan <nacc@us.ibm.com> wrote:
> > > Use the set_dma_ops helper. Instead of modifying vio_dma_mapping_ops,
> > > just create a trivial wrapper for dma_supported.
> > >
> > > Signed-off-by: Milton Miller <miltonm@bga.com>
> > > Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> > 
> > Looks right to me.
> 
> I never saw 8/15 btw ... I'm applying up to 7, please resend the rest.

Ah apologies, 8/15 was for microblaze and get_maintainer.pl didn't cc
many of the same folks. Will resend 8-15 and make sure ppc-dev gets
cc'd.

Thanks,
Nish
-- 
Nishanth Aravamudan <nacc@us.ibm.com>
IBM Linux Technology Center

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 14/15] ppc64 iommu: use coherent_dma_mask for alloc_coherent
  2010-09-15 18:05 ` [PATCH 14/15] ppc64 iommu: use coherent_dma_mask for alloc_coherent Nishanth Aravamudan
@ 2010-11-29  0:58   ` Benjamin Herrenschmidt
  2010-12-01  0:31     ` Nishanth Aravamudan
  0 siblings, 1 reply; 33+ messages in thread
From: Benjamin Herrenschmidt @ 2010-11-29  0:58 UTC (permalink / raw)
  To: Nishanth Aravamudan; +Cc: linuxppc-dev, Paul Mackerras, Milton Miller

On Wed, 2010-09-15 at 11:05 -0700, Nishanth Aravamudan wrote:
> The IOMMU code has been passing the dma-mask instead of the
> coherent_dma_mask to the iommu allocator.  Coherent allocations should
> be made using the coherent_dma_mask.

Won't that break macio devices too ? afaik, they don't set
coherent_dma_mask. Have you tried booting on a G5 with iommu enabled ?

(It may not be broken, just asking...)

Cheers,
Ben.

> Signed-off-by: Milton Miller <miltonm@bga.com>
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> ---
> We currently don't check the mask other than to warn when its being set,
> so I don't think this is stable material.
> ---
>  arch/powerpc/kernel/dma-iommu.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
> index 6e54a0f..e755415 100644
> --- a/arch/powerpc/kernel/dma-iommu.c
> +++ b/arch/powerpc/kernel/dma-iommu.c
> @@ -19,7 +19,7 @@ static void *dma_iommu_alloc_coherent(struct device *dev, size_t size,
>  				      dma_addr_t *dma_handle, gfp_t flag)
>  {
>  	return iommu_alloc_coherent(dev, get_iommu_table_base(dev), size,
> -				    dma_handle, device_to_mask(dev), flag,
> +				    dma_handle, dev->coherent_dma_mask, flag,
>  				    dev_to_node(dev));
>  }
>  

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 15/15] ppc/vio: ensure dma_coherent_mask is set
  2010-09-15 18:05 ` [PATCH 15/15] ppc/vio: ensure dma_coherent_mask is set Nishanth Aravamudan
  2010-09-15 18:37   ` Grant Likely
@ 2010-11-29  1:02   ` Benjamin Herrenschmidt
  2010-11-29 19:46     ` Nishanth Aravamudan
  1 sibling, 1 reply; 33+ messages in thread
From: Benjamin Herrenschmidt @ 2010-11-29  1:02 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: Brian King, Paul Mackerras, linuxppc-dev, Milton Miller

On Wed, 2010-09-15 at 11:05 -0700, Nishanth Aravamudan wrote:
> Without this change drivers, such as ibmvscsi, fail to load with the
> previous change.
> ---

So you broke bisection... fold the patch instead or invert them

Cheers,
Ben.

>  arch/powerpc/kernel/vio.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
> index 3c3083f..e8d73de 100644
> --- a/arch/powerpc/kernel/vio.c
> +++ b/arch/powerpc/kernel/vio.c
> @@ -1259,6 +1259,9 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
>  	viodev->dev.parent = &vio_bus_device.dev;
>  	viodev->dev.bus = &vio_bus_type;
>  	viodev->dev.release = vio_dev_release;
> +        /* needed to ensure proper operation of coherent allocations
> +         * later, in case driver doesn't set it explicitly */
> +        dma_set_coherent_mask(&viodev->dev, DMA_BIT_MASK(64));
>  
>  	/* register with generic device framework */
>  	if (device_register(&viodev->dev)) {

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 15/15] ppc/vio: ensure dma_coherent_mask is set
  2010-11-29  1:02   ` Benjamin Herrenschmidt
@ 2010-11-29 19:46     ` Nishanth Aravamudan
  2010-11-29 20:25       ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 33+ messages in thread
From: Nishanth Aravamudan @ 2010-11-29 19:46 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Brian King, Paul Mackerras, linuxppc-dev, Milton Miller

Hi Ben,

On 29.11.2010 [12:02:57 +1100], Benjamin Herrenschmidt wrote:
> On Wed, 2010-09-15 at 11:05 -0700, Nishanth Aravamudan wrote:
> > Without this change drivers, such as ibmvscsi, fail to load with the
> > previous change.
> > ---
> 
> So you broke bisection... fold the patch instead or invert them

Thanks for the review. I resent this series on 10/18 and it had the
patches folded together.

Thanks,
Nish

-- 
Nishanth Aravamudan <nacc@us.ibm.com>
IBM Linux Technology Center

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 15/15] ppc/vio: ensure dma_coherent_mask is set
  2010-11-29 19:46     ` Nishanth Aravamudan
@ 2010-11-29 20:25       ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 33+ messages in thread
From: Benjamin Herrenschmidt @ 2010-11-29 20:25 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: Brian King, Paul Mackerras, linuxppc-dev, Milton Miller

On Mon, 2010-11-29 at 11:46 -0800, Nishanth Aravamudan wrote:
> > So you broke bisection... fold the patch instead or invert them
> 
> Thanks for the review. I resent this series on 10/18 and it had the
> patches folded together. 

Right, I know :-) I just mistakenly had that old one still tagged in
patchwork, my bad.

I've merged some of the new ones already.

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 14/15] ppc64 iommu: use coherent_dma_mask for alloc_coherent
  2010-11-29  0:58   ` Benjamin Herrenschmidt
@ 2010-12-01  0:31     ` Nishanth Aravamudan
  0 siblings, 0 replies; 33+ messages in thread
From: Nishanth Aravamudan @ 2010-12-01  0:31 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Paul Mackerras, Milton Miller

On 29.11.2010 [11:58:16 +1100], Benjamin Herrenschmidt wrote:
> On Wed, 2010-09-15 at 11:05 -0700, Nishanth Aravamudan wrote:
> > The IOMMU code has been passing the dma-mask instead of the
> > coherent_dma_mask to the iommu allocator.  Coherent allocations should
> > be made using the coherent_dma_mask.
> 
> Won't that break macio devices too ? afaik, they don't set
> coherent_dma_mask. Have you tried booting on a G5 with iommu enabled ?
> 
> (It may not be broken, just asking...)

I have not tried this. I unfortunately do not have immediate access to a
G5 to test on, but will ask around.

Thanks,
Nish

-- 
Nishanth Aravamudan <nacc@us.ibm.com>
IBM Linux Technology Center

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2010-12-01  0:32 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1284573958-8397-1-git-send-email-nacc@us.ibm.com>
2010-09-15 18:05 ` [PATCH 02/15] ppc64: fix dma_iommu_dma_supported compare Nishanth Aravamudan
2010-09-15 18:05 ` [PATCH 03/15] ppc64 iommu: fix check for direct DMA support Nishanth Aravamudan
2010-09-15 18:05 ` [PATCH 04/15] vio: put device on device_register failure Nishanth Aravamudan
2010-09-15 18:29   ` Grant Likely
2010-09-15 18:05 ` [PATCH 05/15] viobus: free TCE table on device release Nishanth Aravamudan
2010-09-15 18:05 ` [PATCH 06/15] pseries/dlpar: use kmemdup Nishanth Aravamudan
2010-09-15 18:05 ` [PATCH 07/15] ppc: pci-common cleanup Nishanth Aravamudan
2010-09-15 18:30   ` Grant Likely
2010-09-15 18:05 ` [PATCH 09/15] ppc/vio: use dma ops helpers Nishanth Aravamudan
2010-09-15 18:33   ` Grant Likely
2010-10-13  4:56     ` Benjamin Herrenschmidt
2010-10-13 17:43       ` Nishanth Aravamudan
2010-09-15 18:05 ` [PATCH 10/15] ppc/pasemi: clean up pasemi iommu table initializations Nishanth Aravamudan
2010-09-15 18:29   ` Olof Johansson
2010-09-15 18:05 ` [PATCH 11/15] ppc/cell: beat dma ops cleanup Nishanth Aravamudan
2010-09-16 11:23   ` Arnd Bergmann
2010-09-15 18:05 ` [PATCH 12/15] ppc/dart: iommu table cleanup Nishanth Aravamudan
2010-09-15 18:05 ` [PATCH 13/15] ppc/pseries: iommu cleanup Nishanth Aravamudan
     [not found]   ` <1284573958-8397-14-git-send-email-nacc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-09-15 18:34     ` Grant Likely
2010-09-15 18:34       ` Grant Likely
2010-09-15 18:05 ` [PATCH 14/15] ppc64 iommu: use coherent_dma_mask for alloc_coherent Nishanth Aravamudan
2010-11-29  0:58   ` Benjamin Herrenschmidt
2010-12-01  0:31     ` Nishanth Aravamudan
2010-09-15 18:05 ` [PATCH 15/15] ppc/vio: ensure dma_coherent_mask is set Nishanth Aravamudan
2010-09-15 18:37   ` Grant Likely
2010-09-15 18:44     ` Nishanth Aravamudan
2010-09-15 18:49       ` Grant Likely
2010-11-29  1:02   ` Benjamin Herrenschmidt
2010-11-29 19:46     ` Nishanth Aravamudan
2010-11-29 20:25       ` Benjamin Herrenschmidt
2010-09-15 18:13 ` [PATCH 01/15] ppc: fix return type of BUID_{HI,LO} macros Nishanth Aravamudan
2010-09-16 22:54   ` Linas Vepstas
2010-09-16 23:04     ` Scott Wood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.