JuliaComputing / xtrx_julia

XTRX LiteX/LitePCIe based design for Julia Computing
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

DMA Mask Fixes #160

Closed sjkelly closed 2 years ago

sjkelly commented 2 years ago

This fixes a deprecated API on Linux 5.18. It also adds a speculative fix to set the DMA_BIT_MASK to DMA_ADDR_WIDTH based on my understanding of: https://www.kernel.org/doc/Documentation/DMA-API-HOWTO.txt

staticfloat commented 2 years ago

This seems, at first glance, to be correct to me. I am curious however about this note in the linked docs:

Special note about PCI: PCI-X specification requires PCI-X devices to support 64-bit addressing (DAC) for all transactions. And at least one platform (SGI SN2) requires 64-bit consistent allocations to operate correctly when the IO bus is in PCI-X mode.

Does this mean that it's illegal to set a mask smaller than 32 bits for a PCIe device? Or does it mean that the hardware must be capable of sending back and forth data packets with 64 bit addresses, but it's still allowed to request that the high 32 bits are all zero, for example?

sjkelly commented 2 years ago

I think PCI-X is different than PCIe in this case. There is more here: https://docs.oracle.com/cd/E19253-01/816-4854/hwovr-25/index.html

PCI supports both 32-bit and 64-bit addresses for memory space.

So I would suspect 32 bits as a hard minimum. Though it appears the Linux kernel DMA API does not care about the size of the DMA address space.

staticfloat commented 2 years ago

I think PCI-X is different than PCIe in this case.

https://en.wikipedia.org/wiki/PCI-X

Not to be confused with PCI Express (PCI-E or PCIe).

Good catch. :P