On Mon, Mar 11, 2019 at 09:43:19AM +0100, Stanislaw Gruszka wrote: > > > However after fixing that mt76usb still did not work. To make things > > > work we had to change rx frag size from 2048 to PAGE_SIZE and change > > > virt_to_head_page() to virt_to_page() when setting SG's. > > > > > I think I understand why first change was needed. If we do 2 separate > > > dma maps of 2 different buffers in single page i.e (PAGE + off=0 > > > and PAGE + off=2048) it causes problem. So either map_sg() return > > > error which mt76usb does not handle correctly or there is issue > > > in AMD IOMMU because two dma maps use the same page. > > Any comment on that? Is fine or not to do 2 or more dma mappings > within the same single page on AMD IOMMU? If not, is there any > mechanism for drivers to find out about this limitation to prevent > to prepare wrong SG buffers? FTR: it was confirmed by Jan (bug reporter) the 2 or more dma mappings within single page works with AMD IOMMU. Most likely it was needed previously to workaround this sg->offset problem until proper fix to AMD IOMMU was applied. Stanislaw