Messages in this thread |  | | From | "Imran Badr" <> | Subject | RE: Calculating kernel logical address .. | Date | Mon, 9 Sep 2002 11:49:02 -0700 |
| |
-----Original Message----- From: linux-kernel-owner@vger.kernel.org [mailto:linux-kernel-owner@vger.kernel.org]On Behalf Of Daniel Phillips Sent: Monday, September 09, 2002 11:23 AM To: Andrew Morton; imran.badr@cavium.com Cc: root@chaos.analogic.com; 'David S. Miller'; linux-kernel@vger.kernel.org Subject: Re: Calculating kernel logical address ..
On Monday 09 September 2002 20:08, Andrew Morton wrote: > Imran Badr wrote: > > > > The virt_to_bus() macro would work only for kernel logical addresses. I am > > trying to find a portable way to figure out the kernel logical address of a > > user buffer so that I could use virt_to_bus() for DMA. The user address is > > mmap'ed from kmalloc'ed buffer in the mmap() entry of my driver. Now when > > the user wants to send this data to the PCI device, it makes an ioctl call > > and give the user address to the driver. Now driver has to figure out the > > kernel logical address for DMA. > > You can obtain this info by walking the user's pagetables with > get_user_pages(). That give `struct page' pointers, with which > all things are possible.
>As long as you can be sure they won't spontaneously vanish on you.
>-- >Daniel >- >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/
down(¤t->mm->mmap_sem) would help.
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/
|  |