RE: PCI DMA mapping question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I was under the impression that GFP_DMA was only needed if you were
allocating memory to be used with the ISA bus.  At least on x86 the PCI bus
can perform DMA on any 32-bit memory address.

ISA (presumably because it's a 16-bit bus) can only access memory from 0 to
16MB, and this is why GFP_DMA is needed.

Am I completely wrong ?

dom 



-----Original Message-----
From: Momchil Velikov [mailto:velco@fadata.bg]
Sent: Thursday, March 25, 2004 3:19 PM
To: Mandeep Singh Sandhu
Subject: Re: PCI DMA mapping question


>>>>> "Mandeep" == Mandeep Singh Sandhu <mandeep_sandhu@infosys.com> 
>>>>> writes:

Mandeep> if i'm allocating by transmit and recieve buffers,
Mandeep> for my ethernet driver, using pci_alloc_consistent then do i 
Mandeep> need to establish bounce buffers as well in case i get a 
Mandeep> mapping in a non-DMA zone?? but in Rubini's book it's written - 
Mandeep> "Allocation is handled in this function so that the buffer will 
Mandeep> be placed in a location that works with DMA..."

  That function checks the device addressing capabilities.  It assumes that
if a device can be addressed in a region with certain characteristics then
*IT* can also address any region with the same characteristics.  For
example, if a device requested to be accessible for MMIO in a region under
1M, the kernel assumes that the device itself can address any region under
1M, thus it allocates page(s) with GFP_DMA set.

Mandeep> so then do i need to keep bounce buffers??

  I'm not sure what's the exact meaning of ``bounce buffer''.  I tend to
think that these ARE the bounce buffers (as opposed to having potentially
larger buffers elsewhere or locking user pages for doing DMA to them).

Mandeep> then it says that the allocation uses GFP_ATOMIC priority, 
Mandeep> shud'nt it use the GFP_DMA priority instead to ensure the 
Mandeep> addresses are allocated in the DMA zone??

  GFP_ATOMIC and GPF_DMA are independent and can be set at once. GFP_ATOMIC
means ``don't sleep'' (which, btw, is by no means ``atomic''), GPF_DMA means
``allocate under 1M''.

~velco

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux