linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] xen/arm,arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..."
@ 2017-04-13 21:04 Stefano Stabellini
  2017-04-13 21:04 ` [PATCH 2/2] xen/arm,arm64: rename __generic_dma_ops to xen_get_dma_ops Stefano Stabellini
  2017-04-18 14:21 ` [PATCH 1/2] xen/arm, arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..." Catalin Marinas
  0 siblings, 2 replies; 15+ messages in thread
From: Stefano Stabellini @ 2017-04-13 21:04 UTC (permalink / raw)
  To: xen-devel
  Cc: linux-kernel, linux-arm-kernel, sstabellini, linux,
	catalin.marinas, will.deacon, boris.ostrovsky, jgross,
	Julien Grall

The following commit:

  commit 815dd18788fe0d41899f51b91d0560279cf16b0d
  Author: Bart Van Assche <bart.vanassche@sandisk.com>
  Date:   Fri Jan 20 13:04:04 2017 -0800

      treewide: Consolidate get_dma_ops() implementations

rearranges get_dma_ops in a way that xen_dma_ops are not returned when
running on Xen anymore, dev->dma_ops is returned instead (see
arch/arm/include/asm/dma-mapping.h:get_arch_dma_ops and
include/linux/dma-mapping.h:get_dma_ops).

Fix the problem by storing dev->dma_ops in dev_archdata, and setting
dev->dma_ops to xen_dma_ops. This way, xen_dma_ops is returned naturally
by get_dma_ops. The Xen code can retrieve the original dev->dma_ops from
dev_archdata when needed. It also allows us to remove __generic_dma_ops
from common headers.

Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Tested-by: Julien Grall <julien.grall@arm.com>
Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
CC: linux@armlinux.org.uk
CC: catalin.marinas@arm.com
CC: will.deacon@arm.com
CC: boris.ostrovsky@oracle.com
CC: jgross@suse.com
CC: Julien Grall <julien.grall@arm.com>
---
 arch/arm/include/asm/device.h        |  3 +++
 arch/arm/include/asm/dma-mapping.h   | 12 +-----------
 arch/arm/mm/dma-mapping.c            |  7 +++++++
 arch/arm64/include/asm/device.h      |  3 +++
 arch/arm64/include/asm/dma-mapping.h | 13 +------------
 arch/arm64/mm/dma-mapping.c          |  7 +++++++
 include/xen/arm/page-coherent.h      |  8 ++++++++
 7 files changed, 30 insertions(+), 23 deletions(-)

diff --git a/arch/arm/include/asm/device.h b/arch/arm/include/asm/device.h
index 220ba20..36ec9c8 100644
--- a/arch/arm/include/asm/device.h
+++ b/arch/arm/include/asm/device.h
@@ -16,6 +16,9 @@ struct dev_archdata {
 #ifdef CONFIG_ARM_DMA_USE_IOMMU
 	struct dma_iommu_mapping	*mapping;
 #endif
+#ifdef CONFIG_XEN
+	const struct dma_map_ops *dev_dma_ops;
+#endif
 	bool dma_coherent;
 };
 
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index 7166569..680d3f3 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -16,19 +16,9 @@
 extern const struct dma_map_ops arm_dma_ops;
 extern const struct dma_map_ops arm_coherent_dma_ops;
 
-static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
-{
-	if (dev && dev->dma_ops)
-		return dev->dma_ops;
-	return &arm_dma_ops;
-}
-
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
-	if (xen_initial_domain())
-		return xen_dma_ops;
-	else
-		return __generic_dma_ops(NULL);
+	return &arm_dma_ops;
 }
 
 #define HAVE_ARCH_DMA_SUPPORTED 1
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 63eabb0..a614459 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -2396,6 +2396,13 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 		dma_ops = arm_get_dma_map_ops(coherent);
 
 	set_dma_ops(dev, dma_ops);
+
+#ifdef CONFIG_XEN
+	if (xen_initial_domain()) {
+		dev->archdata.dev_dma_ops = dev->dma_ops;
+		dev->dma_ops = xen_dma_ops;
+	}
+#endif
 }
 
 void arch_teardown_dma_ops(struct device *dev)
diff --git a/arch/arm64/include/asm/device.h b/arch/arm64/include/asm/device.h
index 73d5bab..5a5fa47 100644
--- a/arch/arm64/include/asm/device.h
+++ b/arch/arm64/include/asm/device.h
@@ -20,6 +20,9 @@ struct dev_archdata {
 #ifdef CONFIG_IOMMU_API
 	void *iommu;			/* private IOMMU data */
 #endif
+#ifdef CONFIG_XEN
+	const struct dma_map_ops *dev_dma_ops;
+#endif
 	bool dma_coherent;
 };
 
diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h
index 505756c..5392dbe 100644
--- a/arch/arm64/include/asm/dma-mapping.h
+++ b/arch/arm64/include/asm/dma-mapping.h
@@ -27,11 +27,8 @@
 #define DMA_ERROR_CODE	(~(dma_addr_t)0)
 extern const struct dma_map_ops dummy_dma_ops;
 
-static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
+static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
-	if (dev && dev->dma_ops)
-		return dev->dma_ops;
-
 	/*
 	 * We expect no ISA devices, and all other DMA masters are expected to
 	 * have someone call arch_setup_dma_ops at device creation time.
@@ -39,14 +36,6 @@ static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
 	return &dummy_dma_ops;
 }
 
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	if (xen_initial_domain())
-		return xen_dma_ops;
-	else
-		return __generic_dma_ops(NULL);
-}
-
 void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 			const struct iommu_ops *iommu, bool coherent);
 #define arch_setup_dma_ops	arch_setup_dma_ops
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index 81cdb2e..7f8b37e 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -977,4 +977,11 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 
 	dev->archdata.dma_coherent = coherent;
 	__iommu_setup_dma_ops(dev, dma_base, size, iommu);
+
+#ifdef CONFIG_XEN
+	if (xen_initial_domain()) {
+		dev->archdata.dev_dma_ops = dev->dma_ops;
+		dev->dma_ops = xen_dma_ops;
+	}
+#endif
 }
diff --git a/include/xen/arm/page-coherent.h b/include/xen/arm/page-coherent.h
index 95ce6ac..b0a2bfc 100644
--- a/include/xen/arm/page-coherent.h
+++ b/include/xen/arm/page-coherent.h
@@ -2,8 +2,16 @@
 #define _ASM_ARM_XEN_PAGE_COHERENT_H
 
 #include <asm/page.h>
+#include <asm/dma-mapping.h>
 #include <linux/dma-mapping.h>
 
+static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
+{
+	if (dev && dev->archdata.dev_dma_ops)
+		return dev->archdata.dev_dma_ops;
+	return get_arch_dma_ops(NULL);
+}
+
 void __xen_dma_map_page(struct device *hwdev, struct page *page,
 	     dma_addr_t dev_addr, unsigned long offset, size_t size,
 	     enum dma_data_direction dir, unsigned long attrs);
-- 
1.9.1

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

* [PATCH 2/2] xen/arm,arm64: rename __generic_dma_ops to xen_get_dma_ops
  2017-04-13 21:04 [PATCH 1/2] xen/arm,arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..." Stefano Stabellini
@ 2017-04-13 21:04 ` Stefano Stabellini
  2017-04-14  0:48   ` Boris Ostrovsky
  2017-04-18 14:21 ` [PATCH 1/2] xen/arm, arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..." Catalin Marinas
  1 sibling, 1 reply; 15+ messages in thread
From: Stefano Stabellini @ 2017-04-13 21:04 UTC (permalink / raw)
  To: xen-devel
  Cc: linux-kernel, linux-arm-kernel, sstabellini, linux,
	catalin.marinas, will.deacon, boris.ostrovsky, jgross,
	Julien Grall

Now that __generic_dma_ops is a xen specific function, rename it to
xen_get_dma_ops. Change all the call sites appropriately.

Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
CC: linux@armlinux.org.uk
CC: catalin.marinas@arm.com
CC: will.deacon@arm.com
CC: boris.ostrovsky@oracle.com
CC: jgross@suse.com
CC: Julien Grall <julien.grall@arm.com>
---
 drivers/xen/swiotlb-xen.c       |  8 ++++----
 include/xen/arm/page-coherent.h | 20 ++++++++++----------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
index e8cef1a..8dab0d3 100644
--- a/drivers/xen/swiotlb-xen.c
+++ b/drivers/xen/swiotlb-xen.c
@@ -693,8 +693,8 @@ void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
 		     unsigned long attrs)
 {
 #if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
-	if (__generic_dma_ops(dev)->mmap)
-		return __generic_dma_ops(dev)->mmap(dev, vma, cpu_addr,
+	if (xen_get_dma_ops(dev)->mmap)
+		return xen_get_dma_ops(dev)->mmap(dev, vma, cpu_addr,
 						    dma_addr, size, attrs);
 #endif
 	return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
@@ -711,7 +711,7 @@ void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
 			unsigned long attrs)
 {
 #if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
-	if (__generic_dma_ops(dev)->get_sgtable) {
+	if (xen_get_dma_ops(dev)->get_sgtable) {
 #if 0
 	/*
 	 * This check verifies that the page belongs to the current domain and
@@ -721,7 +721,7 @@ void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
 		unsigned long bfn = PHYS_PFN(dma_to_phys(dev, handle));
 		BUG_ON (!page_is_ram(bfn));
 #endif
-		return __generic_dma_ops(dev)->get_sgtable(dev, sgt, cpu_addr,
+		return xen_get_dma_ops(dev)->get_sgtable(dev, sgt, cpu_addr,
 							   handle, size, attrs);
 	}
 #endif
diff --git a/include/xen/arm/page-coherent.h b/include/xen/arm/page-coherent.h
index b0a2bfc..b1b4ecd 100644
--- a/include/xen/arm/page-coherent.h
+++ b/include/xen/arm/page-coherent.h
@@ -5,7 +5,7 @@
 #include <asm/dma-mapping.h>
 #include <linux/dma-mapping.h>
 
-static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
+static inline const struct dma_map_ops *xen_get_dma_ops(struct device *dev)
 {
 	if (dev && dev->archdata.dev_dma_ops)
 		return dev->archdata.dev_dma_ops;
@@ -27,13 +27,13 @@ void __xen_dma_sync_single_for_device(struct device *hwdev,
 static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size,
 		dma_addr_t *dma_handle, gfp_t flags, unsigned long attrs)
 {
-	return __generic_dma_ops(hwdev)->alloc(hwdev, size, dma_handle, flags, attrs);
+	return xen_get_dma_ops(hwdev)->alloc(hwdev, size, dma_handle, flags, attrs);
 }
 
 static inline void xen_free_coherent_pages(struct device *hwdev, size_t size,
 		void *cpu_addr, dma_addr_t dma_handle, unsigned long attrs)
 {
-	__generic_dma_ops(hwdev)->free(hwdev, size, cpu_addr, dma_handle, attrs);
+	xen_get_dma_ops(hwdev)->free(hwdev, size, cpu_addr, dma_handle, attrs);
 }
 
 static inline void xen_dma_map_page(struct device *hwdev, struct page *page,
@@ -57,7 +57,7 @@ static inline void xen_dma_map_page(struct device *hwdev, struct page *page,
 	 * specific function.
 	 */
 	if (local)
-		__generic_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs);
+		xen_get_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs);
 	else
 		__xen_dma_map_page(hwdev, page, dev_addr, offset, size, dir, attrs);
 }
@@ -75,8 +75,8 @@ static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle,
 	 * specific function.
 	 */
 	if (pfn_valid(pfn)) {
-		if (__generic_dma_ops(hwdev)->unmap_page)
-			__generic_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs);
+		if (xen_get_dma_ops(hwdev)->unmap_page)
+			xen_get_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs);
 	} else
 		__xen_dma_unmap_page(hwdev, handle, size, dir, attrs);
 }
@@ -86,8 +86,8 @@ static inline void xen_dma_sync_single_for_cpu(struct device *hwdev,
 {
 	unsigned long pfn = PFN_DOWN(handle);
 	if (pfn_valid(pfn)) {
-		if (__generic_dma_ops(hwdev)->sync_single_for_cpu)
-			__generic_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir);
+		if (xen_get_dma_ops(hwdev)->sync_single_for_cpu)
+			xen_get_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir);
 	} else
 		__xen_dma_sync_single_for_cpu(hwdev, handle, size, dir);
 }
@@ -97,8 +97,8 @@ static inline void xen_dma_sync_single_for_device(struct device *hwdev,
 {
 	unsigned long pfn = PFN_DOWN(handle);
 	if (pfn_valid(pfn)) {
-		if (__generic_dma_ops(hwdev)->sync_single_for_device)
-			__generic_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir);
+		if (xen_get_dma_ops(hwdev)->sync_single_for_device)
+			xen_get_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir);
 	} else
 		__xen_dma_sync_single_for_device(hwdev, handle, size, dir);
 }
-- 
1.9.1

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

* Re: [PATCH 2/2] xen/arm,arm64: rename __generic_dma_ops to xen_get_dma_ops
  2017-04-13 21:04 ` [PATCH 2/2] xen/arm,arm64: rename __generic_dma_ops to xen_get_dma_ops Stefano Stabellini
@ 2017-04-14  0:48   ` Boris Ostrovsky
  2017-04-14  2:14     ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 15+ messages in thread
From: Boris Ostrovsky @ 2017-04-14  0:48 UTC (permalink / raw)
  To: Stefano Stabellini, xen-devel
  Cc: linux-kernel, linux-arm-kernel, linux, catalin.marinas,
	will.deacon, jgross, Julien Grall, Konrad Rzeszutek Wilk



On 04/13/2017 05:04 PM, Stefano Stabellini wrote:
> Now that __generic_dma_ops is a xen specific function, rename it to
> xen_get_dma_ops. Change all the call sites appropriately.
>
> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> CC: linux@armlinux.org.uk
> CC: catalin.marinas@arm.com
> CC: will.deacon@arm.com
> CC: boris.ostrovsky@oracle.com
> CC: jgross@suse.com
> CC: Julien Grall <julien.grall@arm.com>

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

(+Konrad)


> ---
>  drivers/xen/swiotlb-xen.c       |  8 ++++----
>  include/xen/arm/page-coherent.h | 20 ++++++++++----------
>  2 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
> index e8cef1a..8dab0d3 100644
> --- a/drivers/xen/swiotlb-xen.c
> +++ b/drivers/xen/swiotlb-xen.c
> @@ -693,8 +693,8 @@ void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
>  		     unsigned long attrs)
>  {
>  #if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
> -	if (__generic_dma_ops(dev)->mmap)
> -		return __generic_dma_ops(dev)->mmap(dev, vma, cpu_addr,
> +	if (xen_get_dma_ops(dev)->mmap)
> +		return xen_get_dma_ops(dev)->mmap(dev, vma, cpu_addr,
>  						    dma_addr, size, attrs);
>  #endif
>  	return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
> @@ -711,7 +711,7 @@ void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
>  			unsigned long attrs)
>  {
>  #if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
> -	if (__generic_dma_ops(dev)->get_sgtable) {
> +	if (xen_get_dma_ops(dev)->get_sgtable) {
>  #if 0
>  	/*
>  	 * This check verifies that the page belongs to the current domain and
> @@ -721,7 +721,7 @@ void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
>  		unsigned long bfn = PHYS_PFN(dma_to_phys(dev, handle));
>  		BUG_ON (!page_is_ram(bfn));
>  #endif
> -		return __generic_dma_ops(dev)->get_sgtable(dev, sgt, cpu_addr,
> +		return xen_get_dma_ops(dev)->get_sgtable(dev, sgt, cpu_addr,
>  							   handle, size, attrs);
>  	}
>  #endif
> diff --git a/include/xen/arm/page-coherent.h b/include/xen/arm/page-coherent.h
> index b0a2bfc..b1b4ecd 100644
> --- a/include/xen/arm/page-coherent.h
> +++ b/include/xen/arm/page-coherent.h
> @@ -5,7 +5,7 @@
>  #include <asm/dma-mapping.h>
>  #include <linux/dma-mapping.h>
>
> -static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
> +static inline const struct dma_map_ops *xen_get_dma_ops(struct device *dev)
>  {
>  	if (dev && dev->archdata.dev_dma_ops)
>  		return dev->archdata.dev_dma_ops;
> @@ -27,13 +27,13 @@ void __xen_dma_sync_single_for_device(struct device *hwdev,
>  static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size,
>  		dma_addr_t *dma_handle, gfp_t flags, unsigned long attrs)
>  {
> -	return __generic_dma_ops(hwdev)->alloc(hwdev, size, dma_handle, flags, attrs);
> +	return xen_get_dma_ops(hwdev)->alloc(hwdev, size, dma_handle, flags, attrs);
>  }
>
>  static inline void xen_free_coherent_pages(struct device *hwdev, size_t size,
>  		void *cpu_addr, dma_addr_t dma_handle, unsigned long attrs)
>  {
> -	__generic_dma_ops(hwdev)->free(hwdev, size, cpu_addr, dma_handle, attrs);
> +	xen_get_dma_ops(hwdev)->free(hwdev, size, cpu_addr, dma_handle, attrs);
>  }
>
>  static inline void xen_dma_map_page(struct device *hwdev, struct page *page,
> @@ -57,7 +57,7 @@ static inline void xen_dma_map_page(struct device *hwdev, struct page *page,
>  	 * specific function.
>  	 */
>  	if (local)
> -		__generic_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs);
> +		xen_get_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs);
>  	else
>  		__xen_dma_map_page(hwdev, page, dev_addr, offset, size, dir, attrs);
>  }
> @@ -75,8 +75,8 @@ static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle,
>  	 * specific function.
>  	 */
>  	if (pfn_valid(pfn)) {
> -		if (__generic_dma_ops(hwdev)->unmap_page)
> -			__generic_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs);
> +		if (xen_get_dma_ops(hwdev)->unmap_page)
> +			xen_get_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs);
>  	} else
>  		__xen_dma_unmap_page(hwdev, handle, size, dir, attrs);
>  }
> @@ -86,8 +86,8 @@ static inline void xen_dma_sync_single_for_cpu(struct device *hwdev,
>  {
>  	unsigned long pfn = PFN_DOWN(handle);
>  	if (pfn_valid(pfn)) {
> -		if (__generic_dma_ops(hwdev)->sync_single_for_cpu)
> -			__generic_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir);
> +		if (xen_get_dma_ops(hwdev)->sync_single_for_cpu)
> +			xen_get_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir);
>  	} else
>  		__xen_dma_sync_single_for_cpu(hwdev, handle, size, dir);
>  }
> @@ -97,8 +97,8 @@ static inline void xen_dma_sync_single_for_device(struct device *hwdev,
>  {
>  	unsigned long pfn = PFN_DOWN(handle);
>  	if (pfn_valid(pfn)) {
> -		if (__generic_dma_ops(hwdev)->sync_single_for_device)
> -			__generic_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir);
> +		if (xen_get_dma_ops(hwdev)->sync_single_for_device)
> +			xen_get_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir);
>  	} else
>  		__xen_dma_sync_single_for_device(hwdev, handle, size, dir);
>  }
>

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

* Re: [PATCH 2/2] xen/arm,arm64: rename __generic_dma_ops to xen_get_dma_ops
  2017-04-14  0:48   ` Boris Ostrovsky
@ 2017-04-14  2:14     ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 15+ messages in thread
From: Konrad Rzeszutek Wilk @ 2017-04-14  2:14 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: Stefano Stabellini, xen-devel, linux-kernel, linux-arm-kernel,
	linux, catalin.marinas, will.deacon, jgross, Julien Grall

On Thu, Apr 13, 2017 at 08:48:48PM -0400, Boris Ostrovsky wrote:
> 
> 
> On 04/13/2017 05:04 PM, Stefano Stabellini wrote:
> > Now that __generic_dma_ops is a xen specific function, rename it to
> > xen_get_dma_ops. Change all the call sites appropriately.
> > 
> > Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> > CC: linux@armlinux.org.uk
> > CC: catalin.marinas@arm.com
> > CC: will.deacon@arm.com
> > CC: boris.ostrovsky@oracle.com
> > CC: jgross@suse.com
> > CC: Julien Grall <julien.grall@arm.com>
> 
> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> 
> (+Konrad)

Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> 
> > ---
> >  drivers/xen/swiotlb-xen.c       |  8 ++++----
> >  include/xen/arm/page-coherent.h | 20 ++++++++++----------
> >  2 files changed, 14 insertions(+), 14 deletions(-)
> > 
> > diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
> > index e8cef1a..8dab0d3 100644
> > --- a/drivers/xen/swiotlb-xen.c
> > +++ b/drivers/xen/swiotlb-xen.c
> > @@ -693,8 +693,8 @@ void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
> >  		     unsigned long attrs)
> >  {
> >  #if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
> > -	if (__generic_dma_ops(dev)->mmap)
> > -		return __generic_dma_ops(dev)->mmap(dev, vma, cpu_addr,
> > +	if (xen_get_dma_ops(dev)->mmap)
> > +		return xen_get_dma_ops(dev)->mmap(dev, vma, cpu_addr,
> >  						    dma_addr, size, attrs);
> >  #endif
> >  	return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
> > @@ -711,7 +711,7 @@ void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
> >  			unsigned long attrs)
> >  {
> >  #if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
> > -	if (__generic_dma_ops(dev)->get_sgtable) {
> > +	if (xen_get_dma_ops(dev)->get_sgtable) {
> >  #if 0
> >  	/*
> >  	 * This check verifies that the page belongs to the current domain and
> > @@ -721,7 +721,7 @@ void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
> >  		unsigned long bfn = PHYS_PFN(dma_to_phys(dev, handle));
> >  		BUG_ON (!page_is_ram(bfn));
> >  #endif
> > -		return __generic_dma_ops(dev)->get_sgtable(dev, sgt, cpu_addr,
> > +		return xen_get_dma_ops(dev)->get_sgtable(dev, sgt, cpu_addr,
> >  							   handle, size, attrs);
> >  	}
> >  #endif
> > diff --git a/include/xen/arm/page-coherent.h b/include/xen/arm/page-coherent.h
> > index b0a2bfc..b1b4ecd 100644
> > --- a/include/xen/arm/page-coherent.h
> > +++ b/include/xen/arm/page-coherent.h
> > @@ -5,7 +5,7 @@
> >  #include <asm/dma-mapping.h>
> >  #include <linux/dma-mapping.h>
> > 
> > -static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
> > +static inline const struct dma_map_ops *xen_get_dma_ops(struct device *dev)
> >  {
> >  	if (dev && dev->archdata.dev_dma_ops)
> >  		return dev->archdata.dev_dma_ops;
> > @@ -27,13 +27,13 @@ void __xen_dma_sync_single_for_device(struct device *hwdev,
> >  static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size,
> >  		dma_addr_t *dma_handle, gfp_t flags, unsigned long attrs)
> >  {
> > -	return __generic_dma_ops(hwdev)->alloc(hwdev, size, dma_handle, flags, attrs);
> > +	return xen_get_dma_ops(hwdev)->alloc(hwdev, size, dma_handle, flags, attrs);
> >  }
> > 
> >  static inline void xen_free_coherent_pages(struct device *hwdev, size_t size,
> >  		void *cpu_addr, dma_addr_t dma_handle, unsigned long attrs)
> >  {
> > -	__generic_dma_ops(hwdev)->free(hwdev, size, cpu_addr, dma_handle, attrs);
> > +	xen_get_dma_ops(hwdev)->free(hwdev, size, cpu_addr, dma_handle, attrs);
> >  }
> > 
> >  static inline void xen_dma_map_page(struct device *hwdev, struct page *page,
> > @@ -57,7 +57,7 @@ static inline void xen_dma_map_page(struct device *hwdev, struct page *page,
> >  	 * specific function.
> >  	 */
> >  	if (local)
> > -		__generic_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs);
> > +		xen_get_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs);
> >  	else
> >  		__xen_dma_map_page(hwdev, page, dev_addr, offset, size, dir, attrs);
> >  }
> > @@ -75,8 +75,8 @@ static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle,
> >  	 * specific function.
> >  	 */
> >  	if (pfn_valid(pfn)) {
> > -		if (__generic_dma_ops(hwdev)->unmap_page)
> > -			__generic_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs);
> > +		if (xen_get_dma_ops(hwdev)->unmap_page)
> > +			xen_get_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs);
> >  	} else
> >  		__xen_dma_unmap_page(hwdev, handle, size, dir, attrs);
> >  }
> > @@ -86,8 +86,8 @@ static inline void xen_dma_sync_single_for_cpu(struct device *hwdev,
> >  {
> >  	unsigned long pfn = PFN_DOWN(handle);
> >  	if (pfn_valid(pfn)) {
> > -		if (__generic_dma_ops(hwdev)->sync_single_for_cpu)
> > -			__generic_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir);
> > +		if (xen_get_dma_ops(hwdev)->sync_single_for_cpu)
> > +			xen_get_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir);
> >  	} else
> >  		__xen_dma_sync_single_for_cpu(hwdev, handle, size, dir);
> >  }
> > @@ -97,8 +97,8 @@ static inline void xen_dma_sync_single_for_device(struct device *hwdev,
> >  {
> >  	unsigned long pfn = PFN_DOWN(handle);
> >  	if (pfn_valid(pfn)) {
> > -		if (__generic_dma_ops(hwdev)->sync_single_for_device)
> > -			__generic_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir);
> > +		if (xen_get_dma_ops(hwdev)->sync_single_for_device)
> > +			xen_get_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir);
> >  	} else
> >  		__xen_dma_sync_single_for_device(hwdev, handle, size, dir);
> >  }
> > 

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

* Re: [PATCH 1/2] xen/arm, arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..."
  2017-04-13 21:04 [PATCH 1/2] xen/arm,arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..." Stefano Stabellini
  2017-04-13 21:04 ` [PATCH 2/2] xen/arm,arm64: rename __generic_dma_ops to xen_get_dma_ops Stefano Stabellini
@ 2017-04-18 14:21 ` Catalin Marinas
  2017-04-19 17:25   ` Stefano Stabellini
  1 sibling, 1 reply; 15+ messages in thread
From: Catalin Marinas @ 2017-04-18 14:21 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: xen-devel, jgross, will.deacon, linux-kernel, linux,
	Julien Grall, boris.ostrovsky, linux-arm-kernel

On Thu, Apr 13, 2017 at 02:04:21PM -0700, Stefano Stabellini wrote:
> The following commit:
> 
>   commit 815dd18788fe0d41899f51b91d0560279cf16b0d
>   Author: Bart Van Assche <bart.vanassche@sandisk.com>
>   Date:   Fri Jan 20 13:04:04 2017 -0800
> 
>       treewide: Consolidate get_dma_ops() implementations
> 
> rearranges get_dma_ops in a way that xen_dma_ops are not returned when
> running on Xen anymore, dev->dma_ops is returned instead (see
> arch/arm/include/asm/dma-mapping.h:get_arch_dma_ops and
> include/linux/dma-mapping.h:get_dma_ops).
> 
> Fix the problem by storing dev->dma_ops in dev_archdata, and setting
> dev->dma_ops to xen_dma_ops. This way, xen_dma_ops is returned naturally
> by get_dma_ops. The Xen code can retrieve the original dev->dma_ops from
> dev_archdata when needed. It also allows us to remove __generic_dma_ops
> from common headers.
> 
> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> Tested-by: Julien Grall <julien.grall@arm.com>
> Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
> CC: linux@armlinux.org.uk
> CC: catalin.marinas@arm.com
> CC: will.deacon@arm.com
> CC: boris.ostrovsky@oracle.com
> CC: jgross@suse.com
> CC: Julien Grall <julien.grall@arm.com>

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [PATCH 1/2] xen/arm, arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..."
  2017-04-18 14:21 ` [PATCH 1/2] xen/arm, arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..." Catalin Marinas
@ 2017-04-19 17:25   ` Stefano Stabellini
  2017-04-19 18:20     ` Juergen Gross
  2017-04-24 19:16     ` Stefano Stabellini
  0 siblings, 2 replies; 15+ messages in thread
From: Stefano Stabellini @ 2017-04-19 17:25 UTC (permalink / raw)
  To: linux
  Cc: Stefano Stabellini, xen-devel, jgross, will.deacon, linux-kernel,
	linux, Julien Grall, boris.ostrovsky, linux-arm-kernel,
	catalin.marinas

Hello Russell,

Can I have your acked-by on the following fix (original patch is
1492117462-19886-1-git-send-email-sstabellini@kernel.org)?

Thanks,

Stefano


On Tue, 18 Apr 2017, Catalin Marinas wrote:
> On Thu, Apr 13, 2017 at 02:04:21PM -0700, Stefano Stabellini wrote:
> > The following commit:
> > 
> >   commit 815dd18788fe0d41899f51b91d0560279cf16b0d
> >   Author: Bart Van Assche <bart.vanassche@sandisk.com>
> >   Date:   Fri Jan 20 13:04:04 2017 -0800
> > 
> >       treewide: Consolidate get_dma_ops() implementations
> > 
> > rearranges get_dma_ops in a way that xen_dma_ops are not returned when
> > running on Xen anymore, dev->dma_ops is returned instead (see
> > arch/arm/include/asm/dma-mapping.h:get_arch_dma_ops and
> > include/linux/dma-mapping.h:get_dma_ops).
> > 
> > Fix the problem by storing dev->dma_ops in dev_archdata, and setting
> > dev->dma_ops to xen_dma_ops. This way, xen_dma_ops is returned naturally
> > by get_dma_ops. The Xen code can retrieve the original dev->dma_ops from
> > dev_archdata when needed. It also allows us to remove __generic_dma_ops
> > from common headers.
> > 
> > Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> > Tested-by: Julien Grall <julien.grall@arm.com>
> > Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
> > CC: linux@armlinux.org.uk
> > CC: catalin.marinas@arm.com
> > CC: will.deacon@arm.com
> > CC: boris.ostrovsky@oracle.com
> > CC: jgross@suse.com
> > CC: Julien Grall <julien.grall@arm.com>
> 
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
> 
> 
> > diff --git a/arch/arm/include/asm/device.h b/arch/arm/include/asm/device.h
> > index 220ba20..36ec9c8 100644
> > --- a/arch/arm/include/asm/device.h
> > +++ b/arch/arm/include/asm/device.h
> > @@ -16,6 +16,9 @@ struct dev_archdata {
> >  #ifdef CONFIG_ARM_DMA_USE_IOMMU
> >  	struct dma_iommu_mapping	*mapping;
> >  #endif
> > +#ifdef CONFIG_XEN
> > +	const struct dma_map_ops *dev_dma_ops;
> > +#endif
> >  	bool dma_coherent;
> >  };
> >  
> > diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
> > index 7166569..680d3f3 100644
> > --- a/arch/arm/include/asm/dma-mapping.h
> > +++ b/arch/arm/include/asm/dma-mapping.h
> > @@ -16,19 +16,9 @@
> >  extern const struct dma_map_ops arm_dma_ops;
> >  extern const struct dma_map_ops arm_coherent_dma_ops;
> >  
> > -static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
> > -{
> > -	if (dev && dev->dma_ops)
> > -		return dev->dma_ops;
> > -	return &arm_dma_ops;
> > -}
> > -
> >  static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> >  {
> > -	if (xen_initial_domain())
> > -		return xen_dma_ops;
> > -	else
> > -		return __generic_dma_ops(NULL);
> > +	return &arm_dma_ops;
> >  }
> >  
> >  #define HAVE_ARCH_DMA_SUPPORTED 1
> > diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
> > index 63eabb0..a614459 100644
> > --- a/arch/arm/mm/dma-mapping.c
> > +++ b/arch/arm/mm/dma-mapping.c
> > @@ -2396,6 +2396,13 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
> >  		dma_ops = arm_get_dma_map_ops(coherent);
> >  
> >  	set_dma_ops(dev, dma_ops);
> > +
> > +#ifdef CONFIG_XEN
> > +	if (xen_initial_domain()) {
> > +		dev->archdata.dev_dma_ops = dev->dma_ops;
> > +		dev->dma_ops = xen_dma_ops;
> > +	}
> > +#endif
> >  }
> >  
> >  void arch_teardown_dma_ops(struct device *dev)
> > diff --git a/arch/arm64/include/asm/device.h b/arch/arm64/include/asm/device.h
> > index 73d5bab..5a5fa47 100644
> > --- a/arch/arm64/include/asm/device.h
> > +++ b/arch/arm64/include/asm/device.h
> > @@ -20,6 +20,9 @@ struct dev_archdata {
> >  #ifdef CONFIG_IOMMU_API
> >  	void *iommu;			/* private IOMMU data */
> >  #endif
> > +#ifdef CONFIG_XEN
> > +	const struct dma_map_ops *dev_dma_ops;
> > +#endif
> >  	bool dma_coherent;
> >  };
> >  
> > diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h
> > index 505756c..5392dbe 100644
> > --- a/arch/arm64/include/asm/dma-mapping.h
> > +++ b/arch/arm64/include/asm/dma-mapping.h
> > @@ -27,11 +27,8 @@
> >  #define DMA_ERROR_CODE	(~(dma_addr_t)0)
> >  extern const struct dma_map_ops dummy_dma_ops;
> >  
> > -static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
> > +static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> >  {
> > -	if (dev && dev->dma_ops)
> > -		return dev->dma_ops;
> > -
> >  	/*
> >  	 * We expect no ISA devices, and all other DMA masters are expected to
> >  	 * have someone call arch_setup_dma_ops at device creation time.
> > @@ -39,14 +36,6 @@ static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
> >  	return &dummy_dma_ops;
> >  }
> >  
> > -static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> > -{
> > -	if (xen_initial_domain())
> > -		return xen_dma_ops;
> > -	else
> > -		return __generic_dma_ops(NULL);
> > -}
> > -
> >  void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
> >  			const struct iommu_ops *iommu, bool coherent);
> >  #define arch_setup_dma_ops	arch_setup_dma_ops
> > diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
> > index 81cdb2e..7f8b37e 100644
> > --- a/arch/arm64/mm/dma-mapping.c
> > +++ b/arch/arm64/mm/dma-mapping.c
> > @@ -977,4 +977,11 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
> >  
> >  	dev->archdata.dma_coherent = coherent;
> >  	__iommu_setup_dma_ops(dev, dma_base, size, iommu);
> > +
> > +#ifdef CONFIG_XEN
> > +	if (xen_initial_domain()) {
> > +		dev->archdata.dev_dma_ops = dev->dma_ops;
> > +		dev->dma_ops = xen_dma_ops;
> > +	}
> > +#endif
> >  }
> > diff --git a/include/xen/arm/page-coherent.h b/include/xen/arm/page-coherent.h
> > index 95ce6ac..b0a2bfc 100644
> > --- a/include/xen/arm/page-coherent.h
> > +++ b/include/xen/arm/page-coherent.h
> > @@ -2,8 +2,16 @@
> >  #define _ASM_ARM_XEN_PAGE_COHERENT_H
> >  
> >  #include <asm/page.h>
> > +#include <asm/dma-mapping.h>
> >  #include <linux/dma-mapping.h>
> >  
> > +static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
> > +{
> > +	if (dev && dev->archdata.dev_dma_ops)
> > +		return dev->archdata.dev_dma_ops;
> > +	return get_arch_dma_ops(NULL);
> > +}
> > +
> >  void __xen_dma_map_page(struct device *hwdev, struct page *page,
> >  	     dma_addr_t dev_addr, unsigned long offset, size_t size,
> >  	     enum dma_data_direction dir, unsigned long attrs);

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

* Re: [PATCH 1/2] xen/arm, arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..."
  2017-04-19 17:25   ` Stefano Stabellini
@ 2017-04-19 18:20     ` Juergen Gross
  2017-04-19 18:32       ` Stefano Stabellini
  2017-04-24 19:16     ` Stefano Stabellini
  1 sibling, 1 reply; 15+ messages in thread
From: Juergen Gross @ 2017-04-19 18:20 UTC (permalink / raw)
  To: Stefano Stabellini, linux
  Cc: xen-devel, will.deacon, linux-kernel, Julien Grall,
	boris.ostrovsky, linux-arm-kernel, catalin.marinas

On 19/04/17 19:25, Stefano Stabellini wrote:
> Hello Russell,
> 
> Can I have your acked-by on the following fix (original patch is
> 1492117462-19886-1-git-send-email-sstabellini@kernel.org)?

Stefano, through which tree should this go? ARM or Xen or other?


Juergen

> 
> Thanks,
> 
> Stefano
> 
> 
> On Tue, 18 Apr 2017, Catalin Marinas wrote:
>> On Thu, Apr 13, 2017 at 02:04:21PM -0700, Stefano Stabellini wrote:
>>> The following commit:
>>>
>>>   commit 815dd18788fe0d41899f51b91d0560279cf16b0d
>>>   Author: Bart Van Assche <bart.vanassche@sandisk.com>
>>>   Date:   Fri Jan 20 13:04:04 2017 -0800
>>>
>>>       treewide: Consolidate get_dma_ops() implementations
>>>
>>> rearranges get_dma_ops in a way that xen_dma_ops are not returned when
>>> running on Xen anymore, dev->dma_ops is returned instead (see
>>> arch/arm/include/asm/dma-mapping.h:get_arch_dma_ops and
>>> include/linux/dma-mapping.h:get_dma_ops).
>>>
>>> Fix the problem by storing dev->dma_ops in dev_archdata, and setting
>>> dev->dma_ops to xen_dma_ops. This way, xen_dma_ops is returned naturally
>>> by get_dma_ops. The Xen code can retrieve the original dev->dma_ops from
>>> dev_archdata when needed. It also allows us to remove __generic_dma_ops
>>> from common headers.
>>>
>>> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
>>> Tested-by: Julien Grall <julien.grall@arm.com>
>>> Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
>>> CC: linux@armlinux.org.uk
>>> CC: catalin.marinas@arm.com
>>> CC: will.deacon@arm.com
>>> CC: boris.ostrovsky@oracle.com
>>> CC: jgross@suse.com
>>> CC: Julien Grall <julien.grall@arm.com>
>>
>> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
>>
>>
>>> diff --git a/arch/arm/include/asm/device.h b/arch/arm/include/asm/device.h
>>> index 220ba20..36ec9c8 100644
>>> --- a/arch/arm/include/asm/device.h
>>> +++ b/arch/arm/include/asm/device.h
>>> @@ -16,6 +16,9 @@ struct dev_archdata {
>>>  #ifdef CONFIG_ARM_DMA_USE_IOMMU
>>>  	struct dma_iommu_mapping	*mapping;
>>>  #endif
>>> +#ifdef CONFIG_XEN
>>> +	const struct dma_map_ops *dev_dma_ops;
>>> +#endif
>>>  	bool dma_coherent;
>>>  };
>>>  
>>> diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
>>> index 7166569..680d3f3 100644
>>> --- a/arch/arm/include/asm/dma-mapping.h
>>> +++ b/arch/arm/include/asm/dma-mapping.h
>>> @@ -16,19 +16,9 @@
>>>  extern const struct dma_map_ops arm_dma_ops;
>>>  extern const struct dma_map_ops arm_coherent_dma_ops;
>>>  
>>> -static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
>>> -{
>>> -	if (dev && dev->dma_ops)
>>> -		return dev->dma_ops;
>>> -	return &arm_dma_ops;
>>> -}
>>> -
>>>  static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
>>>  {
>>> -	if (xen_initial_domain())
>>> -		return xen_dma_ops;
>>> -	else
>>> -		return __generic_dma_ops(NULL);
>>> +	return &arm_dma_ops;
>>>  }
>>>  
>>>  #define HAVE_ARCH_DMA_SUPPORTED 1
>>> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
>>> index 63eabb0..a614459 100644
>>> --- a/arch/arm/mm/dma-mapping.c
>>> +++ b/arch/arm/mm/dma-mapping.c
>>> @@ -2396,6 +2396,13 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
>>>  		dma_ops = arm_get_dma_map_ops(coherent);
>>>  
>>>  	set_dma_ops(dev, dma_ops);
>>> +
>>> +#ifdef CONFIG_XEN
>>> +	if (xen_initial_domain()) {
>>> +		dev->archdata.dev_dma_ops = dev->dma_ops;
>>> +		dev->dma_ops = xen_dma_ops;
>>> +	}
>>> +#endif
>>>  }
>>>  
>>>  void arch_teardown_dma_ops(struct device *dev)
>>> diff --git a/arch/arm64/include/asm/device.h b/arch/arm64/include/asm/device.h
>>> index 73d5bab..5a5fa47 100644
>>> --- a/arch/arm64/include/asm/device.h
>>> +++ b/arch/arm64/include/asm/device.h
>>> @@ -20,6 +20,9 @@ struct dev_archdata {
>>>  #ifdef CONFIG_IOMMU_API
>>>  	void *iommu;			/* private IOMMU data */
>>>  #endif
>>> +#ifdef CONFIG_XEN
>>> +	const struct dma_map_ops *dev_dma_ops;
>>> +#endif
>>>  	bool dma_coherent;
>>>  };
>>>  
>>> diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h
>>> index 505756c..5392dbe 100644
>>> --- a/arch/arm64/include/asm/dma-mapping.h
>>> +++ b/arch/arm64/include/asm/dma-mapping.h
>>> @@ -27,11 +27,8 @@
>>>  #define DMA_ERROR_CODE	(~(dma_addr_t)0)
>>>  extern const struct dma_map_ops dummy_dma_ops;
>>>  
>>> -static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
>>> +static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
>>>  {
>>> -	if (dev && dev->dma_ops)
>>> -		return dev->dma_ops;
>>> -
>>>  	/*
>>>  	 * We expect no ISA devices, and all other DMA masters are expected to
>>>  	 * have someone call arch_setup_dma_ops at device creation time.
>>> @@ -39,14 +36,6 @@ static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
>>>  	return &dummy_dma_ops;
>>>  }
>>>  
>>> -static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
>>> -{
>>> -	if (xen_initial_domain())
>>> -		return xen_dma_ops;
>>> -	else
>>> -		return __generic_dma_ops(NULL);
>>> -}
>>> -
>>>  void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
>>>  			const struct iommu_ops *iommu, bool coherent);
>>>  #define arch_setup_dma_ops	arch_setup_dma_ops
>>> diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
>>> index 81cdb2e..7f8b37e 100644
>>> --- a/arch/arm64/mm/dma-mapping.c
>>> +++ b/arch/arm64/mm/dma-mapping.c
>>> @@ -977,4 +977,11 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
>>>  
>>>  	dev->archdata.dma_coherent = coherent;
>>>  	__iommu_setup_dma_ops(dev, dma_base, size, iommu);
>>> +
>>> +#ifdef CONFIG_XEN
>>> +	if (xen_initial_domain()) {
>>> +		dev->archdata.dev_dma_ops = dev->dma_ops;
>>> +		dev->dma_ops = xen_dma_ops;
>>> +	}
>>> +#endif
>>>  }
>>> diff --git a/include/xen/arm/page-coherent.h b/include/xen/arm/page-coherent.h
>>> index 95ce6ac..b0a2bfc 100644
>>> --- a/include/xen/arm/page-coherent.h
>>> +++ b/include/xen/arm/page-coherent.h
>>> @@ -2,8 +2,16 @@
>>>  #define _ASM_ARM_XEN_PAGE_COHERENT_H
>>>  
>>>  #include <asm/page.h>
>>> +#include <asm/dma-mapping.h>
>>>  #include <linux/dma-mapping.h>
>>>  
>>> +static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
>>> +{
>>> +	if (dev && dev->archdata.dev_dma_ops)
>>> +		return dev->archdata.dev_dma_ops;
>>> +	return get_arch_dma_ops(NULL);
>>> +}
>>> +
>>>  void __xen_dma_map_page(struct device *hwdev, struct page *page,
>>>  	     dma_addr_t dev_addr, unsigned long offset, size_t size,
>>>  	     enum dma_data_direction dir, unsigned long attrs);
> 

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

* Re: [PATCH 1/2] xen/arm, arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..."
  2017-04-19 18:20     ` Juergen Gross
@ 2017-04-19 18:32       ` Stefano Stabellini
  0 siblings, 0 replies; 15+ messages in thread
From: Stefano Stabellini @ 2017-04-19 18:32 UTC (permalink / raw)
  To: Juergen Gross
  Cc: Stefano Stabellini, linux, xen-devel, will.deacon, linux-kernel,
	Julien Grall, boris.ostrovsky, linux-arm-kernel, catalin.marinas

On Wed, 19 Apr 2017, Juergen Gross wrote:
> On 19/04/17 19:25, Stefano Stabellini wrote:
> > Hello Russell,
> > 
> > Can I have your acked-by on the following fix (original patch is
> > 1492117462-19886-1-git-send-email-sstabellini@kernel.org)?
> 
> Stefano, through which tree should this go? ARM or Xen or other?

I think it could go via the Xen tree, but we still need an ack from the
ARM maintainer for changes to code under arch/arm.

 
> Juergen
> 
> > 
> > Thanks,
> > 
> > Stefano
> > 
> > 
> > On Tue, 18 Apr 2017, Catalin Marinas wrote:
> >> On Thu, Apr 13, 2017 at 02:04:21PM -0700, Stefano Stabellini wrote:
> >>> The following commit:
> >>>
> >>>   commit 815dd18788fe0d41899f51b91d0560279cf16b0d
> >>>   Author: Bart Van Assche <bart.vanassche@sandisk.com>
> >>>   Date:   Fri Jan 20 13:04:04 2017 -0800
> >>>
> >>>       treewide: Consolidate get_dma_ops() implementations
> >>>
> >>> rearranges get_dma_ops in a way that xen_dma_ops are not returned when
> >>> running on Xen anymore, dev->dma_ops is returned instead (see
> >>> arch/arm/include/asm/dma-mapping.h:get_arch_dma_ops and
> >>> include/linux/dma-mapping.h:get_dma_ops).
> >>>
> >>> Fix the problem by storing dev->dma_ops in dev_archdata, and setting
> >>> dev->dma_ops to xen_dma_ops. This way, xen_dma_ops is returned naturally
> >>> by get_dma_ops. The Xen code can retrieve the original dev->dma_ops from
> >>> dev_archdata when needed. It also allows us to remove __generic_dma_ops
> >>> from common headers.
> >>>
> >>> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> >>> Tested-by: Julien Grall <julien.grall@arm.com>
> >>> Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
> >>> CC: linux@armlinux.org.uk
> >>> CC: catalin.marinas@arm.com
> >>> CC: will.deacon@arm.com
> >>> CC: boris.ostrovsky@oracle.com
> >>> CC: jgross@suse.com
> >>> CC: Julien Grall <julien.grall@arm.com>
> >>
> >> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
> >>
> >>
> >>> diff --git a/arch/arm/include/asm/device.h b/arch/arm/include/asm/device.h
> >>> index 220ba20..36ec9c8 100644
> >>> --- a/arch/arm/include/asm/device.h
> >>> +++ b/arch/arm/include/asm/device.h
> >>> @@ -16,6 +16,9 @@ struct dev_archdata {
> >>>  #ifdef CONFIG_ARM_DMA_USE_IOMMU
> >>>  	struct dma_iommu_mapping	*mapping;
> >>>  #endif
> >>> +#ifdef CONFIG_XEN
> >>> +	const struct dma_map_ops *dev_dma_ops;
> >>> +#endif
> >>>  	bool dma_coherent;
> >>>  };
> >>>  
> >>> diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
> >>> index 7166569..680d3f3 100644
> >>> --- a/arch/arm/include/asm/dma-mapping.h
> >>> +++ b/arch/arm/include/asm/dma-mapping.h
> >>> @@ -16,19 +16,9 @@
> >>>  extern const struct dma_map_ops arm_dma_ops;
> >>>  extern const struct dma_map_ops arm_coherent_dma_ops;
> >>>  
> >>> -static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
> >>> -{
> >>> -	if (dev && dev->dma_ops)
> >>> -		return dev->dma_ops;
> >>> -	return &arm_dma_ops;
> >>> -}
> >>> -
> >>>  static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> >>>  {
> >>> -	if (xen_initial_domain())
> >>> -		return xen_dma_ops;
> >>> -	else
> >>> -		return __generic_dma_ops(NULL);
> >>> +	return &arm_dma_ops;
> >>>  }
> >>>  
> >>>  #define HAVE_ARCH_DMA_SUPPORTED 1
> >>> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
> >>> index 63eabb0..a614459 100644
> >>> --- a/arch/arm/mm/dma-mapping.c
> >>> +++ b/arch/arm/mm/dma-mapping.c
> >>> @@ -2396,6 +2396,13 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
> >>>  		dma_ops = arm_get_dma_map_ops(coherent);
> >>>  
> >>>  	set_dma_ops(dev, dma_ops);
> >>> +
> >>> +#ifdef CONFIG_XEN
> >>> +	if (xen_initial_domain()) {
> >>> +		dev->archdata.dev_dma_ops = dev->dma_ops;
> >>> +		dev->dma_ops = xen_dma_ops;
> >>> +	}
> >>> +#endif
> >>>  }
> >>>  
> >>>  void arch_teardown_dma_ops(struct device *dev)
> >>> diff --git a/arch/arm64/include/asm/device.h b/arch/arm64/include/asm/device.h
> >>> index 73d5bab..5a5fa47 100644
> >>> --- a/arch/arm64/include/asm/device.h
> >>> +++ b/arch/arm64/include/asm/device.h
> >>> @@ -20,6 +20,9 @@ struct dev_archdata {
> >>>  #ifdef CONFIG_IOMMU_API
> >>>  	void *iommu;			/* private IOMMU data */
> >>>  #endif
> >>> +#ifdef CONFIG_XEN
> >>> +	const struct dma_map_ops *dev_dma_ops;
> >>> +#endif
> >>>  	bool dma_coherent;
> >>>  };
> >>>  
> >>> diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h
> >>> index 505756c..5392dbe 100644
> >>> --- a/arch/arm64/include/asm/dma-mapping.h
> >>> +++ b/arch/arm64/include/asm/dma-mapping.h
> >>> @@ -27,11 +27,8 @@
> >>>  #define DMA_ERROR_CODE	(~(dma_addr_t)0)
> >>>  extern const struct dma_map_ops dummy_dma_ops;
> >>>  
> >>> -static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
> >>> +static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> >>>  {
> >>> -	if (dev && dev->dma_ops)
> >>> -		return dev->dma_ops;
> >>> -
> >>>  	/*
> >>>  	 * We expect no ISA devices, and all other DMA masters are expected to
> >>>  	 * have someone call arch_setup_dma_ops at device creation time.
> >>> @@ -39,14 +36,6 @@ static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
> >>>  	return &dummy_dma_ops;
> >>>  }
> >>>  
> >>> -static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> >>> -{
> >>> -	if (xen_initial_domain())
> >>> -		return xen_dma_ops;
> >>> -	else
> >>> -		return __generic_dma_ops(NULL);
> >>> -}
> >>> -
> >>>  void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
> >>>  			const struct iommu_ops *iommu, bool coherent);
> >>>  #define arch_setup_dma_ops	arch_setup_dma_ops
> >>> diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
> >>> index 81cdb2e..7f8b37e 100644
> >>> --- a/arch/arm64/mm/dma-mapping.c
> >>> +++ b/arch/arm64/mm/dma-mapping.c
> >>> @@ -977,4 +977,11 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
> >>>  
> >>>  	dev->archdata.dma_coherent = coherent;
> >>>  	__iommu_setup_dma_ops(dev, dma_base, size, iommu);
> >>> +
> >>> +#ifdef CONFIG_XEN
> >>> +	if (xen_initial_domain()) {
> >>> +		dev->archdata.dev_dma_ops = dev->dma_ops;
> >>> +		dev->dma_ops = xen_dma_ops;
> >>> +	}
> >>> +#endif
> >>>  }
> >>> diff --git a/include/xen/arm/page-coherent.h b/include/xen/arm/page-coherent.h
> >>> index 95ce6ac..b0a2bfc 100644
> >>> --- a/include/xen/arm/page-coherent.h
> >>> +++ b/include/xen/arm/page-coherent.h
> >>> @@ -2,8 +2,16 @@
> >>>  #define _ASM_ARM_XEN_PAGE_COHERENT_H
> >>>  
> >>>  #include <asm/page.h>
> >>> +#include <asm/dma-mapping.h>
> >>>  #include <linux/dma-mapping.h>
> >>>  
> >>> +static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
> >>> +{
> >>> +	if (dev && dev->archdata.dev_dma_ops)
> >>> +		return dev->archdata.dev_dma_ops;
> >>> +	return get_arch_dma_ops(NULL);
> >>> +}
> >>> +
> >>>  void __xen_dma_map_page(struct device *hwdev, struct page *page,
> >>>  	     dma_addr_t dev_addr, unsigned long offset, size_t size,
> >>>  	     enum dma_data_direction dir, unsigned long attrs);
> > 
> 

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

* Re: [PATCH 1/2] xen/arm, arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..."
  2017-04-19 17:25   ` Stefano Stabellini
  2017-04-19 18:20     ` Juergen Gross
@ 2017-04-24 19:16     ` Stefano Stabellini
  2017-04-25 12:51       ` Julien Grall
  1 sibling, 1 reply; 15+ messages in thread
From: Stefano Stabellini @ 2017-04-24 19:16 UTC (permalink / raw)
  To: linux
  Cc: linux, xen-devel, jgross, will.deacon, linux-kernel,
	Julien Grall, boris.ostrovsky, linux-arm-kernel, catalin.marinas,
	sstabellini

Hi Russell,

Given the outstanding regression we need to fix as soon as possible,
I'll queue these patches on the xentip tree for 4.12.

Please shout if you disagree.

Thank you.

- Stefano


On Wed, 19 Apr 2017, Stefano Stabellini wrote:
> Hello Russell,
> 
> Can I have your acked-by on the following fix (original patch is
> 1492117462-19886-1-git-send-email-sstabellini@kernel.org)?
> 
> Thanks,
> 
> Stefano
> 
> 
> On Tue, 18 Apr 2017, Catalin Marinas wrote:
> > On Thu, Apr 13, 2017 at 02:04:21PM -0700, Stefano Stabellini wrote:
> > > The following commit:
> > > 
> > >   commit 815dd18788fe0d41899f51b91d0560279cf16b0d
> > >   Author: Bart Van Assche <bart.vanassche@sandisk.com>
> > >   Date:   Fri Jan 20 13:04:04 2017 -0800
> > > 
> > >       treewide: Consolidate get_dma_ops() implementations
> > > 
> > > rearranges get_dma_ops in a way that xen_dma_ops are not returned when
> > > running on Xen anymore, dev->dma_ops is returned instead (see
> > > arch/arm/include/asm/dma-mapping.h:get_arch_dma_ops and
> > > include/linux/dma-mapping.h:get_dma_ops).
> > > 
> > > Fix the problem by storing dev->dma_ops in dev_archdata, and setting
> > > dev->dma_ops to xen_dma_ops. This way, xen_dma_ops is returned naturally
> > > by get_dma_ops. The Xen code can retrieve the original dev->dma_ops from
> > > dev_archdata when needed. It also allows us to remove __generic_dma_ops
> > > from common headers.
> > > 
> > > Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> > > Tested-by: Julien Grall <julien.grall@arm.com>
> > > Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
> > > CC: linux@armlinux.org.uk
> > > CC: catalin.marinas@arm.com
> > > CC: will.deacon@arm.com
> > > CC: boris.ostrovsky@oracle.com
> > > CC: jgross@suse.com
> > > CC: Julien Grall <julien.grall@arm.com>
> > 
> > Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
> > 
> > 
> > > diff --git a/arch/arm/include/asm/device.h b/arch/arm/include/asm/device.h
> > > index 220ba20..36ec9c8 100644
> > > --- a/arch/arm/include/asm/device.h
> > > +++ b/arch/arm/include/asm/device.h
> > > @@ -16,6 +16,9 @@ struct dev_archdata {
> > >  #ifdef CONFIG_ARM_DMA_USE_IOMMU
> > >  	struct dma_iommu_mapping	*mapping;
> > >  #endif
> > > +#ifdef CONFIG_XEN
> > > +	const struct dma_map_ops *dev_dma_ops;
> > > +#endif
> > >  	bool dma_coherent;
> > >  };
> > >  
> > > diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
> > > index 7166569..680d3f3 100644
> > > --- a/arch/arm/include/asm/dma-mapping.h
> > > +++ b/arch/arm/include/asm/dma-mapping.h
> > > @@ -16,19 +16,9 @@
> > >  extern const struct dma_map_ops arm_dma_ops;
> > >  extern const struct dma_map_ops arm_coherent_dma_ops;
> > >  
> > > -static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
> > > -{
> > > -	if (dev && dev->dma_ops)
> > > -		return dev->dma_ops;
> > > -	return &arm_dma_ops;
> > > -}
> > > -
> > >  static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> > >  {
> > > -	if (xen_initial_domain())
> > > -		return xen_dma_ops;
> > > -	else
> > > -		return __generic_dma_ops(NULL);
> > > +	return &arm_dma_ops;
> > >  }
> > >  
> > >  #define HAVE_ARCH_DMA_SUPPORTED 1
> > > diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
> > > index 63eabb0..a614459 100644
> > > --- a/arch/arm/mm/dma-mapping.c
> > > +++ b/arch/arm/mm/dma-mapping.c
> > > @@ -2396,6 +2396,13 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
> > >  		dma_ops = arm_get_dma_map_ops(coherent);
> > >  
> > >  	set_dma_ops(dev, dma_ops);
> > > +
> > > +#ifdef CONFIG_XEN
> > > +	if (xen_initial_domain()) {
> > > +		dev->archdata.dev_dma_ops = dev->dma_ops;
> > > +		dev->dma_ops = xen_dma_ops;
> > > +	}
> > > +#endif
> > >  }
> > >  
> > >  void arch_teardown_dma_ops(struct device *dev)
> > > diff --git a/arch/arm64/include/asm/device.h b/arch/arm64/include/asm/device.h
> > > index 73d5bab..5a5fa47 100644
> > > --- a/arch/arm64/include/asm/device.h
> > > +++ b/arch/arm64/include/asm/device.h
> > > @@ -20,6 +20,9 @@ struct dev_archdata {
> > >  #ifdef CONFIG_IOMMU_API
> > >  	void *iommu;			/* private IOMMU data */
> > >  #endif
> > > +#ifdef CONFIG_XEN
> > > +	const struct dma_map_ops *dev_dma_ops;
> > > +#endif
> > >  	bool dma_coherent;
> > >  };
> > >  
> > > diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h
> > > index 505756c..5392dbe 100644
> > > --- a/arch/arm64/include/asm/dma-mapping.h
> > > +++ b/arch/arm64/include/asm/dma-mapping.h
> > > @@ -27,11 +27,8 @@
> > >  #define DMA_ERROR_CODE	(~(dma_addr_t)0)
> > >  extern const struct dma_map_ops dummy_dma_ops;
> > >  
> > > -static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
> > > +static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> > >  {
> > > -	if (dev && dev->dma_ops)
> > > -		return dev->dma_ops;
> > > -
> > >  	/*
> > >  	 * We expect no ISA devices, and all other DMA masters are expected to
> > >  	 * have someone call arch_setup_dma_ops at device creation time.
> > > @@ -39,14 +36,6 @@ static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
> > >  	return &dummy_dma_ops;
> > >  }
> > >  
> > > -static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> > > -{
> > > -	if (xen_initial_domain())
> > > -		return xen_dma_ops;
> > > -	else
> > > -		return __generic_dma_ops(NULL);
> > > -}
> > > -
> > >  void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
> > >  			const struct iommu_ops *iommu, bool coherent);
> > >  #define arch_setup_dma_ops	arch_setup_dma_ops
> > > diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
> > > index 81cdb2e..7f8b37e 100644
> > > --- a/arch/arm64/mm/dma-mapping.c
> > > +++ b/arch/arm64/mm/dma-mapping.c
> > > @@ -977,4 +977,11 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
> > >  
> > >  	dev->archdata.dma_coherent = coherent;
> > >  	__iommu_setup_dma_ops(dev, dma_base, size, iommu);
> > > +
> > > +#ifdef CONFIG_XEN
> > > +	if (xen_initial_domain()) {
> > > +		dev->archdata.dev_dma_ops = dev->dma_ops;
> > > +		dev->dma_ops = xen_dma_ops;
> > > +	}
> > > +#endif
> > >  }
> > > diff --git a/include/xen/arm/page-coherent.h b/include/xen/arm/page-coherent.h
> > > index 95ce6ac..b0a2bfc 100644
> > > --- a/include/xen/arm/page-coherent.h
> > > +++ b/include/xen/arm/page-coherent.h
> > > @@ -2,8 +2,16 @@
> > >  #define _ASM_ARM_XEN_PAGE_COHERENT_H
> > >  
> > >  #include <asm/page.h>
> > > +#include <asm/dma-mapping.h>
> > >  #include <linux/dma-mapping.h>
> > >  
> > > +static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
> > > +{
> > > +	if (dev && dev->archdata.dev_dma_ops)
> > > +		return dev->archdata.dev_dma_ops;
> > > +	return get_arch_dma_ops(NULL);
> > > +}
> > > +
> > >  void __xen_dma_map_page(struct device *hwdev, struct page *page,
> > >  	     dma_addr_t dev_addr, unsigned long offset, size_t size,
> > >  	     enum dma_data_direction dir, unsigned long attrs);
> 

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

* Re: [PATCH 1/2] xen/arm, arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..."
  2017-04-24 19:16     ` Stefano Stabellini
@ 2017-04-25 12:51       ` Julien Grall
  2017-04-25 17:22         ` Stefano Stabellini
  0 siblings, 1 reply; 15+ messages in thread
From: Julien Grall @ 2017-04-25 12:51 UTC (permalink / raw)
  To: Stefano Stabellini, linux
  Cc: xen-devel, jgross, will.deacon, linux-kernel, boris.ostrovsky,
	linux-arm-kernel, catalin.marinas

Hi Stefano,

On 24/04/17 20:16, Stefano Stabellini wrote:
> Given the outstanding regression we need to fix as soon as possible,
> I'll queue these patches on the xentip tree for 4.12.

It looks like there is another rc for 4.11. I am wondering whether you 
could try to send a pull request to Linus so it can be fixed in 4.11?

Cheers,

-- 
Julien Grall

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

* Re: [PATCH 1/2] xen/arm, arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..."
  2017-04-25 12:51       ` Julien Grall
@ 2017-04-25 17:22         ` Stefano Stabellini
  2017-04-26 11:19           ` Catalin Marinas
  0 siblings, 1 reply; 15+ messages in thread
From: Stefano Stabellini @ 2017-04-25 17:22 UTC (permalink / raw)
  To: Julien Grall
  Cc: Stefano Stabellini, linux, xen-devel, jgross, will.deacon,
	linux-kernel, boris.ostrovsky, linux-arm-kernel, catalin.marinas

On Tue, 25 Apr 2017, Julien Grall wrote:
> Hi Stefano,
> 
> On 24/04/17 20:16, Stefano Stabellini wrote:
> > Given the outstanding regression we need to fix as soon as possible,
> > I'll queue these patches on the xentip tree for 4.12.
> 
> It looks like there is another rc for 4.11. I am wondering whether you could
> try to send a pull request to Linus so it can be fixed in 4.11?

No, especially without input from Russell.

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

* Re: [PATCH 1/2] xen/arm, arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..."
  2017-04-25 17:22         ` Stefano Stabellini
@ 2017-04-26 11:19           ` Catalin Marinas
  2017-04-26 17:00             ` Stefano Stabellini
  0 siblings, 1 reply; 15+ messages in thread
From: Catalin Marinas @ 2017-04-26 11:19 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Julien Grall, jgross, will.deacon, linux-kernel, linux,
	boris.ostrovsky, xen-devel, linux-arm-kernel

On Tue, Apr 25, 2017 at 10:22:00AM -0700, Stefano Stabellini wrote:
> On Tue, 25 Apr 2017, Julien Grall wrote:
> > On 24/04/17 20:16, Stefano Stabellini wrote:
> > > Given the outstanding regression we need to fix as soon as possible,
> > > I'll queue these patches on the xentip tree for 4.12.
> > 
> > It looks like there is another rc for 4.11. I am wondering whether you could
> > try to send a pull request to Linus so it can be fixed in 4.11?
> 
> No, especially without input from Russell.

You could add a "Fixes" tag to the first patch so that it gets
back-ported to 4.11.x once it hits mainline (the second patch is just
cosmetic):

Fixes: 815dd18788fe ("treewide: Consolidate get_dma_ops() implementations")

-- 
Catalin

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

* Re: [PATCH 1/2] xen/arm, arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..."
  2017-04-26 11:19           ` Catalin Marinas
@ 2017-04-26 17:00             ` Stefano Stabellini
  2017-04-26 17:13               ` Catalin Marinas
  0 siblings, 1 reply; 15+ messages in thread
From: Stefano Stabellini @ 2017-04-26 17:00 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Stefano Stabellini, Julien Grall, jgross, will.deacon,
	linux-kernel, linux, boris.ostrovsky, xen-devel,
	linux-arm-kernel

On Wed, 26 Apr 2017, Catalin Marinas wrote:
> On Tue, Apr 25, 2017 at 10:22:00AM -0700, Stefano Stabellini wrote:
> > On Tue, 25 Apr 2017, Julien Grall wrote:
> > > On 24/04/17 20:16, Stefano Stabellini wrote:
> > > > Given the outstanding regression we need to fix as soon as possible,
> > > > I'll queue these patches on the xentip tree for 4.12.
> > > 
> > > It looks like there is another rc for 4.11. I am wondering whether you could
> > > try to send a pull request to Linus so it can be fixed in 4.11?
> > 
> > No, especially without input from Russell.
> 
> You could add a "Fixes" tag to the first patch so that it gets
> back-ported to 4.11.x once it hits mainline (the second patch is just
> cosmetic):
> 
> Fixes: 815dd18788fe ("treewide: Consolidate get_dma_ops() implementations")

I did add:

  Cc: <stable@vger.kernel.org>        [4.11+]

I thought that would be enough to trigger a backport?

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

* Re: [PATCH 1/2] xen/arm, arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..."
  2017-04-26 17:00             ` Stefano Stabellini
@ 2017-04-26 17:13               ` Catalin Marinas
  2017-04-26 17:17                 ` Stefano Stabellini
  0 siblings, 1 reply; 15+ messages in thread
From: Catalin Marinas @ 2017-04-26 17:13 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: jgross, will.deacon, linux-kernel, linux, Julien Grall,
	boris.ostrovsky, xen-devel, linux-arm-kernel

On Wed, Apr 26, 2017 at 10:00:30AM -0700, Stefano Stabellini wrote:
> On Wed, 26 Apr 2017, Catalin Marinas wrote:
> > On Tue, Apr 25, 2017 at 10:22:00AM -0700, Stefano Stabellini wrote:
> > > On Tue, 25 Apr 2017, Julien Grall wrote:
> > > > On 24/04/17 20:16, Stefano Stabellini wrote:
> > > > > Given the outstanding regression we need to fix as soon as possible,
> > > > > I'll queue these patches on the xentip tree for 4.12.
> > > > 
> > > > It looks like there is another rc for 4.11. I am wondering whether you could
> > > > try to send a pull request to Linus so it can be fixed in 4.11?
> > > 
> > > No, especially without input from Russell.
> > 
> > You could add a "Fixes" tag to the first patch so that it gets
> > back-ported to 4.11.x once it hits mainline (the second patch is just
> > cosmetic):
> > 
> > Fixes: 815dd18788fe ("treewide: Consolidate get_dma_ops() implementations")
> 
> I did add:
> 
>   Cc: <stable@vger.kernel.org>        [4.11+]
> 
> I thought that would be enough to trigger a backport?

Either would do. I didn't see it in the patch you posted, that's why I
mentioned it.

-- 
Catalin

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

* Re: [PATCH 1/2] xen/arm, arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..."
  2017-04-26 17:13               ` Catalin Marinas
@ 2017-04-26 17:17                 ` Stefano Stabellini
  0 siblings, 0 replies; 15+ messages in thread
From: Stefano Stabellini @ 2017-04-26 17:17 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Stefano Stabellini, jgross, will.deacon, linux-kernel, linux,
	Julien Grall, boris.ostrovsky, xen-devel, linux-arm-kernel

On Wed, 26 Apr 2017, Catalin Marinas wrote:
> On Wed, Apr 26, 2017 at 10:00:30AM -0700, Stefano Stabellini wrote:
> > On Wed, 26 Apr 2017, Catalin Marinas wrote:
> > > On Tue, Apr 25, 2017 at 10:22:00AM -0700, Stefano Stabellini wrote:
> > > > On Tue, 25 Apr 2017, Julien Grall wrote:
> > > > > On 24/04/17 20:16, Stefano Stabellini wrote:
> > > > > > Given the outstanding regression we need to fix as soon as possible,
> > > > > > I'll queue these patches on the xentip tree for 4.12.
> > > > > 
> > > > > It looks like there is another rc for 4.11. I am wondering whether you could
> > > > > try to send a pull request to Linus so it can be fixed in 4.11?
> > > > 
> > > > No, especially without input from Russell.
> > > 
> > > You could add a "Fixes" tag to the first patch so that it gets
> > > back-ported to 4.11.x once it hits mainline (the second patch is just
> > > cosmetic):
> > > 
> > > Fixes: 815dd18788fe ("treewide: Consolidate get_dma_ops() implementations")
> > 
> > I did add:
> > 
> >   Cc: <stable@vger.kernel.org>        [4.11+]
> > 
> > I thought that would be enough to trigger a backport?
> 
> Either would do. I didn't see it in the patch you posted, that's why I
> mentioned it.

Thanks, I appreciated it!

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

end of thread, other threads:[~2017-04-26 17:17 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-13 21:04 [PATCH 1/2] xen/arm,arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..." Stefano Stabellini
2017-04-13 21:04 ` [PATCH 2/2] xen/arm,arm64: rename __generic_dma_ops to xen_get_dma_ops Stefano Stabellini
2017-04-14  0:48   ` Boris Ostrovsky
2017-04-14  2:14     ` Konrad Rzeszutek Wilk
2017-04-18 14:21 ` [PATCH 1/2] xen/arm, arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..." Catalin Marinas
2017-04-19 17:25   ` Stefano Stabellini
2017-04-19 18:20     ` Juergen Gross
2017-04-19 18:32       ` Stefano Stabellini
2017-04-24 19:16     ` Stefano Stabellini
2017-04-25 12:51       ` Julien Grall
2017-04-25 17:22         ` Stefano Stabellini
2017-04-26 11:19           ` Catalin Marinas
2017-04-26 17:00             ` Stefano Stabellini
2017-04-26 17:13               ` Catalin Marinas
2017-04-26 17:17                 ` Stefano Stabellini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).