public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Imran Badr" <imran.badr@cavium.com>
To: "'Larry Sendlosky'" <Larry.Sendlosky@storigen.com>,
	"'lkml'" <linux-kernel@vger.kernel.org>
Subject: RE: DMA from high memory regions
Date: Wed, 26 Jun 2002 09:43:22 -0700	[thread overview]
Message-ID: <004301c21d30$969c5a20$9e10a8c0@IMRANPC> (raw)
In-Reply-To: <7BFCE5F1EF28D64198522688F5449D5A03BFD8@xchangeserver2.storigen.com>


Many thanks for the reply. It sure works and I noticed that code in
pci_map_page() api. Previously I was using kernel 2.4.2 fron RedHat7.1 which
has no such kernel function.
Now, if I need to access that page in my device driver, how can I get kernel
virtual address without using kmap?

Thanks,
Imran.

-----Original Message-----
From: Larry Sendlosky [mailto:Larry.Sendlosky@storigen.com]
Sent: Wednesday, June 26, 2002 6:33 AM
To: imran.badr@cavium.com
Subject: RE: DMA from high memory regions


There is no need to kmap.

1) call map_user_kiobuf to make sure buffer is mapped and pages
   are not swapped.

2) call lock_kiovec to lock the pages for I/O

3) use the struct page pointers in the kiobuf maplist
   to compute physical page address of each page.
   eg  ((struct_page_pointer - mem_map) << PAGE_SHIFT)   is physical
   address of the page described by 'struct page *struct_page_pointer'.

   You now have the physical addresses needed to give to the device
   for DMA.


-----Original Message-----
From: Imran Badr [mailto:imran.badr@cavium.com]
Sent: Tuesday, June 25, 2002 7:30 PM
To: 'lkml'
Subject: DMA from high memory regions


Hi,

I am trying to setup DMA to/from user space. I get a user pointer in my
device driver, from which I build up kiobuf and call map_user_kiobuf. After
this, I call kmap to map pages to kernel virtual space and then virt_to_bus
to get bus address. Now if I define CONFIG_HIGHMEM and that page happens to
be in the memory region near 1GB then DMA never happens and I donot see any
data in result pointer. If CONFIG_HIGHMEM is not defined, then everything
works perfectly. Please suggest any solution.

Thanks,
Imran.



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


       reply	other threads:[~2002-06-26 16:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <7BFCE5F1EF28D64198522688F5449D5A03BFD8@xchangeserver2.storigen.com>
2002-06-26 16:43 ` Imran Badr [this message]
2002-07-09  2:37   ` DMA from high memory regions, GFP_KERNEL and virt_to_bus Imran Badr
2002-06-25 23:06 Linux 2.4.19-rc1 Simon Kirby
2002-06-25 23:29 ` DMA from high memory regions Imran Badr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='004301c21d30$969c5a20$9e10a8c0@IMRANPC' \
    --to=imran.badr@cavium.com \
    --cc=Larry.Sendlosky@storigen.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox