linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] alpha: Add DMA_ERROR_CODE defn to avert compiler error in drm
@ 2011-05-04  8:13 Michael Cree
  2011-05-04 21:59 ` Matt Turner
  2011-05-06 12:30 ` FUJITA Tomonori
  0 siblings, 2 replies; 8+ messages in thread
From: Michael Cree @ 2011-05-04  8:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Michael Cree, linux-alpha, Matt Turner, Richard Henderson,
	Ivan Kokshaysky

The radeon drm code now relies on DMA_ERROR_CODE.  This defines
it in alpha dma-mapping header to at least enable me to compile
radeon drm/kms into kernel.

Signed-off-by: Michael Cree <mcree@orcon.net.nz>
---
 arch/alpha/include/asm/dma-mapping.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h
index 4567aca..644d9c3 100644
--- a/arch/alpha/include/asm/dma-mapping.h
+++ b/arch/alpha/include/asm/dma-mapping.h
@@ -3,6 +3,8 @@
 
 #include <linux/dma-attrs.h>
 
+#define DMA_ERROR_CODE 0
+
 extern struct dma_map_ops *dma_ops;
 
 static inline struct dma_map_ops *get_dma_ops(struct device *dev)
-- 
1.7.4.3


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

* Re: [PATCH] alpha: Add DMA_ERROR_CODE defn to avert compiler error in drm
  2011-05-04  8:13 [PATCH] alpha: Add DMA_ERROR_CODE defn to avert compiler error in drm Michael Cree
@ 2011-05-04 21:59 ` Matt Turner
  2011-05-06 12:43   ` FUJITA Tomonori
  2011-05-06 12:30 ` FUJITA Tomonori
  1 sibling, 1 reply; 8+ messages in thread
From: Matt Turner @ 2011-05-04 21:59 UTC (permalink / raw)
  To: Michael Cree
  Cc: linux-kernel, linux-alpha, Richard Henderson, Ivan Kokshaysky

On Wed, May 4, 2011 at 4:13 AM, Michael Cree <mcree@orcon.net.nz> wrote:
> The radeon drm code now relies on DMA_ERROR_CODE.  This defines
> it in alpha dma-mapping header to at least enable me to compile
> radeon drm/kms into kernel.
>
> Signed-off-by: Michael Cree <mcree@orcon.net.nz>
> ---
>  arch/alpha/include/asm/dma-mapping.h |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h
> index 4567aca..644d9c3 100644
> --- a/arch/alpha/include/asm/dma-mapping.h
> +++ b/arch/alpha/include/asm/dma-mapping.h
> @@ -3,6 +3,8 @@
>
>  #include <linux/dma-attrs.h>
>
> +#define DMA_ERROR_CODE 0
> +
>  extern struct dma_map_ops *dma_ops;
>
>  static inline struct dma_map_ops *get_dma_ops(struct device *dev)
> --
> 1.7.4.3
>
>

Other architectures define this differently.

arch/ia64/include/asm/dma-mapping.h:#define DMA_ERROR_CODE 0
arch/microblaze/include/asm/dma-mapping.h:#define DMA_ERROR_CODE
         (~(dma_addr_t)0x0)
arch/powerpc/include/asm/dma-mapping.h:#define DMA_ERROR_CODE
 (~(dma_addr_t)0x0)
arch/sparc/include/asm/dma-mapping.h:#define DMA_ERROR_CODE
(~(dma_addr_t)0x0)
arch/x86/include/asm/dma-mapping.h:#define DMA_ERROR_CODE       0

Any idea what the reason is?

Matt

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

* Re: [PATCH] alpha: Add DMA_ERROR_CODE defn to avert compiler error in drm
  2011-05-04  8:13 [PATCH] alpha: Add DMA_ERROR_CODE defn to avert compiler error in drm Michael Cree
  2011-05-04 21:59 ` Matt Turner
@ 2011-05-06 12:30 ` FUJITA Tomonori
  2011-05-06 13:49   ` Konrad Rzeszutek Wilk
  1 sibling, 1 reply; 8+ messages in thread
From: FUJITA Tomonori @ 2011-05-06 12:30 UTC (permalink / raw)
  To: mcree; +Cc: linux-kernel, linux-alpha, mattst88, rth, ink

On Wed,  4 May 2011 20:13:37 +1200
Michael Cree <mcree@orcon.net.nz> wrote:

> The radeon drm code now relies on DMA_ERROR_CODE.  This defines
> it in alpha dma-mapping header to at least enable me to compile
> radeon drm/kms into kernel.
> 
> Signed-off-by: Michael Cree <mcree@orcon.net.nz>
> ---
>  arch/alpha/include/asm/dma-mapping.h |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)

This isn't correct. The drivers should not use DMA_ERROR_CODE directly
(some architecture specific drivers use it though). Fix rademon
drm/kms instead.

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

* Re: [PATCH] alpha: Add DMA_ERROR_CODE defn to avert compiler error in drm
  2011-05-04 21:59 ` Matt Turner
@ 2011-05-06 12:43   ` FUJITA Tomonori
  0 siblings, 0 replies; 8+ messages in thread
From: FUJITA Tomonori @ 2011-05-06 12:43 UTC (permalink / raw)
  To: mattst88; +Cc: mcree, linux-kernel, linux-alpha, rth, ink

On Wed, 4 May 2011 17:59:29 -0400
Matt Turner <mattst88@gmail.com> wrote:

> Other architectures define this differently.
> 
> arch/ia64/include/asm/dma-mapping.h:#define DMA_ERROR_CODE 0
> arch/microblaze/include/asm/dma-mapping.h:#define DMA_ERROR_CODE
>          (~(dma_addr_t)0x0)
> arch/powerpc/include/asm/dma-mapping.h:#define DMA_ERROR_CODE
>  (~(dma_addr_t)0x0)
> arch/sparc/include/asm/dma-mapping.h:#define DMA_ERROR_CODE
> (~(dma_addr_t)0x0)
> arch/x86/include/asm/dma-mapping.h:#define DMA_ERROR_CODE       0
> 
> Any idea what the reason is?

Because an invalid DMA address is architecture specific. To be exact,
an invalid DMA address is DMA operation specific.

As I wrote in another mail, this patch is wrong.

Architectures don't need to define DMA_ERROR_CODE.

Some architectures need multiple dma_mapping_error functions. You
could use DMA_ERROR_CODE in order to avoid duplicated code like
this. That is, you define only for dma_map_ops that needs the own
mapping_error function.

static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
{
	struct dma_map_ops *ops = get_dma_ops(dev);
	if (ops->mapping_error)
		return ops->mapping_error(dev, dma_addr);

	return (dma_addr == DMA_ERROR_CODE);
}

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

* Re: [PATCH] alpha: Add DMA_ERROR_CODE defn to avert compiler error in drm
  2011-05-06 12:30 ` FUJITA Tomonori
@ 2011-05-06 13:49   ` Konrad Rzeszutek Wilk
  2011-05-07  0:05     ` FUJITA Tomonori
  0 siblings, 1 reply; 8+ messages in thread
From: Konrad Rzeszutek Wilk @ 2011-05-06 13:49 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: mcree, linux-kernel, linux-alpha, mattst88, rth, ink

On Fri, May 06, 2011 at 09:30:03PM +0900, FUJITA Tomonori wrote:
> On Wed,  4 May 2011 20:13:37 +1200
> Michael Cree <mcree@orcon.net.nz> wrote:
> 
> > The radeon drm code now relies on DMA_ERROR_CODE.  This defines
> > it in alpha dma-mapping header to at least enable me to compile
> > radeon drm/kms into kernel.
> > 
> > Signed-off-by: Michael Cree <mcree@orcon.net.nz>
> > ---
> >  arch/alpha/include/asm/dma-mapping.h |    2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> This isn't correct. The drivers should not use DMA_ERROR_CODE directly
> (some architecture specific drivers use it though). Fix rademon
> drm/kms instead.

What would be a proper value for non-existent bus addresses? As in the value
had not been set? 0?

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

* Re: [PATCH] alpha: Add DMA_ERROR_CODE defn to avert compiler error in drm
  2011-05-06 13:49   ` Konrad Rzeszutek Wilk
@ 2011-05-07  0:05     ` FUJITA Tomonori
  2011-05-07  3:08       ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 8+ messages in thread
From: FUJITA Tomonori @ 2011-05-07  0:05 UTC (permalink / raw)
  To: konrad.wilk
  Cc: fujita.tomonori, mcree, linux-kernel, linux-alpha, mattst88, rth,
	ink

On Fri, 6 May 2011 09:49:25 -0400
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:

> On Fri, May 06, 2011 at 09:30:03PM +0900, FUJITA Tomonori wrote:
> > On Wed,  4 May 2011 20:13:37 +1200
> > Michael Cree <mcree@orcon.net.nz> wrote:
> > 
> > > The radeon drm code now relies on DMA_ERROR_CODE.  This defines
> > > it in alpha dma-mapping header to at least enable me to compile
> > > radeon drm/kms into kernel.
> > > 
> > > Signed-off-by: Michael Cree <mcree@orcon.net.nz>
> > > ---
> > >  arch/alpha/include/asm/dma-mapping.h |    2 ++
> > >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > This isn't correct. The drivers should not use DMA_ERROR_CODE directly
> > (some architecture specific drivers use it though). Fix rademon
> > drm/kms instead.
> 
> What would be a proper value for non-existent bus addresses? As in the value
> had not been set? 0?

Zero is a valid DMA address for some devices.

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

* Re: [PATCH] alpha: Add DMA_ERROR_CODE defn to avert compiler error in drm
  2011-05-07  0:05     ` FUJITA Tomonori
@ 2011-05-07  3:08       ` Konrad Rzeszutek Wilk
  2011-05-07 23:21         ` FUJITA Tomonori
  0 siblings, 1 reply; 8+ messages in thread
From: Konrad Rzeszutek Wilk @ 2011-05-07  3:08 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: mcree, linux-kernel, linux-alpha, mattst88, rth, ink

On Sat, May 07, 2011 at 09:05:50AM +0900, FUJITA Tomonori wrote:
> On Fri, 6 May 2011 09:49:25 -0400
> Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
> 
> > On Fri, May 06, 2011 at 09:30:03PM +0900, FUJITA Tomonori wrote:
> > > On Wed,  4 May 2011 20:13:37 +1200
> > > Michael Cree <mcree@orcon.net.nz> wrote:
> > > 
> > > > The radeon drm code now relies on DMA_ERROR_CODE.  This defines
> > > > it in alpha dma-mapping header to at least enable me to compile
> > > > radeon drm/kms into kernel.
> > > > 
> > > > Signed-off-by: Michael Cree <mcree@orcon.net.nz>
> > > > ---
> > > >  arch/alpha/include/asm/dma-mapping.h |    2 ++
> > > >  1 files changed, 2 insertions(+), 0 deletions(-)
> > > 
> > > This isn't correct. The drivers should not use DMA_ERROR_CODE directly
> > > (some architecture specific drivers use it though). Fix rademon
> > > drm/kms instead.
> > 
> > What would be a proper value for non-existent bus addresses? As in the value
> > had not been set? 0?
> 
> Zero is a valid DMA address for some devices.

Ok, so what is an invalid DMA address?

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

* Re: [PATCH] alpha: Add DMA_ERROR_CODE defn to avert compiler error in drm
  2011-05-07  3:08       ` Konrad Rzeszutek Wilk
@ 2011-05-07 23:21         ` FUJITA Tomonori
  0 siblings, 0 replies; 8+ messages in thread
From: FUJITA Tomonori @ 2011-05-07 23:21 UTC (permalink / raw)
  To: konrad.wilk
  Cc: fujita.tomonori, mcree, linux-kernel, linux-alpha, mattst88, rth,
	ink

On Fri, 6 May 2011 23:08:03 -0400
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:

> On Sat, May 07, 2011 at 09:05:50AM +0900, FUJITA Tomonori wrote:
> > On Fri, 6 May 2011 09:49:25 -0400
> > Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
> > 
> > > On Fri, May 06, 2011 at 09:30:03PM +0900, FUJITA Tomonori wrote:
> > > > On Wed,  4 May 2011 20:13:37 +1200
> > > > Michael Cree <mcree@orcon.net.nz> wrote:
> > > > 
> > > > > The radeon drm code now relies on DMA_ERROR_CODE.  This defines
> > > > > it in alpha dma-mapping header to at least enable me to compile
> > > > > radeon drm/kms into kernel.
> > > > > 
> > > > > Signed-off-by: Michael Cree <mcree@orcon.net.nz>
> > > > > ---
> > > > >  arch/alpha/include/asm/dma-mapping.h |    2 ++
> > > > >  1 files changed, 2 insertions(+), 0 deletions(-)
> > > > 
> > > > This isn't correct. The drivers should not use DMA_ERROR_CODE directly
> > > > (some architecture specific drivers use it though). Fix rademon
> > > > drm/kms instead.
> > > 
> > > What would be a proper value for non-existent bus addresses? As in the value
> > > had not been set? 0?
> > 
> > Zero is a valid DMA address for some devices.
> 
> Ok, so what is an invalid DMA address?

You are looking for a DMA address that is invalid for any device?

If so, there is no such thing because as I wrote, it depends on how a
device does DMA.

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

end of thread, other threads:[~2011-05-07 23:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-04  8:13 [PATCH] alpha: Add DMA_ERROR_CODE defn to avert compiler error in drm Michael Cree
2011-05-04 21:59 ` Matt Turner
2011-05-06 12:43   ` FUJITA Tomonori
2011-05-06 12:30 ` FUJITA Tomonori
2011-05-06 13:49   ` Konrad Rzeszutek Wilk
2011-05-07  0:05     ` FUJITA Tomonori
2011-05-07  3:08       ` Konrad Rzeszutek Wilk
2011-05-07 23:21         ` FUJITA Tomonori

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).