All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: PCIe device driver question
@ 2008-07-31  9:58 Sanka Piyaratna
  0 siblings, 0 replies; 15+ messages in thread
From: Sanka Piyaratna @ 2008-07-31  9:58 UTC (permalink / raw)
  To: Robert Hancock; +Cc: linux-kernel

Hi Robert,

Thanks for that, I did not notice that in the spec. I am currently using 64 bit format unconditionally and this must be what is going wrong. 

Thank you so much for that.


Sanka


----- Original Message ----
From: Robert Hancock <hancockr@shaw.ca>
To: Sanka Piyaratna <cesanka@yahoo.com>
Cc: linux-kernel@vger.kernel.org
Sent: Thursday, 31 July, 2008 6:14:54 PM
Subject: Re: PCIe device driver question

Sanka Piyaratna wrote:
> I allocate memory in the user land using memalign function (typically I allocate about 500 MB) and pass this to the kernel space. In my device driver, I call get_user_pages() to lock down the memory and extract the relevant pages. A scatter-gather list is generated using these page addresses and hence derive the dma_addresses using page_to_phys() function. These addresses are programmed into a FIFO in the hardware device using a memory mapped register interface (PCI BAR based). Subsequently the hardware start filling up the pages and interrupt when a block of pages are complete. I notice the hardware hang (PCIe packets don't seem to get the acknowledgements from the root complex) when the DMA address is < 0x0000_0001_0000_0000. I have verified in the hardware that the PCIe packet is created with the correct address as programed by the device driver dma_address. If i can guard some how that the memory allocation is with in a certain area, I can stop the
>  problem from occuring. Are there any bridge functionality in the Intel architecture that may mask a certain region of memory?

How are you formatting the addresses in the TLP? The PCI Express spec 
says that for addresses below 4GB the 32-bit addressing format must be 
used (you can't use the 64-bit format unconditionally). It could be that 
is what is making the chipset unhappy.



      Find a better answer, faster with the new Yahoo!7 Search. www.yahoo7.com.au/search

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: PCIe device driver question
@ 2008-07-30 22:55 Sanka Piyaratna
  2008-07-31  8:44 ` Robert Hancock
  0 siblings, 1 reply; 15+ messages in thread
From: Sanka Piyaratna @ 2008-07-30 22:55 UTC (permalink / raw)
  To: Robert Hancock; +Cc: linux-kernel

I allocate memory in the user land using memalign function (typically I allocate about 500 MB) and pass this to the kernel space. In my device driver, I call get_user_pages() to lock down the memory and extract the relevant pages. A scatter-gather list is generated using these page addresses and hence derive the dma_addresses using page_to_phys() function. These addresses are programmed into a FIFO in the hardware device using a memory mapped register interface (PCI BAR based). Subsequently the hardware start filling up the pages and interrupt when a block of pages are complete. I notice the hardware hang (PCIe packets don't seem to get the acknowledgements from the root complex) when the DMA address is < 0x0000_0001_0000_0000. I have verified in the hardware that the PCIe packet is created with the correct address as programed by the device driver dma_address. If i can guard some how that the memory allocation is with in a certain area, I can stop the
 problem from occuring. Are there any bridge functionality in the Intel architecture that may mask a certain region of memory?

Thanks and regards,

Sanka



----- Original Message ----
From: Robert Hancock <hancockr@shaw.ca>
To: Sanka Piyaratna <cesanka@yahoo.com>
Cc: linux-kernel@vger.kernel.org
Sent: Thursday, 31 July, 2008 4:54:48 AM
Subject: Re: PCIe device driver question

Sanka Piyaratna wrote:
> Hi,
> 
> I am currently developing a PCIe data capture card hardware and the
> device drivers to drive this. I have implemented DMA on the data
> capture and the scatter-gather DMA is implemented in the hardware.  I
> am testing this in an X86_64 architecture machine with 4 GB of RAM. I
> am able to successfully dma data into any memory (dma) address >
> 0x0000_0001_0000_0000. However, my problem is to dma data to any
> address less than this. When I try to DMA data to an address less than
> 0x0000_0001_0000_0000, the hardware device hangs indicating that the
> address does not exist.
> 
> I have implemented the DMA mask to be full 64 bit and my hardware is
> capable of transfering data to any address < 8TB. I am using kernel
> version 2.6.23.11. 
> 
> Could you please let me know what I might be doing wrong?

The kernel can't do anything to stop you from DMAing anywhere you want 
(barring the system having special IOMMU hardware). If you overwrite 
something you shouldn't have you'll cause a crash, but the kernel has no 
influence on it really.

Unless you're messing up the DMA addresses somehow and writing into a 
space that's not actually RAM (like the MMIO memory hole or something), 
my guess is it's likely a hardware problem..



      Find a better answer, faster with the new Yahoo!7 Search. www.yahoo7.com.au/search

^ permalink raw reply	[flat|nested] 15+ messages in thread
[parent not found: <fa.+kKL98uFtvbcX3ymh2HlJuUDVwY@ifi.uio.no>]
* Re: PCIe device driver question
@ 2008-07-30 16:09 Sanka Piyaratna
  2008-07-30 16:51 ` V.Radhakrishnan
  2008-07-30 16:55 ` Alan Cox
  0 siblings, 2 replies; 15+ messages in thread
From: Sanka Piyaratna @ 2008-07-30 16:09 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

Hi Alan,

Actually the failures occur at addresses lot higher than this range, I am noticing the failure at dma address 0x0000000037845000. This would be at around 900MB ?

Thanks

Sanka



----- Original Message ----
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Sanka Piyaratna <cesanka@yahoo.com>
Cc: linux-kernel@vger.kernel.org
Sent: Thursday, 31 July, 2008 1:17:18 AM
Subject: Re: PCIe device driver question

On Wed, 30 Jul 2008 09:00:58 -0700 (PDT)
Sanka Piyaratna <cesanka@yahoo.com> wrote:

> Hi,
> 
> I am currently developing a PCIe data capture card hardware and the
> device drivers to drive this. I have implemented DMA on the data
> capture and the scatter-gather DMA is implemented in the hardware.  I
> am testing this in an X86_64 architecture machine with 4 GB of RAM. I
> am able to successfully dma data into any memory (dma) address >
> 0x0000_0001_0000_0000. However, my problem is to dma data to any
> address less than this. When I try to DMA data to an address less than
> 0x0000_0001_0000_0000, the hardware device hangs indicating that the
> address does not exist.

Assuming the failures are in the range 640K-1MB then I would imagine your
bridge doesn't permit transfers via DMA to the ISA hole.



      Find a better answer, faster with the new Yahoo!7 Search. www.yahoo7.com.au/search

^ permalink raw reply	[flat|nested] 15+ messages in thread
* PCIe device driver question
@ 2008-07-30 16:00 Sanka Piyaratna
  2008-07-30 15:47 ` Alan Cox
  0 siblings, 1 reply; 15+ messages in thread
From: Sanka Piyaratna @ 2008-07-30 16:00 UTC (permalink / raw)
  To: linux-kernel

Hi,

I am currently developing a PCIe data capture card hardware and the
device drivers to drive this. I have implemented DMA on the data
capture and the scatter-gather DMA is implemented in the hardware.  I
am testing this in an X86_64 architecture machine with 4 GB of RAM. I
am able to successfully dma data into any memory (dma) address >
0x0000_0001_0000_0000. However, my problem is to dma data to any
address less than this. When I try to DMA data to an address less than
0x0000_0001_0000_0000, the hardware device hangs indicating that the
address does not exist.

I have implemented the DMA mask to be full 64 bit and my hardware is
capable of transfering data to any address < 8TB. I am using kernel
version 2.6.23.11. 

Could you please let me know what I might be doing wrong?

Thanks and regards,

Sanka


      Find a better answer, faster with the new Yahoo!7 Search. www.yahoo7.com.au/search

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

end of thread, other threads:[~2008-07-31 20:43 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <fa.PmBLCqOb4Xo53y3W9hAdnsU50Og@ifi.uio.no>
     [not found] ` <fa.42mxuHHJP7XQmYeyxNoEC/NFUHA@ifi.uio.no>
2008-07-30 19:21   ` PCIe device driver question Robert Hancock
2008-07-31 13:11     ` V.Radhakrishnan
2008-07-31 17:37       ` Robert Hancock
2008-07-31 18:47         ` V.Radhakrishnan
2008-07-31 18:52           ` Robert Hancock
2008-07-31 20:47             ` V.Radhakrishnan
2008-07-31  9:58 Sanka Piyaratna
  -- strict thread matches above, loose matches on Subject: below --
2008-07-30 22:55 Sanka Piyaratna
2008-07-31  8:44 ` Robert Hancock
     [not found] <fa.+kKL98uFtvbcX3ymh2HlJuUDVwY@ifi.uio.no>
2008-07-30 19:24 ` Robert Hancock
2008-07-30 16:09 Sanka Piyaratna
2008-07-30 16:51 ` V.Radhakrishnan
2008-07-30 16:55 ` Alan Cox
2008-07-30 16:00 Sanka Piyaratna
2008-07-30 15:47 ` Alan Cox

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.