linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Query on dma_set_mask_and_coherent() Usage
@ 2018-08-23 14:50 Kedareswararao Appana
  2018-08-28 12:55 ` Catalin Marinas
  0 siblings, 1 reply; 2+ messages in thread
From: Kedareswararao Appana @ 2018-08-23 14:50 UTC (permalink / raw)
  To: catalin.marinas, will.deacon; +Cc: linux-arm-kernel, linux-kernel

Hi All,

              On arm64 platform I have booted Linux only with > 32-bit
Address i.e from 0x800000000 (reg =  <0x8 0x00000000 0x0 0x80000000>)

In my driver, I am using dma_set_mask_and_coherent(&pdev->dev,
DMA_BIT_MASK(32)); which should fail if I boot Linux
with the above configuration but the API is returning success.

I have debugged it further and observed that, in the arm64
dma-mapping.c swiotlb is zero resulting dma_supported ops always
returning 1

https://elixir.bootlin.com/linux/v4.17.8/source/arch/arm64/mm/dma-mapping.c#L321

 I will be grateful if someone can send me some pointers for fixing this issue

Regards,
Kedar.

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

* Re: Query on dma_set_mask_and_coherent() Usage
  2018-08-23 14:50 Query on dma_set_mask_and_coherent() Usage Kedareswararao Appana
@ 2018-08-28 12:55 ` Catalin Marinas
  0 siblings, 0 replies; 2+ messages in thread
From: Catalin Marinas @ 2018-08-28 12:55 UTC (permalink / raw)
  To: Kedareswararao Appana; +Cc: will.deacon, linux-kernel, linux-arm-kernel

On Thu, Aug 23, 2018 at 08:20:36PM +0530, Kedareswararao Appana wrote:
>               On arm64 platform I have booted Linux only with > 32-bit
> Address i.e from 0x800000000 (reg =  <0x8 0x00000000 0x0 0x80000000>)

So you have 2GB of RAM starting at 0x8_0000_0000.

> In my driver, I am using dma_set_mask_and_coherent(&pdev->dev,
> DMA_BIT_MASK(32)); which should fail if I boot Linux
> with the above configuration but the API is returning success.
> 
> I have debugged it further and observed that, in the arm64
> dma-mapping.c swiotlb is zero resulting dma_supported ops always
> returning 1
> 
> https://elixir.bootlin.com/linux/v4.17.8/source/arch/arm64/mm/dma-mapping.c#L321
> 
>  I will be grateful if someone can send me some pointers for fixing this issue

It's an assumption we've made here:

https://elixir.bootlin.com/linux/v4.17.8/source/arch/arm64/mm/init.c#L224

32-bit devices are expected to have a dma_pfn_offset (and the hardware
configured accordingly).

-- 
Catalin

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

end of thread, other threads:[~2018-08-28 12:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-23 14:50 Query on dma_set_mask_and_coherent() Usage Kedareswararao Appana
2018-08-28 12:55 ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).