LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [RFC/PATCH] mm: Pass virtual address to [__]p{te,ud,md}_free_tlb()
From: Benjamin Herrenschmidt @ 2009-07-27 21:35 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Nick Piggin, Linux-Arch, linuxppc-dev, Hugh Dickins, linux-kernel,
	Linux Memory Management
In-Reply-To: <alpine.LFD.2.01.0907271210210.25224@localhost.localdomain>

On Mon, 2009-07-27 at 12:11 -0700, Linus Torvalds wrote:
> 
> On Thu, 23 Jul 2009, Benjamin Herrenschmidt wrote:
> > 
> > Hrm... my powerpc-next branch will contain stuff that depend on it, so
> > I'll probably have to pull it in though, unless I tell all my
> > sub-maintainers to also pull from that other branch first :-)
> 
> Ok, I'll just apply the patch. It does look obvious enough.

Thanks. It's been in -next for a day now btw, and afaik, there have been
no issue reported.

Cheers,
Ben.
 

^ permalink raw reply

* Re: [PATCH 5/5] powerpc: use asm-generic/dma-mapping-common.h
From: Becky Bruce @ 2009-07-27 21:08 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <1248405855-15546-6-git-send-email-fujita.tomonori@lab.ntt.co.jp>


On Jul 23, 2009, at 10:24 PM, FUJITA Tomonori wrote:

> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>

Fujita,

Since you're removing all the uses of it, you should probably remove  
PPC_NEED_DMA_SYNC_OPS from arch/powerpc/Kconfig:

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 0603b6c..fb3f4ff 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -307,10 +307,6 @@ config SWIOTLB
           platforms where the size of a physical address is larger
           than the bus address.  Not all platforms support this.

-config PPC_NEED_DMA_SYNC_OPS
-       def_bool y
-       depends on (NOT_COHERENT_CACHE || SWIOTLB)
-
  config HOTPLUG_CPU
         bool "Support for enabling/disabling CPUs"
         depends on SMP && HOTPLUG && EXPERIMENTAL && (PPC_PSERIES ||  
PPC_PMAC)

Otherwise, this looks good to me.

I also think you want an ACK from Ben - making this switch does add  
slight overhead to platforms that don't need sync ops, but I think  
it's worth it.  IIRC, it was Ben who asked for the optimization of  
NEED_DMA_SYNC_OPS, so I'd like him to weigh in here.

Cheers,
Becky


>
> ---
> arch/powerpc/Kconfig                   |    2 +-
> arch/powerpc/include/asm/dma-mapping.h |  242  
> +-------------------------------
> 2 files changed, 7 insertions(+), 237 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index d00131c..0603b6c 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -120,7 +120,7 @@ config PPC
> 	select HAVE_KRETPROBES
> 	select HAVE_ARCH_TRACEHOOK
> 	select HAVE_LMB
> -	select HAVE_DMA_ATTRS if PPC64
> +	select HAVE_DMA_ATTRS
> 	select USE_GENERIC_SMP_HELPERS if SMP
> 	select HAVE_OPROFILE
> 	select HAVE_SYSCALL_WRAPPERS if PPC64
> diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/ 
> include/asm/dma-mapping.h
> index 8ca2b51..91217e4 100644
> --- a/arch/powerpc/include/asm/dma-mapping.h
> +++ b/arch/powerpc/include/asm/dma-mapping.h
> @@ -14,6 +14,7 @@
> #include <linux/mm.h>
> #include <linux/scatterlist.h>
> #include <linux/dma-attrs.h>
> +#include <linux/dma-debug.h>
> #include <asm/io.h>
> #include <asm/swiotlb.h>
>
> @@ -89,6 +90,11 @@ static inline void set_dma_ops(struct device  
> *dev, struct dma_map_ops *ops)
> 	dev->archdata.dma_ops = ops;
> }
>
> +/* this will be removed soon */
> +#define flush_write_buffers()
> +
> +#include <asm-generic/dma-mapping-common.h>
> +
> static inline int dma_supported(struct device *dev, u64 mask)
> {
> 	struct dma_map_ops *dma_ops = get_dma_ops(dev);
> @@ -117,87 +123,6 @@ static inline int dma_set_mask(struct device  
> *dev, u64 dma_mask)
> 	return 0;
> }
>
> -/*
> - * map_/unmap_single actually call through to map/unmap_page now  
> that all the
> - * dma_map_ops have been converted over. We just have to get the  
> page and
> - * offset to pass through to map_page
> - */
> -static inline dma_addr_t dma_map_single_attrs(struct device *dev,
> -					      void *cpu_addr,
> -					      size_t size,
> -					      enum dma_data_direction direction,
> -					      struct dma_attrs *attrs)
> -{
> -	struct dma_map_ops *dma_ops = get_dma_ops(dev);
> -
> -	BUG_ON(!dma_ops);
> -
> -	return dma_ops->map_page(dev, virt_to_page(cpu_addr),
> -				 (unsigned long)cpu_addr % PAGE_SIZE, size,
> -				 direction, attrs);
> -}
> -
> -static inline void dma_unmap_single_attrs(struct device *dev,
> -					  dma_addr_t dma_addr,
> -					  size_t size,
> -					  enum dma_data_direction direction,
> -					  struct dma_attrs *attrs)
> -{
> -	struct dma_map_ops *dma_ops = get_dma_ops(dev);
> -
> -	BUG_ON(!dma_ops);
> -
> -	dma_ops->unmap_page(dev, dma_addr, size, direction, attrs);
> -}
> -
> -static inline dma_addr_t dma_map_page_attrs(struct device *dev,
> -					    struct page *page,
> -					    unsigned long offset, size_t size,
> -					    enum dma_data_direction direction,
> -					    struct dma_attrs *attrs)
> -{
> -	struct dma_map_ops *dma_ops = get_dma_ops(dev);
> -
> -	BUG_ON(!dma_ops);
> -
> -	return dma_ops->map_page(dev, page, offset, size, direction, attrs);
> -}
> -
> -static inline void dma_unmap_page_attrs(struct device *dev,
> -					dma_addr_t dma_address,
> -					size_t size,
> -					enum dma_data_direction direction,
> -					struct dma_attrs *attrs)
> -{
> -	struct dma_map_ops *dma_ops = get_dma_ops(dev);
> -
> -	BUG_ON(!dma_ops);
> -
> -	dma_ops->unmap_page(dev, dma_address, size, direction, attrs);
> -}
> -
> -static inline int dma_map_sg_attrs(struct device *dev, struct  
> scatterlist *sg,
> -				   int nents, enum dma_data_direction direction,
> -				   struct dma_attrs *attrs)
> -{
> -	struct dma_map_ops *dma_ops = get_dma_ops(dev);
> -
> -	BUG_ON(!dma_ops);
> -	return dma_ops->map_sg(dev, sg, nents, direction, attrs);
> -}
> -
> -static inline void dma_unmap_sg_attrs(struct device *dev,
> -				      struct scatterlist *sg,
> -				      int nhwentries,
> -				      enum dma_data_direction direction,
> -				      struct dma_attrs *attrs)
> -{
> -	struct dma_map_ops *dma_ops = get_dma_ops(dev);
> -
> -	BUG_ON(!dma_ops);
> -	dma_ops->unmap_sg(dev, sg, nhwentries, direction, attrs);
> -}
> -
> static inline void *dma_alloc_coherent(struct device *dev, size_t  
> size,
> 				       dma_addr_t *dma_handle, gfp_t flag)
> {
> @@ -216,161 +141,6 @@ static inline void dma_free_coherent(struct  
> device *dev, size_t size,
> 	dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
> }
>
> -static inline dma_addr_t dma_map_single(struct device *dev, void  
> *cpu_addr,
> -					size_t size,
> -					enum dma_data_direction direction)
> -{
> -	return dma_map_single_attrs(dev, cpu_addr, size, direction, NULL);
> -}
> -
> -static inline void dma_unmap_single(struct device *dev, dma_addr_t  
> dma_addr,
> -				    size_t size,
> -				    enum dma_data_direction direction)
> -{
> -	dma_unmap_single_attrs(dev, dma_addr, size, direction, NULL);
> -}
> -
> -static inline dma_addr_t dma_map_page(struct device *dev, struct  
> page *page,
> -				      unsigned long offset, size_t size,
> -				      enum dma_data_direction direction)
> -{
> -	return dma_map_page_attrs(dev, page, offset, size, direction, NULL);
> -}
> -
> -static inline void dma_unmap_page(struct device *dev, dma_addr_t  
> dma_address,
> -				  size_t size,
> -				  enum dma_data_direction direction)
> -{
> -	dma_unmap_page_attrs(dev, dma_address, size, direction, NULL);
> -}
> -
> -static inline int dma_map_sg(struct device *dev, struct scatterlist  
> *sg,
> -			     int nents, enum dma_data_direction direction)
> -{
> -	return dma_map_sg_attrs(dev, sg, nents, direction, NULL);
> -}
> -
> -static inline void dma_unmap_sg(struct device *dev, struct  
> scatterlist *sg,
> -				int nhwentries,
> -				enum dma_data_direction direction)
> -{
> -	dma_unmap_sg_attrs(dev, sg, nhwentries, direction, NULL);
> -}
> -
> -#ifdef CONFIG_PPC_NEED_DMA_SYNC_OPS
> -static inline void dma_sync_single_for_cpu(struct device *dev,
> -		dma_addr_t dma_handle, size_t size,
> -		enum dma_data_direction direction)
> -{
> -	struct dma_map_ops *dma_ops = get_dma_ops(dev);
> -
> -	BUG_ON(!dma_ops);
> -
> -	if (dma_ops->sync_single_range_for_cpu)
> -		dma_ops->sync_single_range_for_cpu(dev, dma_handle, 0,
> -					   size, direction);
> -}
> -
> -static inline void dma_sync_single_for_device(struct device *dev,
> -		dma_addr_t dma_handle, size_t size,
> -		enum dma_data_direction direction)
> -{
> -	struct dma_map_ops *dma_ops = get_dma_ops(dev);
> -
> -	BUG_ON(!dma_ops);
> -
> -	if (dma_ops->sync_single_range_for_device)
> -		dma_ops->sync_single_range_for_device(dev, dma_handle,
> -					      0, size, direction);
> -}
> -
> -static inline void dma_sync_sg_for_cpu(struct device *dev,
> -		struct scatterlist *sgl, int nents,
> -		enum dma_data_direction direction)
> -{
> -	struct dma_map_ops *dma_ops = get_dma_ops(dev);
> -
> -	BUG_ON(!dma_ops);
> -
> -	if (dma_ops->sync_sg_for_cpu)
> -		dma_ops->sync_sg_for_cpu(dev, sgl, nents, direction);
> -}
> -
> -static inline void dma_sync_sg_for_device(struct device *dev,
> -		struct scatterlist *sgl, int nents,
> -		enum dma_data_direction direction)
> -{
> -	struct dma_map_ops *dma_ops = get_dma_ops(dev);
> -
> -	BUG_ON(!dma_ops);
> -
> -	if (dma_ops->sync_sg_for_device)
> -		dma_ops->sync_sg_for_device(dev, sgl, nents, direction);
> -}
> -
> -static inline void dma_sync_single_range_for_cpu(struct device *dev,
> -		dma_addr_t dma_handle, unsigned long offset, size_t size,
> -		enum dma_data_direction direction)
> -{
> -	struct dma_map_ops *dma_ops = get_dma_ops(dev);
> -
> -	BUG_ON(!dma_ops);
> -
> -	if (dma_ops->sync_single_range_for_cpu)
> -		dma_ops->sync_single_range_for_cpu(dev, dma_handle,
> -					   offset, size, direction);
> -}
> -
> -static inline void dma_sync_single_range_for_device(struct device  
> *dev,
> -		dma_addr_t dma_handle, unsigned long offset, size_t size,
> -		enum dma_data_direction direction)
> -{
> -	struct dma_map_ops *dma_ops = get_dma_ops(dev);
> -
> -	BUG_ON(!dma_ops);
> -
> -	if (dma_ops->sync_single_range_for_device)
> -		dma_ops->sync_single_range_for_device(dev, dma_handle, offset,
> -					      size, direction);
> -}
> -#else /* CONFIG_PPC_NEED_DMA_SYNC_OPS */
> -static inline void dma_sync_single_for_cpu(struct device *dev,
> -		dma_addr_t dma_handle, size_t size,
> -		enum dma_data_direction direction)
> -{
> -}
> -
> -static inline void dma_sync_single_for_device(struct device *dev,
> -		dma_addr_t dma_handle, size_t size,
> -		enum dma_data_direction direction)
> -{
> -}
> -
> -static inline void dma_sync_sg_for_cpu(struct device *dev,
> -		struct scatterlist *sgl, int nents,
> -		enum dma_data_direction direction)
> -{
> -}
> -
> -static inline void dma_sync_sg_for_device(struct device *dev,
> -		struct scatterlist *sgl, int nents,
> -		enum dma_data_direction direction)
> -{
> -}
> -
> -static inline void dma_sync_single_range_for_cpu(struct device *dev,
> -		dma_addr_t dma_handle, unsigned long offset, size_t size,
> -		enum dma_data_direction direction)
> -{
> -}
> -
> -static inline void dma_sync_single_range_for_device(struct device  
> *dev,
> -		dma_addr_t dma_handle, unsigned long offset, size_t size,
> -		enum dma_data_direction direction)
> -{
> -}
> -#endif
> -
> static inline int dma_mapping_error(struct device *dev, dma_addr_t  
> dma_addr)
> {
> #ifdef CONFIG_PPC64
> -- 
> 1.6.0.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux- 
> kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply related

* Re: [PATCH 4/5] powerpc: use dma_map_ops struct
From: Becky Bruce @ 2009-07-27 21:03 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <1248405855-15546-5-git-send-email-fujita.tomonori@lab.ntt.co.jp>


On Jul 23, 2009, at 10:24 PM, FUJITA Tomonori wrote:

> This converts uses dma_map_ops struct (in include/linux/dma-mapping.h)
> instead of POWERPC homegrown dma_mapping_ops.
>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>

Acked-by: Becky Bruce <beckyb@kernel.crashing.org>

>
> ---
> arch/powerpc/include/asm/device.h       |    4 +-
> arch/powerpc/include/asm/dma-mapping.h  |   84 +++++++ 
> +-----------------------
> arch/powerpc/include/asm/pci.h          |    4 +-
> arch/powerpc/include/asm/swiotlb.h      |    2 +-
> arch/powerpc/kernel/dma-iommu.c         |    2 +-
> arch/powerpc/kernel/dma-swiotlb.c       |    2 +-
> arch/powerpc/kernel/dma.c               |    2 +-
> arch/powerpc/kernel/ibmebus.c           |    2 +-
> arch/powerpc/kernel/pci-common.c        |    6 +-
> arch/powerpc/kernel/vio.c               |    2 +-
> arch/powerpc/platforms/cell/iommu.c     |    2 +-
> arch/powerpc/platforms/ps3/system-bus.c |    4 +-
> 12 files changed, 37 insertions(+), 79 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/ 
> include/asm/device.h
> index 0086f8d..67fcd7f 100644
> --- a/arch/powerpc/include/asm/device.h
> +++ b/arch/powerpc/include/asm/device.h
> @@ -6,7 +6,7 @@
> #ifndef _ASM_POWERPC_DEVICE_H
> #define _ASM_POWERPC_DEVICE_H
>
> -struct dma_mapping_ops;
> +struct dma_map_ops;
> struct device_node;
>
> struct dev_archdata {
> @@ -14,7 +14,7 @@ struct dev_archdata {
> 	struct device_node	*of_node;
>
> 	/* DMA operations on that device */
> -	struct dma_mapping_ops	*dma_ops;
> +	struct dma_map_ops	*dma_ops;
> 	void			*dma_data;
> #ifdef CONFIG_SWIOTLB
> 	dma_addr_t		max_direct_dma_addr;
> diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/ 
> include/asm/dma-mapping.h
> index 1765c37..8ca2b51 100644
> --- a/arch/powerpc/include/asm/dma-mapping.h
> +++ b/arch/powerpc/include/asm/dma-mapping.h
> @@ -64,56 +64,14 @@ static inline unsigned long  
> device_to_mask(struct device *dev)
> }
>
> /*
> - * DMA operations are abstracted for G5 vs. i/pSeries, PCI vs. VIO
> - */
> -struct dma_mapping_ops {
> -	void *		(*alloc_coherent)(struct device *dev, size_t size,
> -				dma_addr_t *dma_handle, gfp_t flag);
> -	void		(*free_coherent)(struct device *dev, size_t size,
> -				void *vaddr, dma_addr_t dma_handle);
> -	int		(*map_sg)(struct device *dev, struct scatterlist *sg,
> -				int nents, enum dma_data_direction direction,
> -				struct dma_attrs *attrs);
> -	void		(*unmap_sg)(struct device *dev, struct scatterlist *sg,
> -				int nents, enum dma_data_direction direction,
> -				struct dma_attrs *attrs);
> -	int		(*dma_supported)(struct device *dev, u64 mask);
> -	int		(*set_dma_mask)(struct device *dev, u64 dma_mask);
> -	dma_addr_t 	(*map_page)(struct device *dev, struct page *page,
> -				unsigned long offset, size_t size,
> -				enum dma_data_direction direction,
> -				struct dma_attrs *attrs);
> -	void		(*unmap_page)(struct device *dev,
> -				dma_addr_t dma_address, size_t size,
> -				enum dma_data_direction direction,
> -				struct dma_attrs *attrs);
> -#ifdef CONFIG_PPC_NEED_DMA_SYNC_OPS
> -	void            (*sync_single_range_for_cpu)(struct device *hwdev,
> -				dma_addr_t dma_handle, unsigned long offset,
> -				size_t size,
> -				enum dma_data_direction direction);
> -	void            (*sync_single_range_for_device)(struct device  
> *hwdev,
> -				dma_addr_t dma_handle, unsigned long offset,
> -				size_t size,
> -				enum dma_data_direction direction);
> -	void            (*sync_sg_for_cpu)(struct device *hwdev,
> -				struct scatterlist *sg, int nelems,
> -				enum dma_data_direction direction);
> -	void            (*sync_sg_for_device)(struct device *hwdev,
> -				struct scatterlist *sg, int nelems,
> -				enum dma_data_direction direction);
> -#endif
> -};
> -
> -/*
>  * Available generic sets of operations
>  */
> #ifdef CONFIG_PPC64
> -extern struct dma_mapping_ops dma_iommu_ops;
> +extern struct dma_map_ops dma_iommu_ops;
> #endif
> -extern struct dma_mapping_ops dma_direct_ops;
> +extern struct dma_map_ops dma_direct_ops;
>
> -static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
> +static inline struct dma_map_ops *get_dma_ops(struct device *dev)
> {
> 	/* We don't handle the NULL dev case for ISA for now. We could
> 	 * do it via an out of line call but it is not needed for now. The
> @@ -126,14 +84,14 @@ static inline struct dma_mapping_ops  
> *get_dma_ops(struct device *dev)
> 	return dev->archdata.dma_ops;
> }
>
> -static inline void set_dma_ops(struct device *dev, struct  
> dma_mapping_ops *ops)
> +static inline void set_dma_ops(struct device *dev, struct  
> dma_map_ops *ops)
> {
> 	dev->archdata.dma_ops = ops;
> }
>
> static inline int dma_supported(struct device *dev, u64 mask)
> {
> -	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +	struct dma_map_ops *dma_ops = get_dma_ops(dev);
>
> 	if (unlikely(dma_ops == NULL))
> 		return 0;
> @@ -147,7 +105,7 @@ static inline int dma_supported(struct device  
> *dev, u64 mask)
>
> static inline int dma_set_mask(struct device *dev, u64 dma_mask)
> {
> -	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +	struct dma_map_ops *dma_ops = get_dma_ops(dev);
>
> 	if (unlikely(dma_ops == NULL))
> 		return -EIO;
> @@ -161,7 +119,7 @@ static inline int dma_set_mask(struct device  
> *dev, u64 dma_mask)
>
> /*
>  * map_/unmap_single actually call through to map/unmap_page now  
> that all the
> - * dma_mapping_ops have been converted over. We just have to get  
> the page and
> + * dma_map_ops have been converted over. We just have to get the  
> page and
>  * offset to pass through to map_page
>  */
> static inline dma_addr_t dma_map_single_attrs(struct device *dev,
> @@ -170,7 +128,7 @@ static inline dma_addr_t  
> dma_map_single_attrs(struct device *dev,
> 					      enum dma_data_direction direction,
> 					      struct dma_attrs *attrs)
> {
> -	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +	struct dma_map_ops *dma_ops = get_dma_ops(dev);
>
> 	BUG_ON(!dma_ops);
>
> @@ -185,7 +143,7 @@ static inline void dma_unmap_single_attrs(struct  
> device *dev,
> 					  enum dma_data_direction direction,
> 					  struct dma_attrs *attrs)
> {
> -	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +	struct dma_map_ops *dma_ops = get_dma_ops(dev);
>
> 	BUG_ON(!dma_ops);
>
> @@ -198,7 +156,7 @@ static inline dma_addr_t  
> dma_map_page_attrs(struct device *dev,
> 					    enum dma_data_direction direction,
> 					    struct dma_attrs *attrs)
> {
> -	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +	struct dma_map_ops *dma_ops = get_dma_ops(dev);
>
> 	BUG_ON(!dma_ops);
>
> @@ -211,7 +169,7 @@ static inline void dma_unmap_page_attrs(struct  
> device *dev,
> 					enum dma_data_direction direction,
> 					struct dma_attrs *attrs)
> {
> -	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +	struct dma_map_ops *dma_ops = get_dma_ops(dev);
>
> 	BUG_ON(!dma_ops);
>
> @@ -222,7 +180,7 @@ static inline int dma_map_sg_attrs(struct device  
> *dev, struct scatterlist *sg,
> 				   int nents, enum dma_data_direction direction,
> 				   struct dma_attrs *attrs)
> {
> -	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +	struct dma_map_ops *dma_ops = get_dma_ops(dev);
>
> 	BUG_ON(!dma_ops);
> 	return dma_ops->map_sg(dev, sg, nents, direction, attrs);
> @@ -234,7 +192,7 @@ static inline void dma_unmap_sg_attrs(struct  
> device *dev,
> 				      enum dma_data_direction direction,
> 				      struct dma_attrs *attrs)
> {
> -	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +	struct dma_map_ops *dma_ops = get_dma_ops(dev);
>
> 	BUG_ON(!dma_ops);
> 	dma_ops->unmap_sg(dev, sg, nhwentries, direction, attrs);
> @@ -243,7 +201,7 @@ static inline void dma_unmap_sg_attrs(struct  
> device *dev,
> static inline void *dma_alloc_coherent(struct device *dev, size_t  
> size,
> 				       dma_addr_t *dma_handle, gfp_t flag)
> {
> -	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +	struct dma_map_ops *dma_ops = get_dma_ops(dev);
>
> 	BUG_ON(!dma_ops);
> 	return dma_ops->alloc_coherent(dev, size, dma_handle, flag);
> @@ -252,7 +210,7 @@ static inline void *dma_alloc_coherent(struct  
> device *dev, size_t size,
> static inline void dma_free_coherent(struct device *dev, size_t size,
> 				     void *cpu_addr, dma_addr_t dma_handle)
> {
> -	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +	struct dma_map_ops *dma_ops = get_dma_ops(dev);
>
> 	BUG_ON(!dma_ops);
> 	dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
> @@ -304,7 +262,7 @@ static inline void  
> dma_sync_single_for_cpu(struct device *dev,
> 		dma_addr_t dma_handle, size_t size,
> 		enum dma_data_direction direction)
> {
> -	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +	struct dma_map_ops *dma_ops = get_dma_ops(dev);
>
> 	BUG_ON(!dma_ops);
>
> @@ -317,7 +275,7 @@ static inline void  
> dma_sync_single_for_device(struct device *dev,
> 		dma_addr_t dma_handle, size_t size,
> 		enum dma_data_direction direction)
> {
> -	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +	struct dma_map_ops *dma_ops = get_dma_ops(dev);
>
> 	BUG_ON(!dma_ops);
>
> @@ -330,7 +288,7 @@ static inline void dma_sync_sg_for_cpu(struct  
> device *dev,
> 		struct scatterlist *sgl, int nents,
> 		enum dma_data_direction direction)
> {
> -	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +	struct dma_map_ops *dma_ops = get_dma_ops(dev);
>
> 	BUG_ON(!dma_ops);
>
> @@ -342,7 +300,7 @@ static inline void dma_sync_sg_for_device(struct  
> device *dev,
> 		struct scatterlist *sgl, int nents,
> 		enum dma_data_direction direction)
> {
> -	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +	struct dma_map_ops *dma_ops = get_dma_ops(dev);
>
> 	BUG_ON(!dma_ops);
>
> @@ -354,7 +312,7 @@ static inline void  
> dma_sync_single_range_for_cpu(struct device *dev,
> 		dma_addr_t dma_handle, unsigned long offset, size_t size,
> 		enum dma_data_direction direction)
> {
> -	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +	struct dma_map_ops *dma_ops = get_dma_ops(dev);
>
> 	BUG_ON(!dma_ops);
>
> @@ -367,7 +325,7 @@ static inline void  
> dma_sync_single_range_for_device(struct device *dev,
> 		dma_addr_t dma_handle, unsigned long offset, size_t size,
> 		enum dma_data_direction direction)
> {
> -	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +	struct dma_map_ops *dma_ops = get_dma_ops(dev);
>
> 	BUG_ON(!dma_ops);
>
> diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/ 
> asm/pci.h
> index d9483c5..7ae46d7 100644
> --- a/arch/powerpc/include/asm/pci.h
> +++ b/arch/powerpc/include/asm/pci.h
> @@ -61,8 +61,8 @@ static inline int pci_get_legacy_ide_irq(struct  
> pci_dev *dev, int channel)
> }
>
> #ifdef CONFIG_PCI
> -extern void set_pci_dma_ops(struct dma_mapping_ops *dma_ops);
> -extern struct dma_mapping_ops *get_pci_dma_ops(void);
> +extern void set_pci_dma_ops(struct dma_map_ops *dma_ops);
> +extern struct dma_map_ops *get_pci_dma_ops(void);
> #else	/* CONFIG_PCI */
> #define set_pci_dma_ops(d)
> #define get_pci_dma_ops()	NULL
> diff --git a/arch/powerpc/include/asm/swiotlb.h b/arch/powerpc/ 
> include/asm/swiotlb.h
> index 21ce0a3..8979d4c 100644
> --- a/arch/powerpc/include/asm/swiotlb.h
> +++ b/arch/powerpc/include/asm/swiotlb.h
> @@ -13,7 +13,7 @@
>
> #include <linux/swiotlb.h>
>
> -extern struct dma_mapping_ops swiotlb_dma_ops;
> +extern struct dma_map_ops swiotlb_dma_ops;
>
> static inline void dma_mark_clean(void *addr, size_t size) {}
>
> diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/ 
> dma-iommu.c
> index 2983ada..87ddb3f 100644
> --- a/arch/powerpc/kernel/dma-iommu.c
> +++ b/arch/powerpc/kernel/dma-iommu.c
> @@ -89,7 +89,7 @@ static int dma_iommu_dma_supported(struct device  
> *dev, u64 mask)
> 		return 1;
> }
>
> -struct dma_mapping_ops dma_iommu_ops = {
> +struct dma_map_ops dma_iommu_ops = {
> 	.alloc_coherent	= dma_iommu_alloc_coherent,
> 	.free_coherent	= dma_iommu_free_coherent,
> 	.map_sg		= dma_iommu_map_sg,
> diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/ 
> dma-swiotlb.c
> index ca141e1..d1143a6 100644
> --- a/arch/powerpc/kernel/dma-swiotlb.c
> +++ b/arch/powerpc/kernel/dma-swiotlb.c
> @@ -31,7 +31,7 @@ unsigned int ppc_swiotlb_enable;
>  * map_page, and unmap_page on highmem, use normal dma_ops
>  * for everything else.
>  */
> -struct dma_mapping_ops swiotlb_dma_ops = {
> +struct dma_map_ops swiotlb_dma_ops = {
> 	.alloc_coherent = dma_direct_alloc_coherent,
> 	.free_coherent = dma_direct_free_coherent,
> 	.map_sg = swiotlb_map_sg_attrs,
> diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
> index 20a60d6..3e8bb9a 100644
> --- a/arch/powerpc/kernel/dma.c
> +++ b/arch/powerpc/kernel/dma.c
> @@ -140,7 +140,7 @@ static inline void  
> dma_direct_sync_single_range(struct device *dev,
> }
> #endif
>
> -struct dma_mapping_ops dma_direct_ops = {
> +struct dma_map_ops dma_direct_ops = {
> 	.alloc_coherent	= dma_direct_alloc_coherent,
> 	.free_coherent	= dma_direct_free_coherent,
> 	.map_sg		= dma_direct_map_sg,
> diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ 
> ibmebus.c
> index 6e3f624..a4c8b38 100644
> --- a/arch/powerpc/kernel/ibmebus.c
> +++ b/arch/powerpc/kernel/ibmebus.c
> @@ -127,7 +127,7 @@ static int ibmebus_dma_supported(struct device  
> *dev, u64 mask)
> 	return 1;
> }
>
> -static struct dma_mapping_ops ibmebus_dma_ops = {
> +static struct dma_map_ops ibmebus_dma_ops = {
> 	.alloc_coherent = ibmebus_alloc_coherent,
> 	.free_coherent  = ibmebus_free_coherent,
> 	.map_sg         = ibmebus_map_sg,
> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/ 
> pci-common.c
> index 5a56e97..7585f1f 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -50,14 +50,14 @@ resource_size_t isa_mem_base;
> unsigned int ppc_pci_flags = 0;
>
>
> -static struct dma_mapping_ops *pci_dma_ops = &dma_direct_ops;
> +static struct dma_map_ops *pci_dma_ops = &dma_direct_ops;
>
> -void set_pci_dma_ops(struct dma_mapping_ops *dma_ops)
> +void set_pci_dma_ops(struct dma_map_ops *dma_ops)
> {
> 	pci_dma_ops = dma_ops;
> }
>
> -struct dma_mapping_ops *get_pci_dma_ops(void)
> +struct dma_map_ops *get_pci_dma_ops(void)
> {
> 	return pci_dma_ops;
> }
> diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
> index 819e59f..bc7b41e 100644
> --- a/arch/powerpc/kernel/vio.c
> +++ b/arch/powerpc/kernel/vio.c
> @@ -601,7 +601,7 @@ static void vio_dma_iommu_unmap_sg(struct device  
> *dev,
> 	vio_cmo_dealloc(viodev, alloc_size);
> }
>
> -struct dma_mapping_ops vio_dma_mapping_ops = {
> +struct dma_map_ops vio_dma_mapping_ops = {
> 	.alloc_coherent = vio_dma_iommu_alloc_coherent,
> 	.free_coherent  = vio_dma_iommu_free_coherent,
> 	.map_sg         = vio_dma_iommu_map_sg,
> diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/ 
> platforms/cell/iommu.c
> index 5b34fc2..416db17 100644
> --- a/arch/powerpc/platforms/cell/iommu.c
> +++ b/arch/powerpc/platforms/cell/iommu.c
> @@ -642,7 +642,7 @@ static int dma_fixed_dma_supported(struct device  
> *dev, u64 mask)
>
> static int dma_set_mask_and_switch(struct device *dev, u64 dma_mask);
>
> -struct dma_mapping_ops dma_iommu_fixed_ops = {
> +struct dma_map_ops dma_iommu_fixed_ops = {
> 	.alloc_coherent = dma_fixed_alloc_coherent,
> 	.free_coherent  = dma_fixed_free_coherent,
> 	.map_sg         = dma_fixed_map_sg,
> diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/ 
> platforms/ps3/system-bus.c
> index 3f763c5..02ddcc2 100644
> --- a/arch/powerpc/platforms/ps3/system-bus.c
> +++ b/arch/powerpc/platforms/ps3/system-bus.c
> @@ -694,7 +694,7 @@ static int ps3_dma_supported(struct device  
> *_dev, u64 mask)
> 	return mask >= DMA_BIT_MASK(32);
> }
>
> -static struct dma_mapping_ops ps3_sb_dma_ops = {
> +static struct dma_map_ops ps3_sb_dma_ops = {
> 	.alloc_coherent = ps3_alloc_coherent,
> 	.free_coherent = ps3_free_coherent,
> 	.map_sg = ps3_sb_map_sg,
> @@ -704,7 +704,7 @@ static struct dma_mapping_ops ps3_sb_dma_ops = {
> 	.unmap_page = ps3_unmap_page,
> };
>
> -static struct dma_mapping_ops ps3_ioc0_dma_ops = {
> +static struct dma_map_ops ps3_ioc0_dma_ops = {
> 	.alloc_coherent = ps3_alloc_coherent,
> 	.free_coherent = ps3_free_coherent,
> 	.map_sg = ps3_ioc0_map_sg,
> -- 
> 1.6.0.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux- 
> kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply

* Re: [PATCH 3/5] add set_dma_mask hook to struct dma_map_ops
From: Becky Bruce @ 2009-07-27 21:02 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <1248405855-15546-4-git-send-email-fujita.tomonori@lab.ntt.co.jp>


On Jul 23, 2009, at 10:24 PM, FUJITA Tomonori wrote:

> POWERPC needs this hook. SPARC could use it too.
>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>

Acked-by: Becky Bruce <beckyb@kernel.crashing.org>

>
> ---
> include/linux/dma-mapping.h |    1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> index c0f6c3c..91b7618 100644
> --- a/include/linux/dma-mapping.h
> +++ b/include/linux/dma-mapping.h
> @@ -58,6 +58,7 @@ struct dma_map_ops {
> 				   enum dma_data_direction dir);
> 	int (*mapping_error)(struct device *dev, dma_addr_t dma_addr);
> 	int (*dma_supported)(struct device *dev, u64 mask);
> +	int (*set_dma_mask)(struct device *dev, u64 mask);
> 	int is_phys;
> };
>
> --  
> 1.6.0.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux- 
> kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply

* Re: [PATCH 2/5] powerpc: remove swiotlb_pci_dma_ops
From: Becky Bruce @ 2009-07-27 21:02 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <1248405855-15546-3-git-send-email-fujita.tomonori@lab.ntt.co.jp>


On Jul 23, 2009, at 10:24 PM, FUJITA Tomonori wrote:

> Now swiotlb_pci_dma_ops is identical to swiotlb_dma_ops; we can use
> swiotlb_dma_ops with any devices. This removes swiotlb_pci_dma_ops.
>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>

Acked-by: Becky Bruce <beckyb@kernel.crashing.org>

>
> ---
> arch/powerpc/include/asm/swiotlb.h         |    1 -
> arch/powerpc/kernel/dma-swiotlb.c          |   14 --------------
> arch/powerpc/platforms/85xx/mpc8536_ds.c   |    2 +-
> arch/powerpc/platforms/85xx/mpc85xx_ds.c   |    2 +-
> arch/powerpc/platforms/85xx/mpc85xx_mds.c  |    2 +-
> arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    2 +-
> 6 files changed, 4 insertions(+), 19 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/swiotlb.h b/arch/powerpc/ 
> include/asm/swiotlb.h
> index 31e0e43..21ce0a3 100644
> --- a/arch/powerpc/include/asm/swiotlb.h
> +++ b/arch/powerpc/include/asm/swiotlb.h
> @@ -14,7 +14,6 @@
> #include <linux/swiotlb.h>
>
> extern struct dma_mapping_ops swiotlb_dma_ops;
> -extern struct dma_mapping_ops swiotlb_pci_dma_ops;
>
> static inline void dma_mark_clean(void *addr, size_t size) {}
>
> diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/ 
> dma-swiotlb.c
> index c9f6a30..ca141e1 100644
> --- a/arch/powerpc/kernel/dma-swiotlb.c
> +++ b/arch/powerpc/kernel/dma-swiotlb.c
> @@ -45,20 +45,6 @@ struct dma_mapping_ops swiotlb_dma_ops = {
> 	.sync_sg_for_device = swiotlb_sync_sg_for_device
> };
>
> -struct dma_mapping_ops swiotlb_pci_dma_ops = {
> -	.alloc_coherent = dma_direct_alloc_coherent,
> -	.free_coherent = dma_direct_free_coherent,
> -	.map_sg = swiotlb_map_sg_attrs,
> -	.unmap_sg = swiotlb_unmap_sg_attrs,
> -	.dma_supported = swiotlb_dma_supported,
> -	.map_page = swiotlb_map_page,
> -	.unmap_page = swiotlb_unmap_page,
> -	.sync_single_range_for_cpu = swiotlb_sync_single_range_for_cpu,
> -	.sync_single_range_for_device =  
> swiotlb_sync_single_range_for_device,
> -	.sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
> -	.sync_sg_for_device = swiotlb_sync_sg_for_device
> -};
> -
> void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev)
> {
> 	struct pci_controller *hose;
> diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c b/arch/powerpc/ 
> platforms/85xx/mpc8536_ds.c
> index bf052c0..004b7d3 100644
> --- a/arch/powerpc/platforms/85xx/mpc8536_ds.c
> +++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c
> @@ -96,7 +96,7 @@ static void __init mpc8536_ds_setup_arch(void)
> #ifdef CONFIG_SWIOTLB
> 	if (lmb_end_of_DRAM() > max) {
> 		ppc_swiotlb_enable = 1;
> -		set_pci_dma_ops(&swiotlb_pci_dma_ops);
> +		set_pci_dma_ops(&swiotlb_dma_ops);
> 		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
> 	}
> #endif
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/ 
> platforms/85xx/mpc85xx_ds.c
> index c6f92cc..544011a 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> @@ -192,7 +192,7 @@ static void __init mpc85xx_ds_setup_arch(void)
> #ifdef CONFIG_SWIOTLB
> 	if (lmb_end_of_DRAM() > max) {
> 		ppc_swiotlb_enable = 1;
> -		set_pci_dma_ops(&swiotlb_pci_dma_ops);
> +		set_pci_dma_ops(&swiotlb_dma_ops);
> 		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
> 	}
> #endif
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/ 
> powerpc/platforms/85xx/mpc85xx_mds.c
> index 8b8e5f9..c4961ed 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> @@ -241,7 +241,7 @@ static void __init mpc85xx_mds_setup_arch(void)
> #ifdef CONFIG_SWIOTLB
> 	if (lmb_end_of_DRAM() > max) {
> 		ppc_swiotlb_enable = 1;
> -		set_pci_dma_ops(&swiotlb_pci_dma_ops);
> +		set_pci_dma_ops(&swiotlb_dma_ops);
> 		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
> 	}
> #endif
> diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/ 
> powerpc/platforms/86xx/mpc86xx_hpcn.c
> index 8032301..2aa69a6 100644
> --- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> +++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> @@ -105,7 +105,7 @@ mpc86xx_hpcn_setup_arch(void)
> #ifdef CONFIG_SWIOTLB
> 	if (lmb_end_of_DRAM() > max) {
> 		ppc_swiotlb_enable = 1;
> -		set_pci_dma_ops(&swiotlb_pci_dma_ops);
> +		set_pci_dma_ops(&swiotlb_dma_ops);
> 		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
> 	}
> #endif
> -- 
> 1.6.0.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux- 
> kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply

* Re: [PATCH 1/5] powerpc: remove addr_needs_map in struct dma_mapping_ops
From: Becky Bruce @ 2009-07-27 21:02 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <1248405855-15546-2-git-send-email-fujita.tomonori@lab.ntt.co.jp>


On Jul 23, 2009, at 10:24 PM, FUJITA Tomonori wrote:

> This patch adds max_direct_dma_addr to struct dev_archdata to remove
> addr_needs_map in struct dma_mapping_ops. It also converts
> dma_capable() to use max_direct_dma_addr.
>
> max_direct_dma_addr is initialized in pci_dma_dev_setup_swiotlb(),
> called via ppc_md.pci_dma_dev_setup hook.
>
> For further information:
> http://marc.info/?t=124719060200001&r=1&w=2
>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>

Acked-by: Becky Bruce <beckyb@kernel.crashing.org>

>
> ---
> arch/powerpc/include/asm/device.h          |    3 ++
> arch/powerpc/include/asm/dma-mapping.h     |    8 +++---
> arch/powerpc/include/asm/swiotlb.h         |    5 +--
> arch/powerpc/kernel/dma-swiotlb.c          |   36 ++++++++++ 
> +----------------
> arch/powerpc/platforms/85xx/mpc8536_ds.c   |    1 +
> arch/powerpc/platforms/85xx/mpc85xx_ds.c   |    1 +
> arch/powerpc/platforms/85xx/mpc85xx_mds.c  |    1 +
> arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    1 +
> 8 files changed, 28 insertions(+), 28 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/ 
> include/asm/device.h
> index 7d2277c..0086f8d 100644
> --- a/arch/powerpc/include/asm/device.h
> +++ b/arch/powerpc/include/asm/device.h
> @@ -16,6 +16,9 @@ struct dev_archdata {
> 	/* DMA operations on that device */
> 	struct dma_mapping_ops	*dma_ops;
> 	void			*dma_data;
> +#ifdef CONFIG_SWIOTLB
> +	dma_addr_t		max_direct_dma_addr;
> +#endif
> };
>
> static inline void dev_archdata_set_node(struct dev_archdata *ad,
> diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/ 
> include/asm/dma-mapping.h
> index 0c34371..1765c37 100644
> --- a/arch/powerpc/include/asm/dma-mapping.h
> +++ b/arch/powerpc/include/asm/dma-mapping.h
> @@ -87,8 +87,6 @@ struct dma_mapping_ops {
> 				dma_addr_t dma_address, size_t size,
> 				enum dma_data_direction direction,
> 				struct dma_attrs *attrs);
> -	int		(*addr_needs_map)(struct device *dev, dma_addr_t addr,
> -				size_t size);
> #ifdef CONFIG_PPC_NEED_DMA_SYNC_OPS
> 	void            (*sync_single_range_for_cpu)(struct device *hwdev,
> 				dma_addr_t dma_handle, unsigned long offset,
> @@ -426,10 +424,12 @@ static inline int dma_mapping_error(struct  
> device *dev, dma_addr_t dma_addr)
>
> static inline bool dma_capable(struct device *dev, dma_addr_t addr,  
> size_t size)
> {
> -	struct dma_mapping_ops *ops = get_dma_ops(dev);
> +#ifdef CONFIG_SWIOTLB
> +	struct dev_archdata *sd = &dev->archdata;
>
> -	if (ops->addr_needs_map && ops->addr_needs_map(dev, addr, size))
> +	if (sd->max_direct_dma_addr && addr + size > sd- 
> >max_direct_dma_addr)
> 		return 0;
> +#endif
>
> 	if (!dev->dma_mask)
> 		return 0;
> diff --git a/arch/powerpc/include/asm/swiotlb.h b/arch/powerpc/ 
> include/asm/swiotlb.h
> index 30891d6..31e0e43 100644
> --- a/arch/powerpc/include/asm/swiotlb.h
> +++ b/arch/powerpc/include/asm/swiotlb.h
> @@ -16,12 +16,11 @@
> extern struct dma_mapping_ops swiotlb_dma_ops;
> extern struct dma_mapping_ops swiotlb_pci_dma_ops;
>
> -int swiotlb_arch_address_needs_mapping(struct device *, dma_addr_t,
> -				       size_t size);
> -
> static inline void dma_mark_clean(void *addr, size_t size) {}
>
> extern unsigned int ppc_swiotlb_enable;
> int __init swiotlb_setup_bus_notifier(void);
>
> +extern void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev);
> +
> #endif /* __ASM_SWIOTLB_H */
> diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/ 
> dma-swiotlb.c
> index e8a57de..c9f6a30 100644
> --- a/arch/powerpc/kernel/dma-swiotlb.c
> +++ b/arch/powerpc/kernel/dma-swiotlb.c
> @@ -25,26 +25,6 @@ int swiotlb __read_mostly;
> unsigned int ppc_swiotlb_enable;
>
> /*
> - * Determine if an address is reachable by a pci device, or if we  
> must bounce.
> - */
> -static int
> -swiotlb_pci_addr_needs_map(struct device *hwdev, dma_addr_t addr,  
> size_t size)
> -{
> -	dma_addr_t max;
> -	struct pci_controller *hose;
> -	struct pci_dev *pdev = to_pci_dev(hwdev);
> -
> -	hose = pci_bus_to_host(pdev->bus);
> -	max = hose->dma_window_base_cur + hose->dma_window_size;
> -
> -	/* check that we're within mapped pci window space */
> -	if ((addr + size > max) | (addr < hose->dma_window_base_cur))
> -		return 1;
> -
> -	return 0;
> -}
> -
> -/*
>  * At the moment, all platforms that use this code only require
>  * swiotlb to be used if we're operating on HIGHMEM.  Since
>  * we don't ever call anything other than map_sg, unmap_sg,
> @@ -73,22 +53,36 @@ struct dma_mapping_ops swiotlb_pci_dma_ops = {
> 	.dma_supported = swiotlb_dma_supported,
> 	.map_page = swiotlb_map_page,
> 	.unmap_page = swiotlb_unmap_page,
> -	.addr_needs_map = swiotlb_pci_addr_needs_map,
> 	.sync_single_range_for_cpu = swiotlb_sync_single_range_for_cpu,
> 	.sync_single_range_for_device = swiotlb_sync_single_range_for_device,
> 	.sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
> 	.sync_sg_for_device = swiotlb_sync_sg_for_device
> };
>
> +void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev)
> +{
> +	struct pci_controller *hose;
> +	struct dev_archdata *sd;
> +
> +	hose = pci_bus_to_host(pdev->bus);
> +	sd = &pdev->dev.archdata;
> +	sd->max_direct_dma_addr =
> +		hose->dma_window_base_cur + hose->dma_window_size;
> +}
> +
> static int ppc_swiotlb_bus_notify(struct notifier_block *nb,
> 				  unsigned long action, void *data)
> {
> 	struct device *dev = data;
> +	struct dev_archdata *sd;
>
> 	/* We are only intereted in device addition */
> 	if (action != BUS_NOTIFY_ADD_DEVICE)
> 		return 0;
>
> +	sd = &dev->archdata;
> +	sd->max_direct_dma_addr = 0;
> +
> 	/* May need to bounce if the device can't address all of DRAM */
> 	if (dma_get_mask(dev) < lmb_end_of_DRAM())
> 		set_dma_ops(dev, &swiotlb_dma_ops);
> diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c b/arch/powerpc/ 
> platforms/85xx/mpc8536_ds.c
> index 055ff41..bf052c0 100644
> --- a/arch/powerpc/platforms/85xx/mpc8536_ds.c
> +++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c
> @@ -97,6 +97,7 @@ static void __init mpc8536_ds_setup_arch(void)
> 	if (lmb_end_of_DRAM() > max) {
> 		ppc_swiotlb_enable = 1;
> 		set_pci_dma_ops(&swiotlb_pci_dma_ops);
> +		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
> 	}
> #endif
>
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/ 
> platforms/85xx/mpc85xx_ds.c
> index 849c0ac..c6f92cc 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> @@ -193,6 +193,7 @@ static void __init mpc85xx_ds_setup_arch(void)
> 	if (lmb_end_of_DRAM() > max) {
> 		ppc_swiotlb_enable = 1;
> 		set_pci_dma_ops(&swiotlb_pci_dma_ops);
> +		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
> 	}
> #endif
>
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/ 
> powerpc/platforms/85xx/mpc85xx_mds.c
> index 60ed9c0..8b8e5f9 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> @@ -242,6 +242,7 @@ static void __init mpc85xx_mds_setup_arch(void)
> 	if (lmb_end_of_DRAM() > max) {
> 		ppc_swiotlb_enable = 1;
> 		set_pci_dma_ops(&swiotlb_pci_dma_ops);
> +		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
> 	}
> #endif
> }
> diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/ 
> powerpc/platforms/86xx/mpc86xx_hpcn.c
> index 6632702..8032301 100644
> --- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> +++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> @@ -106,6 +106,7 @@ mpc86xx_hpcn_setup_arch(void)
> 	if (lmb_end_of_DRAM() > max) {
> 		ppc_swiotlb_enable = 1;
> 		set_pci_dma_ops(&swiotlb_pci_dma_ops);
> +		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
> 	}
> #endif
> }
> -- 
> 1.6.0.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux- 
> kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply

* Re: image/wrapper script questions
From: Eddie Dawydiuk @ 2009-07-27 20:15 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: linuxppc-dev
In-Reply-To: <20090727183155.7FA16832E416@gemini.denx.de>

Wolfgang,

> In message <4A6DDF80.209@embeddedarm.com> you wrote:
>> I'm working on a custom board using an AMCC 440EP that is using a proprietary 
>> bootloader(optimized for fast boot time). Currently our bootloader loads a 
>> simpleImage.initrd into RAM and jumps into it. I originally chose to use a 
>> simpleImage with an initial ramdisk embedded because it was the simplest 
>> solution to debug the hardware and get a kernel and initial ramdisk running for 
>> development. For production I would prefer to put the initial ramdisk on it's 
> 
> Hm... isn't that an oxymoron? Trying to optimize  for  speed  on  one
> hand, and using an initrd which is one of the slowest ways to boot on
> the other hand?

We advertise the amount of time from a cold boot until one is sitting at a 
command prompt(< 2 s). A Debian filesystem(from Nand or SD card) is then mounted 
in the background. This gives one the power of Debian in a very short amount of 
time. From a technical stand point we have to use an initial ramdisk as we are a 
member of the SD association so we signed an NDA agreeing not to release any 
details of the SD spec. As a result we have code we can't release under the GPL 
so we have to load a proprietary SD card driver as a module.

I guess it depends upon how you define boot, that is we define it as how long it 
takes to get to a Linux shell prompt :) Even without the licensing issue I'm not 
sure we could boot faster(by the definition above) via some other method. All of 
the products I've seen that advertise a fast Linux boot time, boot to an initial 
ramdisk.

http://www.mvista.com/press_release_detail.php?fid=news/2009/Ultra-fast-boot.html

>> Thanks for any suggestions :)
> 
> Use another file system (and another fstype) and separate it from the
> kernel image.
> 
> See also http://www.denx.de/wiki/view/DULG/RootFileSystemSelection

Thanks for the link. Although, I'm not looking for info on optimizing boot time. 
Rather I'm looking for information on what the path of least resistance is to 
boot a kernel with an initrd being loaded from it's own partition. To clarify 
currently I am using a simpleImage.initrd which is a single image with the 
flattened device tree, kernel, and initial ramdisk in a single file. One can 
simply load this image in RAM(assuming 1 to 1 MMU mapping) and jump into it. Now 
what I would like to do is to load a kernel, device tree, and initial ramdisk 
into RAM at different locations.

I'm in the process of coming back up to speed on the low-level boot details of 
the powerpc kernel/architecture. It looks like one can accomplish this by 
loading R3 with the phys address of the device tree block, R4 with the phys 
address of the kernel, and R5 with Null. It also looks like the kernel, already 
has several routines which know about these details(prom_init() and __start()) 
and I was hoping I could reuse this code to accomplish this rather than 
rewriting the bootrom to handle this. That is I was hoping there is a boot 
wrapper image that would allow me to accomplish my goal of creating a single 
image containing a kernel and device tree block, and an interface to specify 
where the bootrom loads the initial ramdisk in RAM. I'll continue reading 
through the docs and code, but if anyone could provide any pointers on how to do 
this I would really appreciate it.

-- 
Best Regards,
________________________________________________________________
  Eddie Dawydiuk, Technologic Systems | voice:  (480) 837-5200
  16525 East Laser Drive              | fax:    (480) 837-5300
  Fountain Hills, AZ 85268            | web: www.embeddedARM.com

^ permalink raw reply

* Re: [RFC/PATCH] mm: Pass virtual address to [__]p{te,ud,md}_free_tlb()
From: Linus Torvalds @ 2009-07-27 19:11 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Nick Piggin, Linux-Arch, linuxppc-dev, Hugh Dickins, linux-kernel,
	Linux Memory Management
In-Reply-To: <1248310415.3367.22.camel@pasglop>



On Thu, 23 Jul 2009, Benjamin Herrenschmidt wrote:
> 
> Hrm... my powerpc-next branch will contain stuff that depend on it, so
> I'll probably have to pull it in though, unless I tell all my
> sub-maintainers to also pull from that other branch first :-)

Ok, I'll just apply the patch. It does look obvious enough.

			Linus

^ permalink raw reply

* anyone know of a patch to support mcpn905/cpci6115 on recent-ish kernels?
From: Chris Friesen @ 2009-07-27 18:43 UTC (permalink / raw)
  To: linuxppc-dev


We've got some people that are currently running an older linux kernel
(from before the ppc/ppc64 merge and the conversion to device tree) on
an Emerson/Motorola cpci6115 (also known as mcpn905) compactPCI board.
They're wondering if it's possible to upgrade to a more recent kernel.

I don't see support for these boards in mainline, but is anyone aware of
patches adding support for more recent kernels?

Barring that, are there any tutorials out there on how to build a dts
file from scratch?  I think we've got the hardware specs, and we've got
a running earlier kernel.

Thanks,

Chris

^ permalink raw reply

* Re: image/wrapper script questions
From: Wolfgang Denk @ 2009-07-27 18:31 UTC (permalink / raw)
  To: Eddie Dawydiuk; +Cc: linuxppc-dev
In-Reply-To: <4A6DDF80.209@embeddedarm.com>

Dear Eddie Dawydiuk,

In message <4A6DDF80.209@embeddedarm.com> you wrote:
> 
> I'm working on a custom board using an AMCC 440EP that is using a proprietary 
> bootloader(optimized for fast boot time). Currently our bootloader loads a 
> simpleImage.initrd into RAM and jumps into it. I originally chose to use a 
> simpleImage with an initial ramdisk embedded because it was the simplest 
> solution to debug the hardware and get a kernel and initial ramdisk running for 
> development. For production I would prefer to put the initial ramdisk on it's 

Hm... isn't that an oxymoron? Trying to optimize  for  speed  on  one
hand, and using an initrd which is one of the slowest ways to boot on
the other hand?

> Thanks for any suggestions :)

Use another file system (and another fstype) and separate it from the
kernel image.

See also http://www.denx.de/wiki/view/DULG/RootFileSystemSelection

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Computers are not intelligent.  They only think they are.

^ permalink raw reply

* image/wrapper script questions
From: Eddie Dawydiuk @ 2009-07-27 17:10 UTC (permalink / raw)
  To: Grant Likely, linuxppc-dev

Hello,

I'm working on a custom board using an AMCC 440EP that is using a proprietary 
bootloader(optimized for fast boot time). Currently our bootloader loads a 
simpleImage.initrd into RAM and jumps into it. I originally chose to use a 
simpleImage with an initial ramdisk embedded because it was the simplest 
solution to debug the hardware and get a kernel and initial ramdisk running for 
development. For production I would prefer to put the initial ramdisk on it's 
own partition to allow customers to easily modify the initrd without having to 
concern themselves with the details of how to recompile a kernel. Would you 
recommend using one of the existing images(e.g. boot wrapper) or modify the 
bootrom to load the PPC registers with the details of where to find the dts, 
kernel, and initrd?

Thanks for any suggestions :)

-- 
Best Regards,
________________________________________________________________
  Eddie Dawydiuk, Technologic Systems | voice:  (480) 837-5200
  16525 East Laser Drive              | fax:    (480) 837-5300
  Fountain Hills, AZ 85268            | web: www.embeddedARM.com

^ permalink raw reply

* Is it a BUG of kexec in E500?
From: wilbur.chan @ 2009-07-27 16:39 UTC (permalink / raw)
  To: Linuxppc-dev

I found a patch for kexec on Booke  in the archives:

http://lists.ozlabs.org/pipermail/linuxppc-dev/2008-November/064798.html

In this pacth , we use an entry to  setup a 1:1 mapping , whose size
is 1GB. However, in e500, the max mapping size for

a single entry is 256M. So I have to setup 4 entries to map 1G kernel
space in my mpc8541.

Is  it a bug here ?  I'm not quite sure.




regards,

^ permalink raw reply

* Re: [PATCH] Support for PCI Express reset type in EEH
From: Richard Lary @ 2009-07-27 14:29 UTC (permalink / raw)
  To: linasvepstas; +Cc: linuxppc-dev, mmlnx, Paul Mackerras, linux-pci
In-Reply-To: <3ae3aa420907241730i74541747l2ca288e0c138001e@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2720 bytes --]




Linas Vepstas <linasvepstas@gmail.com> wrote on 07/24/2009 05:30:09 PM:

> 2009/7/24 Richard Lary <rlary@us.ibm.com>:
> > Linas Vepstas <linasvepstas@gmail.com> wrote on 07/23/2009 07:44:33 AM:
> >
> >> 2009/7/15 Mike Mason <mmlnx@us.ibm.com>:
> >> > By default, EEH does what's known as a "hot reset" during error
recovery
> >> > of
> >> > a PCI Express device.  We've found a case where the device needs a
> >> > "fundamental reset" to recover properly.  The current PCI error
recovery
> >> > and
> >> > EEH frameworks do not support this distinction.
> >> >
> >> > The attached patch (courtesy of Richard Lary) adds a bit field to
> >> > pci_dev
> >> > that indicates whether the device requires a fundamental reset
during
> >> > error
> >> > recovery.  This bit can be checked by EEH to determine which reset
type
> >> > is
> >> > required.
> >> >
> >> > This patch supersedes the previously submitted patch that
implemented a
> >> > reset type callback.
> >> >
> >> > Please review and let me know of any concerns.
> >>
> >> I like this patch a *lot* better .. it is vastly simpler, more direct.
> >>
> >>
> >> > diff -uNrp a/include/linux/pci.h b/include/linux/pci.h
> >> > --- a/include/linux/pci.h       2009-07-13 14:25:37.000000000 -0700
> >> > +++ b/include/linux/pci.h       2009-07-15 10:25:37.000000000 -0700
> >> > @@ -273,6 +273,7 @@ struct pci_dev {
> >> >        unsigned int    ari_enabled:1;  /* ARI forwarding */
> >> >        unsigned int    is_managed:1;
> >> >        unsigned int    is_pcie:1;
> >> > +       unsigned int    fndmntl_rst_rqd:1; /* Dev requires
fundamental
> >> > reset
> >> > */
> >> >        unsigned int    state_saved:1;
> >> >        unsigned int    is_physfn:1;
> >> >        unsigned int    is_virtfn:1;
> >>
> >> As Ben points out, the name is awkward.  How about needs_freset ?
> >
> > I am OK with name change.
> >
> >
> >> Since this affects the entire pci subsystem, it should be documented
> >> properly.  The "pci error recovery" subsystem was designed to be
> >> usable in other architectures, and so the error recovery docs should
> >> take at least a paragraph to describe what this flag means, and when
> >> its supposed to be used.
> >
> > I will update the documentation, are you referring to
> > Documentation/powerpc/eeh-pci-error-recovery.txt
> > or some other documentation?
>
> No, I'm thinking
> Documentation/PCI/pci-error-recovery.txt
>
> because the flag is not powerpc-specific.

Got it, glad I asked...

-rich

> >
> >> Providing the docs patch together with the pci.h patch *only* would
> >> probably simplify acceptance by the PCI community.
> >>
> >> --linas
> >

[-- Attachment #2: Type: text/html, Size: 3743 bytes --]

^ permalink raw reply

* Re: Question about head_fsl_booke.S
From: Kumar Gala @ 2009-07-27 14:26 UTC (permalink / raw)
  To: wilbur.chan; +Cc: linuxppc-dev
In-Reply-To: <e997b7420907260834v5923326ele5af13713622c366@mail.gmail.com>


On Jul 26, 2009, at 10:34 AM, wilbur.chan wrote:

> e500  , in  head_fsl_booke.S
>
> We know,the first two steps are:
>
> 1) invalidate all entries except  the entry we are in
>
> 2) setup a temp mapping and jump to it  respectively:
>
>
>
>         tlbwe
>
>         bl  1f
>     1:  mflr r9
>         rlwimi  r7,r9,0,20,31
>         addi r7, r7,24
>         mtspr   SPRN_SRR0,r7
>         mtspr   SPRN_SRR1,r6
>         rfi
>        /*  jump to 0-4k .
>         question1:   Why not this 'rfi' did not caused jumping  into
> 4k-8k , or 10k-14k ,    etc ?     */

I'm not sure what version of this code you are referencing but it sets  
up a mapping in the alternate address space and jumps to the same EPN.

>
>
>         li r6,0
>
>
>
> question2:  We know that, it is not allowed  the two entrys having the
> same EPN value,so, when setting up a temp entry which ranged from
> 0-4k, is it possible that , this
> range(0-4k)  may conflit with the entry we are executed in now?

Its not allowed for two entries to have the same VA (or conflicting  
VAs) its perfectly find to have the same EPN.  We use the address  
space bit of the VA to ensure we don't conflict.

- k

^ permalink raw reply

* Re: "test" branch update
From: Michael Ellerman @ 2009-07-27  8:45 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list
In-Reply-To: <1248668057.5706.2.camel@pasglop>

[-- Attachment #1: Type: text/plain, Size: 2679 bytes --]

On Mon, 2009-07-27 at 14:14 +1000, Benjamin Herrenschmidt wrote:
> Hi !
> 
> I've started collecting things for my -next branch. For now I put
> everything in -test, I'll move it over to -next in the upcoming couple
> of days if there's no major issue found.

I'm seeing this on Power 6 (Didgo3), haven't had a chance to look any
closer, 100% reproducible, using SLUB.

HugeTLB registered 16 MB page size, pre-allocated 0 pages
HugeTLB registered 16 GB page size, pre-allocated 0 pages
HugeTLB registered 64 KB page size, pre-allocated 0 pages
Unable to handle kernel paging request for data at address 0x00000000
Faulting instruction address: 0xc00000000003ea98
cpu 0x0: Vector: 300 (Data Access) at [c0000000fe6e3840]
    pc: c00000000003ea98: .strcmp+0x10/0x24
    lr: c0000000001c8e60: .sysfs_find_dirent+0x3c/0x78
    sp: c0000000fe6e3ac0
   msr: 8000000000009032
   dar: 0
 dsisr: 40000000
  current = 0xc0000000fe6d8000
  paca    = 0xc000000000ab3200
    pid   = 1, comm = swapper
enter ? for help
[link register   ] c0000000001c8e60 .sysfs_find_dirent+0x3c/0x78
[c0000000fe6e3ac0] c0000000001c939c .sysfs_addrm_start+0x70/0xec
(unreliable)
[c0000000fe6e3b50] c0000000001c6f50 .sysfs_hash_and_remove+0x58/0xb0
[c0000000fe6e3c10] c0000000001ca8a4 .sysfs_remove_link+0x4c/0x6c
[c0000000fe6e3cb0] c00000000014612c .sysfs_slab_alias+0x64/0x154
[c0000000fe6e3d60] c00000000090e22c .slab_sysfs_init+0xd4/0x130
[c0000000fe6e3e00] c000000000009848 .do_one_initcall+0x90/0x1b8
[c0000000fe6e3ef0] c0000000008ef4c0 .kernel_init+0x1f8/0x278
[c0000000fe6e3f90] c00000000002f570 .kernel_thread+0x54/0x70
0:mon> r
R00 = c0000000001c6f50   R16 = 0000000000000000
R01 = c0000000fe6e3ac0   R17 = 0000000004d2dbb8
R02 = c000000000a72248   R18 = c00000000092da50
R03 = 0000000000000073   R19 = 0000000000000000
R04 = ffffffffffffffff   R20 = 0000000002f1fed0
R05 = c0000000feb70460   R21 = 0000000004d2da78
R06 = c0000000fec19640   R22 = 0000000004400000
R07 = 0000000000000001   R23 = c00000000092da48
R08 = ffffffffffffffff   R24 = c00000000092da58
R09 = c000000000bd6080   R25 = 00000000010ad378
R10 = 0000000000000816   R26 = c000000000aa7ac0
R11 = 0000000000000012   R27 = 0000000000000000
R12 = 0000000024000084   R28 = 0000000000000000
R13 = c000000000ab3200   R29 = c0000000fec19690
R14 = 0000000000000000   R30 = c0000000009ddd98
R15 = 0000000000000000   R31 = c0000000fe6e3ac0
pc  = c00000000003ea98 .strcmp+0x10/0x24
lr  = c0000000001c8e60 .sysfs_find_dirent+0x3c/0x78
msr = 8000000000009032   cr  = 24000048
ctr = 0000000000000000   xer = 000000002000000b   trap =  300
dar = 0000000000000000   dsisr = 40000000
0:mon>


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* Re: [PATCH] powerpc/perf_counter: Add alignment-faults and emulation-faults sw events
From: Peter Zijlstra @ 2009-07-27  6:27 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, mingo, paulus, Anton Blanchard, linux-kernel
In-Reply-To: <1248675962.6987.1423.camel@twins>

On Mon, 2009-07-27 at 08:26 +0200, Peter Zijlstra wrote:
> On Mon, 2009-07-27 at 11:47 +1000, Benjamin Herrenschmidt wrote:
> 
> > Sounds good.
> > 
> > BTW. The patch relies on some perctr changes I don't have in my tree
> > (PERF_COUNT_SW_ALIGNMENT_FAULTS isn't defined for me)
> > 
> > Ingo, how do you want to handle that ? Should I wait til round 2 of the
> > merge window before putting Anton's patch in or can I merge some of your
> > stuff in powerpc-next as pre-reqs ? Or you can just take Anton's patch
> > with my:
> > 
> > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > 
> > And stick it in your own queue (though pls, give me a pointer to the git
> > tree in question so I can verify that I don't get new stuff that
> > conflicts before we get to the merge window).
> 
> Please send all missing bits to me and I'll stuff it into:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/peterz/linux-2.6-perf.git perf-master

Or if they're all PPC specific I have no objections of them going
through the PPC git tree.

^ permalink raw reply

* Re: [PATCH] powerpc/perf_counter: Add alignment-faults and emulation-faults sw events
From: Peter Zijlstra @ 2009-07-27  6:26 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, mingo, paulus, Anton Blanchard, linux-kernel
In-Reply-To: <1248659272.28464.29.camel@pasglop>

On Mon, 2009-07-27 at 11:47 +1000, Benjamin Herrenschmidt wrote:

> Sounds good.
> 
> BTW. The patch relies on some perctr changes I don't have in my tree
> (PERF_COUNT_SW_ALIGNMENT_FAULTS isn't defined for me)
> 
> Ingo, how do you want to handle that ? Should I wait til round 2 of the
> merge window before putting Anton's patch in or can I merge some of your
> stuff in powerpc-next as pre-reqs ? Or you can just take Anton's patch
> with my:
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> And stick it in your own queue (though pls, give me a pointer to the git
> tree in question so I can verify that I don't get new stuff that
> conflicts before we get to the merge window).

Please send all missing bits to me and I'll stuff it into:

  git://git.kernel.org/pub/scm/linux/kernel/git/peterz/linux-2.6-perf.git perf-master

^ permalink raw reply

* Re: [PATCH] powerpc/perf_counter: Add alignment-faults and emulation-faults sw events
From: Benjamin Herrenschmidt @ 2009-07-27  4:57 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: linuxppc-dev, mingo, paulus, a.p.zijlstra, linux-kernel
In-Reply-To: <20090727015134.GA18301@kryten>

On Mon, 2009-07-27 at 11:51 +1000, Anton Blanchard wrote:
> Hi Ben,
> 
> > BTW. The patch relies on some perctr changes I don't have in my tree
> > (PERF_COUNT_SW_ALIGNMENT_FAULTS isn't defined for me)
> > 
> > Ingo, how do you want to handle that ? Should I wait til round 2 of the
> > merge window before putting Anton's patch in or can I merge some of your
> > stuff in powerpc-next as pre-reqs ? Or you can just take Anton's patch
> > with my:
> > 
> > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > 
> > And stick it in your own queue (though pls, give me a pointer to the git
> > tree in question so I can verify that I don't get new stuff that
> > conflicts before we get to the merge window).
> 
> I've got another round of this series that I'll send out today.

Ok. I've pushed some to my -test branch, please let me know ASAP if I
have to withdraw some before I move them into -next

Cheers,
Ben.

^ permalink raw reply

* Re: [PATCH] powerpc: Add compat_sys_truncate
From: Benjamin Herrenschmidt @ 2009-07-27  4:34 UTC (permalink / raw)
  To: Chase Douglas; +Cc: linuxppc-dev
In-Reply-To: <87B65A66-572B-442E-88C6-872F23DF39D4@linux.vnet.ibm.com>

On Sun, 2009-07-26 at 22:23 -0400, Chase Douglas wrote:
> On Jul 26, 2009, at 8:37 PM, Benjamin Herrenschmidt wrote:
> > Unfortunately, your patch have been mangled by your mailer
> > our your mail gateway in about every possible way (word
> > wrapped, tabs and whitespace damaged etc...)
> 
> Sorry about that! I made sure my mailer (OS X's Mail) sent it as plain  
> text, but I don't know of any settings for specifying line width or  
> white space handling. I'll have to do some more digging or use a  
> different mailer for patches.

I'm sure you can find somebody else using OS X who can help :-)

I've also heard there may be a problem with our vnet servers but
I don't know for sure.

Cheers,
Ben.

^ permalink raw reply

* "test" branch update
From: Benjamin Herrenschmidt @ 2009-07-27  4:14 UTC (permalink / raw)
  To: linuxppc-dev list

Hi !

I've started collecting things for my -next branch. For now I put
everything in -test, I'll move it over to -next in the upcoming couple
of days if there's no major issue found.

The current log if what I put in is:

Anton Blanchard (3):
      powerpc: Move 64bit VDSO to improve context switch performance
      powerpc: Rearrange SLB preload code
      powerpc: Preload application text segment instead of TASK_UNMAPPED_BASE

Benjamin Herrenschmidt (27):
      mm: Pass virtual address to [__]p{te,ud,md}_free_tlb()
      powerpc: Rename exception.h to exception-64s.h
      powerpc: Use names rather than numbers for SPRGs (v2)
      powerpc: Remove use of a second scratch SPRG in STAB code
      powerpc/mm: Fix definitions of FORCE_MAX_ZONEORDER in Kconfig
      powerpc/pmac: Fix PowerSurge SMP IPI allocation
      powerpc: Change PACA from SPRG3 to SPRG1
      powerpc/mm: Fix misplaced #endif in pgtable-ppc64-64k.h
      powerpc/of: Remove useless register save/restore when calling OF back
      powerpc/mm: Add HW threads support to no_hash TLB management
      powerpc/mm: Add opcode definitions for tlbivax and tlbsrx.
      powerpc/mm: Add more bit definitions for Book3E MMU registers
      powerpc/mm: Add support for early ioremap on non-hash 64-bit processors
      powerpc: Modify some ppc_asm.h macros to accomodate 64-bits Book3E
      powerpc/mm: Make low level TLB flush ops on BookE take additional args
      powerpc/mm: Call mmu_context_init() from ppc64
      powerpc: Clean ifdef usage in copy_thread()
      powerpc: Move definitions of secondary CPU spinloop to header file
      powerpc/mm: Rework & cleanup page table freeing code path
      powerpc: Add SPR definitions for new 64-bit BookE
      powerpc: Add memory management headers for new 64-bit BookE
      powerpc: Add definitions used by exception handling on 64-bit Book3E
      powerpc: Add PACA fields specific to 64-bit Book3E processors
      powerpc/mm: Move around mmu_gathers definition on 64-bit
      powerpc: Add TLB management code for 64-bit Book3E
      powerpc/mm: Add support for SPARSEMEM_VMEMMAP on 64-bit Book3E
      powerpc: Remaining 64-bit Book3E support

Chase Douglas (1):
      powerpc: Add compat_sys_truncate

Frans Pop (1):
      powerpc: Makefile simplification through use of cc-ifversion

Geoff Thorpe (1):
      powerpc: expose the multi-bit ops that underlie single-bit ops.

Gerhard Pircher (1):
      powerpc/amigaone: Convert amigaone_init() to a machine_device_initcall()

Lucian Adrian Grijincu (1):
      powerpc: Update boot wrapper script with the new location of dtc

Michael Ellerman (1):
      powerpc/mpic: Fix MPIC_BROKEN_REGREAD on non broken MPICs

roel kluin (1):
      powerpc/cell: Replace strncpy by strlcpy

^ permalink raw reply

* Re: [PATCH] prom_init: evaluate mem kernel parameter for early allocation
From: Benjamin Herrenschmidt @ 2009-07-27  4:09 UTC (permalink / raw)
  To: Benjamin Krill; +Cc: linuxppc-dev
In-Reply-To: <20090717202922.GA20168@codiert.org>

On Fri, 2009-07-17 at 22:29 +0200, Benjamin Krill wrote:
> Evaluate mem kernel parameter for early memory allocations. If mem is set
> no allocation in the region above the given boundary is allowed. The current
> code doesn't take care about this and allocate memory above the given mem
> boundary.

Breaks build on ppc32 due to ...

> +	opt = strstr(RELOC(prom_cmd_line), RELOC("mem="));

"opt" isn't defined (it's defined inside CONFIG_PPC64). Please respin
a patch that also removes that bit so that "opt" is always defined.

Cheers,
Ben.

^ permalink raw reply

* Re: [PATCH] powerpc: Add compat_sys_truncate
From: Chase Douglas @ 2009-07-27  2:23 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <1248655033.28464.26.camel@pasglop>

On Jul 26, 2009, at 8:37 PM, Benjamin Herrenschmidt wrote:
> Unfortunately, your patch have been mangled by your mailer
> our your mail gateway in about every possible way (word
> wrapped, tabs and whitespace damaged etc...)

Sorry about that! I made sure my mailer (OS X's Mail) sent it as plain  
text, but I don't know of any settings for specifying line width or  
white space handling. I'll have to do some more digging or use a  
different mailer for patches.

Thanks,
Chase

^ permalink raw reply

* Re: [PATCH] powerpc/perf_counter: Add alignment-faults and emulation-faults sw events
From: Anton Blanchard @ 2009-07-27  1:51 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, mingo, paulus, a.p.zijlstra, linux-kernel
In-Reply-To: <1248659272.28464.29.camel@pasglop>


Hi Ben,

> BTW. The patch relies on some perctr changes I don't have in my tree
> (PERF_COUNT_SW_ALIGNMENT_FAULTS isn't defined for me)
> 
> Ingo, how do you want to handle that ? Should I wait til round 2 of the
> merge window before putting Anton's patch in or can I merge some of your
> stuff in powerpc-next as pre-reqs ? Or you can just take Anton's patch
> with my:
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> And stick it in your own queue (though pls, give me a pointer to the git
> tree in question so I can verify that I don't get new stuff that
> conflicts before we get to the merge window).

I've got another round of this series that I'll send out today.

Anton

^ permalink raw reply

* Re: [PATCH] powerpc/perf_counter: Add alignment-faults and emulation-faults sw events
From: Benjamin Herrenschmidt @ 2009-07-27  1:47 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: linuxppc-dev, mingo, paulus, a.p.zijlstra, linux-kernel
In-Reply-To: <20090706121845.GD4391@kryten>

On Mon, 2009-07-06 at 22:18 +1000, Anton Blanchard wrote:
> Hook up the alignment-faults and emulation-faults events for powerpc.
> 
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
> 
> Lots of duplication between PPC_WARN_EMULATED() and perf_swcounter_event()
> here. Maybe we need to create PPC_WARN_ALIGNMENT(), use it and hide all
> calls to perf_swcounter_event in the macros.

Sounds good.

BTW. The patch relies on some perctr changes I don't have in my tree
(PERF_COUNT_SW_ALIGNMENT_FAULTS isn't defined for me)

Ingo, how do you want to handle that ? Should I wait til round 2 of the
merge window before putting Anton's patch in or can I merge some of your
stuff in powerpc-next as pre-reqs ? Or you can just take Anton's patch
with my:

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

And stick it in your own queue (though pls, give me a pointer to the git
tree in question so I can verify that I don't get new stuff that
conflicts before we get to the merge window).

Cheers,
Ben.

> Index: linux.trees.git/arch/powerpc/kernel/align.c
> ===================================================================
> --- linux.trees.git.orig/arch/powerpc/kernel/align.c	2009-07-06 21:50:53.000000000 +1000
> +++ linux.trees.git/arch/powerpc/kernel/align.c	2009-07-06 22:10:41.000000000 +1000
> @@ -25,6 +25,7 @@
>  #include <asm/cache.h>
>  #include <asm/cputable.h>
>  #include <asm/emulated_ops.h>
> +#include <linux/perf_counter.h>
>  
>  struct aligninfo {
>  	unsigned char len;
> @@ -707,6 +708,9 @@
>  	 */
>  	CHECK_FULL_REGS(regs);
>  
> +	perf_swcounter_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs,
> +			     regs->nip);
> +
>  	dsisr = regs->dsisr;
>  
>  	/* Some processors don't provide us with a DSISR we can use here,
> Index: linux.trees.git/arch/powerpc/kernel/traps.c
> ===================================================================
> --- linux.trees.git.orig/arch/powerpc/kernel/traps.c	2009-07-06 21:50:53.000000000 +1000
> +++ linux.trees.git/arch/powerpc/kernel/traps.c	2009-07-06 22:11:52.000000000 +1000
> @@ -34,6 +34,7 @@
>  #include <linux/bug.h>
>  #include <linux/kdebug.h>
>  #include <linux/debugfs.h>
> +#include <linux/perf_counter.h>
>  
>  #include <asm/emulated_ops.h>
>  #include <asm/pgtable.h>
> @@ -759,6 +760,8 @@
>  
>  	/* Emulate the mfspr rD, PVR. */
>  	if ((instword & PPC_INST_MFSPR_PVR_MASK) == PPC_INST_MFSPR_PVR) {
> +		perf_swcounter_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0,
> +				     regs, regs->nip);
>  		PPC_WARN_EMULATED(mfpvr);
>  		rd = (instword >> 21) & 0x1f;
>  		regs->gpr[rd] = mfspr(SPRN_PVR);
> @@ -767,6 +770,8 @@
>  
>  	/* Emulating the dcba insn is just a no-op.  */
>  	if ((instword & PPC_INST_DCBA_MASK) == PPC_INST_DCBA) {
> +		perf_swcounter_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0,
> +				     regs, regs->nip);
>  		PPC_WARN_EMULATED(dcba);
>  		return 0;
>  	}
> @@ -776,6 +781,8 @@
>  		int shift = (instword >> 21) & 0x1c;
>  		unsigned long msk = 0xf0000000UL >> shift;
>  
> +		perf_swcounter_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0,
> +				     regs, regs->nip);
>  		PPC_WARN_EMULATED(mcrxr);
>  		regs->ccr = (regs->ccr & ~msk) | ((regs->xer >> shift) & msk);
>  		regs->xer &= ~0xf0000000UL;
> @@ -784,18 +791,24 @@
>  
>  	/* Emulate load/store string insn. */
>  	if ((instword & PPC_INST_STRING_GEN_MASK) == PPC_INST_STRING) {
> +		perf_swcounter_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0,
> +				     regs, regs->nip);
>  		PPC_WARN_EMULATED(string);
>  		return emulate_string_inst(regs, instword);
>  	}
>  
>  	/* Emulate the popcntb (Population Count Bytes) instruction. */
>  	if ((instword & PPC_INST_POPCNTB_MASK) == PPC_INST_POPCNTB) {
> +		perf_swcounter_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0,
> +				     regs, regs->nip);
>  		PPC_WARN_EMULATED(popcntb);
>  		return emulate_popcntb_inst(regs, instword);
>  	}
>  
>  	/* Emulate isel (Integer Select) instruction */
>  	if ((instword & PPC_INST_ISEL_MASK) == PPC_INST_ISEL) {
> +		perf_swcounter_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0,
> +				     regs, regs->nip);
>  		PPC_WARN_EMULATED(isel);
>  		return emulate_isel(regs, instword);
>  	}
> @@ -994,8 +1007,11 @@
>  
>  #ifdef CONFIG_MATH_EMULATION
>  	errcode = do_mathemu(regs);
> -	if (errcode >= 0)
> +	if (errcode >= 0) {
> +		perf_swcounter_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0,
> +				     regs, regs->nip);
>  		PPC_WARN_EMULATED(math);
> +	}
>  
>  	switch (errcode) {
>  	case 0:
> @@ -1017,8 +1033,11 @@
>  
>  #elif defined(CONFIG_8XX_MINIMAL_FPEMU)
>  	errcode = Soft_emulate_8xx(regs);
> -	if (errcode >= 0)
> +	if (errcode >= 0) {
> +		perf_swcounter_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0,
> +				     regs, regs->nip);
>  		PPC_WARN_EMULATED(8xx);
> +	}
>  
>  	switch (errcode) {
>  	case 0:
> @@ -1129,6 +1148,8 @@
>  
>  	flush_altivec_to_thread(current);
>  
> +	perf_swcounter_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs,
> +			     regs->nip);
>  	PPC_WARN_EMULATED(altivec);
>  	err = emulate_altivec(regs);
>  	if (err == 0) {
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply

* Re: [PATCH] powerpc: Add compat_sys_truncate
From: Benjamin Herrenschmidt @ 2009-07-27  0:37 UTC (permalink / raw)
  To: Chase Douglas; +Cc: linuxppc-dev
In-Reply-To: <8349EEAE-34B9-4D7E-837F-1320057E59D2@linux.vnet.ibm.com>

On Thu, 2009-07-23 at 11:12 -0400, Chase Douglas wrote:
> The truncate syscall has a signed long parameter, so when using a 32- 
> bit userspace with a 64-bit kernel the argument is zero-extended  
> instead of sign-extended. Adding the compat_sys_truncate function  
> fixes the issue.
> 
> This was noticed during an LSB truncate test failure. The test was  
> checking for the correct error number set when truncate is called with  
> a length of -1. The test can be found at:

Hi Chase !

Unfortunately, your patch have been mangled by your mailer
our your mail gateway in about every possible way (word
wrapped, tabs and whitespace damaged etc...)

I'll hand apply this time around but please, look into
fixing your setup :-)

Cheers,
Ben.

> http://bzr.linuxfoundation.org/lsb/devel/runtime-test?cmd=inventory;rev=stewb%40linux-foundation.org-20090626205411-sfb23cc0tjj7jzgm;path=modules/vsx-pcts/tset/POSIX.os/files/truncate/
> 
> Signed-off-by: Chase Douglas <cndougla@linux.vnet.ibm.com>
> 
> diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/ 
> asm/systbl.h
> index 370600c..3cca167 100644
> --- a/arch/powerpc/include/asm/systbl.h
> +++ b/arch/powerpc/include/asm/systbl.h
> @@ -95,7 +95,7 @@ SYSCALL(reboot)
> SYSX(sys_ni_syscall,compat_sys_old_readdir,sys_old_readdir)
> SYSCALL_SPU(mmap)
> SYSCALL_SPU(munmap)
> -SYSCALL_SPU(truncate)
> +COMPAT_SYS_SPU(truncate)
> SYSCALL_SPU(ftruncate)
> SYSCALL_SPU(fchmod)
> SYSCALL_SPU(fchown)
> diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/ 
> sys_ppc32.c
> index bb1cfcf..da9a65b 100644
> --- a/arch/powerpc/kernel/sys_ppc32.c
> +++ b/arch/powerpc/kernel/sys_ppc32.c
> @@ -343,6 +343,12 @@ off_t ppc32_lseek(unsigned int fd, u32 offset,  
> unsigned int origin)
>         return sys_lseek(fd, (int)offset, origin);
> }
> 
> +long compat_sys_truncate(const char __user * path, u32 length)
> +{
> +       /* sign extend length */
> +       return sys_truncate(path, (int)length);
> +}
> +
> /* Note: it is necessary to treat bufsiz as an unsigned int,
>   * with the corresponding cast to a signed int to insure that the
>   * proper conversion (sign extension) between the register  
> representation of a signed int (msr in 32-bit mode)
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox