Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp519057pxk; Wed, 2 Sep 2020 07:50:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMetQnE9dr2gWZo3MIyvZrLm51aBrdmRY12syXU4jLuaukja+ZEgnb3IC+/sjXVu3s98LW X-Received: by 2002:a17:906:24d2:: with SMTP id f18mr361169ejb.510.1599058236153; Wed, 02 Sep 2020 07:50:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599058236; cv=none; d=google.com; s=arc-20160816; b=WdOgc4160wW5SThgh1SlEM/g+N51O2i+8BLz+J8ksG1TXrvlGoKz8jtUT5v9dfcM0H H7Wp7s6JIp0op7mzUBjmL5a2FMlxb6sGZa2DFIWpSbtqgvj8eRe4OL1jmVESfhRJmz67 HKVnT0pZx0+0qHr2ZGuRbDOmt420hq/syvwdlWp+XX4YSJvNpYSC01KSfMKaqACtwDja oGv5QZ++L4guejJNLy7ucf/u9meRsyuP42hX96yDOc95V8fCEQteCyQ/U9GZY4yRwHAA mk6s47ZnxTED5UmglZR1qFmS9oYQrRyivfhV4/jJLQUBIiNoEpbGo9RpNfGTU3FMHA6I uKtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=+G3nbi5B6jFaWrY/cB8uCRGjt6DlWYVRkm6qWyt7TBA=; b=v2ZxIkS8V/BsMgFNLZyWKTH8g1k+ri2N1caWqq9CZsZHYehaaeQZ0JFJ/Le2zNAojv tI97RQ7QL/QzxDS8O3SagrRC+73Joeyw/vBd7xaoDTOjJbdIraWIGPb3xjgYeeE+67MT AtyuIjy2aaVRcB6Sn6ydtlvUwJdQZ6VaW500dU1Abh0gHf7DkwHF2aa/FEje772IPIBh PW0atPdW/M/rm+C3rdyTWUnHLSxwi81jCIe/zLW5HQnYfCQOmXRjP9HD6CMS4P//BII+ xxJRlARYy2i92zfnV2uGcbrKTcJYEUyeqOVrfIZW5DMqrwo99ZzSuolgSiQiroWU2dgV GxLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b="mFUwSTt/"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=XColh7e5; 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=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c2si2645160ejs.702.2020.09.02.07.50.12; Wed, 02 Sep 2020 07:50:36 -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=@cerno.tech header.s=fm3 header.b="mFUwSTt/"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=XColh7e5; 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=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728193AbgIBOs4 (ORCPT + 99 others); Wed, 2 Sep 2020 10:48:56 -0400 Received: from wnew2-smtp.messagingengine.com ([64.147.123.27]:50575 "EHLO wnew2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728067AbgIBOst (ORCPT ); Wed, 2 Sep 2020 10:48:49 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 4205EA32; Wed, 2 Sep 2020 10:48:47 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 02 Sep 2020 10:48:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=+G3nbi5B6jFaWrY/cB8uCRGjt6D lWYVRkm6qWyt7TBA=; b=mFUwSTt//pDZi9BrpQ3mF3MVVo33cVUnDi8Syqiyb4y iQoLyQIiorx4U1vGvvjwRpNBw6UcyujE8ipRVzL4CKz4uPOfOJ45ndRdU9NAwEZn qKj7ba/zTOtL02x17Ffqz/Okzio46PaY4Gpuv8Fy1XsHwTG96OgndfgonLizds8h h6cgzVNA7jjy64bKMHJONqVaFx2y7Xx2OnQ8nGiGSf4d6Ms8DZrIQT7s/qor2/oV UfddLUqul1KMtSyw9/bDHpS0POPiyn/9STuSyGUdvgF9jjPWpfvja4gx0ZhWGDl1 nPu0I1/pus364SYezK8BFSemGnwTGypZ6i21Nq2SsqQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=+G3nbi 5B6jFaWrY/cB8uCRGjt6DlWYVRkm6qWyt7TBA=; b=XColh7e5maJhOmEYrJ1jXs pH8JpNl6qmK0pUZ2UjHbQHSopas8M5/CFa78yaWEZq6TkeqRQ03k93SMpNYGrugz 6G89mQdNeFFzNt3vOBtln15CZE5oI0ObvF3HbHdVKiW/jlQNU+tlU5CSiwSNMtLW CcxMK2ZPEXhtWwEiuldeyTi97Zp+6TMS7ndvGhP4VKaIVeih2jFExRTn5cFjBHql 81nfDMYH9B1Sdjaq+pOJgr0Z5//Q4VRSiz61nOVv4jXTFDBkRy4ydo4aEbBjnm4p 3eCNWw96dPzJ6aDK8UfKlXRfrr+GOGjihuA1lItcp0J/Q33Sm9IVRi7zh2WSrRJA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudefledgkeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepleekgeehhfdutdeljefgleejffehfffgieejhffgueefhfdtveetgeehieeh gedunecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id AF354328005D; Wed, 2 Sep 2020 10:48:45 -0400 (EDT) Date: Wed, 2 Sep 2020 16:48:43 +0200 From: Maxime Ripard To: Chanwoo Choi Cc: Nicolas Saenz Julienne , Eric Anholt , dri-devel@lists.freedesktop.org, linux-rpi-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Dave Stevenson , Tim Gover , Phil Elwell Subject: Re: [PATCH v4 03/78] drm/vc4: hvs: Boost the core clock during modeset Message-ID: <20200902144843.fuvgtu62wdrnd4on@gilmour.lan> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="oo64qjpa7isnxgnm" Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --oo64qjpa7isnxgnm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Tue, Sep 01, 2020 at 08:21:36PM +0900, Chanwoo Choi wrote: > Hi Maxime, >=20 > On 7/9/20 2:41 AM, Maxime Ripard wrote: > > In order to prevent timeouts and stalls in the pipeline, the core clock > > needs to be maxed at 500MHz during a modeset on the BCM2711. > >=20 > > Reviewed-by: Eric Anholt > > Signed-off-by: Maxime Ripard > > --- > > drivers/gpu/drm/vc4/vc4_drv.h | 2 ++ > > drivers/gpu/drm/vc4/vc4_hvs.c | 9 +++++++++ > > drivers/gpu/drm/vc4/vc4_kms.c | 9 +++++++++ > > 3 files changed, 20 insertions(+) > >=20 > > diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_dr= v.h > > index e4cde1f9224b..6358f6ca8d56 100644 > > --- a/drivers/gpu/drm/vc4/vc4_drv.h > > +++ b/drivers/gpu/drm/vc4/vc4_drv.h > > @@ -320,6 +320,8 @@ struct vc4_hvs { > > void __iomem *regs; > > u32 __iomem *dlist; > > =20 > > + struct clk *core_clk; > > + > > /* Memory manager for CRTCs to allocate space in the display > > * list. Units are dwords. > > */ > > diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hv= s.c > > index 836d8799d79e..091fdf4908aa 100644 > > --- a/drivers/gpu/drm/vc4/vc4_hvs.c > > +++ b/drivers/gpu/drm/vc4/vc4_hvs.c > > @@ -19,6 +19,7 @@ > > * each CRTC. > > */ > > =20 > > +#include > > #include > > #include > > =20 > > @@ -540,6 +541,14 @@ static int vc4_hvs_bind(struct device *dev, struct= device *master, void *data) > > hvs->regset.regs =3D hvs_regs; > > hvs->regset.nregs =3D ARRAY_SIZE(hvs_regs); > > =20 > > + if (hvs->hvs5) { > > + hvs->core_clk =3D devm_clk_get(&pdev->dev, NULL); > > + if (IS_ERR(hvs->core_clk)) { > > + dev_err(&pdev->dev, "Couldn't get core clock\n"); > > + return PTR_ERR(hvs->core_clk); > > + } > > + } > > + > > if (!hvs->hvs5) > > hvs->dlist =3D hvs->regs + SCALER_DLIST_START; > > else > > diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_km= s.c > > index 08318e69061b..210cc2408087 100644 > > --- a/drivers/gpu/drm/vc4/vc4_kms.c > > +++ b/drivers/gpu/drm/vc4/vc4_kms.c > > @@ -11,6 +11,8 @@ > > * crtc, HDMI encoder). > > */ > > =20 > > +#include > > + > > #include > > #include > > #include > > @@ -149,6 +151,7 @@ vc4_atomic_complete_commit(struct drm_atomic_state = *state) > > { > > struct drm_device *dev =3D state->dev; > > struct vc4_dev *vc4 =3D to_vc4_dev(dev); > > + struct vc4_hvs *hvs =3D vc4->hvs; > > struct vc4_crtc *vc4_crtc; > > int i; > > =20 > > @@ -160,6 +163,9 @@ vc4_atomic_complete_commit(struct drm_atomic_state = *state) > > vc4_hvs_mask_underrun(dev, vc4_crtc->channel); > > } > > =20 > > + if (vc4->hvs->hvs5) > > + clk_set_min_rate(hvs->core_clk, 500000000); > > + > > drm_atomic_helper_wait_for_fences(dev, state, false); > > =20 > > drm_atomic_helper_wait_for_dependencies(state); > > @@ -182,6 +188,9 @@ vc4_atomic_complete_commit(struct drm_atomic_state = *state) > > =20 > > drm_atomic_helper_commit_cleanup_done(state); > > =20 > > + if (vc4->hvs->hvs5) > > + clk_set_min_rate(hvs->core_clk, 0); > > + > > drm_atomic_state_put(state); > > =20 > > up(&vc4->async_modeset); > >=20 >=20 > This patch doesn't control the enable/disable of core_clk. > So, I think that it need to handle the clock as following: >=20 > diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c > index 4ef88c0b51ab..355d67fd8beb 100644 > --- a/drivers/gpu/drm/vc4/vc4_hvs.c > +++ b/drivers/gpu/drm/vc4/vc4_hvs.c > @@ -588,6 +588,12 @@ static int vc4_hvs_bind(struct device *dev, struct d= evice *master, void *data) > dev_err(&pdev->dev, "Couldn't get core clock\n"); > return PTR_ERR(hvs->core_clk); > } > + > + ret =3D clk_prepare_enable(hvs->core_clk); > + if (ret) { > + dev_err(&pdev->dev, "Couldn't enable core clock\n= "); > + return ret; > + } > } > =20 > if (!hvs->hvs5) > @@ -681,6 +687,8 @@ static void vc4_hvs_unbind(struct device *dev, struct= device *master, > drm_mm_takedown(&vc4->hvs->dlist_mm); > drm_mm_takedown(&vc4->hvs->lbm_mm); > =20 > + clk_prepare_enable(vc4->hvs->core_clk); > + > vc4->hvs =3D NULL; > } Good catch, thanks! Maxime --oo64qjpa7isnxgnm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCX0+wywAKCRDj7w1vZxhR xWO1AQDeDuT9LC5OJjJCw0wJbII/glIroNJaR6BYRKSfUw2EVAEAg87EDHY2jhPJ nlutA8am7X/slgA6UtdYLqOm5hJ6Lgo= =gbvn -----END PGP SIGNATURE----- --oo64qjpa7isnxgnm--