Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp108791rdb; Thu, 5 Oct 2023 19:20:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHSPcmadbYtcoLMFH1CBKuuEQUtKMlo9MdvG6vQDoxu/d0tuxAoNUTRNvlPZF9pelfsKtMA X-Received: by 2002:a17:902:ce8e:b0:1c7:49dd:2ff with SMTP id f14-20020a170902ce8e00b001c749dd02ffmr6087135plg.27.1696558844727; Thu, 05 Oct 2023 19:20:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696558844; cv=none; d=google.com; s=arc-20160816; b=SGhr6AuS75Q3Ghr7NAF5CPuSs5f30cfXbRV05+YRfUqvedgwHmA2Ay0D1HtdbdfnO3 n7XZ76n4XuriycE2jnaydor3MYodvq6KZqIX2hNoka5ymVkBPqh0LjdKd3tk9EV+Us9w PGZ81za0Ggb3jMmKp5yXzmzFrCK3Lf3mkIlrRjCELqNp9LyykedcDjRprGZ3kH7iKHvQ 0EqbPu8bd0fSOdXSXUOOOyJMNU7qCeLYZdHYSXERo7nhMBCbURj5z3H3ChBZkeN2op0y ecOqkf4wW3SVfHk7hlJwSGD1l0SMjr+WUeg0nx7m3d/wn1Ozg2WPVTNq2mlO+VRGCHbs zvhg== 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=7A6svaZ5NLBPCdvLBtrQYDjuifxfenalJYib+EmtrBE=; fh=zHsxGwACgcALZqSE3jYukEZPjRk6bJuioZM2zFAlC2o=; b=DsVYddll794iJqQ3f+ancHHVDCN7Z10l6HGThRiikUc+Th6M2jWMBrSO7u9/PXkhpz T56xVnSDFntJagmZBvKMN6akBV4YUoxxr74F7syfX/hSUlzVmy8abMNKi5BUflrVTG47 zpIiYCk8rHDXB96+FOmf8y9+LGHzBPxLTSCIeoUvXm4J+C4yDXWPDluaF6lbF/B8wPWT 9UrDGbyI3HmJiVqNC/sUC8YUvjosZB2zezfxDrmgRCr8lXGujhoaeNB938uMVmr7eC1K VSQjvcV35vE4UsnT87PkWuglrnKEae9cYJGst/92lAmL9JID1uwXVZf2dig5V6ijt6cL jU5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PMoIPAQS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id f16-20020a170902ce9000b001beef8ccd05si2879684plg.489.2023.10.05.19.20.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 19:20:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PMoIPAQS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id D60148087C9F; Thu, 5 Oct 2023 19:20:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229693AbjJFCUg (ORCPT + 99 others); Thu, 5 Oct 2023 22:20:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbjJFCUf (ORCPT ); Thu, 5 Oct 2023 22:20:35 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4B0CD8; Thu, 5 Oct 2023 19:20:33 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-405361bba99so14732525e9.2; Thu, 05 Oct 2023 19:20:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696558832; x=1697163632; 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=7A6svaZ5NLBPCdvLBtrQYDjuifxfenalJYib+EmtrBE=; b=PMoIPAQSaPvXLyhyRrSc7Ymkz0KboMwITRzSOZxzm09doaHaeQOWDmKdpbUpW9ZZ9v bYxky/qlSBZ1CEn+pIYZrzXqmwIRcJd/UriB/FxkX+aae9q6FlPdZ8BqFh+OBrHR/D25 OPQMdCYNlHXwuyF4sy4c/WVtCFUgEC+rEzy4gGv8omZtSIW9b83xUAVI4fXbgzmqctVJ yQtXJZb9q6Q/8R9GWLegUXhjTlz+mc5y4l57fNsfscJJ7g5m01JSdoAr3jQUjfepl9F7 U/MRzN2AhESOAoJi9bO2DKMvZQnQPleprTRL4HQ6lNyU6aVhejb/uljEn/f0dC30ZjFL A6cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696558832; x=1697163632; 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=7A6svaZ5NLBPCdvLBtrQYDjuifxfenalJYib+EmtrBE=; b=s/Wlz1xEDvCC86cxSXTcYcbMTTWMTygaa0Kz6KkqfBDiox9RnSsfZmHFUX/YQnzFAX yIdmUVdS1Vp4yMT68RJppq5RRGtm/Tdsjy2y1UsWQqJ3VxkjOQIqWhr8dVkEIJ9Nc91S eC6tGVBrQE64cKE2qEfj0dyyDUIEbOQg2HwlpQ/KC//kwBQNERvVk8vk08w9Pibfv022 nRZbfCaCNpw73hv3kKLMjU3SUKjAE5SXsRI4JFFaXKIrf4rXn0655ezDtwwzyFcndmLC /72+QfQYuucK9oW2lGm0MALhuk4JgqUUAKTVj3VVy8Tkrf/gaknniz6Zfw5OaluE8USZ ZkcA== X-Gm-Message-State: AOJu0YyRf1t+HhuR0yKiY40u5jTV+uOLEGHgj7Zn1azsLe6NwYlvJlx9 yG3VCsv/lj9K95kSaOAkB7oyvQMl+W7PZ3lZAitpuZWQuzg= X-Received: by 2002:adf:f546:0:b0:323:3421:9a9 with SMTP id j6-20020adff546000000b00323342109a9mr6326854wrp.60.1696558831882; Thu, 05 Oct 2023 19:20:31 -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: Fri, 6 Oct 2023 11:19:54 +0900 Message-ID: Subject: Re: [RFT PATCH v2 09/12] drm/exynos: Call drm_atomic_helper_shutdown() at shutdown/unbind time To: Marek Szyprowski Cc: Douglas Anderson , 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=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Thu, 05 Oct 2023 19:20:42 -0700 (PDT) Thanks for testing. :) Acked-by : Inki Dae 2023=EB=85=84 9=EC=9B=94 22=EC=9D=BC (=EA=B8=88) =EC=98=A4=ED=9B=84 3:00, M= arek 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 time > > 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 case > > 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 added > > it after drm_kms_helper_poll_fini() since that's when other drivers > > 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 before > > 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 display. > > 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 *dev) > > 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 platf= orm_device *pdev) > > return 0; > > } > > > > +static void exynos_drm_platform_shutdown(struct platform_device *pdev) > > +{ > > + 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 >