* aic7xxx (O2 scsi) DMA coherency
@ 2002-01-03 21:34 Vivien Chappelier
2002-01-03 21:57 ` Alan Cox
0 siblings, 1 reply; 10+ messages in thread
From: Vivien Chappelier @ 2002-01-03 21:34 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
[-- Attachment #1: Type: TEXT/PLAIN, Size: 84 bytes --]
Hello,
This tells the aic7xxx to use DMA safe memory for I/O.
Vivien Chappelier.
[-- Attachment #2: Type: TEXT/plain, Size: 606 bytes --]
diff -Naur linux/drivers/scsi/aic7xxx/aic7xxx_linux_host.h linux.patch/drivers/scsi/aic7xxx/aic7xxx_linux_host.h
--- linux/drivers/scsi/aic7xxx/aic7xxx_linux_host.h Thu Dec 20 18:31:11 2001
+++ linux.patch/drivers/scsi/aic7xxx/aic7xxx_linux_host.h Thu Dec 20 21:43:31 2001
@@ -87,7 +87,7 @@
sg_tablesize: 0, /* max scatter-gather cmds */\
cmd_per_lun: 2, /* cmds per lun */\
present: 0, /* number of 7xxx's present */\
- unchecked_isa_dma: 0, /* no memory DMA restrictions */\
+ unchecked_isa_dma: 1, \
use_clustering: ENABLE_CLUSTERING, \
highmem_io: 1 \
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: aic7xxx (O2 scsi) DMA coherency
2002-01-03 21:57 ` Alan Cox
(?)
@ 2002-01-03 21:51 ` Vivien Chappelier
2002-01-03 22:34 ` Alan Cox
2002-01-03 23:52 ` Ralf Baechle
-1 siblings, 2 replies; 10+ messages in thread
From: Vivien Chappelier @ 2002-01-03 21:51 UTC (permalink / raw)
To: Alan Cox; +Cc: Ralf Baechle, linux-mips
On Thu, 3 Jan 2002, Alan Cox wrote:
> > This tells the aic7xxx to use DMA safe memory for I/O.
>
> That seems totally inappropriate. The unchecked dma option is for
> ancient ISA DMA controllers that didnt do the 16Mb check. If you
> find you need it debug your pci remapper
This is used when scaning for devices (drivers/scsi/scsi_scan.c) . When
this flag is not set, the code uses memory from the stack (unsigned char
scsi_result0[256]; in scan_scsis) instead of kmallocating it DMA safe as
it should on non-coherent systems. Maybe this is the thing to change?
regards,
Vivien Chappelier.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: aic7xxx (O2 scsi) DMA coherency
@ 2002-01-03 21:57 ` Alan Cox
0 siblings, 0 replies; 10+ messages in thread
From: Alan Cox @ 2002-01-03 21:57 UTC (permalink / raw)
To: Vivien Chappelier; +Cc: Ralf Baechle, linux-mips
> This tells the aic7xxx to use DMA safe memory for I/O.
That seems totally inappropriate. The unchecked dma option is for
ancient ISA DMA controllers that didnt do the 16Mb check. If you
find you need it debug your pci remapper
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: aic7xxx (O2 scsi) DMA coherency
@ 2002-01-03 21:57 ` Alan Cox
0 siblings, 0 replies; 10+ messages in thread
From: Alan Cox @ 2002-01-03 21:57 UTC (permalink / raw)
To: Vivien Chappelier; +Cc: Ralf Baechle, linux-mips
> This tells the aic7xxx to use DMA safe memory for I/O.
That seems totally inappropriate. The unchecked dma option is for
ancient ISA DMA controllers that didnt do the 16Mb check. If you
find you need it debug your pci remapper
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: aic7xxx (O2 scsi) DMA coherency
@ 2002-01-03 22:34 ` Alan Cox
0 siblings, 0 replies; 10+ messages in thread
From: Alan Cox @ 2002-01-03 22:34 UTC (permalink / raw)
To: Vivien Chappelier; +Cc: Alan Cox, Ralf Baechle, linux-mips
> scsi_result0[256]; in scan_scsis) instead of kmallocating it DMA safe as
> it should on non-coherent systems. Maybe this is the thing to change?
Please fix that - thats a real bug. Actually you may find the PPC64 people
(Anton and co) already have a patch you can use
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: aic7xxx (O2 scsi) DMA coherency
@ 2002-01-03 22:34 ` Alan Cox
0 siblings, 0 replies; 10+ messages in thread
From: Alan Cox @ 2002-01-03 22:34 UTC (permalink / raw)
To: Vivien Chappelier; +Cc: Alan Cox, Ralf Baechle, linux-mips
> scsi_result0[256]; in scan_scsis) instead of kmallocating it DMA safe as
> it should on non-coherent systems. Maybe this is the thing to change?
Please fix that - thats a real bug. Actually you may find the PPC64 people
(Anton and co) already have a patch you can use
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: aic7xxx (O2 scsi) DMA coherency
2002-01-03 21:51 ` Vivien Chappelier
2002-01-03 22:34 ` Alan Cox
@ 2002-01-03 23:52 ` Ralf Baechle
2002-01-04 17:32 ` Vivien Chappelier
1 sibling, 1 reply; 10+ messages in thread
From: Ralf Baechle @ 2002-01-03 23:52 UTC (permalink / raw)
To: Vivien Chappelier; +Cc: Alan Cox, linux-mips
On Thu, Jan 03, 2002 at 10:51:51PM +0100, Vivien Chappelier wrote:
> > > This tells the aic7xxx to use DMA safe memory for I/O.
> >
> > That seems totally inappropriate. The unchecked dma option is for
> > ancient ISA DMA controllers that didnt do the 16Mb check. If you
> > find you need it debug your pci remapper
>
> This is used when scaning for devices (drivers/scsi/scsi_scan.c) . When
> this flag is not set, the code uses memory from the stack (unsigned char
> scsi_result0[256]; in scan_scsis) instead of kmallocating it DMA safe as
> it should on non-coherent systems. Maybe this is the thing to change?
Indeed, it is. I thought this one died ages ago.
Ralf
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: aic7xxx (O2 scsi) DMA coherency
2002-01-03 21:57 ` Alan Cox
(?)
(?)
@ 2002-01-04 12:30 ` Vivien Chappelier
-1 siblings, 0 replies; 10+ messages in thread
From: Vivien Chappelier @ 2002-01-04 12:30 UTC (permalink / raw)
To: Alan Cox; +Cc: Ralf Baechle, linux-mips
[-- Attachment #1: Type: TEXT/PLAIN, Size: 567 bytes --]
Hello,
On Thu, 3 Jan 2002, Alan Cox wrote:
> > This tells the aic7xxx to use DMA safe memory for I/O.
>
> That seems totally inappropriate. The unchecked dma option is for
> ancient ISA DMA controllers that didnt do the 16Mb check.
>
Maybe this is more appropriate then :)
It tells the scsi scanner to always use DMA safe memory when doing its
INQUIRY commands...
On the O2, kernel is running in cacheable, non-coherent memory. kmalloc,
with GFP_DMA flag will return a piece of uncacheable memory which is safe
for I/O with devices.
regards,
Vivien Chappelier
[-- Attachment #2: Type: TEXT/plain, Size: 952 bytes --]
--- linux/drivers/scsi/scsi_scan.c Thu Dec 20 18:31:09 2001
+++ linux.patch/drivers/scsi/scsi_scan.c Fri Jan 4 13:17:31 2002
@@ -283,7 +283,6 @@
unsigned int lun;
unsigned int max_dev_lun;
unsigned char *scsi_result;
- unsigned char scsi_result0[256];
Scsi_Device *SDpnt;
Scsi_Device *SDtail;
unsigned int sparse_lun;
@@ -305,8 +304,7 @@
scsi_initialize_queue(SDpnt, shpnt);
SDpnt->request_queue.queuedata = (void *) SDpnt;
/* Make sure we have something that is valid for DMA purposes */
- scsi_result = ((!shpnt->unchecked_isa_dma)
- ? &scsi_result0[0] : kmalloc(512, GFP_DMA));
+ scsi_result = kmalloc(512, GFP_DMA);
}
if (scsi_result == NULL) {
@@ -463,7 +461,7 @@
}
/* If we allocated a buffer so we could do DMA, free it now */
- if (scsi_result != &scsi_result0[0] && scsi_result != NULL) {
+ if (scsi_result != NULL) {
kfree(scsi_result);
} {
Scsi_Device *sdev;
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: aic7xxx (O2 scsi) DMA coherency
2002-01-03 23:52 ` Ralf Baechle
@ 2002-01-04 17:32 ` Vivien Chappelier
0 siblings, 0 replies; 10+ messages in thread
From: Vivien Chappelier @ 2002-01-04 17:32 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Alan Cox, linux-mips
[-- Attachment #1: Type: TEXT/PLAIN, Size: 899 bytes --]
On Thu, 3 Jan 2002, Ralf Baechle wrote:
> On Thu, Jan 03, 2002 at 10:51:51PM +0100, Vivien Chappelier wrote:
>
> > > > This tells the aic7xxx to use DMA safe memory for I/O.
> > >
> > > That seems totally inappropriate. The unchecked dma option is for
> > > ancient ISA DMA controllers that didnt do the 16Mb check. If you
> > > find you need it debug your pci remapper
> >
> > This is used when scaning for devices (drivers/scsi/scsi_scan.c) . When
> > this flag is not set, the code uses memory from the stack (unsigned char
> > scsi_result0[256]; in scan_scsis) instead of kmallocating it DMA safe as
> > it should on non-coherent systems. Maybe this is the thing to change?
>
> Indeed, it is. I thought this one died ages ago.
Here is a patch to fix that then. It forces allocation of DMA safe
memory in any case. I've not looked at the PPC64 patch however.
regards,
Vivien Chappelier.
[-- Attachment #2: Type: TEXT/PLAIN, Size: 952 bytes --]
--- linux/drivers/scsi/scsi_scan.c Thu Dec 20 18:31:09 2001
+++ linux.patch/drivers/scsi/scsi_scan.c Fri Jan 4 13:17:31 2002
@@ -283,7 +283,6 @@
unsigned int lun;
unsigned int max_dev_lun;
unsigned char *scsi_result;
- unsigned char scsi_result0[256];
Scsi_Device *SDpnt;
Scsi_Device *SDtail;
unsigned int sparse_lun;
@@ -305,8 +304,7 @@
scsi_initialize_queue(SDpnt, shpnt);
SDpnt->request_queue.queuedata = (void *) SDpnt;
/* Make sure we have something that is valid for DMA purposes */
- scsi_result = ((!shpnt->unchecked_isa_dma)
- ? &scsi_result0[0] : kmalloc(512, GFP_DMA));
+ scsi_result = kmalloc(512, GFP_DMA);
}
if (scsi_result == NULL) {
@@ -463,7 +461,7 @@
}
/* If we allocated a buffer so we could do DMA, free it now */
- if (scsi_result != &scsi_result0[0] && scsi_result != NULL) {
+ if (scsi_result != NULL) {
kfree(scsi_result);
} {
Scsi_Device *sdev;
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: aic7xxx (O2 scsi) DMA coherency
[not found] <20020104194622.29320.qmail@gateway.total-knowledge.com>
@ 2002-01-04 20:58 ` Vivien Chappelier
0 siblings, 0 replies; 10+ messages in thread
From: Vivien Chappelier @ 2002-01-04 20:58 UTC (permalink / raw)
To: Ilya Volynets; +Cc: linux-mips
On Fri, 4 Jan 2002, Ilya Volynets wrote:
> On Friday 04 January 2002 11:33 am, you wrote:
> This is true in theory. In practice you have to look at kmalloc implementation
> and how it uses GFP_DMA. I don't remember anything arch specific in there,
> but I never seriously dug in that part. I believe it doesn't do what we need,
> otherwice We'd be using it for pci_alloc_consistent.
Well, both pci_alloc_consistent and kmalloc will end up calling
__get_free_pages, with the GFP_DMA flag set. On setup, with the MIPS64
arch, DMA memory is set to start in non-cacheable space (don't know how).
So both pci_alloc_consistent and kmalloc(GFP_DMA,...) will return DMA safe
(i.e. non cacheable) memory.
see mm/slab.c (for kmalloc and how it finally calls __get_free_pages).
regards,
Vivien Chappelier.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2002-01-04 21:59 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-03 21:34 aic7xxx (O2 scsi) DMA coherency Vivien Chappelier
2002-01-03 21:57 ` Alan Cox
2002-01-03 21:57 ` Alan Cox
2002-01-03 21:51 ` Vivien Chappelier
2002-01-03 22:34 ` Alan Cox
2002-01-03 22:34 ` Alan Cox
2002-01-03 23:52 ` Ralf Baechle
2002-01-04 17:32 ` Vivien Chappelier
2002-01-04 12:30 ` Vivien Chappelier
[not found] <20020104194622.29320.qmail@gateway.total-knowledge.com>
2002-01-04 20:58 ` Vivien Chappelier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.