Hi Harsh,

On 26/03/18 10:55, Harsh Jain wrote:
Hi,

Can we add  offset to dma address received from IOMMU in scatter/Gather list 
before sending it to H/W.

Address to HW = sg_dma_address(sg) + offset, where 0 < offset < sg_dma_len(sg).

sg_dma_address() should already account for sg->offset (i.e. the start of the buffer within the page. If there's a DMA API implementation failing to respect that then that's a bug.

I need this operation to make sure our H/W does not receives entry of size 
greater than 2K.

If however it's just that you want to fragment a single SG entry into multiple commaneds/descriptors/etc. internally to your driver, then I can't see that being an issue as long as you don't visibly modify the scatterlist itself. If there's a genuine length and/or alignment limitation in the hardware, though, it would be better to set up dev->dma_parms appropriately to describe them, such that the subsystem responsible for generating the scatterlist respects the appropriate constraints in the first place (and if it doesn't, then that's another bug to fix).

Robin.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to