* RE: DMA from high memory regions
[not found] <7BFCE5F1EF28D64198522688F5449D5A03BFD8@xchangeserver2.storigen.com>
@ 2002-06-26 16:43 ` Imran Badr
2002-07-09 2:37 ` DMA from high memory regions, GFP_KERNEL and virt_to_bus Imran Badr
0 siblings, 1 reply; 3+ messages in thread
From: Imran Badr @ 2002-06-26 16:43 UTC (permalink / raw)
To: 'Larry Sendlosky', 'lkml'
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/
^ permalink raw reply [flat|nested] 3+ messages in thread* RE: DMA from high memory regions, GFP_KERNEL and virt_to_bus
2002-06-26 16:43 ` DMA from high memory regions Imran Badr
@ 2002-07-09 2:37 ` Imran Badr
0 siblings, 0 replies; 3+ messages in thread
From: Imran Badr @ 2002-07-09 2:37 UTC (permalink / raw)
To: 'Larry Sendlosky', 'lkml'
I really appreciate your useful suggestions. I have another question about
kmalloc. Whenever kmalloc() is called with GFP_KERNEL flag, does it always
returns mapped memory pointer? Is it guaranteed that virt_to_bus() is going
to return correct bus address for that memory pointer ?
Thanks,
Imran.
-----Original Message-----
From: linux-kernel-owner@vger.kernel.org
[mailto:linux-kernel-owner@vger.kernel.org]On Behalf Of Imran Badr
Sent: Wednesday, June 26, 2002 9:43 AM
To: 'Larry Sendlosky'; 'lkml'
Subject: RE: DMA from high memory regions
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/
-
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Linux 2.4.19-rc1
@ 2002-06-25 23:06 Simon Kirby
2002-06-25 23:29 ` DMA from high memory regions Imran Badr
0 siblings, 1 reply; 3+ messages in thread
From: Simon Kirby @ 2002-06-25 23:06 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: lkml
Hello,
This fix did not yet make it in to the tg3 driver as of -rc1. This patch
fixes an occasional crash problem with several of our boxes and the tg3
driver (fix from Jes).
--
Hi Dave
Here's another one, tg3_recycle_rx() needs to declare dest_idx_unmasked
as unsigned int or it will do funny stuff on modular division once we go
above 31 bit values.
I don't think this is the bug that Scott was hitting, but it is of
course possible. It takes about 120 minutes for me with a packet
generator, spewing out 64 byte packets, to trigger it.
Cheers,
Jes
--- ../orig/drivers/net/tg3.c Tue May 14 07:30:52 2002
+++ drivers/net/tg3.c Fri Jun 14 11:20:48 2002
@@ -1689,7 +1669,7 @@
* tg3_alloc_rx_skb for full details.
*/
static void tg3_recycle_rx(struct tg3 *tp, u32 opaque_key,
- int src_idx, int dest_idx_unmasked)
+ int src_idx, u32 dest_idx_unmasked)
{
struct tg3_rx_buffer_desc *src_desc, *dest_desc;
struct ring_info *src_map, *dest_map;
--
Simon-
[ Stormix Technologies Inc. ][ NetNation Communications Inc. ]
[ sim@stormix.com ][ sim@netnation.com ]
[ Opinions expressed are not necessarily those of my employers. ]
^ permalink raw reply [flat|nested] 3+ messages in thread* DMA from high memory regions
2002-06-25 23:06 Linux 2.4.19-rc1 Simon Kirby
@ 2002-06-25 23:29 ` Imran Badr
0 siblings, 0 replies; 3+ messages in thread
From: Imran Badr @ 2002-06-25 23:29 UTC (permalink / raw)
To: 'lkml'
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-07-09 2:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <7BFCE5F1EF28D64198522688F5449D5A03BFD8@xchangeserver2.storigen.com>
2002-06-26 16:43 ` DMA from high memory regions Imran Badr
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox