On Thu, Apr 16, 2020 at 12:49:56PM +0300, Dan Carpenter wrote:
> On Tue, Apr 14, 2020 at 04:18:47PM +0200, Ørjan Eide wrote:
> > @@ -238,6 +242,10 @@ static void ion_unmap_dma_buf(struct
> > dma_buf_attachment *attachment,
> > s
On Tue, Apr 14, 2020 at 04:28:10PM +0200, Greg Kroah-Hartman wrote:
> On Tue, Apr 14, 2020 at 04:18:47PM +0200, �rjan Eide wrote:
> > Only sync the sg-list of an Ion dma-buf attachment when the attachment
> > is actually mapped on the device.
> >
> > dma-bufs may be synced at any time. It can be
dma-direct: correct the physical addr in
dma_direct_sync_sg_for_cpu/device") moves the dma-api back to the old
behaviour and picks the dma_address that may be invalid.
dma-buf core doesn't ensure that the buffer is mapped on the device, and
thus have a valid sg_list, before calling the exporter's
beg
dma-direct: correct the physical addr in
dma_direct_sync_sg_for_cpu/device") moves the dma-api back to the old
behaviour and picks the dma_address that may be invalid.
dma-buf core doesn't ensure that the buffer is mapped on the device, and
thus have a valid sg_list, before calling the exporter's
beg
back to the device using dma_sync_{single,sg}_to_device.
>
> > I've run some testing, and this patch does indeed fix the crash in
> > dma_sync_sg_for_cpu when it tried to use the 0 dma_address from the sg
> > list.
> >
> > Tested-by: Ørjan Eide
> >
&g
rally
> > > while a buffer is dma mapped you have the device access it (though of
> > > course it is supported for CPU to access to the buffer while dma mapped)
> > > and then once the buffer is dma-unmapped the CPU can access it. This is
> > > how the D
arm_iommu_mmap_attrs() ignores the page offset in vma->vm_pgoff that was
specified in the mmap call. Any user of dma_mmap_* will get an
unexpected result when the device uses the IOMMU DMA ops.
Some DRM driver that use dma_mmap_* seems to depend on it ignoring
vma->vm_pgoff. Both the Samsung Exyn
Set vm_pgoff to 0 after using it to look up the GEM node, before passing
it on rockchip_gem_mmap_buf() where the offset must be from the start of
the buffer.
Passing in the fake offset currently works because the
dma_mmap_attrs implementation that is used for this device,
arm_iommu_mmap_attrs, ign