[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEHp+GZRNApNBxznU8YioJO7+ezosKtUmTqaQXe8J6r2QyGjcw@mail.gmail.com>
Date: Mon, 27 Jan 2025 18:47:37 +0100
From: Dima Stepanov <dstepanov.src@...il.com>
To: Robin Murphy <robin.murphy@....com>
Cc: Christoph Hellwig <hch@....de>, Marek Szyprowski <m.szyprowski@...sung.com>, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kernel/dma: dma_common_find_pages returns pages for
requested address
On Mon, Jan 27, 2025 at 12:50 PM Robin Murphy <robin.murphy@....com> wrote:
>
> No, that's a bug in the caller of dma_mmap_attrs(). As the kerneldoc
> says, cpu_addr/dma_addr/size must still represent the whole buffer as
> returned by the allocator - any offset for the mapping itself relative
> to the start of the buffer is expressed in vma->pgoff.
>
> Thanks,
> Robin.
I see, thanks for clarification Robin. I was confused, because depending
on the backend it will work or not work. But i believe that in this case it is
undefined behavior. That is unfortunate to me, since the idea behind was:
- The memory allocated once because of device/firmware
- Different users could request a part of this memory from the kernel and
mmap it
And i didn't want to expose this offset information to the user. Wanted to
rely on the kernel to mmap the proper part of the buffer.
Thanks,
Dima.
Powered by blists - more mailing lists