When I malloc the memory in user space, the memory may be discontinuous for
large chunks of memory say 16k or 32k. Does the 'kiobuf' interface take
care of this or it assumes it to be continuous?

regards,
Daljeet Maini
IBM Global Services Ltd. - Bangalore
Ph. No. - 5267117 Extn 2954


|--------+----------------------->
|        |          Gerd Knorr   |
|        |          <kraxel@bytes|
|        |          ex.org>      |
|        |                       |
|        |          05/15/01     |
|        |          01:03 PM     |
|        |          Please       |
|        |          respond to   |
|        |          Gerd Knorr   |
|        |                       |
|--------+----------------------->
  >--------------------------------------------------------|
  |                                                        |
  |       To:     [EMAIL PROTECTED]             |
  |       cc:     (bcc: Daljeet Maini/India/IBM)           |
  |       Subject:     Re: mmap                            |
  >--------------------------------------------------------|






[EMAIL PROTECTED] wrote:
>  I am doing the following:
>
>     malloc some memory is user space
>     pass its pointer to some kernel module
>     in the kernel module...do a pci_alloc_consistent so that i get a
memory
>     region for PCI DMA operations

Wrong approach, you can use kiobufs if you want DMA to the malloc()ed
userspace memory:

 * lock down the user memory using map_user_kiobuf() + lock_kiovec()
   (see linux/iobuf.h).
 * translate the iobuf->maplist into a scatterlist [1]
 * feed pci_map_sg() with the scatterlist to get DMA addresses.
   you can pass to the hardware.

And the reverse to free everything when you are done of course.

  Gerd

[1] IMHO it would be more useful if iobufs would use a scatterlist
    instead of an struct page* array.


--
Gerd Knorr <[EMAIL PROTECTED]>  --  SuSE Labs, Außenstelle Berlin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to