All of lore.kernel.org
 help / color / mirror / Atom feed
* convert parisc to the generic dma-noncoherent code
@ 2018-06-19  7:04 Christoph Hellwig
       [not found] ` <20180619070455.26624-1-hch-jcswGhMUV9g@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2018-06-19  7:04 UTC (permalink / raw)
  To: linux-parisc-u79uwXL29TY76Z2rM5mHXA
  Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

This should address all the comments raised last time.

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

* [PATCH 1/3] parisc: merge pcx_dma_ops and pcxl_dma_ops
       [not found] ` <20180619070455.26624-1-hch-jcswGhMUV9g@public.gmane.org>
@ 2018-06-19  7:04   ` Christoph Hellwig
  2018-06-19  7:04   ` [PATCH 2/3] parisc: always use flush_kernel_dcache_range for DMA cache maintainance Christoph Hellwig
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2018-06-19  7:04 UTC (permalink / raw)
  To: linux-parisc-u79uwXL29TY76Z2rM5mHXA
  Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

The only difference is that pcxl supports dma coherent allocations, while
pcx only supports non-consistent allocations and otherwise fails.

But dma_alloc* is not in the fast path, and merging these two allows an
easy migration path to the generic dma-noncoherent implementation, so
do it.

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 arch/parisc/include/asm/dma-mapping.h |  3 +-
 arch/parisc/kernel/pci-dma.c          | 80 ++++++++++++---------------
 arch/parisc/kernel/setup.c            |  8 +--
 arch/parisc/mm/init.c                 | 11 +---
 4 files changed, 43 insertions(+), 59 deletions(-)

diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h
index 01e1fc057c83..eeec8dd18e74 100644
--- a/arch/parisc/include/asm/dma-mapping.h
+++ b/arch/parisc/include/asm/dma-mapping.h
@@ -22,8 +22,7 @@
 */
 
 #ifdef CONFIG_PA11
-extern const struct dma_map_ops pcxl_dma_ops;
-extern const struct dma_map_ops pcx_dma_ops;
+extern const struct dma_map_ops pa11_dma_ops;
 #endif
 
 extern const struct dma_map_ops *hppa_dma_ops;
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index 6df07ce4f3c2..d34cd6d34717 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -395,7 +395,7 @@ pcxl_dma_init(void)
 
 __initcall(pcxl_dma_init);
 
-static void *pa11_dma_alloc(struct device *dev, size_t size,
+static void *pcxl_dma_alloc(struct device *dev, size_t size,
 		dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs)
 {
 	unsigned long vaddr;
@@ -422,16 +422,44 @@ static void *pa11_dma_alloc(struct device *dev, size_t size,
 	return (void *)vaddr;
 }
 
+static void *pcx_dma_alloc(struct device *dev, size_t size,
+		dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs)
+{
+	void *addr;
+
+	if ((attrs & DMA_ATTR_NON_CONSISTENT) == 0)
+		return NULL;
+
+	addr = (void *)__get_free_pages(flag, get_order(size));
+	if (addr)
+		*dma_handle = (dma_addr_t)virt_to_phys(addr);
+
+	return addr;
+}
+
+static void *pa11_dma_alloc(struct device *dev, size_t size,
+		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+{
+
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
+		return pcxl_dma_alloc(dev, size, dma_handle, gfp, attrs);
+	else
+		return pcx_dma_alloc(dev, size, dma_handle, gfp, attrs);
+}
+
 static void pa11_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
-	int order;
+	int order = get_order(size);
 
-	order = get_order(size);
-	size = 1 << (order + PAGE_SHIFT);
-	unmap_uncached_pages((unsigned long)vaddr, size);
-	pcxl_free_range((unsigned long)vaddr, size);
-	free_pages((unsigned long)__va(dma_handle), order);
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl) {
+		size = 1 << (order + PAGE_SHIFT);
+		unmap_uncached_pages((unsigned long)vaddr, size);
+		pcxl_free_range((unsigned long)vaddr, size);
+
+		vaddr = __va(dma_handle);
+	}
+	free_pages((unsigned long)vaddr, get_order(size));
 }
 
 static dma_addr_t pa11_dma_map_page(struct device *dev, struct page *page,
@@ -560,7 +588,7 @@ static void pa11_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
 	flush_kernel_dcache_range((unsigned long)vaddr, size);
 }
 
-const struct dma_map_ops pcxl_dma_ops = {
+const struct dma_map_ops pa11_dma_ops = {
 	.alloc =		pa11_dma_alloc,
 	.free =			pa11_dma_free,
 	.map_page =		pa11_dma_map_page,
@@ -573,39 +601,3 @@ const struct dma_map_ops pcxl_dma_ops = {
 	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
 	.cache_sync =		pa11_dma_cache_sync,
 };
-
-static void *pcx_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs)
-{
-	void *addr;
-
-	if ((attrs & DMA_ATTR_NON_CONSISTENT) == 0)
-		return NULL;
-
-	addr = (void *)__get_free_pages(flag, get_order(size));
-	if (addr)
-		*dma_handle = (dma_addr_t)virt_to_phys(addr);
-
-	return addr;
-}
-
-static void pcx_dma_free(struct device *dev, size_t size, void *vaddr,
-		dma_addr_t iova, unsigned long attrs)
-{
-	free_pages((unsigned long)vaddr, get_order(size));
-	return;
-}
-
-const struct dma_map_ops pcx_dma_ops = {
-	.alloc =		pcx_dma_alloc,
-	.free =			pcx_dma_free,
-	.map_page =		pa11_dma_map_page,
-	.unmap_page =		pa11_dma_unmap_page,
-	.map_sg =		pa11_dma_map_sg,
-	.unmap_sg =		pa11_dma_unmap_sg,
-	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
-	.sync_single_for_device = pa11_dma_sync_single_for_device,
-	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
-	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
-	.cache_sync =		pa11_dma_cache_sync,
-};
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
index 8d3a7b80ac42..5c8450a22255 100644
--- a/arch/parisc/kernel/setup.c
+++ b/arch/parisc/kernel/setup.c
@@ -97,14 +97,12 @@ void __init dma_ops_init(void)
 		panic(	"PA-RISC Linux currently only supports machines that conform to\n"
 			"the PA-RISC 1.1 or 2.0 architecture specification.\n");
 
-	case pcxs:
-	case pcxt:
-		hppa_dma_ops = &pcx_dma_ops;
-		break;
 	case pcxl2:
 		pa7300lc_init();
 	case pcxl: /* falls through */
-		hppa_dma_ops = &pcxl_dma_ops;
+	case pcxs:
+	case pcxt:
+		hppa_dma_ops = &pa11_dma_ops;
 		break;
 	default:
 		break;
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 2607d2d33405..74842d28a7a1 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -19,7 +19,6 @@
 #include <linux/gfp.h>
 #include <linux/delay.h>
 #include <linux/init.h>
-#include <linux/pci.h>		/* for hppa_dma_ops and pcxl_dma_ops */
 #include <linux/initrd.h>
 #include <linux/swap.h>
 #include <linux/unistd.h>
@@ -616,17 +615,13 @@ void __init mem_init(void)
 	free_all_bootmem();
 
 #ifdef CONFIG_PA11
-	if (hppa_dma_ops == &pcxl_dma_ops) {
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl) {
 		pcxl_dma_start = (unsigned long)SET_MAP_OFFSET(MAP_START);
 		parisc_vmalloc_start = SET_MAP_OFFSET(pcxl_dma_start
 						+ PCXL_DMA_MAP_SIZE);
-	} else {
-		pcxl_dma_start = 0;
-		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
-	}
-#else
-	parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
+	} else
 #endif
+		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
 
 	mem_init_print_info(NULL);
 
-- 
2.17.1

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

* [PATCH 2/3] parisc: always use flush_kernel_dcache_range for DMA cache maintainance
       [not found] ` <20180619070455.26624-1-hch-jcswGhMUV9g@public.gmane.org>
  2018-06-19  7:04   ` [PATCH 1/3] parisc: merge pcx_dma_ops and pcxl_dma_ops Christoph Hellwig
@ 2018-06-19  7:04   ` Christoph Hellwig
  2018-06-19  7:04   ` [PATCH 3/3] parisc: use generic dma_noncoherent_ops Christoph Hellwig
  2018-07-11 15:34   ` convert parisc to the generic dma-noncoherent code Christoph Hellwig
  3 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2018-06-19  7:04 UTC (permalink / raw)
  To: linux-parisc-u79uwXL29TY76Z2rM5mHXA
  Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

Current the S/G list based DMA ops use flush_kernel_vmap_range which
contains a few UP optimizations, while the rest of the DMA operations
uses flush_kernel_dcache_range.  The single vs sg operations are supposed
to have the same effect, so they should use the same routines.  Use
the more conservation version for now, but if people more familiar with
parisc think the vmap version is generally fine for DMA we should switch
all interfaces over to it.

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 arch/parisc/kernel/pci-dma.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index d34cd6d34717..1f85ca2c0c9e 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -537,7 +537,7 @@ static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
 	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
 
 	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
+		flush_kernel_dcache_range(sg_virt(sg), sg->length);
 }
 
 static void pa11_dma_sync_single_for_cpu(struct device *dev,
@@ -568,7 +568,7 @@ static void pa11_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sgl
 	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
 
 	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
+		flush_kernel_dcache_range(sg_virt(sg), sg->length);
 }
 
 static void pa11_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
@@ -579,7 +579,7 @@ static void pa11_dma_sync_sg_for_device(struct device *dev, struct scatterlist *
 	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
 
 	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
+		flush_kernel_dcache_range(sg_virt(sg), sg->length);
 }
 
 static void pa11_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
-- 
2.17.1

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

* [PATCH 3/3] parisc: use generic dma_noncoherent_ops
       [not found] ` <20180619070455.26624-1-hch-jcswGhMUV9g@public.gmane.org>
  2018-06-19  7:04   ` [PATCH 1/3] parisc: merge pcx_dma_ops and pcxl_dma_ops Christoph Hellwig
  2018-06-19  7:04   ` [PATCH 2/3] parisc: always use flush_kernel_dcache_range for DMA cache maintainance Christoph Hellwig
@ 2018-06-19  7:04   ` Christoph Hellwig
  2018-07-11 15:34   ` convert parisc to the generic dma-noncoherent code Christoph Hellwig
  3 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2018-06-19  7:04 UTC (permalink / raw)
  To: linux-parisc-u79uwXL29TY76Z2rM5mHXA
  Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

Switch to the generic noncoherent direct mapping implementation.

Fix sync_single_for_cpu to do skip the cache flush unless the transfer
is to the device to match the more tested unmap_single path which should
have the same cache coherency implications.

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 arch/parisc/Kconfig                   |   4 +
 arch/parisc/include/asm/dma-mapping.h |   4 -
 arch/parisc/kernel/pci-dma.c          | 145 ++------------------------
 arch/parisc/kernel/setup.c            |   2 +-
 4 files changed, 16 insertions(+), 139 deletions(-)

diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index c480770fabcd..6fb2243a3b04 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -188,6 +188,10 @@ config PA20
 config PA11
 	def_bool y
 	depends on PA7000 || PA7100LC || PA7200 || PA7300LC
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_CACHE_SYNC
 
 config PREFETCH
 	def_bool y
diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h
index eeec8dd18e74..44a9f97194aa 100644
--- a/arch/parisc/include/asm/dma-mapping.h
+++ b/arch/parisc/include/asm/dma-mapping.h
@@ -21,10 +21,6 @@
 ** flush/purge and allocate "regular" cacheable pages for everything.
 */
 
-#ifdef CONFIG_PA11
-extern const struct dma_map_ops pa11_dma_ops;
-#endif
-
 extern const struct dma_map_ops *hppa_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index 1f85ca2c0c9e..04c48f1ef3fb 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -21,13 +21,12 @@
 #include <linux/init.h>
 #include <linux/gfp.h>
 #include <linux/mm.h>
-#include <linux/pci.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/string.h>
 #include <linux/types.h>
-#include <linux/scatterlist.h>
-#include <linux/export.h>
+#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/cacheflush.h>
 #include <asm/dma.h>    /* for DMA_CHUNK_SIZE */
@@ -437,7 +436,7 @@ static void *pcx_dma_alloc(struct device *dev, size_t size,
 	return addr;
 }
 
-static void *pa11_dma_alloc(struct device *dev, size_t size,
+void *arch_dma_alloc(struct device *dev, size_t size,
 		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
 {
 
@@ -447,7 +446,7 @@ static void *pa11_dma_alloc(struct device *dev, size_t size,
 		return pcx_dma_alloc(dev, size, dma_handle, gfp, attrs);
 }
 
-static void pa11_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	int order = get_order(size);
@@ -462,142 +461,20 @@ static void pa11_dma_free(struct device *dev, size_t size, void *vaddr,
 	free_pages((unsigned long)vaddr, get_order(size));
 }
 
-static dma_addr_t pa11_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size,
-		enum dma_data_direction direction, unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	void *addr = page_address(page) + offset;
-	BUG_ON(direction == DMA_NONE);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		flush_kernel_dcache_range((unsigned long) addr, size);
-
-	return virt_to_phys(addr);
-}
-
-static void pa11_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,
-		size_t size, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	BUG_ON(direction == DMA_NONE);
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	if (direction == DMA_TO_DEVICE)
-		return;
-
-	/*
-	 * For PCI_DMA_FROMDEVICE this flush is not necessary for the
-	 * simple map/unmap case. However, it IS necessary if if
-	 * pci_dma_sync_single_* has been called and the buffer reused.
-	 */
-
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle), size);
+	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
 }
 
-static int pa11_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	int i;
-	struct scatterlist *sg;
-
-	BUG_ON(direction == DMA_NONE);
-
-	for_each_sg(sglist, sg, nents, i) {
-		unsigned long vaddr = (unsigned long)sg_virt(sg);
-
-		sg_dma_address(sg) = (dma_addr_t) virt_to_phys(vaddr);
-		sg_dma_len(sg) = sg->length;
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		flush_kernel_dcache_range(vaddr, sg->length);
-	}
-	return nents;
+	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
 }
 
-static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	BUG_ON(direction == DMA_NONE);
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	if (direction == DMA_TO_DEVICE)
-		return;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_dcache_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
-			size);
-}
-
-static void pa11_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
-			size);
-}
-
-static void pa11_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
-{
-	int i;
-	struct scatterlist *sg;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_dcache_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
-{
-	int i;
-	struct scatterlist *sg;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_dcache_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
+void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
 	       enum dma_data_direction direction)
 {
 	flush_kernel_dcache_range((unsigned long)vaddr, size);
 }
-
-const struct dma_map_ops pa11_dma_ops = {
-	.alloc =		pa11_dma_alloc,
-	.free =			pa11_dma_free,
-	.map_page =		pa11_dma_map_page,
-	.unmap_page =		pa11_dma_unmap_page,
-	.map_sg =		pa11_dma_map_sg,
-	.unmap_sg =		pa11_dma_unmap_sg,
-	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
-	.sync_single_for_device = pa11_dma_sync_single_for_device,
-	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
-	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
-	.cache_sync =		pa11_dma_cache_sync,
-};
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
index 5c8450a22255..4e87c35c22b7 100644
--- a/arch/parisc/kernel/setup.c
+++ b/arch/parisc/kernel/setup.c
@@ -102,7 +102,7 @@ void __init dma_ops_init(void)
 	case pcxl: /* falls through */
 	case pcxs:
 	case pcxt:
-		hppa_dma_ops = &pa11_dma_ops;
+		hppa_dma_ops = &dma_noncoherent_ops;
 		break;
 	default:
 		break;
-- 
2.17.1

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

* Re: convert parisc to the generic dma-noncoherent code
       [not found] ` <20180619070455.26624-1-hch-jcswGhMUV9g@public.gmane.org>
                     ` (2 preceding siblings ...)
  2018-06-19  7:04   ` [PATCH 3/3] parisc: use generic dma_noncoherent_ops Christoph Hellwig
@ 2018-07-11 15:34   ` Christoph Hellwig
       [not found]     ` <20180711153445.GC31946-jcswGhMUV9g@public.gmane.org>
  3 siblings, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2018-07-11 15:34 UTC (permalink / raw)
  To: linux-parisc-u79uwXL29TY76Z2rM5mHXA, Helge Deller
  Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

ping?  Any comments?

On Tue, Jun 19, 2018 at 09:04:52AM +0200, Christoph Hellwig wrote:
> This should address all the comments raised last time.
> 
> 
> _______________________________________________
> iommu mailing list
> iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu
---end quoted text---

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

* Re: convert parisc to the generic dma-noncoherent code
       [not found]     ` <20180711153445.GC31946-jcswGhMUV9g@public.gmane.org>
@ 2018-07-13  8:14       ` Helge Deller
       [not found]         ` <e2b653d8-cc04-7a81-89a0-9d286c5cc0ca-Mmb7MZpHnFY@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Helge Deller @ 2018-07-13  8:14 UTC (permalink / raw)
  To: Christoph Hellwig, linux-parisc-u79uwXL29TY76Z2rM5mHXA
  Cc: James Bottomley, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

On 11.07.2018 17:34, Christoph Hellwig wrote:
> ping?  Any comments?

I applied those 3 patches on top of git head, and booted the
32-bit kernel on a HP 715/64 (PCX-L) and a HP B160L (PCX-L2).
On both machines I had problems with those drivers which use
DMA (I checked specifically the lasi NIC card, which is the 
main onboard NIC card in both machines).
Getting IP via DHCP was unreliable, pings on the same network 
to both machines gave lost packets, login via ssh sometimes failed
and so on.

So, there is definitively some cache-flush missing in this patchset.

I'm happy to test any further patches, but I'l be blocked at least
until end of next week. It would be good if James could do some 
testing on his PCX-machine too, since that machine is different
than mine.

Thanks for your efforts to clean that up!
Helge

> On Tue, Jun 19, 2018 at 09:04:52AM +0200, Christoph Hellwig wrote:
>> This should address all the comments raised last time.
For the record: Here is the link to the patchbundle:
https://patchwork.kernel.org/bundle/helge/DMA_OP/

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

* Re: convert parisc to the generic dma-noncoherent code
       [not found]         ` <e2b653d8-cc04-7a81-89a0-9d286c5cc0ca-Mmb7MZpHnFY@public.gmane.org>
@ 2018-07-15 16:29             ` John David Anglin
  0 siblings, 0 replies; 14+ messages in thread
From: John David Anglin @ 2018-07-15 16:29 UTC (permalink / raw)
  To: Helge Deller, Christoph Hellwig, linux-parisc-u79uwXL29TY76Z2rM5mHXA
  Cc: James Bottomley, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

T24gMjAxOC0wNy0xMyA0OjE0IEFNLCBIZWxnZSBEZWxsZXIgd3JvdGU6Cj4gT24gMTEuMDcuMjAx
OCAxNzozNCwgQ2hyaXN0b3BoIEhlbGx3aWcgd3JvdGU6Cj4+IHBpbmc/ICBBbnkgY29tbWVudHM/
Cj4gSSBhcHBsaWVkIHRob3NlIDMgcGF0Y2hlcyBvbiB0b3Agb2YgZ2l0IGhlYWQsIGFuZCBib290
ZWQgdGhlCj4gMzItYml0IGtlcm5lbCBvbiBhIEhQIDcxNS82NCAoUENYLUwpIGFuZCBhIEhQIEIx
NjBMIChQQ1gtTDIpLgo+IE9uIGJvdGggbWFjaGluZXMgSSBoYWQgcHJvYmxlbXMgd2l0aCB0aG9z
ZSBkcml2ZXJzIHdoaWNoIHVzZQo+IERNQSAoSSBjaGVja2VkIHNwZWNpZmljYWxseSB0aGUgbGFz
aSBOSUMgY2FyZCwgd2hpY2ggaXMgdGhlCj4gbWFpbiBvbmJvYXJkIE5JQyBjYXJkIGluIGJvdGgg
bWFjaGluZXMpLgo+IEdldHRpbmcgSVAgdmlhIERIQ1Agd2FzIHVucmVsaWFibGUsIHBpbmdzIG9u
IHRoZSBzYW1lIG5ldHdvcmsKPiB0byBib3RoIG1hY2hpbmVzIGdhdmUgbG9zdCBwYWNrZXRzLCBs
b2dpbiB2aWEgc3NoIHNvbWV0aW1lcyBmYWlsZWQKPiBhbmQgc28gb24uCj4KPiBTbywgdGhlcmUg
aXMgZGVmaW5pdGl2ZWx5IHNvbWUgY2FjaGUtZmx1c2ggbWlzc2luZyBpbiB0aGlzIHBhdGNoc2V0
LgpQb3NzaWJseSwgdGhlIGNvZGUgc2hvdWxkIHVzZSBmbHVzaF9rZXJuZWxfdm1hcF9yYW5nZSgp
IGFzIGl0IHB1cmdlcyB0aGUgClRMQiBlbnRyaWVzIHVzZWQKZm9yIHRoZSBjYWNoZSBmbHVzaC7C
oCBTb21lIG9mIHRoZSByb3V0aW5lcyBpbiBwY2ktZG1hLmMgY3VycmVudGx5IHVzZSBpdC4KCkRh
dmUKCi0tIApKb2huIERhdmlkIEFuZ2xpbiAgZGF2ZS5hbmdsaW5AYmVsbC5uZXQKCl9fX19fX19f
X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCmlvbW11IG1haWxpbmcgbGlz
dAppb21tdUBsaXN0cy5saW51eC1mb3VuZGF0aW9uLm9yZwpodHRwczovL2xpc3RzLmxpbnV4Zm91
bmRhdGlvbi5vcmcvbWFpbG1hbi9saXN0aW5mby9pb21tdQ==

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

* Re: convert parisc to the generic dma-noncoherent code
@ 2018-07-15 16:29             ` John David Anglin
  0 siblings, 0 replies; 14+ messages in thread
From: John David Anglin @ 2018-07-15 16:29 UTC (permalink / raw)
  To: Helge Deller, Christoph Hellwig, linux-parisc-u79uwXL29TY76Z2rM5mHXA
  Cc: James Bottomley, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

On 2018-07-13 4:14 AM, Helge Deller wrote:
> On 11.07.2018 17:34, Christoph Hellwig wrote:
>> ping?  Any comments?
> I applied those 3 patches on top of git head, and booted the
> 32-bit kernel on a HP 715/64 (PCX-L) and a HP B160L (PCX-L2).
> On both machines I had problems with those drivers which use
> DMA (I checked specifically the lasi NIC card, which is the
> main onboard NIC card in both machines).
> Getting IP via DHCP was unreliable, pings on the same network
> to both machines gave lost packets, login via ssh sometimes failed
> and so on.
>
> So, there is definitively some cache-flush missing in this patchset.
Possibly, the code should use flush_kernel_vmap_range() as it purges the 
TLB entries used
for the cache flush.  Some of the routines in pci-dma.c currently use it.

Dave

-- 
John David Anglin  dave.anglin@bell.net

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* Re: convert parisc to the generic dma-noncoherent code
       [not found]             ` <e29f9140-0d47-e074-1609-d6ae8f8869b3-CzeTG9NwML0@public.gmane.org>
@ 2018-07-17 13:19                 ` Christoph Hellwig
  0 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2018-07-17 13:19 UTC (permalink / raw)
  To: John David Anglin
  Cc: James Bottomley, Helge Deller,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Christoph Hellwig, linux-parisc-u79uwXL29TY76Z2rM5mHXA

On Sun, Jul 15, 2018 at 12:29:37PM -0400, John David Anglin wrote:
> On 2018-07-13 4:14 AM, Helge Deller wrote:
>> On 11.07.2018 17:34, Christoph Hellwig wrote:
>>> ping?  Any comments?
>> I applied those 3 patches on top of git head, and booted the
>> 32-bit kernel on a HP 715/64 (PCX-L) and a HP B160L (PCX-L2).
>> On both machines I had problems with those drivers which use
>> DMA (I checked specifically the lasi NIC card, which is the
>> main onboard NIC card in both machines).
>> Getting IP via DHCP was unreliable, pings on the same network
>> to both machines gave lost packets, login via ssh sometimes failed
>> and so on.
>>
>> So, there is definitively some cache-flush missing in this patchset.
> Possibly, the code should use flush_kernel_vmap_range() as it purges the =

> TLB entries used
> for the cache flush.=A0 Some of the routines in pci-dma.c currently use i=
t.

That might be worth a try and is already discussed in my description.

Also it might be good to check that the last patch really is the culprit,
I'm pretty certain it is, but a double check never hurts.

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

* Re: convert parisc to the generic dma-noncoherent code
@ 2018-07-17 13:19                 ` Christoph Hellwig
  0 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2018-07-17 13:19 UTC (permalink / raw)
  To: John David Anglin
  Cc: James Bottomley, Helge Deller,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Christoph Hellwig, linux-parisc-u79uwXL29TY76Z2rM5mHXA

On Sun, Jul 15, 2018 at 12:29:37PM -0400, John David Anglin wrote:
> On 2018-07-13 4:14 AM, Helge Deller wrote:
>> On 11.07.2018 17:34, Christoph Hellwig wrote:
>>> ping?  Any comments?
>> I applied those 3 patches on top of git head, and booted the
>> 32-bit kernel on a HP 715/64 (PCX-L) and a HP B160L (PCX-L2).
>> On both machines I had problems with those drivers which use
>> DMA (I checked specifically the lasi NIC card, which is the
>> main onboard NIC card in both machines).
>> Getting IP via DHCP was unreliable, pings on the same network
>> to both machines gave lost packets, login via ssh sometimes failed
>> and so on.
>>
>> So, there is definitively some cache-flush missing in this patchset.
> Possibly, the code should use flush_kernel_vmap_range() as it purges the 
> TLB entries used
> for the cache flush.  Some of the routines in pci-dma.c currently use it.

That might be worth a try and is already discussed in my description.

Also it might be good to check that the last patch really is the culprit,
I'm pretty certain it is, but a double check never hurts.

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

* Re: convert parisc to the generic dma-noncoherent code
       [not found]                 ` <20180717131952.GF13582-jcswGhMUV9g@public.gmane.org>
@ 2018-07-22 15:45                     ` Helge Deller
  0 siblings, 0 replies; 14+ messages in thread
From: Helge Deller @ 2018-07-22 15:45 UTC (permalink / raw)
  To: Christoph Hellwig, John David Anglin
  Cc: James Bottomley,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-parisc-u79uwXL29TY76Z2rM5mHXA

T24gMTcuMDcuMjAxOCAxNToxOSwgQ2hyaXN0b3BoIEhlbGx3aWcgd3JvdGU6Cj4gT24gU3VuLCBK
dWwgMTUsIDIwMTggYXQgMTI6Mjk6MzdQTSAtMDQwMCwgSm9obiBEYXZpZCBBbmdsaW4gd3JvdGU6
Cj4+IE9uIDIwMTgtMDctMTMgNDoxNCBBTSwgSGVsZ2UgRGVsbGVyIHdyb3RlOgo+Pj4gT24gMTEu
MDcuMjAxOCAxNzozNCwgQ2hyaXN0b3BoIEhlbGx3aWcgd3JvdGU6Cj4+Pj4gcGluZz8gIEFueSBj
b21tZW50cz8KPj4+IEkgYXBwbGllZCB0aG9zZSAzIHBhdGNoZXMgb24gdG9wIG9mIGdpdCBoZWFk
LCBhbmQgYm9vdGVkIHRoZQo+Pj4gMzItYml0IGtlcm5lbCBvbiBhIEhQIDcxNS82NCAoUENYLUwp
IGFuZCBhIEhQIEIxNjBMIChQQ1gtTDIpLgo+Pj4gT24gYm90aCBtYWNoaW5lcyBJIGhhZCBwcm9i
bGVtcyB3aXRoIHRob3NlIGRyaXZlcnMgd2hpY2ggdXNlCj4+PiBETUEgKEkgY2hlY2tlZCBzcGVj
aWZpY2FsbHkgdGhlIGxhc2kgTklDIGNhcmQsIHdoaWNoIGlzIHRoZQo+Pj4gbWFpbiBvbmJvYXJk
IE5JQyBjYXJkIGluIGJvdGggbWFjaGluZXMpLgo+Pj4gR2V0dGluZyBJUCB2aWEgREhDUCB3YXMg
dW5yZWxpYWJsZSwgcGluZ3Mgb24gdGhlIHNhbWUgbmV0d29yawo+Pj4gdG8gYm90aCBtYWNoaW5l
cyBnYXZlIGxvc3QgcGFja2V0cywgbG9naW4gdmlhIHNzaCBzb21ldGltZXMgZmFpbGVkCj4+PiBh
bmQgc28gb24uCj4+Pgo+Pj4gU28sIHRoZXJlIGlzIGRlZmluaXRpdmVseSBzb21lIGNhY2hlLWZs
dXNoIG1pc3NpbmcgaW4gdGhpcyBwYXRjaHNldC4KPj4gUG9zc2libHksIHRoZSBjb2RlIHNob3Vs
ZCB1c2UgZmx1c2hfa2VybmVsX3ZtYXBfcmFuZ2UoKSBhcyBpdCBwdXJnZXMgdGhlIAo+PiBUTEIg
ZW50cmllcyB1c2VkCj4+IGZvciB0aGUgY2FjaGUgZmx1c2guwqAgU29tZSBvZiB0aGUgcm91dGlu
ZXMgaW4gcGNpLWRtYS5jIGN1cnJlbnRseSB1c2UgaXQuCj4gCj4gVGhhdCBtaWdodCBiZSB3b3J0
aCBhIHRyeSBhbmQgaXMgYWxyZWFkeSBkaXNjdXNzZWQgaW4gbXkgZGVzY3JpcHRpb24uCj4gCj4g
QWxzbyBpdCBtaWdodCBiZSBnb29kIHRvIGNoZWNrIHRoYXQgdGhlIGxhc3QgcGF0Y2ggcmVhbGx5
IGlzIHRoZSBjdWxwcml0LAo+IEknbSBwcmV0dHkgY2VydGFpbiBpdCBpcywgYnV0IGEgZG91Ymxl
IGNoZWNrIG5ldmVyIGh1cnRzLgoKU29tZWhvdyBJIG5vdyBjYW4ndCByZXByb2R1Y2UgdGhlIGNh
Y2hlIGlzc3VlcyBhbnkgbG9uZ2VyLiBCb3RoLCB5b3VyIG9yaWdpbmFsCnBhdGNoIGFuZCB3aGVu
IHVzaW5nIGZsdXNoX2tlcm5lbF92bWFwX3JhbmdlKCksIGJvdGggd29yay4KClNvLCB5b3UgY2Fu
IGFkZCBhIApUZXN0ZWQtYnk6IEhlbGdlIERlbGxlciA8ZGVsbGVyQGdteC5kZT4KdG8geW91ciBv
cmlnaW5hbCBwYXRjaCBzZXJpZXMuCgpIZWxnZQpfX19fX19fX19fX19fX19fX19fX19fX19fX19f
X19fX19fX19fX19fX19fX19fXwppb21tdSBtYWlsaW5nIGxpc3QKaW9tbXVAbGlzdHMubGludXgt
Zm91bmRhdGlvbi5vcmcKaHR0cHM6Ly9saXN0cy5saW51eGZvdW5kYXRpb24ub3JnL21haWxtYW4v
bGlzdGluZm8vaW9tbXU=

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

* Re: convert parisc to the generic dma-noncoherent code
@ 2018-07-22 15:45                     ` Helge Deller
  0 siblings, 0 replies; 14+ messages in thread
From: Helge Deller @ 2018-07-22 15:45 UTC (permalink / raw)
  To: Christoph Hellwig, John David Anglin
  Cc: James Bottomley,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-parisc-u79uwXL29TY76Z2rM5mHXA

On 17.07.2018 15:19, Christoph Hellwig wrote:
> On Sun, Jul 15, 2018 at 12:29:37PM -0400, John David Anglin wrote:
>> On 2018-07-13 4:14 AM, Helge Deller wrote:
>>> On 11.07.2018 17:34, Christoph Hellwig wrote:
>>>> ping?  Any comments?
>>> I applied those 3 patches on top of git head, and booted the
>>> 32-bit kernel on a HP 715/64 (PCX-L) and a HP B160L (PCX-L2).
>>> On both machines I had problems with those drivers which use
>>> DMA (I checked specifically the lasi NIC card, which is the
>>> main onboard NIC card in both machines).
>>> Getting IP via DHCP was unreliable, pings on the same network
>>> to both machines gave lost packets, login via ssh sometimes failed
>>> and so on.
>>>
>>> So, there is definitively some cache-flush missing in this patchset.
>> Possibly, the code should use flush_kernel_vmap_range() as it purges the 
>> TLB entries used
>> for the cache flush.  Some of the routines in pci-dma.c currently use it.
> 
> That might be worth a try and is already discussed in my description.
> 
> Also it might be good to check that the last patch really is the culprit,
> I'm pretty certain it is, but a double check never hurts.

Somehow I now can't reproduce the cache issues any longer. Both, your original
patch and when using flush_kernel_vmap_range(), both work.

So, you can add a 
Tested-by: Helge Deller <deller@gmx.de>
to your original patch series.

Helge
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* Re: convert parisc to the generic dma-noncoherent code
       [not found]                     ` <c080d766-5b7b-2776-848c-60da09bd2c9c-Mmb7MZpHnFY@public.gmane.org>
@ 2018-07-22 19:57                       ` Christoph Hellwig
       [not found]                         ` <20180722195722.GA10147-jcswGhMUV9g@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2018-07-22 19:57 UTC (permalink / raw)
  To: Helge Deller
  Cc: James Bottomley,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	John David Anglin, Christoph Hellwig,
	linux-parisc-u79uwXL29TY76Z2rM5mHXA

On Sun, Jul 22, 2018 at 05:45:40PM +0200, Helge Deller wrote:
> Somehow I now can't reproduce the cache issues any longer. Both, your original
> patch and when using flush_kernel_vmap_range(), both work.
> 
> So, you can add a 
> Tested-by: Helge Deller <deller-Mmb7MZpHnFY@public.gmane.org>
> to your original patch series.

I can merge this through the dma-mapping tree, but given that
it touches only arch/parisc/ it might make more sense to merge it
through the parisc tree.

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

* Re: convert parisc to the generic dma-noncoherent code
       [not found]                         ` <20180722195722.GA10147-jcswGhMUV9g@public.gmane.org>
@ 2018-07-23  5:46                           ` Helge Deller
  0 siblings, 0 replies; 14+ messages in thread
From: Helge Deller @ 2018-07-23  5:46 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: James Bottomley,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	John David Anglin, linux-parisc-u79uwXL29TY76Z2rM5mHXA

On 22.07.2018 21:57, Christoph Hellwig wrote:
> On Sun, Jul 22, 2018 at 05:45:40PM +0200, Helge Deller wrote:
>> Somehow I now can't reproduce the cache issues any longer. Both, your original
>> patch and when using flush_kernel_vmap_range(), both work.
>>
>> So, you can add a 
>> Tested-by: Helge Deller <deller-Mmb7MZpHnFY@public.gmane.org>
>> to your original patch series.
> 
> I can merge this through the dma-mapping tree, but given that
> it touches only arch/parisc/ it might make more sense to merge it
> through the parisc tree.

Sure, I will take it through the parisc tree.

Thanks!
Helge

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

end of thread, other threads:[~2018-07-23  5:46 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-19  7:04 convert parisc to the generic dma-noncoherent code Christoph Hellwig
     [not found] ` <20180619070455.26624-1-hch-jcswGhMUV9g@public.gmane.org>
2018-06-19  7:04   ` [PATCH 1/3] parisc: merge pcx_dma_ops and pcxl_dma_ops Christoph Hellwig
2018-06-19  7:04   ` [PATCH 2/3] parisc: always use flush_kernel_dcache_range for DMA cache maintainance Christoph Hellwig
2018-06-19  7:04   ` [PATCH 3/3] parisc: use generic dma_noncoherent_ops Christoph Hellwig
2018-07-11 15:34   ` convert parisc to the generic dma-noncoherent code Christoph Hellwig
     [not found]     ` <20180711153445.GC31946-jcswGhMUV9g@public.gmane.org>
2018-07-13  8:14       ` Helge Deller
     [not found]         ` <e2b653d8-cc04-7a81-89a0-9d286c5cc0ca-Mmb7MZpHnFY@public.gmane.org>
2018-07-15 16:29           ` John David Anglin
2018-07-15 16:29             ` John David Anglin
     [not found]             ` <e29f9140-0d47-e074-1609-d6ae8f8869b3-CzeTG9NwML0@public.gmane.org>
2018-07-17 13:19               ` Christoph Hellwig
2018-07-17 13:19                 ` Christoph Hellwig
     [not found]                 ` <20180717131952.GF13582-jcswGhMUV9g@public.gmane.org>
2018-07-22 15:45                   ` Helge Deller
2018-07-22 15:45                     ` Helge Deller
     [not found]                     ` <c080d766-5b7b-2776-848c-60da09bd2c9c-Mmb7MZpHnFY@public.gmane.org>
2018-07-22 19:57                       ` Christoph Hellwig
     [not found]                         ` <20180722195722.GA10147-jcswGhMUV9g@public.gmane.org>
2018-07-23  5:46                           ` Helge Deller

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.