From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 876F7C04EBE for ; Thu, 8 Oct 2020 14:09:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D59362184D for ; Thu, 8 Oct 2020 14:09:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="enBpRbP+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D59362184D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CE0C56B005C; Thu, 8 Oct 2020 10:09:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C916B6B005D; Thu, 8 Oct 2020 10:09:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B58FA6B0062; Thu, 8 Oct 2020 10:09:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0144.hostedemail.com [216.40.44.144]) by kanga.kvack.org (Postfix) with ESMTP id 876B26B005C for ; Thu, 8 Oct 2020 10:09:20 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 0BAF61EE6 for ; Thu, 8 Oct 2020 14:09:20 +0000 (UTC) X-FDA: 77348940480.26.verse01_61028b9271d8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id D4A691804B660 for ; Thu, 8 Oct 2020 14:09:19 +0000 (UTC) X-HE-Tag: verse01_61028b9271d8 X-Filterd-Recvd-Size: 5846 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Thu, 8 Oct 2020 14:09:18 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id m6so6788933wrn.0 for ; Thu, 08 Oct 2020 07:09:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=elZJD7XRgqQldYOtQwrqdR/qGnh8Wpkk/pfQRzrmtYM=; b=enBpRbP+Y+vrFIYrWPQNxBnkuaMmg25PgrMBeow6OQNpTFvPzN+XBpA5OiRQs3FnpH yn2sjyj5Z/cKTHqfztw85EqTF/+tUnU7Ggylp9H+9saopjbyB39hup7iipRvTm1N8QkU 4hcPZCQBIGwlfCroWRjBD48VJcP3UF4X4GYKQ= 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:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=elZJD7XRgqQldYOtQwrqdR/qGnh8Wpkk/pfQRzrmtYM=; b=blpxmoUhDWBloZSznxXy5+HsmtUeqno3+ausGImtLkIeSBF1nwSbMPBUvdT5chz9h1 zeCbonWBA2NI8yygwhKMUSp7asaYBj6f4wR8N/AO6bb/y8+JlHpCzjfsil/lmM0MBMas im10ZyNQxMLCUN83ZW2Rs7MGTWxYxV3jUHPFxewMnYtsHsAtX2GKu2wIoqu0H0TlcCdE BmR9PJPlgulzxWhmiRL5TgiMZ7xEX7DZdcKPJ4TGSiuFcTFUNR6lEttVM06TNYmSTY+8 /Yu1t8ZM4sm+KgceVaFntq2LN8k0sfa4W4dXirKsvGpnPRRQ2Rd/YftlW1nnitjuRKzt 5XSw== X-Gm-Message-State: AOAM531VHCLw593EjhW5JMQry7whmDRNvM4S9KjcsWR38z4kFDDzSgHJ QYeKsEUlIj040mCn1gnjzN1VCg== X-Google-Smtp-Source: ABdhPJxnvjHp0B8DifTQr62vFQPdmb3m15u0GYpDuxfNs6OohHQD8sm0hL1lDYa4JXvQgG/WhvcUCQ== X-Received: by 2002:a5d:4802:: with SMTP id l2mr9290612wrq.282.1602166157191; Thu, 08 Oct 2020 07:09:17 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id b200sm7777009wme.44.2020.10.08.07.09.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 07:09:16 -0700 (PDT) Date: Thu, 8 Oct 2020 16:09:14 +0200 From: Daniel Vetter To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: 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, daniel@ffwll.ch, sumit.semwal@linaro.org Subject: Re: [PATCH 2/4] drm/prime: document that use the page array is deprecated Message-ID: <20201008140914.GF438822@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> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20201008112342.9394-2-christian.koenig@amd.com> X-Operating-System: Linux phenom 5.7.0-1-amd64 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Oct 08, 2020 at 01:23:40PM +0200, Christian K=F6nig 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. >=20 > Signed-off-by: Christian K=F6nig > --- > drivers/gpu/drm/drm_prime.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) >=20 > 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 i= n > * @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 f= or new > + * drivers. The pages array is only useful for page faults and those c= an > + * corrupt fields in the struct page if they are not handled by the ex= porting > + * 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 b= y 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 :-) -Daniel > int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page= **pages, > dma_addr_t *addrs, int max_entries) > --=20 > 2.17.1 >=20 --=20 Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch