On 9/24/20 4:49 AM, Jason Gunthorpe wrote:
On Thu, Sep 24, 2020 at 06:49:07AM +0100, Christoph Hellwig wrote:
+ } else {
+ device->dev.dma_parms = dma_device->dma_parms;
/*
+ * Auto setup the segment size if a DMA device was passed in.
+ * The PCI core sets the maximum segment size to 64 KB. Increase
+ * this parameter to 2 GB.
*/
+ dma_set_max_seg_size(dma_device, SZ_2G);
You can't just inherity DMA properties like this this. Please
fix all code that looks at the seg size to look at the DMA device.
Inherit? This is overriding the PCI default of 64K to be 2G for RDMA
devices.
With inherit I mean the
device->dev.dma_parms = dma_device->dma_parms;
line, which is completely bogus. All DMA mapping is done on the
dma_device in the RDMA core and ULPs, so it also can't have an effect.
Oh. Yes, no idea why that is there..
commit c9121262d57b8a3be4f08073546436ba0128ca6a
Author: Bart Van Assche <bvanassche@xxxxxxx>
Date: Fri Oct 25 15:58:30 2019 -0700
RDMA/core: Set DMA parameters correctly
The dma_set_max_seg_size() call in setup_dma_device() does not have any
effect since device->dev.dma_parms is NULL. Fix this by initializing
device->dev.dma_parms first.
Bart?
(just noticed this email)
Hi Jason,
That code may be a leftover from when the ib_dma_*() functions used &dev->dev as
their first argument instead of dev->dma_device. See also commit 0957c29f78af
("IB/core: Restore I/O MMU, s390 and powerpc support").
Bart.