linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cciss 2.6; replaces DMA masks with kernel defines
@ 2005-06-10 14:34 mike.miller
  2005-06-10 16:55 ` Jeff Garzik
  0 siblings, 1 reply; 15+ messages in thread
From: mike.miller @ 2005-06-10 14:34 UTC (permalink / raw)
  To: akpm, axboe; +Cc: linux-kernel, linux-scsi

This patch removes our homegrown DMA masks and uses the ones defined in
the kernel instead.
Thanks to Jens Axboe for the code. Please consider this for inclusion.

Signed-off-by: Mike Miller <mike.miller@hp.com>

 cciss.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

--------------------------------------------------------------------------------
diff -burNp lx2612-rc6.orig/drivers/block/cciss.c lx2612-rc6/drivers/block/cciss.c
--- lx2612-rc6.orig/drivers/block/cciss.c	2005-06-10 08:43:05.516957392 -0500
+++ lx2612-rc6/drivers/block/cciss.c	2005-06-10 08:56:44.302483072 -0500
@@ -126,8 +126,6 @@ static struct board_type products[] = {
 #define MAX_CTLR_ORIG 	8
 
 
-#define CCISS_DMA_MASK	0xFFFFFFFF	/* 32 bit DMA */
-
 static ctlr_info_t *hba[MAX_CTLR];
 
 static void do_cciss_request(request_queue_t *q);
@@ -2747,9 +2745,9 @@ static int __devinit cciss_init_one(stru
 	hba[i]->pdev = pdev;
 
 	/* configure PCI DMA stuff */
-	if (!pci_set_dma_mask(pdev, 0xffffffffffffffffULL))
+	if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK))
 		printk("cciss: using DAC cycles\n");
-	else if (!pci_set_dma_mask(pdev, 0xffffffff))
+	else if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK))
 		printk("cciss: not using DAC cycles\n");
 	else {
 		printk("cciss: no suitable DMA available\n");

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

* Re: [PATCH] cciss 2.6; replaces DMA masks with kernel defines
  2005-06-10 14:34 [PATCH] cciss 2.6; replaces DMA masks with kernel defines mike.miller
@ 2005-06-10 16:55 ` Jeff Garzik
  2005-06-10 20:39   ` DMA mapping (was Re: [PATCH] cciss 2.6; replaces DMA masks with kernel defines) Lee Revell
  0 siblings, 1 reply; 15+ messages in thread
From: Jeff Garzik @ 2005-06-10 16:55 UTC (permalink / raw)
  To: mike.miller; +Cc: akpm, axboe, linux-kernel, linux-scsi

mike.miller@hp.com wrote:
> This patch removes our homegrown DMA masks and uses the ones defined in
> the kernel instead.
> Thanks to Jens Axboe for the code. Please consider this for inclusion.
> 
> Signed-off-by: Mike Miller <mike.miller@hp.com>

You need to add '#include <linux/dma-mapping.h>'

	Jeff




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

* DMA mapping (was Re: [PATCH] cciss 2.6; replaces DMA masks with kernel defines)
  2005-06-10 16:55 ` Jeff Garzik
@ 2005-06-10 20:39   ` Lee Revell
  2005-06-10 20:45     ` Arjan van de Ven
  0 siblings, 1 reply; 15+ messages in thread
From: Lee Revell @ 2005-06-10 20:39 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: mike.miller, akpm, axboe, linux-kernel, linux-scsi

On Fri, 2005-06-10 at 12:55 -0400, Jeff Garzik wrote:
> mike.miller@hp.com wrote:
> > This patch removes our homegrown DMA masks and uses the ones defined in
> > the kernel instead.
> > Thanks to Jens Axboe for the code. Please consider this for inclusion.
> > 
> > Signed-off-by: Mike Miller <mike.miller@hp.com>
> 
> You need to add '#include <linux/dma-mapping.h>'
> 

Why doesn't this file define 29, 30, 31 bit DMA masks, required by many
devices?  I know of at least 2 soundcards that need a 29 bit DMA mask.

Lee


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

* Re: DMA mapping (was Re: [PATCH] cciss 2.6; replaces DMA masks with kernel defines)
  2005-06-10 20:39   ` DMA mapping (was Re: [PATCH] cciss 2.6; replaces DMA masks with kernel defines) Lee Revell
@ 2005-06-10 20:45     ` Arjan van de Ven
  2005-06-10 20:49       ` Lee Revell
                         ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Arjan van de Ven @ 2005-06-10 20:45 UTC (permalink / raw)
  To: Lee Revell
  Cc: Jeff Garzik, mike.miller, akpm, axboe, linux-kernel, linux-scsi

On Fri, 2005-06-10 at 16:39 -0400, Lee Revell wrote:
> On Fri, 2005-06-10 at 12:55 -0400, Jeff Garzik wrote:
> > mike.miller@hp.com wrote:
> > > This patch removes our homegrown DMA masks and uses the ones defined in
> > > the kernel instead.
> > > Thanks to Jens Axboe for the code. Please consider this for inclusion.
> > > 
> > > Signed-off-by: Mike Miller <mike.miller@hp.com>
> > 
> > You need to add '#include <linux/dma-mapping.h>'
> > 
> 
> Why doesn't this file define 29, 30, 31 bit DMA masks, required by many
> devices?  I know of at least 2 soundcards that need a 29 bit DMA mask.

your mail unfortunately was not in diff -u form ;)
I'm pretty sure that such constants are welcome



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

* Re: DMA mapping (was Re: [PATCH] cciss 2.6; replaces DMA masks with kernel defines)
  2005-06-10 20:45     ` Arjan van de Ven
@ 2005-06-10 20:49       ` Lee Revell
  2005-06-11 18:32         ` jgarzik
  2005-06-10 20:59       ` Lee Revell
  2005-06-10 21:17       ` Lee Revell
  2 siblings, 1 reply; 15+ messages in thread
From: Lee Revell @ 2005-06-10 20:49 UTC (permalink / raw)
  To: Arjan van de Ven
  Cc: Jeff Garzik, mike.miller, akpm, axboe, linux-kernel, linux-scsi

On Fri, 2005-06-10 at 22:45 +0200, Arjan van de Ven wrote: 
> > Why doesn't this file define 29, 30, 31 bit DMA masks, required by many
> > devices?  I know of at least 2 soundcards that need a 29 bit DMA mask.
> 
> your mail unfortunately was not in diff -u form ;)
> I'm pretty sure that such constants are welcome
> 

OK, I just wanted to see if there was a reason before posting it.

Anyone know of hardware that needs less than a 29 bit mask?

Lee


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

* Re: DMA mapping (was Re: [PATCH] cciss 2.6; replaces DMA masks with kernel defines)
  2005-06-10 20:45     ` Arjan van de Ven
  2005-06-10 20:49       ` Lee Revell
@ 2005-06-10 20:59       ` Lee Revell
  2005-06-10 21:17       ` Lee Revell
  2 siblings, 0 replies; 15+ messages in thread
From: Lee Revell @ 2005-06-10 20:59 UTC (permalink / raw)
  To: Arjan van de Ven
  Cc: alsa-devel, Jeff Garzik, mike.miller, akpm, axboe, linux-kernel,
	linux-scsi

On Fri, 2005-06-10 at 22:45 +0200, Arjan van de Ven wrote:
> On Fri, 2005-06-10 at 16:39 -0400, Lee Revell wrote:
> > On Fri, 2005-06-10 at 12:55 -0400, Jeff Garzik wrote:
> > > mike.miller@hp.com wrote:
> > > > This patch removes our homegrown DMA masks and uses the ones defined in
> > > > the kernel instead.
> > > > Thanks to Jens Axboe for the code. Please consider this for inclusion.
> > > > 
> > > > Signed-off-by: Mike Miller <mike.miller@hp.com>
> > > 
> > > You need to add '#include <linux/dma-mapping.h>'
> > > 
> > 
> > Why doesn't this file define 29, 30, 31 bit DMA masks, required by many
> > devices?  I know of at least 2 soundcards that need a 29 bit DMA mask.
> 
> your mail unfortunately was not in diff -u form ;)
> I'm pretty sure that such constants are welcome

Which reminds me, the SBLive has a 29 bit mask in the OSS driver but 31
in the ALSA driver.  I'm going to preserve the discrepancy, it seems
pointless to change the behavior of a deprecated driver.

Lee


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

* Re: DMA mapping (was Re: [PATCH] cciss 2.6; replaces DMA masks with kernel defines)
  2005-06-10 20:45     ` Arjan van de Ven
  2005-06-10 20:49       ` Lee Revell
  2005-06-10 20:59       ` Lee Revell
@ 2005-06-10 21:17       ` Lee Revell
  2005-06-10 21:30         ` Matthew Wilcox
  2 siblings, 1 reply; 15+ messages in thread
From: Lee Revell @ 2005-06-10 21:17 UTC (permalink / raw)
  To: Arjan van de Ven
  Cc: Jeff Garzik, mike.miller, akpm, axboe, linux-kernel, linux-scsi

On Fri, 2005-06-10 at 22:45 +0200, Arjan van de Ven wrote:
> On Fri, 2005-06-10 at 16:39 -0400, Lee Revell wrote:
> > On Fri, 2005-06-10 at 12:55 -0400, Jeff Garzik wrote:
> > > mike.miller@hp.com wrote:
> > > > This patch removes our homegrown DMA masks and uses the ones defined in
> > > > the kernel instead.
> > > > Thanks to Jens Axboe for the code. Please consider this for inclusion.
> > > > 
> > > > Signed-off-by: Mike Miller <mike.miller@hp.com>
> > > 
> > > You need to add '#include <linux/dma-mapping.h>'
> > > 
> > 
> > Why doesn't this file define 29, 30, 31 bit DMA masks, required by many
> > devices?  I know of at least 2 soundcards that need a 29 bit DMA mask.
> 
> your mail unfortunately was not in diff -u form ;)
> I'm pretty sure that such constants are welcome
> 

OK, this covers the drivers I know.  I didn't make any attempt to check
them all.


According to Robert Love's book there's at least one device than can
only DMA into a 24 bit address space, maybe the PCI NE2K?

Sommary: Add mask defines for some devices that can't DMA into full
32/64 bit address space.

Signed-Off-By: Lee Revell <rlrevell@joe-job.com>

--- linux-2.6.12-rc5-k7/include/linux/dma-mapping.h~	2005-03-02 02:38:25.000000000 -0500
+++ linux-2.6.12-rc5-k7/include/linux/dma-mapping.h	2005-06-10 17:10:12.000000000 -0400
@@ -15,6 +15,8 @@
 
 #define DMA_64BIT_MASK	0xffffffffffffffffULL
 #define DMA_32BIT_MASK	0x00000000ffffffffULL
+#define DMA_31BIT_MASK	0x000000007fffffffULL
+#define DMA_29BIT_MASK	0x000000001fffffffULL
 
 #include <asm/dma-mapping.h>
 



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

* Re: DMA mapping (was Re: [PATCH] cciss 2.6; replaces DMA masks with kernel defines)
  2005-06-10 21:17       ` Lee Revell
@ 2005-06-10 21:30         ` Matthew Wilcox
  2005-06-10 23:08           ` Lee Revell
  2005-06-10 23:17           ` Lee Revell
  0 siblings, 2 replies; 15+ messages in thread
From: Matthew Wilcox @ 2005-06-10 21:30 UTC (permalink / raw)
  To: Lee Revell
  Cc: Arjan van de Ven, Jeff Garzik, mike.miller, akpm, axboe,
	linux-kernel, linux-scsi

On Fri, Jun 10, 2005 at 05:17:32PM -0400, Lee Revell wrote:
> OK, this covers the drivers I know.  I didn't make any attempt to check
> them all.

I know of two others ...

sym2 has:
#define DMA_DAC_MASK    0x000000ffffffffffULL /* 40-bit */

and aic7xxx has:
        const uint64_t   mask_39bit = 0x7FFFFFFFFFULL;

Would you mind respinning your patch to include these?

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain

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

* Re: DMA mapping (was Re: [PATCH] cciss 2.6; replaces DMA masks with kernel defines)
  2005-06-10 21:30         ` Matthew Wilcox
@ 2005-06-10 23:08           ` Lee Revell
  2005-06-11 13:54             ` Matthew Wilcox
  2005-06-10 23:17           ` Lee Revell
  1 sibling, 1 reply; 15+ messages in thread
From: Lee Revell @ 2005-06-10 23:08 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Arjan van de Ven, Jeff Garzik, mike.miller, akpm, axboe,
	linux-kernel, linux-scsi

On Fri, 2005-06-10 at 22:30 +0100, Matthew Wilcox wrote:
> On Fri, Jun 10, 2005 at 05:17:32PM -0400, Lee Revell wrote:
> > OK, this covers the drivers I know.  I didn't make any attempt to check
> > them all.
> 
> I know of two others ...
> 
> sym2 has:
> #define DMA_DAC_MASK    0x000000ffffffffffULL /* 40-bit */
> 
> and aic7xxx has:
>         const uint64_t   mask_39bit = 0x7FFFFFFFFFULL;

b44 needs 30 bit:

#define B44_DMA_MASK 0x3fffffff

These seem to be all over the place.  I guess it saves a tiny bit of
silicon.  Don't these all violate the PCI spec?

Should I just add everything from 24 to 63?

Lee


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

* Re: DMA mapping (was Re: [PATCH] cciss 2.6; replaces DMA masks with kernel defines)
  2005-06-10 21:30         ` Matthew Wilcox
  2005-06-10 23:08           ` Lee Revell
@ 2005-06-10 23:17           ` Lee Revell
  2005-06-11 15:39             ` Pavel Machek
  1 sibling, 1 reply; 15+ messages in thread
From: Lee Revell @ 2005-06-10 23:17 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Arjan van de Ven, Jeff Garzik, mike.miller, akpm, axboe,
	linux-kernel, linux-scsi

On Fri, 2005-06-10 at 22:30 +0100, Matthew Wilcox wrote:
> On Fri, Jun 10, 2005 at 05:17:32PM -0400, Lee Revell wrote:
> > OK, this covers the drivers I know.  I didn't make any attempt to check
> > them all.
> 
> I know of two others ...
> 
> sym2 has:
> #define DMA_DAC_MASK    0x000000ffffffffffULL /* 40-bit */
> 
> and aic7xxx has:
>         const uint64_t   mask_39bit = 0x7FFFFFFFFFULL;
> 
> Would you mind respinning your patch to include these?
> 

I'm grepping the drivers, and what a mess.  This will be a nice cleanup.

Why would someone use 0xFFFFffff?

Lee


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

* Re: DMA mapping (was Re: [PATCH] cciss 2.6; replaces DMA masks with kernel defines)
  2005-06-10 23:08           ` Lee Revell
@ 2005-06-11 13:54             ` Matthew Wilcox
  2005-06-15 18:19               ` Lee Revell
  0 siblings, 1 reply; 15+ messages in thread
From: Matthew Wilcox @ 2005-06-11 13:54 UTC (permalink / raw)
  To: Lee Revell
  Cc: Matthew Wilcox, Arjan van de Ven, Jeff Garzik, mike.miller, akpm,
	axboe, linux-kernel, linux-scsi

On Fri, Jun 10, 2005 at 07:08:11PM -0400, Lee Revell wrote:
> b44 needs 30 bit:
> 
> #define B44_DMA_MASK 0x3fffffff
> 
> These seem to be all over the place.  I guess it saves a tiny bit of
> silicon.  Don't these all violate the PCI spec?

No, it's permitted.  What would violate the PCI spec would be failing
to decode the full 32/64 bit address and creating aliases (like 10-bit
ISA cards did).  This is just a reestriction on which parts of memory
a card can DMA to.

> Should I just add everything from 24 to 63?

Actually, it'd be useful to have a central list of what DMA masks devices
really take.  It might provide some arguments for changing the zone allocater.

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain

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

* Re: DMA mapping (was Re: [PATCH] cciss 2.6; replaces DMA masks with kernel defines)
  2005-06-10 23:17           ` Lee Revell
@ 2005-06-11 15:39             ` Pavel Machek
  0 siblings, 0 replies; 15+ messages in thread
From: Pavel Machek @ 2005-06-11 15:39 UTC (permalink / raw)
  To: Lee Revell
  Cc: Matthew Wilcox, Arjan van de Ven, Jeff Garzik, mike.miller, akpm,
	axboe, linux-kernel, linux-scsi

Hi!

> > I know of two others ...
> > 
> > sym2 has:
> > #define DMA_DAC_MASK    0x000000ffffffffffULL /* 40-bit */
> > 
> > and aic7xxx has:
> >         const uint64_t   mask_39bit = 0x7FFFFFFFFFULL;
> > 
> > Would you mind respinning your patch to include these?
> > 
> 
> I'm grepping the drivers, and what a mess.  This will be a nice cleanup.
> 
> Why would someone use 0xFFFFffff?

To make it easier to count Fs?
									Pavel

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

* Re: DMA mapping (was Re: [PATCH] cciss 2.6; replaces DMA masks with kernel defines)
  2005-06-10 20:49       ` Lee Revell
@ 2005-06-11 18:32         ` jgarzik
  2005-06-13  2:58           ` Jeff Garzik
  0 siblings, 1 reply; 15+ messages in thread
From: jgarzik @ 2005-06-11 18:32 UTC (permalink / raw)
  To: Lee Revell
  Cc: Arjan van de Ven, Jeff Garzik, mike.miller, akpm, axboe,
	linux-kernel, linux-scsi

On Fri, Jun 10, 2005 at 04:49:48PM -0400, Lee Revell wrote:
> On Fri, 2005-06-10 at 22:45 +0200, Arjan van de Ven wrote: 
> > > Why doesn't this file define 29, 30, 31 bit DMA masks, required by many
> > > devices?  I know of at least 2 soundcards that need a 29 bit DMA mask.
> > 
> > your mail unfortunately was not in diff -u form ;)
> > I'm pretty sure that such constants are welcome
> > 
> 
> OK, I just wanted to see if there was a reason before posting it.
> 
> Anyone know of hardware that needs less than a 29 bit mask?

ALS2000 sound device, which is basically an ISA SB chip on a PCI board.

	Jeff




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

* Re: DMA mapping (was Re: [PATCH] cciss 2.6; replaces DMA masks with kernel defines)
  2005-06-11 18:32         ` jgarzik
@ 2005-06-13  2:58           ` Jeff Garzik
  0 siblings, 0 replies; 15+ messages in thread
From: Jeff Garzik @ 2005-06-13  2:58 UTC (permalink / raw)
  To: Lee Revell
  Cc: Arjan van de Ven, mike.miller, akpm, axboe, linux-kernel, linux-scsi

jgarzik@pentafluge.infradead.org wrote:
> On Fri, Jun 10, 2005 at 04:49:48PM -0400, Lee Revell wrote:
> 
>>On Fri, 2005-06-10 at 22:45 +0200, Arjan van de Ven wrote: 
>>
>>>>Why doesn't this file define 29, 30, 31 bit DMA masks, required by many
>>>>devices?  I know of at least 2 soundcards that need a 29 bit DMA mask.
>>>
>>>your mail unfortunately was not in diff -u form ;)
>>>I'm pretty sure that such constants are welcome
>>>
>>
>>OK, I just wanted to see if there was a reason before posting it.
>>
>>Anyone know of hardware that needs less than a 29 bit mask?
> 
> 
> ALS2000 sound device, which is basically an ISA SB chip on a PCI board.

ALS4000, excuse me.

	Jeff



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

* Re: DMA mapping (was Re: [PATCH] cciss 2.6; replaces DMA masks with kernel defines)
  2005-06-11 13:54             ` Matthew Wilcox
@ 2005-06-15 18:19               ` Lee Revell
  0 siblings, 0 replies; 15+ messages in thread
From: Lee Revell @ 2005-06-15 18:19 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Arjan van de Ven, Jeff Garzik, mike.miller, akpm, axboe,
	linux-kernel, linux-scsi

On Sat, 2005-06-11 at 14:54 +0100, Matthew Wilcox wrote:
> On Fri, Jun 10, 2005 at 07:08:11PM -0400, Lee Revell wrote:
> > Should I just add everything from 24 to 63?
> 
> Actually, it'd be useful to have a central list of what DMA masks devices
> really take.  It might provide some arguments for changing the zone allocater.
> 

OK, patch attached.  I don't have time to cover every case, maybe
someone else can run with this.

Lee

Summary: Add DMA mask constants other than 32 and 64 bit

Signed-Off-By: Lee Revell <rlrevell@joe-job.com>

--- linux-2.6.12-rc5-k7/include/linux/dma-mapping.h-orig	2005-06-15 14:14:04.000000000 -0400
+++ linux-2.6.12-rc5-k7/include/linux/dma-mapping.h	2005-06-15 14:17:13.000000000 -0400
@@ -14,7 +14,12 @@
 };
 
 #define DMA_64BIT_MASK	0xffffffffffffffffULL
+#define DMA_40BIT_MASK	0x000000ffffffffffULL
+#define DMA_39BIT_MASK	0x0000007fffffffffULL
 #define DMA_32BIT_MASK	0x00000000ffffffffULL
+#define DMA_31BIT_MASK	0x000000007fffffffULL
+#define DMA_30BIT_MASK	0x000000003fffffffULL
+#define DMA_29BIT_MASK	0x000000001fffffffULL
 
 #include <asm/dma-mapping.h>



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

end of thread, other threads:[~2005-06-15 18:16 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-10 14:34 [PATCH] cciss 2.6; replaces DMA masks with kernel defines mike.miller
2005-06-10 16:55 ` Jeff Garzik
2005-06-10 20:39   ` DMA mapping (was Re: [PATCH] cciss 2.6; replaces DMA masks with kernel defines) Lee Revell
2005-06-10 20:45     ` Arjan van de Ven
2005-06-10 20:49       ` Lee Revell
2005-06-11 18:32         ` jgarzik
2005-06-13  2:58           ` Jeff Garzik
2005-06-10 20:59       ` Lee Revell
2005-06-10 21:17       ` Lee Revell
2005-06-10 21:30         ` Matthew Wilcox
2005-06-10 23:08           ` Lee Revell
2005-06-11 13:54             ` Matthew Wilcox
2005-06-15 18:19               ` Lee Revell
2005-06-10 23:17           ` Lee Revell
2005-06-11 15:39             ` Pavel Machek

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