Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1176325pxf; Fri, 12 Mar 2021 03:54:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxC8Mq+LXKOcDcEiyFClAfdhPYwp+V8Wy6FRxSNgdF5HyZkcjBUrJUrwT6uRn5PYXPDt4x8 X-Received: by 2002:a17:906:ef2:: with SMTP id x18mr8263586eji.323.1615550072057; Fri, 12 Mar 2021 03:54:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615550072; cv=none; d=google.com; s=arc-20160816; b=GgbQglHVXxGUcxz2nGKseX1rYLb4+npWcE41njgdlsd/7pCBFBYb4LXUttS26CwZg5 +aQmAiO/5XY+FVwp84PqRQ7BzAZLBfZphfoI5JCMch/PLNRSNlvnAaUBm0IqHNqzZOzk 6rUk50sPpkPja4uIi1lmKBUuLUN1/d7Qh/0OArEHUZsKbUTi0W7mM2a9zfgWPbkyQ7vH GVOY3VOOwNdJtREtegJCHNcYa21gpv9Fxja5op5l5N/MgPKZCRZRz24Yv6hh9dNncqh1 YS96qhIWtuI6qmgfAe4j2FaiIHJQi4TZkfJHd7jaxkWCXiZ8LL3EP+9lVrqMh2Dsd1pS j2Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:cc:to:subject:from:date; bh=yDpV+aXwFiLHSmVYPb444CXLB+5PeVRHgUjSxeRe+RE=; b=TVFngswP9T3kOhfI43h+HbAQ+NsWgwn9lGHche0W6HMIVrOO8E2YEe5FQyCYvgy0mu WmlTdMF5rWG+8jqx61H3N6E7T3t9ZG5KwOrjQEeAHQstNewb6ILUpEa3UhpYEFOz3mpu a8Ni5AhEmRD/mA5sQ+jXDOxH7YDzsEKGkVlzGo1S9Pt6pA6fX6C4SGlhShGxPCDigmqN afXhXYLVnSm992nXokxNntnwhTUw4VzUDyL2QSFQDr8WLh3fc/aQ/CtAZ6UNB3mbM5jx KQxCNHd6ItfqfLwl+eMjZwGbJwW3AcMMV/f/DvcWw95JRY1vhAPwGFqWoTvYMt5L9evB l34Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j7si3839211ejc.237.2021.03.12.03.54.09; Fri, 12 Mar 2021 03:54:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231728AbhCLLwq convert rfc822-to-8bit (ORCPT + 99 others); Fri, 12 Mar 2021 06:52:46 -0500 Received: from aposti.net ([89.234.176.197]:38764 "EHLO aposti.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231611AbhCLLwW (ORCPT ); Fri, 12 Mar 2021 06:52:22 -0500 Date: Thu, 11 Mar 2021 16:12:55 +0000 From: Paul Cercueil Subject: Re: [PATCH v2 3/5] drm: Add and export function drm_gem_cma_mmap_noncoherent To: Christoph Hellwig Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sam Ravnborg , od@zcrc.me, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org Message-Id: In-Reply-To: <20210311123642.GA1741910@infradead.org> References: <20210307202835.253907-1-paul@crapouillou.net> <20210307202835.253907-4-paul@crapouillou.net> <20210311122642.GB1739082@infradead.org> <3I1TPQ.E55GRWWDYVRG@crapouillou.net> <20210311123642.GA1741910@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le jeu. 11 mars 2021 ? 12:36, Christoph Hellwig 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