PCIe Device to Host DMA now working, but why!!!

Hi,

I had posted a question some time back looking for reasons why my device to host dma was not working ( http://www.osronline.com/showthread.cfm?link=226257 ). Now we found out that setting Maximum payload size value in config space to 512 bytes solves the whole issue and dma is working now. Earlier value of this register was 1024 bytes and it looks like no other values except 512 work!!! can anybody tell me what is going on here!?

thanks
rohit.

xxxxx@gmail.com wrote:

I had posted a question some time back looking for reasons why my device to host dma was not working ( http://www.osronline.com/showthread.cfm?link=226257 ). Now we found out that setting Maximum payload size value in config space to 512 bytes solves the whole issue and dma is working now. Earlier value of this register was 1024 bytes and it looks like no other values except 512 work!!! can anybody tell me what is going on here!?

That’s odd. Is your PCIExpress IP supposed to handle 1024-byte TLPs?
How old is your motherboard? Are you sure that your IP is honoring the
value in your config space?

The root complex has its own upper limit. It is not required to support
every possible payload size. For example, most early PCIExpress boards
couldn’t handle TLPs larger than 128 bytes. The actual limit imposed on
your wire is the minimum of the root complex limit and your board’s
config space limit. If your root complex’s limit is below 1024, then
your change should not have made any difference at all.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

I believe that it is the System Software’s (i.e. the System BIOS’s)
responsibility to program the value in the Maximum Payload Size in the
Device Control register in the PCIe Capabiliies structure. The way I read
his email is that his driver (or his hardware or firmware) was setting
this field. Even though his device may support such a payload size, that
value may violate upstream components’ capabilities.

Tim Roberts
Sent by: xxxxx@lists.osr.com
07/06/2012 12:39 PM
Please respond to
“Windows System Software Devs Interest List”

To
“Windows System Software Devs Interest List”
cc

Subject
Re: [ntdev] PCIe Device to Host DMA now working, but why!!!

xxxxx@gmail.com wrote:
> I had posted a question some time back looking for reasons why my device
to host dma was not working (
http://www.osronline.com/showthread.cfm?link=226257 ). Now we found out
that setting Maximum payload size value in config space to 512 bytes
solves the whole issue and dma is working now. Earlier value of this
register was 1024 bytes and it looks like no other values except 512
work!!! can anybody tell me what is going on here!?

That’s odd. Is your PCIExpress IP supposed to handle 1024-byte TLPs?
How old is your motherboard? Are you sure that your IP is honoring the
value in your config space?

The root complex has its own upper limit. It is not required to support
every possible payload size. For example, most early PCIExpress boards
couldn’t handle TLPs larger than 128 bytes. The actual limit imposed on
your wire is the minimum of the root complex limit and your board’s
config space limit. If your root complex’s limit is below 1024, then
your change should not have made any difference at all.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

xxxxx@attotech.com wrote:

I believe that it is the System Software’s (i.e. the System BIOS’s)
responsibility to program the value in the Maximum Payload Size in the
Device Control register in the PCIe Capabiliies structure. The way I
read his email is that his driver (or his hardware or firmware) was
setting this field. Even though his device may support such a payload
size, that value may violate upstream components’ capabilities.

Well, we’re both right. The device declares the maximum value it can
support in the Device Capabilities register, which is read-only. The
BIOS programs the Device Control register with the computed value for
this link.

I interpreted his message to mean “we changed our device firmware to
reduce the maximum size reported in the Device Capabilities register”.
You interpreted his message to mean “we overrode the value in the Device
Control register”. If your interpretation is correct, then your
conclusion is also correct.

To the original poster, if that’s what you did, that’s invalid. The
value in the Device Control register is the one your device must use.
You can’t arbitrarily override it.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

In “Device Capabilities Register”, Max payload size is set to 1024 bytes.
When my driver sets(overrides) the Max payload size in “Device Control Register” to 256 bytes ( I my earlier post i mentioned it as 512, sorry.) dev_to_host dma starts working.

The initial value of Max payload size in “Device Control Register” was 1024 bytes, this i believe was set by the BIOS?

Does it mean that BIOS was wrongly setting it to 1024 bytes when in reality it could support only 256 bytes payload?

xxxxx@gmail.com wrote:

In “Device Capabilities Register”, Max payload size is set to 1024 bytes.
When my driver sets(overrides) the Max payload size in “Device Control Register” to 256 bytes ( I my earlier post i mentioned it as 512, sorry.) dev_to_host dma starts working.

The initial value of Max payload size in “Device Control Register” was 1024 bytes, this i believe was set by the BIOS?

Does it mean that BIOS was wrongly setting it to 1024 bytes when in reality it could support only 256 bytes payload?

That’s very unlikely, unless you’ve flashed the BIOS with code that
doesn’t match your hardware. Are you sure your PCIe IP can handle
1024-byte TLPs? Is this a recent motherboard? What chipset does it have?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

I’ve seen some boxes a couple years ago where the PCIe tree could not handle larger transfer sizes, even though it claimed to.