[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <JPBTPQ.TL10VUKPUBL23@crapouillou.net>
Date: Thu, 11 Mar 2021 16:12:55 +0000
From: Paul Cercueil <paul@...pouillou.net>
To: Christoph Hellwig <hch@...radead.org>
Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Sam Ravnborg <sam@...nborg.org>, od@...c.me,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
linux-mips@...r.kernel.org
Subject: Re: [PATCH v2 3/5] drm: Add and export function
drm_gem_cma_mmap_noncoherent
Le jeu. 11 mars 2021 à 12:36, Christoph Hellwig <hch@...radead.org> a
écrit :
> On Thu, Mar 11, 2021 at 12:32:27PM +0000, Paul Cercueil wrote:
>> > dma_to_phys must not be used by drivers.
>> >
>> > I have a proper helper for this waiting for users:
>> >
>> >
>> http://git.infradead.org/users/hch/misc.git/commitdiff/96a546e7229ec53aadbdb7936d1e5e6cb5958952
>> >
>> > If you can confirm the helpers works for you I can try to still
>> sneak
>> > it to Linus for 5.12 to ease the merge pain.
>>
>> I can try. How do I get a page pointer from a dma_addr_t?
>
> You don't - you get it from using virt_to_page on the pointer returned
> from dma_alloc_noncoherent. That beind said to keep the API sane I
> should probably add a wrapper that does that for you.
I tested using:
ret = dma_mmap_pages(cma_obj->base.dev->dev,
vma, vma->vm_end - vma->vm_start,
virt_to_page(cma_obj->vaddr));
It works fine.
I think I can use remap_pfn_range() for now, and switch to your new API
once it's available in drm-misc-next.
Cheers,
-Paul
Powered by blists - more mailing lists