From patchwork Thu Sep 21 19:26:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 142994 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5194291vqi; Thu, 21 Sep 2023 16:03:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHZb4C47AKuwOJf7c6sSpbGeuskDNyemcl2GFnoBJcwhfYspBkkD7WeYFXiR5Yasp4wsWx8 X-Received: by 2002:a05:6a20:918b:b0:140:a6ec:b55f with SMTP id v11-20020a056a20918b00b00140a6ecb55fmr7744752pzd.16.1695337428204; Thu, 21 Sep 2023 16:03:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695337428; cv=none; d=google.com; s=arc-20160816; b=XAa8rokipOYA93+uHi92Z77t6UrcWomOQFk69lJKkZrUattTqRXxvHjQ4TQHHkvSK3 XPjKGmNd6H/SFREbKm0cCeQTF6Bx27NoOOONrsc5XAt4fQEAL6T1X3v9YXoT3ohc2q8K PdRfIAeN/Js57sKIJlK4BKibPpIsFRCf2EsiZDKrUmsTdf1sS2znmt/QIoZAiX2haYpV u/4shH/obptCeu5hravKOgBiIWrIlUpxsMAWYD0da4INCiMymp5Ef3KZjjU8UPptGcsH CJhAJL0CKA4eKOUHJioX9qqszMRvF9QrASi13bOPnKHxD6X1aN6GNbBTtIhfB6isMPEl OZhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NI6y381yNrtia6QcCIC7z4DDn4lzJBG1Oz9c+agvn3E=; fh=JYEoSEGNpvfEUsFIfSt7bd7z9eXT1DkNt7O1/8IIylo=; b=Ug0rYrAG7pLe5O4Z6rVbll1pdzAzONhdqxxhafxtXnAZdJCcPFmG3tIn+RZDtPygOM TGqxFuPbEA90e0U8S8syawtIhNKPgG+h3bqDIiem2Evq48maJ4xkovfFpIHoWH4ul3At HGes/FbrZlYciH5BNtp9B6O3+wlBGxuA5fmu3bmGtkKSFY5mJsEQFQC+3WGUsPRdBagS jzTlJAIhXqXoqwjrY/RkXNW+yXJJrQ7O92Gdk9ZpNwmYKQ6t28G2D+meeG1YfB6G4xoQ ld9xwFDAnaP2V1Ipth1yB9CTjzxI7mnkoiGuJpbc8IEi4D4sKKM36pKrasVJVFu8qIm2 jejw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=IBzxunwt; 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=NONE dis=NONE) header.from=chromium.org Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id i124-20020a639d82000000b0056532fbe28csi2486298pgd.459.2023.09.21.16.03.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 16:03:48 -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=@chromium.org header.s=google header.b=IBzxunwt; 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=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 70F7283797DE; Thu, 21 Sep 2023 13:29:23 -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 S231809AbjIUU3R (ORCPT + 29 others); Thu, 21 Sep 2023 16:29:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232052AbjIUU2v (ORCPT ); Thu, 21 Sep 2023 16:28:51 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7615D4200 for ; Thu, 21 Sep 2023 12:28:17 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1c46b30a1ceso11386685ad.3 for ; Thu, 21 Sep 2023 12:28:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695324497; x=1695929297; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NI6y381yNrtia6QcCIC7z4DDn4lzJBG1Oz9c+agvn3E=; b=IBzxunwtPiO3QT1Ag6NPl8BWqPJrQYjFrxL5RcPtEwAoNmoFitEAZLTtsMQ3sXrl3+ IY/T23TICRoKdn/yFcSDzOtt7SZhBG/vqve8N3YwSyTGR7jcf9n7mKrDYaUM8B4fgo1h XVT5aYslG5nYLUeDccz5AUNYicDZjcg4gdJsE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695324497; x=1695929297; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NI6y381yNrtia6QcCIC7z4DDn4lzJBG1Oz9c+agvn3E=; b=fuwZhd+InpAzyr2kzNCFZ0LcJ4DuL1MXHQ+JtWtkpaXlT9VbwgOSJwdFt8tsqmBFda bMtYuobIVL0sh6wAuZwLefRreHwj5qRDqAzjEC6TGC7NxT2iheZVo82yn8UyhSdvMwwH /e34veQwK63HfijPBx/BW2tnT5CHl9+NNf/R55F3JaR/TvaXBccwo0OIzyC0v1kB2bLq ieCSdy2k35gBN+eV8LwKxLfYPqFUpQPjjlHFpu48mgFJ4E3U+Y2jESOZNHRlxrQnV8k4 Xrla/yEYf2v01PkZGTxmhZeMoRlTV5oDCmEMNT7//8DBTVhAGHXQjvGR7oJH39vglM96 Mv8g== X-Gm-Message-State: AOJu0Yx2tbCo617PNrt96w2ki5ZCmEcy+/N2o7kk3+lYNOafPHo1rlD5 NVtxDHIBvuus9Du7lLnc//Sf7A== X-Received: by 2002:a17:902:ab17:b0:1c4:4efc:90a6 with SMTP id ik23-20020a170902ab1700b001c44efc90a6mr6250166plb.38.1695324496702; Thu, 21 Sep 2023 12:28:16 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e6ed:6d49:f262:8041]) by smtp.gmail.com with ESMTPSA id w8-20020a1709029a8800b001b9f032bb3dsm1892875plp.3.2023.09.21.12.28.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:28:15 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , Sascha Hauer , airlied@gmail.com, daniel@ffwll.ch, festevam@gmail.com, kernel@pengutronix.de, l.stach@pengutronix.de, laurentiu.palcu@oss.nxp.com, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, shawnguo@kernel.org Subject: [RFT PATCH v2 01/12] drm/imx/dcss: Call drm_atomic_helper_shutdown() at shutdown time Date: Thu, 21 Sep 2023 12:26:44 -0700 Message-ID: <20230921122641.RFT.v2.1.I134336fce7eac5a63bdac46d57b0888858fc8081@changeid> X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog In-Reply-To: <20230921192749.1542462-1-dianders@chromium.org> References: <20230921192749.1542462-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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, 21 Sep 2023 13:29:23 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777690139072126418 X-GMAIL-MSGID: 1777690139072126418 Based on grepping through the source code this driver appears to be missing a call to drm_atomic_helper_shutdown() at system shutdown 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 comes straight out of the kernel doc "driver instance overview" in drm_drv.c. Suggested-by: Maxime Ripard Reviewed-by: Maxime Ripard Signed-off-by: Douglas Anderson Tested-by: Laurentiu Palcu Reviewed-by: Laurentiu Palcu --- This commit is only compile-time tested. (no changes since v1) drivers/gpu/drm/imx/dcss/dcss-drv.c | 8 ++++++++ drivers/gpu/drm/imx/dcss/dcss-kms.c | 7 +++++++ drivers/gpu/drm/imx/dcss/dcss-kms.h | 1 + 3 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/imx/dcss/dcss-drv.c b/drivers/gpu/drm/imx/dcss/dcss-drv.c index c68b0d93ae9e..b61cec0cc79d 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-drv.c +++ b/drivers/gpu/drm/imx/dcss/dcss-drv.c @@ -92,6 +92,13 @@ static int dcss_drv_platform_remove(struct platform_device *pdev) return 0; } +static void dcss_drv_platform_shutdown(struct platform_device *pdev) +{ + struct dcss_drv *mdrv = dev_get_drvdata(&pdev->dev); + + dcss_kms_shutdown(mdrv->kms); +} + static struct dcss_type_data dcss_types[] = { [DCSS_IMX8MQ] = { .name = "DCSS_IMX8MQ", @@ -114,6 +121,7 @@ MODULE_DEVICE_TABLE(of, dcss_of_match); static struct platform_driver dcss_platform_driver = { .probe = dcss_drv_platform_probe, .remove = dcss_drv_platform_remove, + .shutdown = dcss_drv_platform_shutdown, .driver = { .name = "imx-dcss", .of_match_table = dcss_of_match, diff --git a/drivers/gpu/drm/imx/dcss/dcss-kms.c b/drivers/gpu/drm/imx/dcss/dcss-kms.c index 896de946f8df..d0ea4e97cded 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-kms.c +++ b/drivers/gpu/drm/imx/dcss/dcss-kms.c @@ -172,3 +172,10 @@ void dcss_kms_detach(struct dcss_kms_dev *kms) dcss_crtc_deinit(&kms->crtc, drm); drm->dev_private = NULL; } + +void dcss_kms_shutdown(struct dcss_kms_dev *kms) +{ + struct drm_device *drm = &kms->base; + + drm_atomic_helper_shutdown(drm); +} diff --git a/drivers/gpu/drm/imx/dcss/dcss-kms.h b/drivers/gpu/drm/imx/dcss/dcss-kms.h index dfe5dd99eea3..62521c1fd6d2 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-kms.h +++ b/drivers/gpu/drm/imx/dcss/dcss-kms.h @@ -34,6 +34,7 @@ struct dcss_kms_dev { struct dcss_kms_dev *dcss_kms_attach(struct dcss_dev *dcss); void dcss_kms_detach(struct dcss_kms_dev *kms); +void dcss_kms_shutdown(struct dcss_kms_dev *kms); int dcss_crtc_init(struct dcss_crtc *crtc, struct drm_device *drm); void dcss_crtc_deinit(struct dcss_crtc *crtc, struct drm_device *drm); struct dcss_plane *dcss_plane_init(struct drm_device *drm, From patchwork Thu Sep 21 19:26:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 143008 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5212033vqi; Thu, 21 Sep 2023 16:45:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHfvEuQAjHBbmTPHGHaU3NFHjMEHBrxsoOTQ6AHbnoNj6VQ2jlS4yOfJ8DZvfBZAru9UoLJ X-Received: by 2002:a17:902:ec8c:b0:1c3:dbad:52d4 with SMTP id x12-20020a170902ec8c00b001c3dbad52d4mr7811565plg.33.1695339902352; Thu, 21 Sep 2023 16:45:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695339902; cv=none; d=google.com; s=arc-20160816; b=kocwwpzEhr8LG1cWF1M9bfBvo3WIuotny2WkFq0kVybI74AcOB37/VQ4ik7C+V67DJ UMCoMbt4nqVQ6D+pfBTlWpIhfODYhU/tYHLNX5VFsULM8Jn3g8rlRUoiqmdp79v7bFmP thEItNbrWfUSgK2+8W02iYFyu56Dh5SXIfUyESrtzYa8lW5DQmn+NLRwkIgHWPDWQetV puysjtyYtkj3Jlo3mwztDGdk8WIfNQQz1ty6EfqZUxqfumPnt4Y6QCXPrg3Y2zMJjirT DvjQVaccq8Cw2xt4dyIhkFeqvfLxSkSmdRSNJGgN3Okm2qw3I0eu5Tg7nCQB+oMfansF reMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hhxODKU/1KHUMb12P9tKCTdkzqsk+8BNlEjNG+/jd3Y=; fh=5Q9VEH+RUtwJr/4AX2+Mkyj3ZpwwjS2k+q43QZ1fN8A=; b=SaDfZ7diqGlVgdZi979uPzqcd/93f59VXcm3qc1eL3maqgx8moI42ZV3m68KSc6dg3 O3VzskVPR/4eeqii6wnY1gXuKYDHAn5vqzxgUsD5dzMLrsJ7gw9K+CF9h36bANE+cIk5 xse457kzhle+zmf1FAucwovv4HlTIUp1plk9CjIL/iWGdH7olemzO4sQyE5DeuAROGUH 8aktgXJ9DArkrY73ivQhkklZEB7hU7kBCggvMO7qsBJAXjS1zvdj9qTOKzQjUz8erR6J PEepEXjd/oF5YZkhs4PM/imNunV4aZodtel6x2Gtd+2xYL9UdFujFN/2punNOUz/k6zN 7zEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="GrwNN/9h"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id m19-20020a170902c45300b001bbd0450af8si2263066plm.187.2023.09.21.16.45.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 16:45:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="GrwNN/9h"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3CED5801BF68; Thu, 21 Sep 2023 12:44:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229731AbjIUTnr (ORCPT + 28 others); Thu, 21 Sep 2023 15:43:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230426AbjIUTnd (ORCPT ); Thu, 21 Sep 2023 15:43:33 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25650F83A for ; Thu, 21 Sep 2023 12:28:21 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1c434c33ec0so10965925ad.3 for ; Thu, 21 Sep 2023 12:28:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695324500; x=1695929300; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hhxODKU/1KHUMb12P9tKCTdkzqsk+8BNlEjNG+/jd3Y=; b=GrwNN/9hLscrK5fqkYez9DZBtBVh34oZ6q0evGTfUa1qjTjmOcYN0UJAL3gZ6d2vSa CjcMjsHkcTphgVmkMNtXoRuO/UJoOf1jKTBqR3DuYv2zhUvzbpIGx4Q4eNLiHhQji4/R y9DdgJMyGB2G+OqMNNjTWbHisHm1Afe7RZQ0s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695324500; x=1695929300; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hhxODKU/1KHUMb12P9tKCTdkzqsk+8BNlEjNG+/jd3Y=; b=dJ61kzsFP248DWtpGFGEQdmrJpRk8HCrd6aaUlMTsadnOsKNn5AIlkQuuPsB/HOgNx zpExoZcP3ryEwgSxEPemOF+iLIDH87gsciUTId3rXpM3vBM8naJW51XXhu2vdBQGedlq eyI99d6dpsWGk9dHN3iHh5/IpX+T3tMkfkYf0qqKfwbZ5uZH8OLyK4AV/py70TCjcG3d FFCDbRxSjNt3lyfjhQrddx63hr67zGMZ5L46DRaNKYFxGykOmw0x9jaxqkjwMKGUsVKR hbqWwbHa/59P4ufvmHop2aFpjsxIMk0VJebucmEJFWohnwkCS2xIpSxbfOaKKohXtj+Q Uu9A== X-Gm-Message-State: AOJu0YwFurivhnnGR8qeDCJIP4PKiaOvhUepLmnbW9x13nT7EG5sSsUH Effdk0DJc6z51789C0ycfu1eYA== X-Received: by 2002:a17:902:6ac8:b0:1bb:1523:b311 with SMTP id i8-20020a1709026ac800b001bb1523b311mr5075598plt.41.1695324500459; Thu, 21 Sep 2023 12:28:20 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e6ed:6d49:f262:8041]) by smtp.gmail.com with ESMTPSA id w8-20020a1709029a8800b001b9f032bb3dsm1892875plp.3.2023.09.21.12.28.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:28:19 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , airlied@gmail.com, anitha.chrisanthus@intel.com, daniel@ffwll.ch, edmund.j.dea@intel.com, linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 02/12] drm/kmb: Call drm_atomic_helper_shutdown() at shutdown time Date: Thu, 21 Sep 2023 12:26:45 -0700 Message-ID: <20230921122641.RFT.v2.2.I20cb02bafa7c2368e4bd579df0716eb62a3a21bf@changeid> X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog In-Reply-To: <20230921192749.1542462-1-dianders@chromium.org> References: <20230921192749.1542462-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Thu, 21 Sep 2023 12:44:00 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777692733073025489 X-GMAIL-MSGID: 1777692733073025489 Based on grepping through the source code this driver appears to be missing a call to drm_atomic_helper_shutdown() at system shutdown 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 comes straight out of the kernel doc "driver instance overview" in drm_drv.c. Suggested-by: Maxime Ripard Reviewed-by: Maxime Ripard Signed-off-by: Douglas Anderson --- This commit is only compile-time tested. (no changes since v1) drivers/gpu/drm/kmb/kmb_drv.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c index 24035b53441c..af9bd34fefc0 100644 --- a/drivers/gpu/drm/kmb/kmb_drv.c +++ b/drivers/gpu/drm/kmb/kmb_drv.c @@ -476,6 +476,11 @@ static int kmb_remove(struct platform_device *pdev) return 0; } +static void kmb_shutdown(struct platform_device *pdev) +{ + drm_atomic_helper_shutdown(platform_get_drvdata(pdev)); +} + static int kmb_probe(struct platform_device *pdev) { struct device *dev = get_device(&pdev->dev); @@ -622,6 +627,7 @@ static SIMPLE_DEV_PM_OPS(kmb_pm_ops, kmb_pm_suspend, kmb_pm_resume); static struct platform_driver kmb_platform_driver = { .probe = kmb_probe, .remove = kmb_remove, + .shutdown = kmb_shutdown, .driver = { .name = "kmb-drm", .pm = &kmb_pm_ops, From patchwork Thu Sep 21 19:26:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 143013 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5214765vqi; Thu, 21 Sep 2023 16:52:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHbP/RAGfS0gI8u7WXhJy3yJshqlQSO1N+wgxY/6VquMP6IpeV+BbBlbMtXq2FPwxhlE22k X-Received: by 2002:a17:90b:4c05:b0:273:b0bd:343b with SMTP id na5-20020a17090b4c0500b00273b0bd343bmr6704413pjb.41.1695340372044; Thu, 21 Sep 2023 16:52:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695340372; cv=none; d=google.com; s=arc-20160816; b=qWaPpo0/X1L/HecNLIIj4wg9I6+DQ2tu690QDrKAPnOB/5ooccxjAVZnctBE8OZwg1 tkSBx//1bHqacNrlDRMeJi9STX2C4CEfdg8x3uAWMMkuCaO9nhTp69Ltm8M3SYdd4bLa 7zG014kEbmqGll2tOhlSFD4RLWQ9uRPkJp/gOCa5wkZk9XmoiqhjQauNeKIQXTpBthft MWnGw/i4QOZAzpQd6BFsoMtwIeU+BFQRLtR2rzqhfeXKE1mNBesQstw01ZmHwZLo7fmE MYhAjVGOP4pO5YWM5H79pzi+rEqE+AUHzCW6LaMsFu4pghBP5wKN1fcmUhyr60h73gJX 5xaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qhFda07Eo+JhAQAACXr7n7to50ItTosGgo10Du+RGvo=; fh=LuNsKyu9IznsaFGU7mDb7+8DoU1Qc6m+uzwtwW95ZOg=; b=UZVD6Xatqs7KWNSYh/uT7y7j1K4RbgrQCiTPHD8KF5XrxRKdLrXTlULkTvM9mgUsLV V2IQ9cq3yA54pPRBbDNaT70jzsrBpIdgPltiNWLma8g90F4v+N1a6qynr+vpFdo3Qzxd bi0KdEJVB8rJ1z+kqTofnQu4CHatSCzxZ02kNnYuM8Zvywjz574cOHGmKiKMmm7Id/KV IL2zrZb2I848aP7fOy9jBxZU4SElwMyh9ej/KJJ5+R2izeNVi/pRzocTLLQ6ZlsbOtUR czdKQ5Ahi+1YZIis4r2KF7m+EuJsGmAw1Qk0r63DCdRVibOGlPTAJTWwb0h+PIUgHf6B VwEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=f0lhqKw3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id bj3-20020a17090b088300b00271bc76ca5fsi2640109pjb.39.2023.09.21.16.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 16:52:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=f0lhqKw3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 9FF678226F5A; Thu, 21 Sep 2023 12:46:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231310AbjIUTpp (ORCPT + 28 others); Thu, 21 Sep 2023 15:45:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231199AbjIUTp1 (ORCPT ); Thu, 21 Sep 2023 15:45:27 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50A494236 for ; Thu, 21 Sep 2023 12:28:26 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1c3d6d88231so11301625ad.0 for ; Thu, 21 Sep 2023 12:28:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695324503; x=1695929303; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qhFda07Eo+JhAQAACXr7n7to50ItTosGgo10Du+RGvo=; b=f0lhqKw3oJ1yFQA9tqXZV9wOds8/+79QdXFdG5im3zc8TOsvqe//6yLOCH9sctWUcr rrKN79e8HoHVXVz2G7EzvaIcPbelXn/gCeNg0877wf5DuG6e44+uz0B9AqO5o8+zTgJ0 C1jnFfaCShAcZs7lDKWgVjHUb6MoRPryIjgqE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695324503; x=1695929303; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qhFda07Eo+JhAQAACXr7n7to50ItTosGgo10Du+RGvo=; b=QUI0742DULjF5GVZAtbpsqQgJQ8ekk82FSRABTHh4XYP+Mt6SoWPWxHyyXH2OZTnAo riY5h9KwFgxNT2cErddZ79/KTIDaDgHnIg9UIeh2AFjPf3dgHeFQRz5wyvai7Lr8ANh4 an3ZXEuzdKC5HfzJKVlF2BSNah5GusN8oMgX7hl4dqUzVhwrmtirS+fBVPEWQk30Gtat 8euO/EcnnveTXbkFEDUU5JLNPOtHmWHvitxcUdkIn4glkcVwMp1mmeAc2kWWeT2vCM1H Upa7jxiM8DrkR7HtAghhEoYQnux7xFCPd2j+ZUeCe/mFsMLyUlIZEZ5mCF6prbJUKusz pEMA== X-Gm-Message-State: AOJu0YwbPnNSBbzD1z0REzmkpy4S9EXrArQbyxSbuIaduh4xjkF6yia8 oOASKOfYA6cJTXgmZRSpan6bn+q630EJnUcXR20RMl4X X-Received: by 2002:a17:902:f80a:b0:1c5:deaa:d72e with SMTP id ix10-20020a170902f80a00b001c5deaad72emr1042601plb.30.1695324503552; Thu, 21 Sep 2023 12:28:23 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e6ed:6d49:f262:8041]) by smtp.gmail.com with ESMTPSA id w8-20020a1709029a8800b001b9f032bb3dsm1892875plp.3.2023.09.21.12.28.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:28:22 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , Fei Shao , airlied@gmail.com, angelogioacchino.delregno@collabora.com, chunkuang.hu@kernel.org, daniel@ffwll.ch, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com, p.zabel@pengutronix.de Subject: [RFT PATCH v2 03/12] drm/mediatek: Call drm_atomic_helper_shutdown() at shutdown time Date: Thu, 21 Sep 2023 12:26:46 -0700 Message-ID: <20230921122641.RFT.v2.3.I2b014f90afc4729b6ecc7b5ddd1f6dedcea4625b@changeid> X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog In-Reply-To: <20230921192749.1542462-1-dianders@chromium.org> References: <20230921192749.1542462-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Thu, 21 Sep 2023 12:46:09 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777693225994707894 X-GMAIL-MSGID: 1777693225994707894 Based on grepping through the source code this driver appears to be missing a call to drm_atomic_helper_shutdown() at system shutdown 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 comes straight out of the kernel doc "driver instance overview" in drm_drv.c. This driver users the component model and shutdown happens in the base driver. The "drvdata" for this driver will always be valid if shutdown() is called and we know that if the "drm" pointer in our private data is non-NULL then we need to call drm_atomic_helper_shutdown(). 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. Suggested-by: Maxime Ripard Reviewed-by: Maxime Ripard Reviewed-by: Fei Shao Tested-by: Fei Shao Signed-off-by: Douglas Anderson --- Changes in v2: - Rebased and resolved conflicts. drivers/gpu/drm/mediatek/mtk_drm_drv.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index d16cc8219105..6bab360c0c1a 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -919,6 +919,14 @@ static void mtk_drm_remove(struct platform_device *pdev) of_node_put(private->comp_node[i]); } +static void mtk_drm_shutdown(struct platform_device *pdev) +{ + struct mtk_drm_private *private = platform_get_drvdata(pdev); + + if (private->drm) + drm_atomic_helper_shutdown(private->drm); +} + static int mtk_drm_sys_prepare(struct device *dev) { struct mtk_drm_private *private = dev_get_drvdata(dev); @@ -950,6 +958,7 @@ static const struct dev_pm_ops mtk_drm_pm_ops = { static struct platform_driver mtk_drm_platform_driver = { .probe = mtk_drm_probe, .remove_new = mtk_drm_remove, + .shutdown = mtk_drm_shutdown, .driver = { .name = "mediatek-drm", .pm = &mtk_drm_pm_ops, From patchwork Thu Sep 21 19:26:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 142946 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5163468vqi; Thu, 21 Sep 2023 15:00:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHILKVbiaM9vLOFwwEaWoKdKqdkORKIIAdZGiWjg7iaDSkUgV7+pm4qD3rzA+IMEGMTm5Zo X-Received: by 2002:a05:6a00:24d2:b0:68f:c057:b54c with SMTP id d18-20020a056a0024d200b0068fc057b54cmr6799236pfv.1.1695333630622; Thu, 21 Sep 2023 15:00:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695333630; cv=none; d=google.com; s=arc-20160816; b=I3gQn2lQUEBga+SUr5jpl38eDNHukRf9K3fxZE7ZSkGBWPNo85ZNTW/6TvK1SYJjEp gr4EA+Dd+dUCilx6KgjKTNAozTkBeYXTOHQCKSYRsv/JGkfIUXgnl64bSv/tCT2JlhWd fIslfWJUNmfcLf/8gO0Q8eGROerDWwECJwfvuL/h9h0o5UcYWBLzDGyIAzPsknqOPwhs X7BURW8gnODNPT6CWluJUoALPc8CfQElQ/c8+/fLv4Wxpfp12zZbPxKnm7C47APypdQt TiNsaxkPHVwDAhLwEnsz7SgHm8hv/a5vB6FVT5xlgk7+uCvbIZpYZoK5XhdzXP4TVTfF MOKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XHA8WV61h1sCTUoopvu6jUmhZo1/0sc2wBZa91YnlqI=; fh=u85gH5kGaDXpX57owmSeIIiySHyXErB32Ub2fdxtHNg=; b=FqBDEn6SU9JwAWj+ArkYpsYFHUIh4votzOLEg/i9cuHI6zi0qBVGxRcdZkiPCa0Dax FT63RAAO/fI8TapOz8lgs9dbyFtaNtJX0FMeRVfcyyCH7I0ZKSzz+6TUucfo9VQFwG5A VcK8PFX6hnQp0tbsuYtURdnDWCB0NBopfuiqfZUWMZzCE7ESzRoMF6PEonE7l6MbFViY jyIxrUk6IwqQ2xJl4eB+3/PPqn10yaET59pKulDo5p4jwk8sGkURpk5aWcW6PWp2TkFf yjTDbfjnWEzFOPWaBW3Id5vJaA0181vzpHm3toxtnRumpCbM+2kVfI9KeFHxiSAAxQW0 CbKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PMIbhcMO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id l3-20020a056a00140300b00690d624f294si2461242pfu.322.2023.09.21.15.00.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 15:00:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PMIbhcMO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 3DE2E80565B3; Thu, 21 Sep 2023 12:50:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229788AbjIUTuA (ORCPT + 28 others); Thu, 21 Sep 2023 15:50:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230208AbjIUTtd (ORCPT ); Thu, 21 Sep 2023 15:49:33 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1A421090D for ; Thu, 21 Sep 2023 12:28:28 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-68fcb4dc8a9so1265300b3a.2 for ; Thu, 21 Sep 2023 12:28:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695324506; x=1695929306; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XHA8WV61h1sCTUoopvu6jUmhZo1/0sc2wBZa91YnlqI=; b=PMIbhcMOgys27dEgkEIP5PwEsYx+RS1t9LGrN8SSq4KnKOIioLxkv6SLiGSwL8C5GX cRJZbVH52RhoVbcmskCJWEJpZii0wciCHY1Y2AweY67YaEKt9evu+oea4fm/WSH+y6KY L0gaAaaLkvf1/6cU1NkCYKI6MZhUyZ6xWmh7o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695324506; x=1695929306; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XHA8WV61h1sCTUoopvu6jUmhZo1/0sc2wBZa91YnlqI=; b=nf6RLsSBZF97KvhEOx4H3u1OESMThFx079ljssjHudfRTke5nsaBbOqbtx3WvEdMqq hnl744WQiYPGZxOE/wlvwM46s+sCm+89DBatp187MDEVEemlvlMZeTIBOEf36U85QA8h ulYnakP+VQtZtEbxNm1Otuo+ad6lMrkCQ8wK4dIFr0x7pOkfDTCT6fqEd3ae5YJUdCD3 +JTisW9MEJUwrUvWpN3FFF2Z5KGTjwRz/z8J3XUvYCdLGlhHZVSbQEajYnliOWLuHj3G e4inZuFPGOXyTpDQP0+j73ZeSCwsD4h+k2yi5DEbArwotSOvl6iH+dEMc5Lmay4hFASN 8QDw== X-Gm-Message-State: AOJu0Yxo6zO8V5fFPduoVmOkkKBO9cwxbxkvo6TQWFrEZqcoYzJMqFnN lFA+iLR4jyLHBixceKcoOsx0RQ== X-Received: by 2002:a05:6a20:3ca8:b0:15c:e0bf:40ec with SMTP id b40-20020a056a203ca800b0015ce0bf40ecmr5940561pzj.17.1695324506566; Thu, 21 Sep 2023 12:28:26 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e6ed:6d49:f262:8041]) by smtp.gmail.com with ESMTPSA id w8-20020a1709029a8800b001b9f032bb3dsm1892875plp.3.2023.09.21.12.28.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:28:24 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , airlied@gmail.com, bskeggs@redhat.com, daniel@ffwll.ch, kherbst@redhat.com, linux-kernel@vger.kernel.org, lyude@redhat.com, nouveau@lists.freedesktop.org Subject: [RFT PATCH v2 04/12] drm/nouveau: Call drm_atomic_helper_shutdown() or equiv at shutdown time Date: Thu, 21 Sep 2023 12:26:47 -0700 Message-ID: <20230921122641.RFT.v2.4.Ie7588ec6e0f93e8bc700e76b265ad1a7ad6b15ad@changeid> X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog In-Reply-To: <20230921192749.1542462-1-dianders@chromium.org> References: <20230921192749.1542462-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Thu, 21 Sep 2023 12:50:30 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777686157254283393 X-GMAIL-MSGID: 1777686157254283393 Based on grepping through the source code this driver appears to be missing a call to drm_atomic_helper_shutdown() (or drm_helper_force_disable_all() if not using atomic) at system shutdown 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 comes straight out of the kernel doc "driver instance overview" in drm_drv.c. Suggested-by: Maxime Ripard Reviewed-by: Maxime Ripard Signed-off-by: Douglas Anderson Reviewed-by: Lyude Paul Tested-by: Lyude Paul --- This commit is only compile-time tested. I made my best guess about how to fit this into the existing code. If someone wishes a different style, please yell. (no changes since v1) drivers/gpu/drm/nouveau/nouveau_display.c | 9 +++++++++ drivers/gpu/drm/nouveau/nouveau_display.h | 1 + drivers/gpu/drm/nouveau/nouveau_drm.c | 13 +++++++++++++ drivers/gpu/drm/nouveau/nouveau_drv.h | 1 + drivers/gpu/drm/nouveau/nouveau_platform.c | 6 ++++++ 5 files changed, 30 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index d8c92521226d..05c3688ccb76 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -642,6 +642,15 @@ nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime) disp->fini(dev, runtime, suspend); } +void +nouveau_display_shutdown(struct drm_device *dev) +{ + if (drm_drv_uses_atomic_modeset(dev)) + drm_atomic_helper_shutdown(dev); + else + drm_helper_force_disable_all(dev); +} + static void nouveau_display_create_properties(struct drm_device *dev) { diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h index 2ab2ddb1eadf..9df62e833cda 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.h +++ b/drivers/gpu/drm/nouveau/nouveau_display.h @@ -47,6 +47,7 @@ void nouveau_display_destroy(struct drm_device *dev); int nouveau_display_init(struct drm_device *dev, bool resume, bool runtime); void nouveau_display_hpd_resume(struct drm_device *dev); void nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime); +void nouveau_display_shutdown(struct drm_device *dev); int nouveau_display_suspend(struct drm_device *dev, bool runtime); void nouveau_display_resume(struct drm_device *dev, bool runtime); int nouveau_display_vblank_enable(struct drm_crtc *crtc); diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 50589f982d1a..8ecfd66b7aab 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -879,6 +879,18 @@ nouveau_drm_remove(struct pci_dev *pdev) pci_disable_device(pdev); } +void +nouveau_drm_device_shutdown(struct drm_device *dev) +{ + nouveau_display_shutdown(dev); +} + +static void +nouveau_drm_shutdown(struct pci_dev *pdev) +{ + nouveau_drm_device_shutdown(pci_get_drvdata(pdev)); +} + static int nouveau_do_suspend(struct drm_device *dev, bool runtime) { @@ -1346,6 +1358,7 @@ nouveau_drm_pci_driver = { .id_table = nouveau_drm_pci_table, .probe = nouveau_drm_probe, .remove = nouveau_drm_remove, + .shutdown = nouveau_drm_shutdown, .driver.pm = &nouveau_pm_ops, }; diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 3666a7403e47..aa936cabb6cf 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h @@ -327,6 +327,7 @@ struct drm_device * nouveau_platform_device_create(const struct nvkm_device_tegra_func *, struct platform_device *, struct nvkm_device **); void nouveau_drm_device_remove(struct drm_device *dev); +void nouveau_drm_device_shutdown(struct drm_device *dev); #define NV_PRINTK(l,c,f,a...) do { \ struct nouveau_cli *_cli = (c); \ diff --git a/drivers/gpu/drm/nouveau/nouveau_platform.c b/drivers/gpu/drm/nouveau/nouveau_platform.c index 23cd43a7fd19..b2e82a96411c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_platform.c +++ b/drivers/gpu/drm/nouveau/nouveau_platform.c @@ -50,6 +50,11 @@ static int nouveau_platform_remove(struct platform_device *pdev) return 0; } +static void nouveau_platform_shutdown(struct platform_device *pdev) +{ + nouveau_drm_device_shutdown(platform_get_drvdata(pdev)); +} + #if IS_ENABLED(CONFIG_OF) static const struct nvkm_device_tegra_func gk20a_platform_data = { .iommu_bit = 34, @@ -94,4 +99,5 @@ struct platform_driver nouveau_platform_driver = { }, .probe = nouveau_platform_probe, .remove = nouveau_platform_remove, + .shutdown = nouveau_platform_shutdown, }; From patchwork Thu Sep 21 19:26:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 143060 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5252773vqi; Thu, 21 Sep 2023 18:22:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHg+f8Zg93eRt7J3FxvlvE6dNxv7hhkbjoBlPq21FIXiqnbZPCoqMR0J3B0YytUQnfTK26q X-Received: by 2002:a05:6a00:24d2:b0:68f:c057:b54c with SMTP id d18-20020a056a0024d200b0068fc057b54cmr7186231pfv.1.1695345763247; Thu, 21 Sep 2023 18:22:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695345763; cv=none; d=google.com; s=arc-20160816; b=TklIYWcYAXDOeahmmH26FigICXiAIOWXlsqZERk5+atv4HmM1i5MCjxozfBCegRxB8 SqmydpXLkwuxobVvd3wU1uDSG4s5v1q/2x68eva9HV2yfYtfiz2QjEIvmcH0nV7k6lvC h2lbnCOCtKzWR+6JtDDe39kBGm9IruBgEBrv2QTnMnYItEM7XRELSYpKo6676nteIVMB USaK4jvGLVfa+SIDUj+7BVJek3aY3mCN4OpMZSbuVLITMS1Y5kST1GpbESB3vWi0LcPu O3ag8pSvUcirrYn5YNZ3HOQj+bf7dpxi/xf3y39shoQ+8bZL0QHwhm3EtmY0ofrntW7S Uzig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EjE+v7+9YV8M91Wchnv2I6StT/F66BSqTQ0jlAjsGeo=; fh=IcQ7t2jYSX2sUMSLAAHg4fLKyqTczA22Et3CECFZmTs=; b=eHenYI6lnpn4aUO5nSQVIeLOKvHofw8J9JOmviN0oVG8T54QmD/BIA0iCmDVkGRZoz IpuQBbCtqGVPkDZoNIsEYYybUx0cJnEco970WCPKEnUlyQPjGdsgzzMYZw7uTNp0zseZ waYj71Ct0oUPoF7KhxN+ZVx3ZDGDivGvSQM4rOTdCOozRfdXwY+rvoEewSTk9SBhpGdG ILUcui7NwsOjBUt8imU9Fob9v7+KJaAHyJ8yd1cDz4pQOhgI+DVrR1HIaidDillKQsrl NHNqX8QgzYWAD20z5hJnw1coeLzNUjy9roBHK3aGj7pkH6q0TWf+as13ZX0cBiq70XS8 9kGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Bz1MvDOX; 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=NONE dis=NONE) header.from=chromium.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id bt25-20020a056a00439900b006901504b6a3si2693656pfb.153.2023.09.21.18.22.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 18:22:43 -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=@chromium.org header.s=google header.b=Bz1MvDOX; 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=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 7E0C58080EF1; Thu, 21 Sep 2023 12:47:47 -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 S230486AbjIUTr0 (ORCPT + 28 others); Thu, 21 Sep 2023 15:47:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230451AbjIUTrQ (ORCPT ); Thu, 21 Sep 2023 15:47:16 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 836DCA239E for ; Thu, 21 Sep 2023 12:28:30 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-577fb90bb76so797268a12.2 for ; Thu, 21 Sep 2023 12:28:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695324510; x=1695929310; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EjE+v7+9YV8M91Wchnv2I6StT/F66BSqTQ0jlAjsGeo=; b=Bz1MvDOX7w4+rP0FNtborBxKeiu3FaZeNyukwwR+dENSq0XFjkS3x58nk6JLljhkut 9Bf5b1xmPqCpm0hKi/d5PjJfmXDqp1C++oies7+hAuEvwdeDvUD+M9+tjdhGOuIU4DWz mbPP0JazvVEMqW6y57JGa1DfJhLXtbTvLXRAY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695324510; x=1695929310; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EjE+v7+9YV8M91Wchnv2I6StT/F66BSqTQ0jlAjsGeo=; b=sEHVOZ55Vqy1DsHbgRndFo5jgJ5Wb4EEIs5YgE+FnsR60Svx7brQVVqUrNOEfRpWGY KL8T0p2xzQFYcr3Kwh2TM+FcjDishqiRXHmPnku7P3Y/YX95WfNQcWv98/MFXgIFSQQK WJvqArh5+anY+LEOrqYaB3OEvlhlIItOLOPLKzv1znd0h1CkVZDp2z484bwj9GcVg2xQ Yzdj2lKP/lcEu9C3Zw8MuWOyApD4XucqmCt/4H+PbSX1/rHR+JaR9sJfruvEgVv70F2A Exr0z7mkrVWbDcEj6nVxFnhjU0Hil+o8tFYYDQam5Q+WYaXl+CibaBC+2pSHYgFo4X2r OS+g== X-Gm-Message-State: AOJu0YwWnkhOqGQzMnzqmbV0fLmarb7fHaa/pMJL0TPoFxM88sNdCPxf ubbxvJKNjQEk8LpmEuU66OP1GQ== X-Received: by 2002:a05:6a20:840d:b0:154:6480:83b4 with SMTP id c13-20020a056a20840d00b00154648083b4mr7513077pzd.14.1695324509805; Thu, 21 Sep 2023 12:28:29 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e6ed:6d49:f262:8041]) by smtp.gmail.com with ESMTPSA id w8-20020a1709029a8800b001b9f032bb3dsm1892875plp.3.2023.09.21.12.28.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:28:28 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , airlied@gmail.com, daniel@ffwll.ch, jonathanh@nvidia.com, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, mperttunen@nvidia.com, thierry.reding@gmail.com Subject: [RFT PATCH v2 05/12] drm/tegra: Call drm_atomic_helper_shutdown() at shutdown time Date: Thu, 21 Sep 2023 12:26:48 -0700 Message-ID: <20230921122641.RFT.v2.5.Ifb4450979b62976fd5a98847dade2e5b377d47c8@changeid> X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog In-Reply-To: <20230921192749.1542462-1-dianders@chromium.org> References: <20230921192749.1542462-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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]); Thu, 21 Sep 2023 12:47:47 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777698878670020952 X-GMAIL-MSGID: 1777698878670020952 Based on grepping through the source code this driver appears to be missing a call to drm_atomic_helper_shutdown() at system shutdown 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 comes straight out of the kernel doc "driver instance overview" in drm_drv.c. Suggested-by: Maxime Ripard Reviewed-by: Maxime Ripard Signed-off-by: Douglas Anderson --- This commit is only compile-time tested. (no changes since v1) drivers/gpu/drm/tegra/drm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index ff36171c8fb7..ce2d4153f7bd 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -1312,6 +1312,11 @@ static int host1x_drm_remove(struct host1x_device *dev) return 0; } +static void host1x_drm_shutdown(struct host1x_device *dev) +{ + drm_atomic_helper_shutdown(dev_get_drvdata(&dev->dev)); +} + #ifdef CONFIG_PM_SLEEP static int host1x_drm_suspend(struct device *dev) { @@ -1380,6 +1385,7 @@ static struct host1x_driver host1x_drm_driver = { }, .probe = host1x_drm_probe, .remove = host1x_drm_remove, + .shutdown = host1x_drm_shutdown, .subdevs = host1x_drm_subdevs, }; From patchwork Thu Sep 21 19:26:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 142973 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5187433vqi; Thu, 21 Sep 2023 15:48:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGHKPx6IRuml1Ky2wUUT8yIxljy3roh9aQe+r1tkUTTPXKNz/kmntDsH6srLR1mHVji3zT4 X-Received: by 2002:a05:6358:284:b0:134:d030:e5da with SMTP id w4-20020a056358028400b00134d030e5damr6178668rwj.21.1695336517744; Thu, 21 Sep 2023 15:48:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695336517; cv=none; d=google.com; s=arc-20160816; b=lNpumOSmy35F2zxPZcgyBFa3kxTleC6FLL5IHZCQkTDFsE9g3iFE/oOw+43D06c6a3 DZRjp7T3nfWPgrSBVIStvVax+WUfvqD1Qzdy8mCEQZCqnEtVh1RLgEJuRW4H/lc8ec0G /rUOQuCCKUT/xGBI8WbiVV27eLVJAgOvlRniVp9oQwjMsmyQapV8tNVL2gGBtPI/KKN6 kMv70KNQYbcmMGcKPlioYp6/KbhFOfdS+g0s/zM6Hph4jFFP5zt8awz0b+J6OoQOIbD+ B4WU7Uu+ztNL3RB12gbWp9oZBCmcXQHhbxv7jo2h8mTREfiyGwgh+fm9MmsNwv5nfThL frew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cZtAYqJWE7JpdsZxb5rfWkU3kZ2lTrkKomU0ysGX5d0=; fh=6KkIg9Dpbcp7fIplU7SB3fHrXbhB2SNmQOp52ejbWMA=; b=Ts7VRosdV8qyWmlNNJMZOwfaSSgQyVrMFIagUJIN3RcjL8HvUP79iSUvqK5mPZZlYE 8PkBfSzO/20oovMrC81f7YCw02m+Vl/JZhLGY1Pb7HXm4r0trHLih1IvuPhAocCKvIpk qd2rRasyn8rBYwsZRHT+xx5ieZALTQ/Y5AWwTxGeaNrUcOchnaUWHdRrE2JRXXmviTRF uRtFgCcvOc1uLJimd3Ij84O/L5qINxoGJ/sqMeezjzBsdgFP6nji1RFIQRvrK10XzNvg 4zFUagHQkCLG6O6JQiqbf6lTFardbimPf68DOibdnC8RbBZ7Lew5V35fL52XWT2JFUb4 ktGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ToDHSlZL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id l9-20020a654c49000000b005652bd27e80si2442236pgr.588.2023.09.21.15.48.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 15:48:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ToDHSlZL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id A43598198012; Thu, 21 Sep 2023 12:42:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230392AbjIUTmW (ORCPT + 28 others); Thu, 21 Sep 2023 15:42:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230054AbjIUTmB (ORCPT ); Thu, 21 Sep 2023 15:42:01 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 064B07D96 for ; Thu, 21 Sep 2023 12:28:33 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-690d8fb3b7eso1228090b3a.1 for ; Thu, 21 Sep 2023 12:28:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695324512; x=1695929312; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cZtAYqJWE7JpdsZxb5rfWkU3kZ2lTrkKomU0ysGX5d0=; b=ToDHSlZL2ePyl5Fy5MYy4QymnfmjAzXN7tA6azG2N3WLAFyjK8LPmf1PxPBfFsYVBk +MLMjrmk98l21JXBPpSX5nh491HXyHEENNsNXlfTDFTWo/c/0/2moZAj3+rejToe5VIB 5tX0fiqCKBhcmDoNIqvpYmXyP3YqeouI5xEUo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695324512; x=1695929312; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cZtAYqJWE7JpdsZxb5rfWkU3kZ2lTrkKomU0ysGX5d0=; b=R82AALYUmsAXkgtdJfoaqQj5iZlN57VJ8I+oljXEDDOKloza8zum7WheeaXjNC/dDI Nyloph3lk4P82bDekdEHy1HsOx9pKUN1i8fLrMDnA/dCF75+ra2IIvOWvJuK0y5YlgBx VsgwmGQy2vUybk/TW8mvTNHjCxgP2lEcdHw7n/RZVfCkAa/5TgVJtboajQmvKjVrn/qQ fseybIjn5IzUmvIAwNllJkXHA8jltTXOK9mqazn/xEb3i3WrJ7EimvHwdTvMx0rpV37I Ga24cSrSgLpozEaMvV2xHIlpT8XTzbDyGfVCa9sV5C1dK8a955L21t2pXZj1Bi7GKaMz NiKA== X-Gm-Message-State: AOJu0YzuM0zl1iIkA7Rg7dfh72S64lnOz26ktAQGZFlMUvY/WuiIi/V2 EM09RdXtxDMzHBFqLK69jYI3pA== X-Received: by 2002:a05:6a20:7f93:b0:152:6b63:f1e5 with SMTP id d19-20020a056a207f9300b001526b63f1e5mr8883328pzj.38.1695324512344; Thu, 21 Sep 2023 12:28:32 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e6ed:6d49:f262:8041]) by smtp.gmail.com with ESMTPSA id w8-20020a1709029a8800b001b9f032bb3dsm1892875plp.3.2023.09.21.12.28.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:28:30 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , abrodkin@synopsys.com, airlied@gmail.com, daniel@ffwll.ch, linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 06/12] drm/arcpgu: Call drm_atomic_helper_shutdown() at shutdown time Date: Thu, 21 Sep 2023 12:26:49 -0700 Message-ID: <20230921122641.RFT.v2.6.I8a0a246fea222059881d01a8fff2adcf7ef3d7a4@changeid> X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog In-Reply-To: <20230921192749.1542462-1-dianders@chromium.org> References: <20230921192749.1542462-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Thu, 21 Sep 2023 12:42:28 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777689184684096646 X-GMAIL-MSGID: 1777689184684096646 Based on grepping through the source code this driver appears to be missing a call to drm_atomic_helper_shutdown() at system shutdown 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 comes straight out of the kernel doc "driver instance overview" in drm_drv.c. Suggested-by: Maxime Ripard Reviewed-by: Maxime Ripard Signed-off-by: Douglas Anderson --- This commit is only compile-time tested. (no changes since v1) drivers/gpu/drm/tiny/arcpgu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/tiny/arcpgu.c b/drivers/gpu/drm/tiny/arcpgu.c index e5b10e41554a..c1e851c982e4 100644 --- a/drivers/gpu/drm/tiny/arcpgu.c +++ b/drivers/gpu/drm/tiny/arcpgu.c @@ -414,6 +414,11 @@ static int arcpgu_remove(struct platform_device *pdev) return 0; } +static void arcpgu_shutdown(struct platform_device *pdev) +{ + drm_atomic_helper_shutdown(platform_get_drvdata(pdev)); +} + static const struct of_device_id arcpgu_of_table[] = { {.compatible = "snps,arcpgu"}, {} @@ -424,6 +429,7 @@ MODULE_DEVICE_TABLE(of, arcpgu_of_table); static struct platform_driver arcpgu_platform_driver = { .probe = arcpgu_probe, .remove = arcpgu_remove, + .shutdown = arcpgu_shutdown, .driver = { .name = "arcpgu", .of_match_table = arcpgu_of_table, From patchwork Thu Sep 21 19:26:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 143027 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5227816vqi; Thu, 21 Sep 2023 17:21:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHsAoFRFPWyyvY9pBAeInUBQ/v4KglDx6KiRnsTcu4UghY1OoNB5OuWpW5T4sA2BQLazwuZ X-Received: by 2002:a05:6358:52d4:b0:132:dc58:b372 with SMTP id z20-20020a05635852d400b00132dc58b372mr8163538rwz.19.1695342068090; Thu, 21 Sep 2023 17:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695342068; cv=none; d=google.com; s=arc-20160816; b=jCgz93GFCPhXeZGyyCx1kuWNvl7FlBUOdhsGzZPxH+DsPDzzn6yvWD0sikgu8E3uBq 22nhL5VH7BmVH9N8c7E+GPNxJNRo2EH4vEcOBCTQ7/e4a+9FmwXpjnDmGnXXtEfAV6gM 2YllmGoAinrQ7aZi32eew+mLn+zgJO7oBFBSsDJl3U4Olpeha/ShfzfC8r22dlxXM1CG T3UTuC5uKJQ+0Jn8/ldE5Qjwh8HrenB7n3rb20y2L8WOnx/pjCMXjj6btsxnpEOQYaqo lSsDAj1Z7c+f6oDdEv69HCgAmmxRGweqWEOZFlMoR/6+6muEhp7DVlL+EPfM8mwOnKK3 /aQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yIB9Su1U7bIPFr+7ANN/OcavTAqWwcBq0GS4I1/bwSs=; fh=F5ges0200sYyAL3tcOOm51W65I2/Tz/5LjD8sA7LRd0=; b=gcfENmp8QB3uS4but0qzg1a/TJF3M8a2odllHTi3gMiGRaNwlUZClEIRMmr7HFUM3q FoN16mTRGIro22RkfjcIehmdYbUBg+plux7v3HzSnpT1+H10eFDBTCWwKl9AFK7yFL7a npumXi+fLhWYlvbThFJHl4sOIan8EuCZ2OkWAEnqp0YcD1z9i1t+x21mAnlJMeyBQgE1 ii7wEw35LF6id3zGFJir4DhGwq0u7XHC6otNu01qMgl17YLsgaVazeNjTtRnbmIEuBsp cq+tEsluMCe7hBm5NTIwkbw518frYQ4cacgTQ0CxFD4u1sFbS+v1Kk/0oFDFMDld7nLy fhvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kA6r8M8D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id m9-20020a654389000000b005740b47241csi2433770pgp.804.2023.09.21.17.21.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 17:21:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kA6r8M8D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A53A582A0BF3; Thu, 21 Sep 2023 12:42:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229939AbjIUTmY (ORCPT + 28 others); Thu, 21 Sep 2023 15:42:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230074AbjIUTmC (ORCPT ); Thu, 21 Sep 2023 15:42:02 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C816311C9 for ; Thu, 21 Sep 2023 12:28:36 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1c364fb8a4cso12168595ad.1 for ; Thu, 21 Sep 2023 12:28:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695324515; x=1695929315; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yIB9Su1U7bIPFr+7ANN/OcavTAqWwcBq0GS4I1/bwSs=; b=kA6r8M8D6Zpr7sxzIC+SfyB79mHUCKovgwcDPwEVLYgz10fPiu0IgMY8JNr//MEMfL kOmkrIGwDWfenhXNaIzEnQ3K/IAKCH8owsMw5ZchmcmYLk6XB7RXok1v+97Ppsnsd9XR l3U2zsJGakrUFmXlBAXPfEHlwGH/ftunRaVQA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695324515; x=1695929315; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yIB9Su1U7bIPFr+7ANN/OcavTAqWwcBq0GS4I1/bwSs=; b=ZFddzsZR+DmC9ftY00mJBLVGY9APdp2LXROVIY9P9PIuR6DMREWtgMF+5WapBmOCzZ ch+y6ZfGAbaJ4f+buB1U0QNInSBAi767OVT1QZwyzup4BkHtC0Zdy+LTHqyRHOYEH4lj V4ek32NVJR+007mAYKX89msO3vlWRHDlqS8szgLeNap4Jzj3rW/SyneL/+qmq39teGPH s690Z6Yv3A0W4FdUpQqjKOJluROxiKpNWfbPGt7ck35W15fFGVTMqhx5b4/uKtpSYxuQ DJa5ekV5a0/CaRKHYsIdPGtrKYFYlk19nNSvKgd6qheV1kvZIYgRZmYCVVD0tk6ejHWz GRdw== X-Gm-Message-State: AOJu0Ywp22PBlvkOiDzj43sgqpoQAsPlddRK4iXOFpSgn9EPSLujrBsW N/0vRbf59Okp0D0BQPzwp5qpMQ== X-Received: by 2002:a17:902:bb83:b0:1c2:82e:32de with SMTP id m3-20020a170902bb8300b001c2082e32demr5155768pls.0.1695324515416; Thu, 21 Sep 2023 12:28:35 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e6ed:6d49:f262:8041]) by smtp.gmail.com with ESMTPSA id w8-20020a1709029a8800b001b9f032bb3dsm1892875plp.3.2023.09.21.12.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:28:34 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , Bokun.Zhang@amd.com, Hawking.Zhang@amd.com, James.Zhu@amd.com, Victor.Zhao@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, alexander.deucher@amd.com, amd-gfx@lists.freedesktop.org, christian.koenig@amd.com, daniel@ffwll.ch, felix.kuehling@amd.com, jim.cromie@gmail.com, le.ma@amd.com, lijo.lazar@amd.com, linux-kernel@vger.kernel.org, maarten.lankhorst@linux.intel.com, mario.limonciello@amd.com, mdaenzer@redhat.com, shiwu.zhang@amd.com, srinivasan.shanmugam@amd.com, tzimmermann@suse.de Subject: [RFT PATCH v2 07/12] drm/amdgpu: Call drm_atomic_helper_shutdown() at shutdown time Date: Thu, 21 Sep 2023 12:26:50 -0700 Message-ID: <20230921122641.RFT.v2.7.I27914059cc822b52db9bf72b4013b525b60e06fd@changeid> X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog In-Reply-To: <20230921192749.1542462-1-dianders@chromium.org> References: <20230921192749.1542462-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Thu, 21 Sep 2023 12:42:29 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777695004058552866 X-GMAIL-MSGID: 1777695004058552866 Based on grepping through the source code this driver appears to be missing a call to drm_atomic_helper_shutdown() at system shutdown 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 comes straight out of the kernel doc "driver instance overview" in drm_drv.c. Suggested-by: Maxime Ripard Signed-off-by: Douglas Anderson --- This commit is only compile-time tested. ...and further, I'd say that this patch is more of a plea for help than a patch I think is actually right. I'm _fairly_ certain that drm/amdgpu needs this call at shutdown time but the logic is a bit hard for me to follow. I'd appreciate if anyone who actually knows what this should look like could illuminate me, or perhaps even just post a patch themselves! (no changes since v1) drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 ++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 ++ 3 files changed, 13 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 8f2255b3a38a..cfcff0b37466 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -1104,6 +1104,7 @@ static inline struct amdgpu_device *amdgpu_ttm_adev(struct ttm_device *bdev) int amdgpu_device_init(struct amdgpu_device *adev, uint32_t flags); void amdgpu_device_fini_hw(struct amdgpu_device *adev); +void amdgpu_device_shutdown_hw(struct amdgpu_device *adev); void amdgpu_device_fini_sw(struct amdgpu_device *adev); int amdgpu_gpu_wait_for_idle(struct amdgpu_device *adev); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index a2cdde0ca0a7..fa5925c2092d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -4247,6 +4247,16 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev) } +void amdgpu_device_shutdown_hw(struct amdgpu_device *adev) +{ + if (adev->mode_info.mode_config_initialized) { + if (!drm_drv_uses_atomic_modeset(adev_to_drm(adev))) + drm_helper_force_disable_all(adev_to_drm(adev)); + else + drm_atomic_helper_shutdown(adev_to_drm(adev)); + } +} + void amdgpu_device_fini_sw(struct amdgpu_device *adev) { int idx; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index e90f730eb715..3a7cbff111d1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -2333,6 +2333,8 @@ amdgpu_pci_shutdown(struct pci_dev *pdev) struct drm_device *dev = pci_get_drvdata(pdev); struct amdgpu_device *adev = drm_to_adev(dev); + amdgpu_device_shutdown_hw(adev); + if (amdgpu_ras_intr_triggered()) return; From patchwork Thu Sep 21 19:26:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 142895 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5128581vqi; Thu, 21 Sep 2023 13:46:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGJ4M0ixp65J07J9iRDWuHKVQH3d4x2ZdySdQZeI/cdjxWa2Y4VTlQ/Ig2/7xp2/7LpHXH6 X-Received: by 2002:a17:902:dac5:b0:1b6:6f12:502e with SMTP id q5-20020a170902dac500b001b66f12502emr6724121plx.49.1695329198037; Thu, 21 Sep 2023 13:46:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695329198; cv=none; d=google.com; s=arc-20160816; b=zWZ4PYOBZC0IlJmEXaD/NcEE7G7jtz7ai4kNCdSYyRpuy3BbTY0XVWj/NcSTSxf4iF 06nquvlH7maU/2jySLT+CoiDu+HerigLWY9A/T1kHTa5konkU2w4hAqJqMsY7WVKNG2q xwhQ5aVahIllEBDvMJ7kQU2xFboGSQcwfsOreqloZ8yBBAvMWq/ZHqzSnhak+uWC0vJk Xrj5GK1scSeCEs5ZeU8SF8Rwl1rumHjDjYn/L/Za74Tt4/jvNvp/wolh/cP1pqJ7FI9w IV6dQ8UZMQoYE+dszM4W/Ql9P7TWux0/ps4RlHEeZMXfHMni2APQJT0TNlpdHwZXHp1P ZCtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pLjLrmqx+liQMxms0HfuoarLoIvQ77Y5EZxHJFXGDMo=; fh=Z4ZyLSzJJ8oXYf7fmYnIfVrK+FZ8rEdS0PAx36IDmWI=; b=qfiMdEjRIUR1SQS2cDv36W2TNF7w9HHt08DpU3FXOOLPvRTqVt9SmDlRaJGwrKp6g4 3GL3SL6GRAX3I/6H0aeXXH1jVEt+lyO4XwoTgpIh1A8F3ZUdeB0AUmM4tUd0fpVET/73 1Q0PAxgTcACCduGPNdblaO2mGqsvxoZHzsNRhbEuFp3xM+YwaaJklWOAjcuFPquPyQ5t eHdxnnmKwtGglX/z+vHyck83bm3scsKlWGEbD47dnsN9VAP1sqrsaggP4OYBow90W/53 icHqybBlYKd+E9Il7k4+OOqOCtfUnLIj3kUuq5efl76X89W6hUsXmfSwLbBPBGwuuXRg vBzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LIF8E9mc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id x10-20020a170902a38a00b001c5db1e47c3si1486369pla.553.2023.09.21.13.46.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 13:46:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LIF8E9mc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id CB1D48197059; Thu, 21 Sep 2023 12:49:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229513AbjIUTtJ (ORCPT + 28 others); Thu, 21 Sep 2023 15:49:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229988AbjIUTsn (ORCPT ); Thu, 21 Sep 2023 15:48:43 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2F3F2716 for ; Thu, 21 Sep 2023 12:28:39 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-690f7d73a3aso1243638b3a.0 for ; Thu, 21 Sep 2023 12:28:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695324519; x=1695929319; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pLjLrmqx+liQMxms0HfuoarLoIvQ77Y5EZxHJFXGDMo=; b=LIF8E9mckttFvbrw4NDM1Sg64ux3FFvfxfpgs0S5Ciro8qeKUJGSsAXmN+fVtRh8vM c6c6Dustjci7+T6kT781AZZAANIJLJK5N1QLDiYayOLN/nmSSWhtwvcY+MkCz2O8IXNL V0UcSDcFiUCNQfM9PJJo7hcInXhEYma/Xeixs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695324519; x=1695929319; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pLjLrmqx+liQMxms0HfuoarLoIvQ77Y5EZxHJFXGDMo=; b=gZ0W1W5iLJRuiVm3yAKBRzU33a2fP034Z7Vgw1enCo+lekIAUYuh2V8WAGsEoSqOip mRWdbgipJ2o9zmed9fDjiS8zFiaz2F3fNdfu0DEMtSLuBUV6TksgAFQwDAZtGQu/lely IwV/6lt1iq+LlT8Ftk9ZsWML+W3lTjct1tx/93zP1XeUxARGI+xFo5ptDYTZqk/2Y64R TU5DtENp6OiKb7kjT5unwdoDD1UKG3rMn36rPcReqZmkkmt9qpk1IZ/5dPA3DdL8ZRun sF4DjKz4xTFJ/ryTe04n1bPGV5SBDEXz9ze1psvNmLHLnRGT4RzSEvVyGUd7P5mo2Atq aa4w== X-Gm-Message-State: AOJu0YweYGdA9n1dZ6dhy45xaGI5mL/CyxU+MFa4viZBe6claHxCSjkj QWmaj3TdNyNcHUb41btGQHgr1A== X-Received: by 2002:a05:6a20:324c:b0:148:6063:3273 with SMTP id hm12-20020a056a20324c00b0014860633273mr5419552pzc.29.1695324518923; Thu, 21 Sep 2023 12:28:38 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e6ed:6d49:f262:8041]) by smtp.gmail.com with ESMTPSA id w8-20020a1709029a8800b001b9f032bb3dsm1892875plp.3.2023.09.21.12.28.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:28:37 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , Baolin Wang , airlied@gmail.com, daniel@ffwll.ch, kieran.bingham+renesas@ideasonboard.com, linux-kernel@vger.kernel.org, orsonzhai@gmail.com, robh@kernel.org, sam@ravnborg.org, steven.price@arm.com, tzimmermann@suse.de, zhang.lyra@gmail.com Subject: [RFT PATCH v2 08/12] drm/sprd: Call drm_atomic_helper_shutdown() at remove time Date: Thu, 21 Sep 2023 12:26:51 -0700 Message-ID: <20230921122641.RFT.v2.8.I7a2dd349cb52bae53280d0a49e22cc27b923274b@changeid> X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog In-Reply-To: <20230921192749.1542462-1-dianders@chromium.org> References: <20230921192749.1542462-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Thu, 21 Sep 2023 12:49:13 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777681509105039452 X-GMAIL-MSGID: 1777681509105039452 Based on grepping through the source code, this driver appears to be missing a call to drm_atomic_helper_shutdown() at remove time. Let's add it. The fact that we should call drm_atomic_helper_shutdown() in the case of OS driver remove comes straight out of the kernel doc "driver instance overview" in drm_drv.c. While at it, let's also fix it so that if the driver's bind fails or if a driver gets unbound that the drvdata gets set to NULL. This will make sure we can't get confused during a later shutdown(). Suggested-by: Maxime Ripard Reviewed-by: Maxime Ripard Signed-off-by: Douglas Anderson --- This commit is only compile-time tested. (no changes since v1) drivers/gpu/drm/sprd/sprd_drm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sprd/sprd_drm.c b/drivers/gpu/drm/sprd/sprd_drm.c index 0aa39156f2fa..86a175116140 100644 --- a/drivers/gpu/drm/sprd/sprd_drm.c +++ b/drivers/gpu/drm/sprd/sprd_drm.c @@ -114,6 +114,7 @@ static int sprd_drm_bind(struct device *dev) drm_kms_helper_poll_fini(drm); err_unbind_all: component_unbind_all(drm->dev, drm); + platform_set_drvdata(pdev, NULL); return ret; } @@ -122,10 +123,11 @@ static void sprd_drm_unbind(struct device *dev) struct drm_device *drm = dev_get_drvdata(dev); drm_dev_unregister(drm); - drm_kms_helper_poll_fini(drm); + drm_atomic_helper_shutdown(drm); component_unbind_all(drm->dev, drm); + dev_set_drvdata(dev, NULL); } static const struct component_master_ops drm_component_ops = { From patchwork Thu Sep 21 19:26:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 143070 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5256999vqi; Thu, 21 Sep 2023 18:34:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFQWpKudd4M6Mc5RhOZ3BeWqyLHhyEq/vbtGfjPow4MymwgT2rPZGD5lOsdSKPbnfLNg02 X-Received: by 2002:a05:6a20:a127:b0:135:38b5:7e4e with SMTP id q39-20020a056a20a12700b0013538b57e4emr7724554pzk.59.1695346461108; Thu, 21 Sep 2023 18:34:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695346461; cv=none; d=google.com; s=arc-20160816; b=Uv+cEOBYPQCFWTPtXOzjzrxC4LYt7uQ07esKNjFoAGBwKeuXTHY/fPk5v8Y3vhVnGD X8NizCMWJ9MgNHzBg9UXKTLoxa9aNLfhJy/B+TnHKDUUe0wOiLkbJkEWKZ0URazU3j3P PcVGSQtYldg68CfOl/hqee0MG7UQBa39AK+hL71j5wxOyvX2ZUoXxkJ4IFxxbrEIfLQQ gILMB+vM2MxEA8pYF9/O/J+7n0tlht8kZFKJIJwB28Xy3HYtHCr8v/Bw6Gln2DNp6ocB GHmm3zCNPqPyZfc+s1v3Oyzyujf2qKLiyrt03gJzn7hf+zoz1/KqPX4zGUq1bZzq3P/c nN0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iA2li7ELqa/hnFznycO86SuLFz051HXi1UIFyEU+SsY=; fh=7RwYEj0fYLncuLc25mzncyIkG8D2UUpxIRGivT/XvxQ=; b=lkIAA/nsHhiduiLz4n7BUmrJO8EoGKs26V9Y+LriyaLTBwu3Sk/Fhj6w7avNCe7Bg+ d3i+ZcqWM7G0M4i2rkUrtLXL0gBe0ppw1yfRIdYF63iN7mPN21BY29ZHBh94A/V4wGQs 6IGo7+ii+D7Nu+f/eir7jUjhEoJ4eJ6QgUMLoO4AdP8AB5lJ53IIDecT4wyY4R6Fx1OU DP3cBHf7wJGsaTECKI2hjZZJ+Tn1fxi0inkB8A+4kCCfxkF6b8WpIj2PIUc+oc6qZh8/ b014HNieoj4fFOZcWilSCVCgATrZNRzD7nARP3LEQk9oqIp76Tk61st2ruLmoDDMLllg FYJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BGmAnpIi; 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=NONE dis=NONE) header.from=chromium.org Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id g15-20020a17090a300f00b00268137c2f12si5185335pjb.2.2023.09.21.18.34.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 18:34:21 -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=@chromium.org header.s=google header.b=BGmAnpIi; 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=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 525978339393; Thu, 21 Sep 2023 12:49:30 -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 S231145AbjIUTtL (ORCPT + 28 others); Thu, 21 Sep 2023 15:49:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230370AbjIUTso (ORCPT ); Thu, 21 Sep 2023 15:48:44 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC3B983CA for ; Thu, 21 Sep 2023 12:28:41 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1c465d59719so11303875ad.1 for ; Thu, 21 Sep 2023 12:28:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695324521; x=1695929321; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iA2li7ELqa/hnFznycO86SuLFz051HXi1UIFyEU+SsY=; b=BGmAnpIi3iuDy812Osm+g+26341LogmDzQhgtW6SO6RxhNh2/Xxh9zdGfTP1dghyfu mwBgbXni0d0hUX2T+0307DGHcjWJjqjCHyQ6333ddP7sLjutHJ8eOWH0AU8ZqzyA5uwe 0tQCgIWsVbv8HjmWYojERkl+ck9leykdb9Cyg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695324521; x=1695929321; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iA2li7ELqa/hnFznycO86SuLFz051HXi1UIFyEU+SsY=; b=qGZZ1+je8XixjGWzzswGSmmkd4PM6L1scbdj1MgjTF2D1azUepE60o88jDEE+OSSzW dDHTlO0NjaDWSPlvLLsLZ7YZcA2+p+9jPDYT5xXUJe87Qoyyga5KbsbpskNQWgt49ie+ CVQVvD+WRefIIWg/0vwJJw+wEQYn1BBdWbvMTVPaY/aOODinlmfCZOS0S9mIL8zLv5eN eOevMoQ1KzxGosDpzXGTX5W9zMluRdtbXn8+lMG936sJ42TCW4BvW8gV5AUWsui9Dzca o0iIZu3naCOoCGekP16mqS/6to/AXhwO77LTN33Er/VPOtY2K4ASxQsj1JDUxS3BjCFz JKfw== X-Gm-Message-State: AOJu0YxIFHs9dAq5qeolah9ybydKsHz+sN9mmOBM99vI+OLPblN99Ofn c5fmDKSqeayZAJJyUeK9bmOJgA== X-Received: by 2002:a17:903:1205:b0:1c4:638:fff4 with SMTP id l5-20020a170903120500b001c40638fff4mr6441686plh.17.1695324521206; Thu, 21 Sep 2023 12:28:41 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e6ed:6d49:f262:8041]) by smtp.gmail.com with ESMTPSA id w8-20020a1709029a8800b001b9f032bb3dsm1892875plp.3.2023.09.21.12.28.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:28:40 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , airlied@gmail.com, alim.akhtar@samsung.com, daniel@ffwll.ch, inki.dae@samsung.com, krzysztof.kozlowski@linaro.org, kyungmin.park@samsung.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, sw0312.kim@samsung.com Subject: [RFT PATCH v2 09/12] drm/exynos: Call drm_atomic_helper_shutdown() at shutdown/unbind time Date: Thu, 21 Sep 2023 12:26:52 -0700 Message-ID: <20230921122641.RFT.v2.9.Iea33274908b6b258955f45a8aaf6f5bba24ad6cd@changeid> X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog In-Reply-To: <20230921192749.1542462-1-dianders@chromium.org> References: <20230921192749.1542462-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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, 21 Sep 2023 12:49:30 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777699610787930076 X-GMAIL-MSGID: 1777699610787930076 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 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 platform_device *pdev) return 0; } +static void exynos_drm_platform_shutdown(struct platform_device *pdev) +{ + struct drm_device *drm = platform_get_drvdata(pdev); + + if (drm) + drm_atomic_helper_shutdown(drm); +} + static struct platform_driver exynos_drm_platform_driver = { .probe = exynos_drm_platform_probe, .remove = exynos_drm_platform_remove, + .shutdown = exynos_drm_platform_shutdown, .driver = { .name = "exynos-drm", .pm = &exynos_drm_pm_ops, From patchwork Thu Sep 21 19:26:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 142996 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5199634vqi; Thu, 21 Sep 2023 16:13:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJfgLemphaIsuQj49F1IkUoiFZMZqyXqawUGNyzKQWDjXJsMBoSnV5cEdifXJwhi/xd6D1 X-Received: by 2002:a81:9297:0:b0:56d:2d82:63dc with SMTP id j145-20020a819297000000b0056d2d8263dcmr6499003ywg.10.1695338035934; Thu, 21 Sep 2023 16:13:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695338035; cv=none; d=google.com; s=arc-20160816; b=Zf4NpmiyXlo77EmwNdMBinTDLJnxYaN9lXFA9dgAJbBlw7cI82IQpP5GNOWxO/IaAI P4pjiK+rjbNddc/6nWNT3byQFcoo3x5BKOmBTZkDHHhUe/5gsMebA3BgVUEjKEv6Dq3H Mvqq8dBaQDv2x1czHr7gNMPCf4s2MW6cyvgOF8C2AGshof+6CKJNNhLn3BK52elu6lnN eShmWazHvwcQh6JGCUERX74plyPLj3zkmRsPWG+bPSN6QUkhiunbV8Ytml8iFv36Guuu LIuT1MAXc3bmI0X7n7AVOcvdGqU47WRrPNh/mxYaXwA1hF4p+8gFfX4zTYHywRrMkJ5t d3Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SjE9g39gnCCj7j/VSb42AYR6J5acTdAldxrB9mluCQs=; fh=EKdpOkl3MPhgdEtijZqmzNPkw5d8ymlXDTQ7+vtrW84=; b=Dz2bBWk8Yo2Yc5n3FjrB8yTk93D2BZVY1w2+nGfm87nCzgSw97iedkNOIJzfX2eh6t 4MqMAe9aSyEfQ2W/AKrlXnJgGvA7ZGl5pntHPlasjSKytoEbYVcABAi+I3TMwIMzAT6L C9OZLcQwWKulc34E/ANkIWd0ou630T4y1wysmH8424Y/fMGbTluz/JlV1htr/hm4FEzr y7AzAbrl1iQutpDHV5PMBXC8fgieOra306sV7eHnagcQFgDxXyviG/O9mAe+Xzwyp+FI rgoNE/F45rIqMylXBEQYcX9qsbb1EliSodxU52rDL3puxpTkRLnZzYH2xEmQ+lMifWwd FUIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=UlFhRDpu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id s8-20020a17090aad8800b0026b502223cbsi2578579pjq.10.2023.09.21.16.13.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 16:13:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=UlFhRDpu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id CCC098325D12; Thu, 21 Sep 2023 12:48:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231260AbjIUTsA (ORCPT + 28 others); Thu, 21 Sep 2023 15:48:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230169AbjIUTrk (ORCPT ); Thu, 21 Sep 2023 15:47:40 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99F98EA627 for ; Thu, 21 Sep 2023 12:28:44 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1c09673b006so11154185ad.1 for ; Thu, 21 Sep 2023 12:28:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695324524; x=1695929324; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SjE9g39gnCCj7j/VSb42AYR6J5acTdAldxrB9mluCQs=; b=UlFhRDpuDdoVAn1e29otD8iq6yUH4efuvBH5/2VDVbZwhVYDLQOfjPbd5Csa9nefxV ygeWb3u9m0lzH50UQjUpyjseYNrvueJJQSHJecEIWrDZDbP9QIphlRvU2pB2WxBOextk A88/4yMrcFFC0DrrDa1N5AP/nJDnBLs7XKc8A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695324524; x=1695929324; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SjE9g39gnCCj7j/VSb42AYR6J5acTdAldxrB9mluCQs=; b=ZiuD5qZ1jahOuUeRszmVZlB9FjSTJR6asSDTYhNley6NlG7/9HCfnhOo390yPV9fXW 3vOxJ3V0d2jdVsbSLdhA/KNazd44luMHDODJ2BfOmxg0W2U/CKPVTNrutsr3z/qX2t7F XwcYVPt2g/FIhoYWM0jHSrxzszt3L6gLXJ4VAgID15aQGJosfnAQ1abPpMQ+VP0jF858 v/jHDPAHKHGs/D6rzNmX3nLeEcFDNVo2ZoG9fm/tBMi6ByUeJ3A2aYWj8dDXfu3bagMZ cPYu44Woepdy1kAwGM3u0gV/DQ7iyVQR7guFTbbdMXnEclOpCfURa43lXY6nlUSuX4Oh y7Wg== X-Gm-Message-State: AOJu0YzqBgufdCufUr0pye7DJnYhYHdwtSTbJVKjJiZZeuIH2acNBrLa xJV5k0RJP0DgsOgR4pP0XlkV3Q== X-Received: by 2002:a17:902:d491:b0:1c3:8230:30d8 with SMTP id c17-20020a170902d49100b001c3823030d8mr7671409plg.38.1695324524060; Thu, 21 Sep 2023 12:28:44 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e6ed:6d49:f262:8041]) by smtp.gmail.com with ESMTPSA id w8-20020a1709029a8800b001b9f032bb3dsm1892875plp.3.2023.09.21.12.28.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:28:42 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , airlied@gmail.com, daniel@ffwll.ch, linux-kernel@vger.kernel.org, patrik.r.jakobsson@gmail.com Subject: [RFT PATCH v2 10/12] drm/gma500: Call drm_helper_force_disable_all() at shutdown/remove time Date: Thu, 21 Sep 2023 12:26:53 -0700 Message-ID: <20230921122641.RFT.v2.10.I1be622999c3b23f28f077fc75bb0319396a216e9@changeid> X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog In-Reply-To: <20230921192749.1542462-1-dianders@chromium.org> References: <20230921192749.1542462-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Thu, 21 Sep 2023 12:48:01 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777690776293359640 X-GMAIL-MSGID: 1777690776293359640 Based on grepping through the source code, this driver appears to be missing a call to drm_atomic_helper_shutdown(), or in this case the non-atomic equivalent drm_helper_force_disable_all(), at system shutdown time and at driver remove time. This is important because drm_helper_force_disable_all() will cause panels to get disabled cleanly which may be important for their power sequencing. Future changes will remove any custom powering off in individual panel drivers so the DRM drivers need to start getting this right. The fact that we should call drm_atomic_helper_shutdown(), or in this case the non-atomic equivalent drm_helper_force_disable_all(), in the case of OS shutdown/restart comes straight out of the kernel doc "driver instance overview" in drm_drv.c. Suggested-by: Maxime Ripard Reviewed-by: Maxime Ripard Signed-off-by: Douglas Anderson --- This commit is only compile-time tested. (no changes since v1) drivers/gpu/drm/gma500/psb_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c index 8b64f61ffaf9..a5a399bbe8f5 100644 --- a/drivers/gpu/drm/gma500/psb_drv.c +++ b/drivers/gpu/drm/gma500/psb_drv.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -485,6 +486,12 @@ static void psb_pci_remove(struct pci_dev *pdev) struct drm_device *dev = pci_get_drvdata(pdev); drm_dev_unregister(dev); + drm_helper_force_disable_all(dev); +} + +static void psb_pci_shutdown(struct pci_dev *pdev) +{ + drm_helper_force_disable_all(pci_get_drvdata(pdev)); } static DEFINE_RUNTIME_DEV_PM_OPS(psb_pm_ops, gma_power_suspend, gma_power_resume, NULL); @@ -521,6 +528,7 @@ static struct pci_driver psb_pci_driver = { .id_table = pciidlist, .probe = psb_pci_probe, .remove = psb_pci_remove, + .shutdown = psb_pci_shutdown, .driver.pm = &psb_pm_ops, }; From patchwork Thu Sep 21 19:26:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 143097 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5275067vqi; Thu, 21 Sep 2023 19:26:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHnZgfT5Rd+mzwmTu8EDMZV0ov7Po/itMe6YAnFYOsLbVqMkCb+dkLlJi7XdYRYfVARAoL1 X-Received: by 2002:a17:90b:4c89:b0:273:6b28:9e30 with SMTP id my9-20020a17090b4c8900b002736b289e30mr7049780pjb.41.1695349590158; Thu, 21 Sep 2023 19:26:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695349590; cv=none; d=google.com; s=arc-20160816; b=TY5gRGO61C33nPa+iEr/2Wxdz7i2JK/3Rx4/yb68OrjUVoWz4xkkyFpGnTiTJwxUkN o3FoNsKaAiljf4ESwnTuW5BOtHGA83Y6xr0uKP/pNdigVPYK4IhZbkJor4K+OMraP1+a TqdHXx7cWxTPdR2ZaMTKZNQsUHJ5O0cfJUa1Lsoe5WAR/lxvDq8WfYUxxwDkTzEuiBPi cgz/geg7O7ZFTsnzKhv+RTF/H6SMZ6uX5LYZG8H6ai6TrqW7Aqi/AEc1x76zZGy1uVYV tWNidoJjmyMMw0HoB7X/vv8ykM5ULsiXk6oIiyivOg3nUYWazcYRCOcebdeZ0JOnLXPJ qZXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vNE7U3MRFdvHzy3AatqQxrB+Rii45BA8np0vc2lW0nQ=; fh=h492tw1UbLxr3Y2N9M0cAh0yR9u9CpUfN4pgmMs6V8Q=; b=QU4V2AI5UVZNzs4St3OMNVXWKupgpKhXxua5Vg5J3iNDL8goEoljm4OjGv5wOnFnvb aIa0+lEAwc7NyIkI90v3pih6p+mtrPcBYHbB0BroSlLcy2JsY+Vnj9o3if8QnEOKjPJn bQRhnXeor2vSwQ9rTZCdbhs/chcmCy1sEREt4yAzaj3+aSdm3eV+MfwWL8RqXQvFLbTc al4WYcxzLkPhUIoHgx7YgxSXEUk9zIhrBYZN1kziHRdFeJ9nALr6sz2hFzBPmOCrCT3b jBFey/ssJ1bqmc6wex6OQ8474yqaFa1HeWj0dadXorkvY3SS9e6h9A9em3GkyIyL5/+b xjmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FETYVesb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id em13-20020a17090b014d00b00262c7b59f4esi4879578pjb.188.2023.09.21.19.26.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 19:26:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FETYVesb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id C28428101687; Thu, 21 Sep 2023 12:48:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231276AbjIUTrw (ORCPT + 28 others); Thu, 21 Sep 2023 15:47:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231240AbjIUTrg (ORCPT ); Thu, 21 Sep 2023 15:47:36 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CF12EA63B for ; Thu, 21 Sep 2023 12:28:46 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1c3f97f2239so11941185ad.0 for ; Thu, 21 Sep 2023 12:28:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695324526; x=1695929326; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vNE7U3MRFdvHzy3AatqQxrB+Rii45BA8np0vc2lW0nQ=; b=FETYVesb9dGOgsBD2GUKMgueygA+8BJAYSOAnFW3kFNsJUQrxUB62+jlUc/bbDpQHm koYL/VrKtTCRll2qdEWetFD////djqBBwPPsZjNHlHK1TjXvBfBWQvehABIf7OUHYDP0 mi/XndU5nNO0ci+HVykK/i2H5RhbMy5rea7WQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695324526; x=1695929326; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vNE7U3MRFdvHzy3AatqQxrB+Rii45BA8np0vc2lW0nQ=; b=poey8Y4mXSk5oVRzLckI93Akf9yunp6ShFM0j/9q9hUNide3wXhOsfu+5keEgzmlpl k1gC2TcYkjeiUEcWrYH5K1K2dnr6oEDt0GD0Hn9T/Xuo8T6PbFMsT2i8D9Ubr5LGNfHB LrsvSiQzadJRV6wG+84K/FN9AAWDbMQ2DN+yhqICnRm/QBj61ljmx0qjGLtv75D437ln 8X3SKpB3LrnL1CRIruMCrzhW9GxIi3b2lo8LfdAMsztK6E97YpbxnFHw630B7qX1+Lmz KzBUtjyd2IK0oDhBLneeZ77LGRJfet5FTsoRQgDv/9yLM6cJW+yhWm6m0hpMbYjIcAhY tcFA== X-Gm-Message-State: AOJu0Yw5MPb10Duj9SVJwoi9ugeuBF4l4GTN/pwt3wmv2HbWF2JlOLWA 25N9XdM3v4sB4PsFH5pmDTU2FQ== X-Received: by 2002:a17:902:7fce:b0:1bf:27a2:b52b with SMTP id t14-20020a1709027fce00b001bf27a2b52bmr5978389plb.58.1695324526019; Thu, 21 Sep 2023 12:28:46 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e6ed:6d49:f262:8041]) by smtp.gmail.com with ESMTPSA id w8-20020a1709029a8800b001b9f032bb3dsm1892875plp.3.2023.09.21.12.28.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:28:45 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , Xinhui.Pan@amd.com, airlied@gmail.com, alexander.deucher@amd.com, amd-gfx@lists.freedesktop.org, christian.koenig@amd.com, daniel@ffwll.ch, linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 11/12] drm/radeon: Call drm_helper_force_disable_all() at shutdown/remove time Date: Thu, 21 Sep 2023 12:26:54 -0700 Message-ID: <20230921122641.RFT.v2.11.I022cfc2dcd30e77d4f7005a2d912dd7ab76c0338@changeid> X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog In-Reply-To: <20230921192749.1542462-1-dianders@chromium.org> References: <20230921192749.1542462-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Thu, 21 Sep 2023 12:48:16 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777702892009153272 X-GMAIL-MSGID: 1777702892009153272 Based on grepping through the source code, this driver appears to be missing a call to drm_atomic_helper_shutdown(), or in this case the non-atomic equivalent drm_helper_force_disable_all(), at system shutdown time and at driver remove time. This is important because drm_helper_force_disable_all() will cause panels to get disabled cleanly which may be important for their power sequencing. Future changes will remove any custom powering off in individual panel drivers so the DRM drivers need to start getting this right. The fact that we should call drm_atomic_helper_shutdown(), or in this case the non-atomic equivalent drm_helper_force_disable_all(), in the case of OS shutdown/restart comes straight out of the kernel doc "driver instance overview" in drm_drv.c. NOTE: in order to get things inserted in the right place, I had to replace the old/deprecated drm_put_dev() function with the equivalent new calls. Suggested-by: Maxime Ripard Reviewed-by: Maxime Ripard Signed-off-by: Douglas Anderson --- I honestly have no idea if I got this patch right. The shutdown() function already had some special case logic for PPC, Loongson, and VMs and I don't 100% for sure know how this interacts with those. Everything here is just compile tested. (no changes since v1) drivers/gpu/drm/radeon/radeon_drv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 39cdede460b5..67995ea24852 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -38,6 +38,7 @@ #include #include +#include #include #include #include @@ -357,7 +358,9 @@ radeon_pci_remove(struct pci_dev *pdev) { struct drm_device *dev = pci_get_drvdata(pdev); - drm_put_dev(dev); + drm_dev_unregister(dev); + drm_helper_force_disable_all(dev); + drm_dev_put(dev); } static void @@ -368,6 +371,8 @@ radeon_pci_shutdown(struct pci_dev *pdev) */ if (radeon_device_is_virtual()) radeon_pci_remove(pdev); + else + drm_helper_force_disable_all(pci_get_drvdata(pdev)); #if defined(CONFIG_PPC64) || defined(CONFIG_MACH_LOONGSON64) /* From patchwork Thu Sep 21 19:26:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 143110 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5282071vqi; Thu, 21 Sep 2023 19:48:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEfUaiw72J4su4vIwv53CCBzqpQBmYFJzra4UEZ/GRgiPaOg5gZUwPwL5dglEX03d6AL8Ni X-Received: by 2002:a05:6902:1890:b0:bc9:92c9:7fd1 with SMTP id cj16-20020a056902189000b00bc992c97fd1mr9163323ybb.3.1695350896222; Thu, 21 Sep 2023 19:48:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695350896; cv=none; d=google.com; s=arc-20160816; b=y6EZT2yHyCrVEsZd2frL3EalLoGQ+aAmEkDnGulJlaJely07VE+V3J8sz7Vx9mstmp oz1WYLT49TS5ORJm1Ydz1el1Rz67iufMFprevEUYpoQf0QHnIJbsMvu7g5xw0J9MKpeV iMi9R1HECsVqf8V4TkmzbO+1X5krddBcuAbVztdOh9WdnVGDmJz7CzOyvo29oPCS2H9r SFzpO3P3Vk80BUUwn7Z7f2SgKGtWyKrGQBv8PJrYM2D78FL4/kKQew0AQrHrPEN5Uo/v 5jSmmGE7KM9gWTWxSPs5WqsDdNmycR+9iwml51oE0nfERi+5ia4pKLkDqB/tuLgQXdbe HmQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6yWq/C0tGEFLQw6PZcuzFNMM1hDy2t48whBia8F49Jg=; fh=8QRJ4FQn02FtHGCZFNwNBtZ5NUg+fEu+YhROfW8MK9c=; b=zXb9PsB/b9P0PQLVYv9YctbV09/c+maQga2XkXZOnQwF1o/QMagsCPlPV/UpiYC9KD KSZmUsz4tmYbYBibtLcvaps7Kv28fGvOENLWPfjxbvsHPTpixPWMQoEVxi46BylSxdWs EUTvMudFdcbi3ZVqnJ0IL9aTYT5IMviHLOk0BUVwN5Y6HZWgAkF8tNeUjh002bCTysGr QofjmU9jSa4+mohN/NPb05MrweAWT47kvO3fQyL+UBsxHreIsbiYSnLJjKe23Z6j6e2R ewyh5dW9yfh6SlN9qC8oxFUrZj/YdS9EBQkgop3A9Mjs25dtTDX+BgFi/OVeEAHKm7uo 5i6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hxwGXiYb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id cf4-20020a056a02084400b00577ed0133d2si2746717pgb.453.2023.09.21.19.48.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 19:48:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hxwGXiYb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 0BC4E81C50AE; Thu, 21 Sep 2023 12:48:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231316AbjIUTsl (ORCPT + 28 others); Thu, 21 Sep 2023 15:48:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231237AbjIUTs3 (ORCPT ); Thu, 21 Sep 2023 15:48:29 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8E2C59E3 for ; Thu, 21 Sep 2023 12:28:49 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1c5c91bec75so11092595ad.3 for ; Thu, 21 Sep 2023 12:28:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695324529; x=1695929329; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6yWq/C0tGEFLQw6PZcuzFNMM1hDy2t48whBia8F49Jg=; b=hxwGXiYb4PM04EE74siGDJwQX0yEZrnJ1g7ZxEaC1XmHA8FSHr5IWWQuQ3KyIueDBO 1xH8dUw35rP3xosg/qTRmsRnVEO792m61KxNhpyRukmmOrRA/PQ2wZrE26LMV96yuWTU 3B1UBS9/LlKbvQtWtt0zP96Tulxt9Pw+F/Xmw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695324529; x=1695929329; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6yWq/C0tGEFLQw6PZcuzFNMM1hDy2t48whBia8F49Jg=; b=tN4kaHaPifyD+qzebcItmahfru9kfRh6uS2p1CabeTSS1m64jgXgMthGqlGaIGG8/Z 7KrGEBEK8XNgQkxUEszpcpFmauPjiAAdzl8oWNxHwozvAzlsKs08vPBeyhPDgxeky95/ l3D5z1nbQ3AD+EoaQTvDM2yf4lRYuy0CmlFIh3VKbX0q9HPnvWQEwlQMAa9mQmW5IsRH fKD16tsYdsZxvHOCzNt6+wpEjVjR5fCRObb+VsFaRQOXMdYtgE3ZWtHbcvofW8CIK0L0 1ivbwRfv3mHiYrCF6nuOQmsFR3x7pY6eNpvZHgFMf9iV1PM1O25cLX/8ictdGNwuTZ0o 8xdQ== X-Gm-Message-State: AOJu0YzxwF6//cMHy4BgQRJDFD2feHfSI+EsQI9fdbfp/ZHHyJX20GZ2 +4LH9yUtXpxKeAn41PHFYKryFw== X-Received: by 2002:a17:902:c409:b0:1c4:4a4d:cda with SMTP id k9-20020a170902c40900b001c44a4d0cdamr7404355plk.15.1695324528913; Thu, 21 Sep 2023 12:28:48 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e6ed:6d49:f262:8041]) by smtp.gmail.com with ESMTPSA id w8-20020a1709029a8800b001b9f032bb3dsm1892875plp.3.2023.09.21.12.28.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:28:47 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , Geert Uytterhoeven , airlied@gmail.com, biju.das.jz@bp.renesas.com, daniel@ffwll.ch, kieran.bingham+renesas@ideasonboard.com, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, paul@crapouillou.net, sam@ravnborg.org, tzimmermann@suse.de Subject: [RFT PATCH v2 12/12] drm/renesas/shmobile: Call drm_helper_force_disable_all() at shutdown/remove time Date: Thu, 21 Sep 2023 12:26:55 -0700 Message-ID: <20230921122641.RFT.v2.12.Iaf638a1d4c8b3c307a6192efabb4cbb06b195f15@changeid> X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog In-Reply-To: <20230921192749.1542462-1-dianders@chromium.org> References: <20230921192749.1542462-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Thu, 21 Sep 2023 12:48:50 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777704261388953458 X-GMAIL-MSGID: 1777704261388953458 Based on grepping through the source code, this driver appears to be missing a call to drm_atomic_helper_shutdown(), or in this case the non-atomic equivalent drm_helper_force_disable_all(), at system shutdown time and at driver remove time. This is important because drm_helper_force_disable_all() will cause panels to get disabled cleanly which may be important for their power sequencing. Future changes will remove any custom powering off in individual panel drivers so the DRM drivers need to start getting this right. The fact that we should call drm_atomic_helper_shutdown(), or in this case the non-atomic equivalent drm_helper_force_disable_all(), in the case of OS shutdown/restart comes straight out of the kernel doc "driver instance overview" in drm_drv.c. Suggested-by: Maxime Ripard Cc: Geert Uytterhoeven Signed-off-by: Douglas Anderson --- This commit is only compile-time tested. As Geert pointed out in response to v1 [1], this patch conflicts with the patches doing atomic conversion [2]. Since those patches don't appear to be landed yet, I'm simply reposting v1. If those patches land, I'm more than happy to re-post this one. I'm also more than happy if someone wants to incorporate these changes into a different patch. [1] https://lore.kernel.org/r/CAMuHMdWOB7d-KE3F7aeZvVimNuy_U30uk=PND7=tWmPzCd7_eg@mail.gmail.com [2] https://lore.kernel.org/dri-devel/fd7a6702490bd431f314d6591551bb39e77e3304.1692178020.git.geert+renesas@glider.be/ Changes in v2: - Rebased and resolved conflicts. drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c index e5db4e0095ba..8c4c9d17a79e 100644 --- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c +++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -179,10 +180,18 @@ static void shmob_drm_remove(struct platform_device *pdev) drm_dev_unregister(ddev); drm_kms_helper_poll_fini(ddev); + drm_helper_force_disable_all(ddev); free_irq(sdev->irq, ddev); drm_dev_put(ddev); } +static void shmob_drm_shutdown(struct platform_device *pdev) +{ + struct shmob_drm_device *sdev = platform_get_drvdata(pdev); + + drm_helper_force_disable_all(sdev->ddev); +} + static int shmob_drm_probe(struct platform_device *pdev) { struct shmob_drm_platform_data *pdata = pdev->dev.platform_data; @@ -287,6 +296,7 @@ static int shmob_drm_probe(struct platform_device *pdev) static struct platform_driver shmob_drm_platform_driver = { .probe = shmob_drm_probe, .remove_new = shmob_drm_remove, + .shutdown = shmob_drm_shutdown, .driver = { .name = "shmob-drm", .pm = pm_sleep_ptr(&shmob_drm_pm_ops),