Am 12.03.20 um 11:19 schrieb Christoph Hellwig:
On Thu, Mar 12, 2020 at 11:14:22AM +0100, Christian König wrote:
The page pointer is set to NULL and only the DMA address,
length and offset values are valid.
NAK. The only valid way to fill DMA address in scatterlists is
dma_map_sg / dma_map_sg_attr.
How can we then map PCIe BARs into an scatterlist which are not backed by
struct pages?
You can't. scatterlists by definition map memory backed by a struct
page. If you want to map something else struct scatterlist is the
wrong structure and you need to use something else (which you should
anyway as struct scatterlist is a bad design patter, and the above
is only one of the many issues with it).
But how should we then deal with all the existing interfaces which
already take a scatterlist/sg_table ?
The whole DMA-buf design and a lot of drivers are build around
scatterlist/sg_table and to me that actually makes quite a lot of sense.
For TTM I'm also trying for quite a while to just nuke the manual
dma_address arrays we have and switch over to scatterlist/sg_table.
I mean we could come up with a new structure for this, but to me that
just looks like reinventing the wheel. Especially since drivers need to
be able to handle both I/O to system memory and I/O to PCIe BARs.
Regards,
Christian.