Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp234010rdg; Tue, 10 Oct 2023 08:47:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHuO+o4f4PEu0fkR5oIiA/ieEGlUKrGQLbnd/fG9vAYoiKiLbjlHTMfeXH7T1G9kv3gE1Er X-Received: by 2002:a05:6a21:819f:b0:15d:8409:8804 with SMTP id pd31-20020a056a21819f00b0015d84098804mr15767443pzb.57.1696952873398; Tue, 10 Oct 2023 08:47:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696952873; cv=none; d=google.com; s=arc-20160816; b=uThiadicFDpBrm3xVtUNdsq/Dn3HdXNLFyrv1mVF4fVpVk4UqvHcCa9ItpNf2c7lo8 eVh0GTwZ7NJUhJvOhdO303eWsiu+7rk5YmcPhGNn/rvu7LZ7yygCDrQpe/9BuPReWRZJ XtfDuidppC+X7JbpyGSYJw7ICgdwJzjMLIXA1Ub5scnZZYaS+0VVzV05cOSBhsD/uDaQ xtKe026uS7bHMHHNexyAIzcMkIJ1UiiLnD7T+r9jb5y0/IvHFG5cN+jpIguSnGybBoqU +HBGGpMirh5Fc0RRBkxb0KUjX+4Ctw0cBMKu5aew0urV8jk5jq/7aBGmmJp9hBzRKkmN ZioA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=KKkGXdScv1Oyh1OtZfwEYCK039UMnBrmGwVDK++uXz0=; fh=M9+wkZih/5/igRQ/kzf7leE3hZVo4bQ/4J3exwItm9A=; b=p8+bNWmw7VtiwUPK+bl45U1gt4NSMa9dWtjkRrkIOBZCaWb7Dx/3Gc3FqNDROROj3f E358kas0vyZfJGN8pRvzdpbzPOAHxvpFrPNwRBWBao2s8xwdaEibOWt5HZ/CNLNT789j 4nYPnWMooTPpKnKEh1DX7NHtxzOqaV0C3QpJ/h0DmwLt2OervTIuDwAWVd59/WwQ1UB4 gUFl8pvZQteu0yjW0GULBTtMnMMgfkNi+qlFwRyCYNCS/V/carlCBpqNTnaiocznjl0i vnXxZQnxf0GwopsUdmFjXCYOyX3Q/ubE1gHSPhXT3KwHJzzIFKBoRZOmteNYhsngpmx0 kpdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=X6qoRkkO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id j63-20020a638042000000b005859c255ce9si2016098pgd.861.2023.10.10.08.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 08:47:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=X6qoRkkO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 5476B80A2839; Tue, 10 Oct 2023 08:47:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233265AbjJJPrj (ORCPT + 99 others); Tue, 10 Oct 2023 11:47:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232502AbjJJPrh (ORCPT ); Tue, 10 Oct 2023 11:47:37 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBEF393; Tue, 10 Oct 2023 08:47:35 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-9a6190af24aso1014543066b.0; Tue, 10 Oct 2023 08:47:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696952854; x=1697557654; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=KKkGXdScv1Oyh1OtZfwEYCK039UMnBrmGwVDK++uXz0=; b=X6qoRkkO6OZDe5cpehRYzHy660TCxZmvx88YgOty99XSpU59gycxFQf6xLf04GZX2V MtD8sgED6JSYbrL8ukR85H4SKKX/aBBFqJ3M2OWQ4BaaMFyfi2cy2DRfE1X7vNrEEpVB UXh+Ve1oMM7x2WsaYj3DTVw7LBPhaJodUC4FAcRQObvnXhzHy7Tze5hUO/HYw00BXISu ihDLJlJyX8oeomVxfVz1MBZq4XHB6YOn1JoD9w3TaZta6QySlE86e0J43Gersz67bOym V4ZTDfrU7AKYIJ9frPR7It5Ry3VUU1tTP6gi0CnT9P03M/X4xR6RP2/Aon1ahU9763eM QTHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696952854; x=1697557654; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KKkGXdScv1Oyh1OtZfwEYCK039UMnBrmGwVDK++uXz0=; b=K0LlmTMfEnff8BBCB+h/61rbSh1nfrAKqskFIVownB6DvdSGzpYcOo2B9qnELDCDv+ 7axwDI29L9YS2JaeNhg+vvj8CjyGML6nzDjFJbZH0HfGdcQrX3D3oV5Rw2RqGcJ1yMgX LjYxvxeDhAQiDkHoEnMeMcULSFDp9ieaTLF1+AbRU/krskCHj5PpqBsEdHcaeZ4OxzxK oXwO81Ebg0GqCE4N+CZIkUJ7ouv/W4KS6nmnUMvVm7Um6zTqPLQT6UuCqgq6EOXYL/6P t5BNU/RUijenmSuPEaaFdvEl9aViCP1d5W7ipwBfgAcAHq9JEvoScO3XJF6dcdxgXSk2 mHBg== X-Gm-Message-State: AOJu0YzaqnvMJO7c90rYdA1cRQFfaB0Geanp1IMO5YSB3ILF7Uf1zDM3 25npFuOFcOLGplNRNtrZteMY8RGtA69yQ6YtynE= X-Received: by 2002:a17:907:1dd2:b0:9ae:406c:3425 with SMTP id og18-20020a1709071dd200b009ae406c3425mr17287051ejc.0.1696952854189; Tue, 10 Oct 2023 08:47:34 -0700 (PDT) MIME-Version: 1.0 References: <20230921192749.1542462-1-dianders@chromium.org> <20230921122641.RFT.v2.9.Iea33274908b6b258955f45a8aaf6f5bba24ad6cd@changeid> In-Reply-To: From: Inki Dae Date: Wed, 11 Oct 2023 00:46:58 +0900 Message-ID: Subject: Re: [RFT PATCH v2 09/12] drm/exynos: Call drm_atomic_helper_shutdown() at shutdown/unbind time To: Doug Anderson Cc: Marek Szyprowski , dri-devel@lists.freedesktop.org, Maxime Ripard , linux-samsung-soc@vger.kernel.org, alim.akhtar@samsung.com, sw0312.kim@samsung.com, krzysztof.kozlowski@linaro.org, linux-kernel@vger.kernel.org, kyungmin.park@samsung.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 10 Oct 2023 08:47:50 -0700 (PDT) X-Spam-Level: ** Hi, 2023=EB=85=84 10=EC=9B=94 6=EC=9D=BC (=EA=B8=88) =EC=98=A4=ED=9B=84 10:51, = Doug Anderson =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > Hi, > > On Thu, Oct 5, 2023 at 7:20=E2=80=AFPM Inki Dae wrote= : > > > > Thanks for testing. :) > > > > Acked-by : Inki Dae > > Inki: does that mean you'd like this to go through drm-misc? I'm happy > to do that, but there are no dependencies here so this could easily go > through your tree. Ah, you are right. No dependency here. I will pick it up. Thanks, Inki Dae > > > > 2023=EB=85=84 9=EC=9B=94 22=EC=9D=BC (=EA=B8=88) =EC=98=A4=ED=9B=84 3:0= 0, Marek Szyprowski =EB=8B=98=EC=9D=B4 =EC=9E=91= =EC=84=B1: > > > > > > > > > On 21.09.2023 21:26, Douglas Anderson wrote: > > > > Based on grepping through the source code this driver appears to be > > > > missing a call to drm_atomic_helper_shutdown() at system shutdown t= ime > > > > and at driver unbind time. Among other things, this means that if a > > > > panel is in use that it won't be cleanly powered off at system > > > > shutdown time. > > > > > > > > The fact that we should call drm_atomic_helper_shutdown() in the ca= se > > > > of OS shutdown/restart and at driver remove (or unbind) time comes > > > > straight out of the kernel doc "driver instance overview" in > > > > drm_drv.c. > > > > > > > > A few notes about this fix: > > > > - When adding drm_atomic_helper_shutdown() to the unbind path, I ad= ded > > > > it after drm_kms_helper_poll_fini() since that's when other driv= ers > > > > seemed to have it. > > > > - Technically with a previous patch, ("drm/atomic-helper: > > > > drm_atomic_helper_shutdown(NULL) should be a noop"), we don't > > > > actually need to check to see if our "drm" pointer is NULL befor= e > > > > calling drm_atomic_helper_shutdown(). We'll leave the "if" test = in, > > > > though, so that this patch can land without any dependencies. It > > > > could potentially be removed later. > > > > - This patch also makes sure to set the drvdata to NULL in the case= of > > > > bind errors to make sure that shutdown can't access freed data. > > > > > > > > Suggested-by: Maxime Ripard > > > > Reviewed-by: Maxime Ripard > > > > Signed-off-by: Douglas Anderson > > > > > > Seems to be working fine on all my test Exynos-based boards with disp= lay. > > > > > > Tested-by: Marek Szyprowski > > > > > > Reviewed-by: Marek Szyprowski > > > > > > > --- > > > > This commit is only compile-time tested. > > > > > > > > (no changes since v1) > > > > > > > > drivers/gpu/drm/exynos/exynos_drm_drv.c | 11 +++++++++++ > > > > 1 file changed, 11 insertions(+) > > > > > > > > diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/= drm/exynos/exynos_drm_drv.c > > > > index 8399256cb5c9..5380fb6c55ae 100644 > > > > --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c > > > > +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c > > > > @@ -300,6 +300,7 @@ static int exynos_drm_bind(struct device *dev) > > > > drm_mode_config_cleanup(drm); > > > > exynos_drm_cleanup_dma(drm); > > > > kfree(private); > > > > + dev_set_drvdata(dev, NULL); > > > > err_free_drm: > > > > drm_dev_put(drm); > > > > > > > > @@ -313,6 +314,7 @@ static void exynos_drm_unbind(struct device *de= v) > > > > drm_dev_unregister(drm); > > > > > > > > drm_kms_helper_poll_fini(drm); > > > > + drm_atomic_helper_shutdown(drm); > > > > > > > > component_unbind_all(drm->dev, drm); > > > > drm_mode_config_cleanup(drm); > > > > @@ -350,9 +352,18 @@ static int exynos_drm_platform_remove(struct p= latform_device *pdev) > > > > return 0; > > > > } > > > > > > > > +static void exynos_drm_platform_shutdown(struct platform_device *p= dev) > > > > +{ > > > > + struct drm_device *drm =3D platform_get_drvdata(pdev); > > > > + > > > > + if (drm) > > > > + drm_atomic_helper_shutdown(drm); > > > > +} > > > > + > > > > static struct platform_driver exynos_drm_platform_driver =3D { > > > > .probe =3D exynos_drm_platform_probe, > > > > .remove =3D exynos_drm_platform_remove, > > > > + .shutdown =3D exynos_drm_platform_shutdown, > > > > .driver =3D { > > > > .name =3D "exynos-drm", > > > > .pm =3D &exynos_drm_pm_ops, > > > > > > Best regards > > > -- > > > Marek Szyprowski, PhD > > > Samsung R&D Institute Poland > > >