All of lore.kernel.org
 help / color / mirror / Atom feed
* [Query]  doubt on parameters passed to dma_map_single_attrs() API
@ 2016-03-22 10:23 ` Sodagudi Prasad
  0 siblings, 0 replies; 4+ messages in thread
From: Sodagudi Prasad @ 2016-03-22 10:23 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linux; +Cc: shashim, sboyd, psodagud


Hi All,

Would like to check whether the dma_map_single_attrs() API, can accept 
ptr variable from high memory or not?
If we pass the memory pointer, which is pointing high memory does not 
work with virt_to_page API.

10 static inline dma_addr_t dma_map_single_attrs(struct device *dev, 
void *ptr,
  11                                               size_t size,
  12                                               enum 
dma_data_direction dir,
  13                                               struct dma_attrs 
*attrs)
  14 {
  15         const struct dma_map_ops *ops = get_dma_ops(dev);
  16         dma_addr_t addr;
  17
  18         kmemcheck_mark_initialized(ptr, size);
  19         BUG_ON(!valid_dma_direction(dir));
  20         addr = ops->map_page(dev, virt_to_page(ptr),
  21                              (unsigned long)ptr & ~PAGE_MASK, size,
  22                              dir, attrs);
<Prasad> using the virt_to_page for the high memory will end up with 
wrong address.
  23         debug_dma_map_page(dev, virt_to_page(ptr),
  24                            (unsigned long)ptr & ~PAGE_MASK, size,
  25                            dir, addr, true);
  26         return addr;
  27 }

The only restriction which is observed that, ptr should point to 
physically contiguous memory.

So can we pass high memory mapped address to dma_map_single API or not?

-Thanks, Prasad

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum,
Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Query]  doubt on parameters passed to dma_map_single_attrs() API
@ 2016-03-22 10:23 ` Sodagudi Prasad
  0 siblings, 0 replies; 4+ messages in thread
From: Sodagudi Prasad @ 2016-03-22 10:23 UTC (permalink / raw)
  To: linux-arm-kernel


Hi All,

Would like to check whether the dma_map_single_attrs() API, can accept 
ptr variable from high memory or not?
If we pass the memory pointer, which is pointing high memory does not 
work with virt_to_page API.

10 static inline dma_addr_t dma_map_single_attrs(struct device *dev, 
void *ptr,
  11                                               size_t size,
  12                                               enum 
dma_data_direction dir,
  13                                               struct dma_attrs 
*attrs)
  14 {
  15         const struct dma_map_ops *ops = get_dma_ops(dev);
  16         dma_addr_t addr;
  17
  18         kmemcheck_mark_initialized(ptr, size);
  19         BUG_ON(!valid_dma_direction(dir));
  20         addr = ops->map_page(dev, virt_to_page(ptr),
  21                              (unsigned long)ptr & ~PAGE_MASK, size,
  22                              dir, attrs);
<Prasad> using the virt_to_page for the high memory will end up with 
wrong address.
  23         debug_dma_map_page(dev, virt_to_page(ptr),
  24                            (unsigned long)ptr & ~PAGE_MASK, size,
  25                            dir, addr, true);
  26         return addr;
  27 }

The only restriction which is observed that, ptr should point to 
physically contiguous memory.

So can we pass high memory mapped address to dma_map_single API or not?

-Thanks, Prasad

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum,
Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Query]  doubt on parameters passed to dma_map_single_attrs() API
  2016-03-22 10:23 ` Sodagudi Prasad
@ 2016-03-22 12:34   ` Russell King - ARM Linux
  -1 siblings, 0 replies; 4+ messages in thread
From: Russell King - ARM Linux @ 2016-03-22 12:34 UTC (permalink / raw)
  To: Sodagudi Prasad; +Cc: linux-kernel, linux-arm-kernel, shashim, sboyd

On Tue, Mar 22, 2016 at 03:53:02PM +0530, Sodagudi Prasad wrote:
> 
> Hi All,
> 
> Would like to check whether the dma_map_single_attrs() API, can accept ptr
> variable from high memory or not?

It can't.  Direct mapped, lowmem only.

No pointers allowed from dma_alloc_coherent(), dma_alloc_writecombine(),
ioremap(), vmalloc(), kmap(), kmap_atomic() or similar function, or
derived from one of these.

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Query] doubt on parameters passed to dma_map_single_attrs() API
@ 2016-03-22 12:34   ` Russell King - ARM Linux
  0 siblings, 0 replies; 4+ messages in thread
From: Russell King - ARM Linux @ 2016-03-22 12:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 22, 2016 at 03:53:02PM +0530, Sodagudi Prasad wrote:
> 
> Hi All,
> 
> Would like to check whether the dma_map_single_attrs() API, can accept ptr
> variable from high memory or not?

It can't.  Direct mapped, lowmem only.

No pointers allowed from dma_alloc_coherent(), dma_alloc_writecombine(),
ioremap(), vmalloc(), kmap(), kmap_atomic() or similar function, or
derived from one of these.

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-22 12:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-22 10:23 [Query] doubt on parameters passed to dma_map_single_attrs() API Sodagudi Prasad
2016-03-22 10:23 ` Sodagudi Prasad
2016-03-22 12:34 ` Russell King - ARM Linux
2016-03-22 12:34   ` Russell King - ARM Linux

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.