2006-08-02 15:22:08

by Rolf Eike Beer

[permalink] [raw]
Subject: [PATCH] Move valid_dma_direction() from x86_64 to generic code

As suggested by Muli Ben-Yehuda this function is moved to generic code as
may be useful for all archs.

Signed-off-by: Rolf Eike Beer <[email protected]>

---
commit 9f990495512e3f106ce56f885a675636b47ff421
tree ad2864a5204c57d9836ff2360d6bf80c0d2246e3
parent 3ac898b16fb75cd996ec98fa578ea06b6ffb2760
author Rolf Eike Beer <[email protected]> Wed, 02 Aug 2006 17:07:56 +0200
committer Rolf Eike Beer <[email protected]> Wed, 02 Aug 2006 17:07:56 +0200

include/asm-x86_64/dma-mapping.h | 7 -------
include/linux/dma-mapping.h | 7 +++++++
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h
index b6da83d..10174b1 100644
--- a/include/asm-x86_64/dma-mapping.h
+++ b/include/asm-x86_64/dma-mapping.h
@@ -55,13 +55,6 @@ extern dma_addr_t bad_dma_address;
extern struct dma_mapping_ops* dma_ops;
extern int iommu_merge;

-static inline int valid_dma_direction(int dma_direction)
-{
- return ((dma_direction == DMA_BIDIRECTIONAL) ||
- (dma_direction == DMA_TO_DEVICE) ||
- (dma_direction == DMA_FROM_DEVICE));
-}
-
static inline int dma_mapping_error(dma_addr_t dma_addr)
{
if (dma_ops->mapping_error)
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 635690c..ff203c4 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -24,6 +24,13 @@ #define DMA_29BIT_MASK 0x000000001ffffff
#define DMA_28BIT_MASK 0x000000000fffffffULL
#define DMA_24BIT_MASK 0x0000000000ffffffULL

+static inline int valid_dma_direction(int dma_direction)
+{
+ return ((dma_direction == DMA_BIDIRECTIONAL) ||
+ (dma_direction == DMA_TO_DEVICE) ||
+ (dma_direction == DMA_FROM_DEVICE));
+}
+
#include <asm/dma-mapping.h>

/* Backwards compat, remove in 2.7.x */


2006-08-02 18:55:31

by Muli Ben-Yehuda

[permalink] [raw]
Subject: Re: [PATCH] Move valid_dma_direction() from x86_64 to generic code

On Wed, Aug 02, 2006 at 05:20:40PM +0200, Rolf Eike Beer wrote:

> As suggested by Muli Ben-Yehuda this function is moved to generic code as
> may be useful for all archs.

I like it, but ...

> diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h
> index b6da83d..10174b1 100644
> --- a/include/asm-x86_64/dma-mapping.h
> +++ b/include/asm-x86_64/dma-mapping.h
> @@ -55,13 +55,6 @@ extern dma_addr_t bad_dma_address;
> extern struct dma_mapping_ops* dma_ops;
> extern int iommu_merge;
>
> -static inline int valid_dma_direction(int dma_direction)
> -{
> - return ((dma_direction == DMA_BIDIRECTIONAL) ||
> - (dma_direction == DMA_TO_DEVICE) ||
> - (dma_direction == DMA_FROM_DEVICE));
> -}
> -

Several files include asm/dma-mapping.h directly, which will now cause
them to fail to compile on x86-64 due to the missing definition for
valid_dma_direction, unless by chance another header already brought
it in indirectly. I guess the right thing to do is convert them all to
using linux/dma-mapping.h instead.

./arch/x86_64/kernel/pci-swiotlb.c:6:#include <asm/dma-mapping.h>
./drivers/net/fec_8xx/fec_main.c:40:#include <asm/dma-mapping.h>
./drivers/net/fs_enet/fs_enet.h:11:#include <asm/dma-mapping.h>
./include/asm-x86_64/swiotlb.h:5:#include <asm/dma-mapping.h>
./include/linux/dma-mapping.h:27:#include <asm/dma-mapping.h>

Cheers,
Muli

2006-08-03 06:22:39

by Rolf Eike Beer

[permalink] [raw]
Subject: Re: [PATCH] Move valid_dma_direction() from x86_64 to generic code

Muli Ben-Yehuda wrote:
> On Wed, Aug 02, 2006 at 05:20:40PM +0200, Rolf Eike Beer wrote:
> > As suggested by Muli Ben-Yehuda this function is moved to generic code as
> > may be useful for all archs.
>
> I like it, but ...

> Several files include asm/dma-mapping.h directly, which will now cause
> them to fail to compile on x86-64 due to the missing definition for
> valid_dma_direction, unless by chance another header already brought
> it in indirectly. I guess the right thing to do is convert them all to
> using linux/dma-mapping.h instead.

Yes, akpm already fixed it up. Sorry guys, currently no x86 kernel around
here. Need to fix that.

> ./arch/x86_64/kernel/pci-swiotlb.c:6:#include <asm/dma-mapping.h>
> ./drivers/net/fec_8xx/fec_main.c:40:#include <asm/dma-mapping.h>
> ./drivers/net/fs_enet/fs_enet.h:11:#include <asm/dma-mapping.h>
> ./include/asm-x86_64/swiotlb.h:5:#include <asm/dma-mapping.h>

I suspect it to be a bug anyway that every of this files ever included
asm/dma-mapping.h.

> ./include/linux/dma-mapping.h:27:#include <asm/dma-mapping.h>

This is perfectly valid, isn't it :)

Eike


Attachments:
(No filename) (1.09 kB)
(No filename) (189.00 B)
Download all attachments

2006-08-03 07:23:57

by Muli Ben-Yehuda

[permalink] [raw]
Subject: Re: [PATCH] Move valid_dma_direction() from x86_64 to generic code

On Thu, Aug 03, 2006 at 08:25:19AM +0200, Rolf Eike Beer wrote:

> > ./arch/x86_64/kernel/pci-swiotlb.c:6:#include <asm/dma-mapping.h>
> > ./drivers/net/fec_8xx/fec_main.c:40:#include <asm/dma-mapping.h>
> > ./drivers/net/fs_enet/fs_enet.h:11:#include <asm/dma-mapping.h>
> > ./include/asm-x86_64/swiotlb.h:5:#include <asm/dma-mapping.h>
>
> I suspect it to be a bug anyway that every of this files ever included
> asm/dma-mapping.h.

Agreed wrt the fs_enet and fec_8xx; the swiotlb stuff I dimly recall I
had a reason for. I'll take a look in bit to verify akpm's fix works.

> > ./include/linux/dma-mapping.h:27:#include <asm/dma-mapping.h>
>
> This is perfectly valid, isn't it :)

:-)

Cheers,
Muli

2006-08-03 21:11:32

by Duran, Leo

[permalink] [raw]
Subject: IOMMU (Calgary) patches

Andi, Jon, Muli,

I'm trying to build with the latest IOMMU patches for x86_64, so, I've
pulled down 2.6.17, and the 2.6.18-rc3 patches... But, that's obviously
lagging behind a bit.

Is there a source tree that you guys work from?
(I'm hoping that there's a better mechanism than keeping track of
patches as they are submitted here).

Leo Duran.

-----Original Message-----
From: Muli Ben-Yehuda [mailto:[email protected]]
Sent: Thursday, August 03, 2006 2:24 AM
To: Rolf Eike Beer
Cc: Andrew Morton; [email protected]; Andi Kleen;
[email protected]
Subject: [discuss] Re: [PATCH] Move valid_dma_direction() from x86_64 to
generic code

On Thu, Aug 03, 2006 at 08:25:19AM +0200, Rolf Eike Beer wrote:

> > ./arch/x86_64/kernel/pci-swiotlb.c:6:#include <asm/dma-mapping.h>
> > ./drivers/net/fec_8xx/fec_main.c:40:#include <asm/dma-mapping.h>
> > ./drivers/net/fs_enet/fs_enet.h:11:#include <asm/dma-mapping.h>
> > ./include/asm-x86_64/swiotlb.h:5:#include <asm/dma-mapping.h>
>
> I suspect it to be a bug anyway that every of this files ever included

> asm/dma-mapping.h.

Agreed wrt the fs_enet and fec_8xx; the swiotlb stuff I dimly recall I
had a reason for. I'll take a look in bit to verify akpm's fix works.

> > ./include/linux/dma-mapping.h:27:#include <asm/dma-mapping.h>
>
> This is perfectly valid, isn't it :)

:-)

Cheers,
Muli




2006-08-03 21:26:51

by Jon Mason

[permalink] [raw]
Subject: Re: IOMMU (Calgary) patches

On Thu, Aug 03, 2006 at 04:10:55PM -0500, Duran, Leo wrote:
> Andi, Jon, Muli,
>
> I'm trying to build with the latest IOMMU patches for x86_64, so, I've
> pulled down 2.6.17, and the 2.6.18-rc3 patches... But, that's obviously
> lagging behind a bit.
>
> Is there a source tree that you guys work from?
Hey Leo,

I personally use the mercurial tree hosted on kernel.org
(http://www.kernel.org/hg/linux-2.6). Alternatively, you can use git to
access the latest tree.

> (I'm hoping that there's a better mechanism than keeping track of
> patches as they are submitted here).

Andrew Morton is good about pulling in the IOMMU patches as soon as we
push them. So the -mm kernel is an option. Andi also queues up the
patches in his firstfloor repository. So you can pull the patches from
there.

So, if you can't wait for the latest kernel and don't want to
get the latest kernel and patch it with Andi's patches on firstfloor,
then the mm kernel will be the best option. But, the mercurial tree I
mentioned above should be sufficient.

Thanks,
Jon

> Leo Duran.
>
> -----Original Message-----
> From: Muli Ben-Yehuda [mailto:[email protected]]
> Sent: Thursday, August 03, 2006 2:24 AM
> To: Rolf Eike Beer
> Cc: Andrew Morton; [email protected]; Andi Kleen;
> [email protected]
> Subject: [discuss] Re: [PATCH] Move valid_dma_direction() from x86_64 to
> generic code
>
> On Thu, Aug 03, 2006 at 08:25:19AM +0200, Rolf Eike Beer wrote:
>
> > > ./arch/x86_64/kernel/pci-swiotlb.c:6:#include <asm/dma-mapping.h>
> > > ./drivers/net/fec_8xx/fec_main.c:40:#include <asm/dma-mapping.h>
> > > ./drivers/net/fs_enet/fs_enet.h:11:#include <asm/dma-mapping.h>
> > > ./include/asm-x86_64/swiotlb.h:5:#include <asm/dma-mapping.h>
> >
> > I suspect it to be a bug anyway that every of this files ever included
>
> > asm/dma-mapping.h.
>
> Agreed wrt the fs_enet and fec_8xx; the swiotlb stuff I dimly recall I
> had a reason for. I'll take a look in bit to verify akpm's fix works.
>
> > > ./include/linux/dma-mapping.h:27:#include <asm/dma-mapping.h>
> >
> > This is perfectly valid, isn't it :)
>
> :-)
>
> Cheers,
> Muli
>
>
>
>

2006-08-03 21:36:04

by Duran, Leo

[permalink] [raw]
Subject: RE: IOMMU (Calgary) patches

Jon,
Many thanks. That helps.
Leo.

-----Original Message-----
From: Jon Mason [mailto:[email protected]]
Sent: Thursday, August 03, 2006 4:26 PM
To: Duran, Leo
Cc: Muli Ben-Yehuda; Andi Kleen; [email protected];
[email protected]
Subject: Re: IOMMU (Calgary) patches

On Thu, Aug 03, 2006 at 04:10:55PM -0500, Duran, Leo wrote:
> Andi, Jon, Muli,
>
> I'm trying to build with the latest IOMMU patches for x86_64, so, I've
> pulled down 2.6.17, and the 2.6.18-rc3 patches... But, that's
obviously
> lagging behind a bit.
>
> Is there a source tree that you guys work from?
Hey Leo,

I personally use the mercurial tree hosted on kernel.org
(http://www.kernel.org/hg/linux-2.6). Alternatively, you can use git to
access the latest tree.

> (I'm hoping that there's a better mechanism than keeping track of
> patches as they are submitted here).

Andrew Morton is good about pulling in the IOMMU patches as soon as we
push them. So the -mm kernel is an option. Andi also queues up the
patches in his firstfloor repository. So you can pull the patches from
there.

So, if you can't wait for the latest kernel and don't want to
get the latest kernel and patch it with Andi's patches on firstfloor,
then the mm kernel will be the best option. But, the mercurial tree I
mentioned above should be sufficient.

Thanks,
Jon

> Leo Duran.
>
> -----Original Message-----
> From: Muli Ben-Yehuda [mailto:[email protected]]
> Sent: Thursday, August 03, 2006 2:24 AM
> To: Rolf Eike Beer
> Cc: Andrew Morton; [email protected]; Andi Kleen;
> [email protected]
> Subject: [discuss] Re: [PATCH] Move valid_dma_direction() from x86_64
to
> generic code
>
> On Thu, Aug 03, 2006 at 08:25:19AM +0200, Rolf Eike Beer wrote:
>
> > > ./arch/x86_64/kernel/pci-swiotlb.c:6:#include <asm/dma-mapping.h>
> > > ./drivers/net/fec_8xx/fec_main.c:40:#include <asm/dma-mapping.h>
> > > ./drivers/net/fs_enet/fs_enet.h:11:#include <asm/dma-mapping.h>
> > > ./include/asm-x86_64/swiotlb.h:5:#include <asm/dma-mapping.h>
> >
> > I suspect it to be a bug anyway that every of this files ever
included
>
> > asm/dma-mapping.h.
>
> Agreed wrt the fs_enet and fec_8xx; the swiotlb stuff I dimly recall I
> had a reason for. I'll take a look in bit to verify akpm's fix works.
>
> > > ./include/linux/dma-mapping.h:27:#include <asm/dma-mapping.h>
> >
> > This is perfectly valid, isn't it :)
>
> :-)
>
> Cheers,
> Muli
>
>
>
>




2006-08-03 22:46:48

by Andi Kleen

[permalink] [raw]
Subject: Re: [discuss] IOMMU (Calgary) patches

On Thursday 03 August 2006 23:10, Duran, Leo wrote:
> Andi, Jon, Muli,
>
> I'm trying to build with the latest IOMMU patches for x86_64, so, I've
> pulled down 2.6.17, and the 2.6.18-rc3 patches... But, that's obviously
> lagging behind a bit.
>
> Is there a source tree that you guys work from?

My latest source tree which contains all the submitted Calgary updates
is in ftp://ftp.firstfloor.org/pub/ak/x86_64/quilt/patches/ (in quilt format)

-Andi