We have a PCIe device that does DMA transfers from device memory to system memory. Our device is 64-bit DMA capable, but fetches DMA descriptors from 32-bit bus addresses (i.e., it requires DMA descriptors to be available at bus addresses below 4GB).
As part of its initialization, the device driver indicates the device is 64-bit DMA capable by calling
pci_set_dma_mask(dev, DMA_BIT_MASK(64)) (and checks the return value is 0). Then, it indicates the device can only address 32-bit consistent memory by calling
pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(32)) (and also checks the return value is 0).
To setup DMA transfers, the driver allocates one or more 4kB pages in consistent memory:
pci_alloc_consistent(dev, size, &dmaAddress).
One of our customers is reporting issues on an NVIDIA Xavier module (Linux kernel 4.9.108-tegra). Our investigations have shown that the dmaAddress obtained from pci_alloc_consistent is above 4GB (e.g. 0x0000_0004_fdff_f000). Considering that
pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(32)) was successful, this should not happen. DMA addresses obtained from
pci_alloc_consistent should be less than 4GB.
Is this a known issue? Is a fix available?