Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp1305427ybb; Fri, 29 Mar 2019 01:40:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvy6FKnaACTcoTL7zDcpmR8c7B2qn4JoGVvyTJ37V2X2sNMM66bUcHqMprOCBj1AL0EaGY X-Received: by 2002:a62:3849:: with SMTP id f70mr42461093pfa.46.1553848839303; Fri, 29 Mar 2019 01:40:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553848839; cv=none; d=google.com; s=arc-20160816; b=fPa/P7pI9ESROnBQbih21atZ58kjg809vvXSbNy/zj+jlOw1xwAuNT/+UKkI+S7OgM vGnkGicF84lslwBxflUqtjoNnCzvM5xBaNMXKQRtxUeODlQ/NN+UIKWD7StIgzxE/Ouo df1fpP7YYR5DprxDkn2jEG0oVSoM/wNKqEagVv7Uc49WCsM/SBOPWnvF37K/6jf1yruz QvpgNKabsqqjYelPkfVOUbQIuLViYi6qMbCZitoVsdYNBRjroXoJV/8heRE86vg9jQa7 c1V/OH6tfhP5BpY+3wD48zeoRQeBd/QWoDb17jPFZfawn4xPxTpgCJfhWIcLmSzSrty7 65Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id; bh=IeNEJgFstvRVwaS01IK4MPX+Qd1vX81Wi7A5IC+SWUk=; b=zkl4NWnRK7jp7lavGd2ELhW7jxxqwwpjoaAvlDUdYmgZzGYOFF/BfQs+YSZbkmL6BD TS6Yd0/0IRVJ8VSDFh1Xn4a/y2lBZEpZEyFnhYNX/OaEPZVcq/tjQI4IcZoqP2r6EgLh EK2Z8fGV7MyEvIOiyo9nRBZobPjXoaJbOjlt3JJSiqR1hzR8k+PDOXIN2ZOWDRJyLR67 vwdeHP4wQQYzYNfqSLBmd+sW90MKVN4cUwWGFDi96JNnvANSyKIs7B76lnWbtjBkGB7H crJVwbV+/u+l3JJPJ9mLinf/eTOhgtHb/S/sK39abaZRpGc5e+jwfPQsnb+UxCMHp2bv HlZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q78si123697pgq.321.2019.03.29.01.40.23; Fri, 29 Mar 2019 01:40:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729156AbfC2IiZ (ORCPT + 99 others); Fri, 29 Mar 2019 04:38:25 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:41839 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729009AbfC2IiY (ORCPT ); Fri, 29 Mar 2019 04:38:24 -0400 Received: from aptenodytes (aaubervilliers-681-1-91-136.w90-88.abo.wanadoo.fr [90.88.32.136]) (Authenticated sender: paul.kocialkowski@bootlin.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 32CA724000F; Fri, 29 Mar 2019 08:38:19 +0000 (UTC) Message-ID: <95645eb463840faf32bae284c16af443cc62f8a8.camel@bootlin.com> Subject: Re: [PATCH v3 1/2] drm/file: Rehabilitate the firstopen hook for non-legacy drivers From: Paul Kocialkowski To: Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Eric Anholt , Eben Upton , Thomas Petazzoni Date: Fri, 29 Mar 2019 09:38:19 +0100 In-Reply-To: <20190329083534.GC2665@phenom.ffwll.local> References: <20190328161306.22757-1-paul.kocialkowski@bootlin.com> <20190328161306.22757-2-paul.kocialkowski@bootlin.com> <20190329083534.GC2665@phenom.ffwll.local> Organization: Bootlin Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel, On Fri, 2019-03-29 at 09:35 +0100, Daniel Vetter wrote: > On Thu, Mar 28, 2019 at 05:13:05PM +0100, Paul Kocialkowski wrote: > > The firstopen DRM driver hook was initially used to perform hardware > > initialization, which is now considered legacy. Only a single user of > > firstopen remains at this point (savage). > > > > In some specific cases, non-legacy drivers may also need to implement > > these hooks. For instance on VC4, we need to allocate a 16 MiB buffer > > for the GPU. Because it's not required for fbcon, it's a waste to > > allocate it before userspace starts using the DRM device. > > > > Using firstopen and lastclose for this allocation seems like the best > > fit, so re-habilitate the hook to allow it to be called for non-legacy > > drivers. > > > > Signed-off-by: Paul Kocialkowski > > Reviewed-by: Eric Anholt > > --- > > drivers/gpu/drm/drm_file.c | 3 +-- > > include/drm/drm_drv.h | 3 --- > > 2 files changed, 1 insertion(+), 5 deletions(-) > > > > diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c > > index b1838a41ad43..c011b5cbfb6b 100644 > > --- a/drivers/gpu/drm/drm_file.c > > +++ b/drivers/gpu/drm/drm_file.c > > @@ -266,8 +266,7 @@ static int drm_setup(struct drm_device * dev) > > { > > int ret; > > > > - if (dev->driver->firstopen && > > - drm_core_check_feature(dev, DRIVER_LEGACY)) { > > + if (dev->driver->firstopen) { > > If you guys insist on this (still not a fan myself) pls pull it out of > drm_setup - that's all just legacy hw setup in there. I still think > tracking this a bit more accurately (if you want to bother with this) > would be better. I sent out this v3 right before receiving your comments on v2, so this new iteration only takes Eric's comments into account. I think the points you made on v2 are very legitimate and I'll be working to prepare a new series that takes them into consideration :) Cheers, Paul > -Daniel > > > ret = dev->driver->firstopen(dev); > > if (ret != 0) > > return ret; > > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h > > index ca46a45a9cce..de5637494503 100644 > > --- a/include/drm/drm_drv.h > > +++ b/include/drm/drm_drv.h > > @@ -234,9 +234,6 @@ struct drm_driver { > > * kernel driver does not really own the hardware. Instead ownershipe is > > * handled with the help of userspace through an inheritedly racy dance > > * to set/unset the VT into raw mode. > > - * > > - * Legacy drivers initialize the hardware in the @firstopen callback, > > - * which isn't even called for modern drivers. > > */ > > void (*lastclose) (struct drm_device *); > > > > -- > > 2.21.0 > > -- Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com