mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Christoph Hellwig <hch@lst.de>, Ian Abbott <abbotti@mev.co.uk>
Cc: linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	H Hartley Sweeten <hsweeten@visionengravers.com>,
	Robin Murphy <robin.murphy@arm.com>,
	iommu@lists.linux.dev
Subject: Re: [PATCH 4/4] comedi: allocate DMA coherent buffer as individual pages
Date: Mon, 28 Apr 2025 17:33:35 +0200	[thread overview]
Message-ID: <d37ccb03-0d03-46ff-b62f-2fcb78263fe7@samsung.com> (raw)
In-Reply-To: <20250428125648.GC27794@lst.de>

On 28.04.2025 14:56, Christoph Hellwig wrote:
> On Tue, Apr 15, 2025 at 12:35:59PM +0100, Ian Abbott wrote:
>> +			vma->vm_start = start;
>> +			vma->vm_end = start + PAGE_SIZE;
>> +			retval = dma_mmap_coherent(bm->dma_hw_dev, vma,
>> +						   buf->virt_addr,
>> +						   buf->dma_addr, PAGE_SIZE);
> I'm not  fan of the vm_start/vm_end manipulation, but I've seen it in
> other places.  In a perfect world we'd have a dma_mmap_coherent_offset
> or similar helper that encapsulates it, and then maybe later replace
> that hack with passing on the offset.

Indeed the dma_mmap_*() makes too many assumptions about the vma. The 
case You mentioned is probably in drivers/infiniband/hw/hfi1/file_ops.c 
but I also see that the vma->vm_pgoff is being adjusted before most 
dma_mmap_*() calls, which proves that the current API is somehow 
limited. It would be great to fix this too while touching the 
dma_mmap_attrs() API.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


  reply	other threads:[~2025-04-28 15:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-15 11:35 [PATCH 0/4] comedi: non-contiguous buffer pages changes Ian Abbott
2025-04-15 11:35 ` [PATCH 1/4] comedi: ni_pcidio: Do not bother filling buffer with 0xaa byte values Ian Abbott
2025-04-15 11:35 ` [PATCH 2/4] comedi: access buffer data page-by-page Ian Abbott
2025-04-15 11:35 ` [PATCH 3/4] comedi: remove the mapping of the Comedi buffer in vmalloc address space Ian Abbott
2025-04-15 11:35 ` [PATCH 4/4] comedi: allocate DMA coherent buffer as individual pages Ian Abbott
2025-04-28 12:56   ` Christoph Hellwig
2025-04-28 15:33     ` Marek Szyprowski [this message]
2025-04-29 15:59       ` Ian Abbott

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d37ccb03-0d03-46ff-b62f-2fcb78263fe7@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=abbotti@mev.co.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@lst.de \
    --cc=hsweeten@visionengravers.com \
    --cc=iommu@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®