Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1260803pxu; Thu, 8 Oct 2020 07:18:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3eHVz105hgRFyEr8eoo5+uRJYYJqavQLpOZ5Bk0K4P2UPN3UO+bD1bO50wS4K/VAnc43V X-Received: by 2002:a50:cc8d:: with SMTP id q13mr9070304edi.298.1602166725439; Thu, 08 Oct 2020 07:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602166725; cv=none; d=google.com; s=arc-20160816; b=NQ80yr6Pit0jLYbNp5THgV5e6AuvW6x2OC/al9zFVFPd+/7p1i3nNsywtuRS0sAxep Q7DAgTUWztaPQ10nebmwUKg1Z6CfjBghsAjKjjDXa4HzNh9qNa01lkQU0m7rvBN6EOXm 651fz9g2Ry+QbSod60ifl2Oelf/zu+dG9rcxX2RT5eH6D0Mwe37/lDY2v+Ctw2SFKEdm UU73s25m50R/IvVBXIvH/I5xQXKleiB4rEcgsF7R8irRajCLhmP3+Gdh3IhIkirJqff7 q6/M8nYZ+mcofSChAj3GG1FQ12DGPGRyrhNwUt+KtBbnEVTOtxoNXYkTOmnsQJPfrsOu i+gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:mail-followup-to :message-id:subject:to:from:date:dkim-signature; bh=SKpxYdUurmpOS5BkncePHyl2hsG1ycnDl5RK5GsXoXc=; b=ljKUWyDG2Y7m2Z5xXpTWW9godd2M1Wjyz48gXW2+W1GOOAjxeH65tNDSn9IGKAcgWc ETJjq9SL7842bEU4SAC7D0kW6EzZBZ4uNx6WxORumTEGZl8b6Zb/evBMWS1PiXwvsnwi JZoJq27GcSq4s7AcUCU2q8R26QVv7HWaLhVDuV0M8W/gc20pXuTCv7zeNO2WMKVB7FsH tgtHKZD2/hlANAlJLjIPXgjwb1bnR6gqfISNZzM8/cUVBB92trFDP/swEf81wMwkR7fb rwjZ1flySCNLzMQbApgjlJPLUByXYKI+rNOe1RXttWEGCdVRLz1OLW0ktz8GEzcY4BGH M8Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=fUX+sAvA; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f21si3686695edy.137.2020.10.08.07.18.20; Thu, 08 Oct 2020 07:18:45 -0700 (PDT) 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; dkim=pass header.i=@ffwll.ch header.s=google header.b=fUX+sAvA; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730482AbgJHOOZ (ORCPT + 99 others); Thu, 8 Oct 2020 10:14:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729840AbgJHOOZ (ORCPT ); Thu, 8 Oct 2020 10:14:25 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5B21C061755 for ; Thu, 8 Oct 2020 07:14:23 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id q5so6686105wmq.0 for ; Thu, 08 Oct 2020 07:14:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=SKpxYdUurmpOS5BkncePHyl2hsG1ycnDl5RK5GsXoXc=; b=fUX+sAvAlhLn8s9pMBv+CAJuKweXXzPXeQaXLLKXLzS93kfhlCTgAvIlGdaRzQ60Ej 9iQX+6UZwIrYj21RORZgWLqnIxjjHHTZso4kF+xYv3yiS3nKviqo+RBzttefQD3uGI0n ypnYadZqRu/XN5JvDkbxL51lo817XHh2ps7SE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=SKpxYdUurmpOS5BkncePHyl2hsG1ycnDl5RK5GsXoXc=; b=cVM4PFCmFGtHPig3qH8bLWxWFEm0wi483n3n+CMm6kMWmSC9BE+sG2X46SVpXucO6P qagmjzCvKnt0lbevr86KWSL+rUEEaywTMF8hm5XeAhyZIZiEjSxW2MtY8Qb9KKpSiKIr kBZo7HH7LQOczlM/HgAAr6s95A79Ofh1aoEbQ4Zg6E986hzySsdGpPYeueXoR8UIjEMN O0abDgJzInGMFp/JLQx8FrzR7a6QPQtzK/ut7QGlviUI4s/uIu3H3G/vr6EG33UWgY6Y EPY1q7QfDgIYXkK8yr2obg/qfC0lY1zazKCzrldkzwFkdNo1133VIWn5vrJRAMwW9X8r vyqg== X-Gm-Message-State: AOAM531Hz4RddjwZaN3rhWwfLZpVIWPjeUZzg4z/cJ8QdVByqDw/So/F PCzDPIFfbxvPc47TW1TK7x/aNg== X-Received: by 2002:a1c:bd43:: with SMTP id n64mr8613712wmf.113.1602166462550; Thu, 08 Oct 2020 07:14:22 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id x81sm7251502wmb.11.2020.10.08.07.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 07:14:21 -0700 (PDT) Date: Thu, 8 Oct 2020 16:14:19 +0200 From: Daniel Vetter To: Christian =?iso-8859-1?Q?K=F6nig?= , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linaro-mm-sig@lists.linaro.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, chris@chris-wilson.co.uk, airlied@redhat.com, akpm@linux-foundation.org, sumit.semwal@linaro.org Subject: Re: [PATCH 2/4] drm/prime: document that use the page array is deprecated Message-ID: <20201008141419.GH438822@phenom.ffwll.local> Mail-Followup-To: Christian =?iso-8859-1?Q?K=F6nig?= , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linaro-mm-sig@lists.linaro.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, chris@chris-wilson.co.uk, airlied@redhat.com, akpm@linux-foundation.org, sumit.semwal@linaro.org References: <20201008112342.9394-1-christian.koenig@amd.com> <20201008112342.9394-2-christian.koenig@amd.com> <20201008140914.GF438822@phenom.ffwll.local> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201008140914.GF438822@phenom.ffwll.local> X-Operating-System: Linux phenom 5.7.0-1-amd64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 08, 2020 at 04:09:14PM +0200, Daniel Vetter wrote: > On Thu, Oct 08, 2020 at 01:23:40PM +0200, Christian K?nig wrote: > > We have reoccurring requests on this so better document that > > this approach doesn't work and dma_buf_mmap() needs to be used instead. > > > > Signed-off-by: Christian K?nig > > --- > > drivers/gpu/drm/drm_prime.c | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c > > index 4910c446db83..16fa2bfc271e 100644 > > --- a/drivers/gpu/drm/drm_prime.c > > +++ b/drivers/gpu/drm/drm_prime.c > > @@ -956,7 +956,7 @@ EXPORT_SYMBOL(drm_gem_prime_import); > > /** > > * drm_prime_sg_to_page_addr_arrays - convert an sg table into a page array > > * @sgt: scatter-gather table to convert > > - * @pages: optional array of page pointers to store the page array in > > + * @pages: deprecated array of page pointers to store the page array in > > * @addrs: optional array to store the dma bus address of each page > > * @max_entries: size of both the passed-in arrays > > * > > @@ -965,6 +965,11 @@ EXPORT_SYMBOL(drm_gem_prime_import); > > * > > * Drivers can use this in their &drm_driver.gem_prime_import_sg_table > > * implementation. > > + * > > + * Specifying the pages array is deprecated and strongly discouraged for new > > + * drivers. The pages array is only useful for page faults and those can > > + * corrupt fields in the struct page if they are not handled by the exporting > > + * driver. > > */ > > I'd make this a _lot_ stronger: Aside from amdgpu and radeon all drivers > using this only need it for the pages array. Imo just open-code the sg > table walking loop in amdgpu/radeon (it's really not much code), and then > drop the dma_addr_t parameter from this function here (it's set to NULL by > everyone else). > > And then deprecate this entire function here with a big warning that a) > dma_buf_map_attachment is allowed to leave the struct page pointers NULL > and b) this breaks mmap, users must call dma_buf_mmap instead. > > Also maybe make it an uppercase DEPRECATED or something like that :-) OK I just realized I missed nouveau. That would be 3 places where we need to stuff the dma_addr_t list into something ttm can take. Still feels better than this half-deprecated function kludge ... -Daniel > -Daniel > > > int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages, > > dma_addr_t *addrs, int max_entries) > > -- > > 2.17.1 > > > > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch