From nobody Thu Feb 12 10:55:16 2026 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECB99129E86 for ; Wed, 12 Jun 2024 22:24:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718231087; cv=none; b=AqUCbNa9RXETmWsM3Fu9TkMwbC6D8Cyqc8mpmqK5ABuJv6JLd8/jPUYJ7BhAMP4iLXDH9a/wyqMBPfwIhnXRNEYgfMvS2de1/hYhC57pysgeHJwqVrG/zbGwxyEhB2ZY9h5h3+M5Ng+plAboB5fnTX8vrqQf1PXV5/wHsxZJKUw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718231087; c=relaxed/simple; bh=MzY9RSGkVht2aXs2PA/k/TDRM4oP57qTRFAWTRHZiAE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J8TnE7pToXfJvgTuzAxmbehIg/PjxmUcJXCKrIJOsaJSoh52b75uTVwGGTpomM/P5Lcmg08vOPH6klEJ/lNyLniWsUfpetr4WWcVqm0rsbhut05a1F19nH3EyAS8ntkcQItu6PZM+EGCGAYMKnFYur4CsMbIZkisz3pXsmEhdGM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Zec0UYnO; arc=none smtp.client-ip=209.85.216.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Zec0UYnO" Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-2c1ab9e17f6so257914a91.1 for ; Wed, 12 Jun 2024 15:24:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1718231085; x=1718835885; 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=eoxHQFAxTEKhFcdkzLVS9yQebfe3JVmywDzGyzZKvTc=; b=Zec0UYnO5BkYSIvg4uS/B/X9eGKwOXDuGsWyK+yjuuJNOb9Z8Qk5fLwxk60lu1cChs BigKjMpyD8mWXN5RqVWNw0VDYHq8pY0Xk7sI+cZGFF43YTMGEjf1b4KtASUYpguB/8ni P29v8sdU4rZaTtwaXqJUIpLxySc94l6iDI/ag= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718231085; x=1718835885; 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=eoxHQFAxTEKhFcdkzLVS9yQebfe3JVmywDzGyzZKvTc=; b=AuN0ypD7SKC4cdG/pDPJVI5rzLJfTrRnNavyICIt360pldR+dmmlU8Y9a9k9Qs+x5Q Z6vZzG5PVcVWwhyqVw6B4413zNsjMAWYcZ+aec+Aqx3WzeOM9DpoI1QSzFmIfenFhUry cbMiJjpTs6vf+ZK99mVeq6rlg09SxDT6ViFxpL9RCVafb3tCxQbeoeqo/VZKPSEGgZE3 vw1tOHw+oW4Mk3cyGT3D5mugLNoNl9Yr+qc8jDi7Ht0A3ovp6dfBxM86cs+KTSAxwrJI JbpHAqO6eOLxDz1L77p7qebXvS+nzy+FV4frVWh8Hr3MpETMf/6IsLYFFBniOaXVCm0D 1XDQ== X-Forwarded-Encrypted: i=1; AJvYcCUh3wG8gHmupKzR8QD6uiVRFMzGBLlBwOAOQ4uEo53KekvKbF6rpDwPfSTDgBh9U/prkaTSs3pjzqtWZQgJU1SfhPiRM6tmuBOq65G3 X-Gm-Message-State: AOJu0YzY5wyFDg6Q3opmvvKhlwqWOXJHCBastlhPGYAhla2MZqEmXD10 92MQ+3xsmbeD63MDCX87RH0I31CTJCwah77UAgDyqMQtNvp8Ntgr/9f2bAql5gpizONv+3bSuNk = X-Google-Smtp-Source: AGHT+IGoKR+i8ngPgUDnHIH0M19hh39IIq/3uUrBXIU2bl3u/ZzKf7epk3yumtBMdDz0FOKiHNHMNA== X-Received: by 2002:a17:90b:17ce:b0:2c4:aa69:c4bc with SMTP id 98e67ed59e1d1-2c4aa69c57bmr2820224a91.19.1718231085222; Wed, 12 Jun 2024 15:24:45 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:2816:6a42:9074:18cc]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6f30acda9sm87914105ad.198.2024.06.12.15.24.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 15:24:43 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , Anitha Chrisanthus , Daniel Vetter , David Airlie , Edmund Dea , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/8] drm/kmb: Call drm_atomic_helper_shutdown() at shutdown time Date: Wed, 12 Jun 2024 15:23:41 -0700 Message-ID: <20240612152336.v2.1.I20cb02bafa7c2368e4bd579df0716eb62a3a21bf@changeid> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog In-Reply-To: <20240612222435.3188234-1-dianders@chromium.org> References: <20240612222435.3188234-1-dianders@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 169b83987ce2..73d82b4d33e7 100644 --- a/drivers/gpu/drm/kmb/kmb_drv.c +++ b/drivers/gpu/drm/kmb/kmb_drv.c @@ -475,6 +475,11 @@ static void kmb_remove(struct platform_device *pdev) drm_atomic_helper_shutdown(drm); } =20 +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 =3D get_device(&pdev->dev); @@ -621,6 +626,7 @@ static SIMPLE_DEV_PM_OPS(kmb_pm_ops, kmb_pm_suspend, km= b_pm_resume); static struct platform_driver kmb_platform_driver =3D { .probe =3D kmb_probe, .remove_new =3D kmb_remove, + .shutdown =3D kmb_shutdown, .driver =3D { .name =3D "kmb-drm", .pm =3D &kmb_pm_ops, --=20 2.45.2.505.gda0bf45e8d-goog From nobody Thu Feb 12 10:55:16 2026 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2076012C54D for ; Wed, 12 Jun 2024 22:24:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718231090; cv=none; b=S4JDtVgnbgBqBi+dxlwkoT1Chw4Ne7sBvyFTLerMig6TmwH5cx63oy+VmlVbJF6t4HwvKe2N4V+K/sly4vBeYCO2DPU7zZVWRkryY+TdBA7mJmVJl1Il86MsG4d3w4icB9Q62nP2wsIeHDTYkBb9gidKuFqRiLEslBYl2+8CiNg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718231090; c=relaxed/simple; bh=HGzIge+7bnjQiHBPTYl+Omvw6qwV6Fo+vN9k3Ffj8do=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S6ixbcpULQm8KePtQfmHdt5iw4CpJfFZvN8nao3qVKd3TECJCFp8mV6enDGrelx8NTzclPDgVR56ggdua8gI8NUzeN8e0WigD8yP3PZx+KLfZtUDpi5v5ackiF89f+yBXVjeRBXpDOz0bO6oVMPHCyEDLivkS1YtL4Zck3sOu4A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=ZdwsM3Zf; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ZdwsM3Zf" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1f480624d0fso3206925ad.1 for ; Wed, 12 Jun 2024 15:24:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1718231088; x=1718835888; 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=aR6S2QVtzFM/jxymlLuEpObYuJIES6ks6qhmMWCUZhU=; b=ZdwsM3ZffKSb+D2bPVWgsjXOXZlyPWbzv6FWa+z0JGNXx4cXKHg4Dl2Qx2tss8fe7a GvzoPEIksvTvO9aoCaLWaXWlg5Pwi3Bpxv+kvWpdIjHBEBFaO/lZZ39gpROB8RbOtCBs 4ShbWEBpUTpi13AfJMCx45mJz82GnFTHSpfLc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718231088; x=1718835888; 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=aR6S2QVtzFM/jxymlLuEpObYuJIES6ks6qhmMWCUZhU=; b=G8Q9E8Spyef+YrHQ85OIpjQ7r0c0H7rzrajP5xQMvuW7BkJL3LDQXJQ5pKWteZOz6B ms0IRRJKeL1UHwGLpVV6SpGIXxStUcaW2xj2AAc/BONkha8sfcZubKraIC2wTEsWCmZq kCFPRdhjSo01MT0W6clazrH05KvUqBGbYLwblIWOt1inWd+AryTK++Nni8z3J0o+1FPU BbcvqIImR3rC8Sa54VrYUZFZJEXIaLIwcPTEhzdNUCRMX8BQrWY/qc+M/FaDtBUQsPVe JLgz3/3D1gBbSI8oBTZGpjoitahfJg/P+8U38iP1vfih4OCMNViBVFWUr2qwyhnrUw3m LRMg== X-Forwarded-Encrypted: i=1; AJvYcCW0fAjrR0gndKT1W+iSljVujMYNKuXKy3xf9bIWiBixMtJpkaWpY1YAczvfYtmhduGWIVfsgwk1bQKomsDRUdVKMscxnbJe8gy7WYmA X-Gm-Message-State: AOJu0YzmRar5OoFXR39h3mdfJin4rSWJRGqfyksitC3ofXB9OMS7N9Vh BG8SUE2hYWfCuKGW2q8WrRYzM9qfS6oGWwn9q+Uvtu45t1zH1I0AhFquh0IpJA== X-Google-Smtp-Source: AGHT+IHKCE/3t+anxzcGR/vWhd2u/e5A1hvjZyotl4hoC22LuX9W+2G5IFPLfxJ6lZv8cQy/absvjg== X-Received: by 2002:a17:902:e844:b0:1f6:225e:67a1 with SMTP id d9443c01a7336-1f83b70eaa3mr34942835ad.56.1718231088645; Wed, 12 Jun 2024 15:24:48 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:2816:6a42:9074:18cc]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6f30acda9sm87914105ad.198.2024.06.12.15.24.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 15:24:47 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , Daniel Vetter , Danilo Krummrich , David Airlie , Karol Herbst , Lyude Paul , linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org Subject: [PATCH v2 2/8] drm/nouveau: Call drm_atomic_helper_shutdown() or equiv at shutdown time Date: Wed, 12 Jun 2024 15:23:42 -0700 Message-ID: <20240612152336.v2.2.Ie7588ec6e0f93e8bc700e76b265ad1a7ad6b15ad@changeid> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog In-Reply-To: <20240612222435.3188234-1-dianders@chromium.org> References: <20240612222435.3188234-1-dianders@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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/no= uveau/nouveau_display.c index d4725a968827..15da55c382f1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -645,6 +645,15 @@ nouveau_display_fini(struct drm_device *dev, bool susp= end, bool runtime) disp->fini(dev, runtime, suspend); } =20 +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/no= uveau/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 runtim= e); void nouveau_display_hpd_resume(struct drm_device *dev); void nouveau_display_fini(struct drm_device *dev, bool suspend, bool runti= me); +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/nouvea= u/nouveau_drm.c index a947e1d5f309..b41154c9b9cc 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -894,6 +894,18 @@ nouveau_drm_remove(struct pci_dev *pdev) pci_disable_device(pdev); } =20 +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) { @@ -1361,6 +1373,7 @@ nouveau_drm_pci_driver =3D { .id_table =3D nouveau_drm_pci_table, .probe =3D nouveau_drm_probe, .remove =3D nouveau_drm_remove, + .shutdown =3D nouveau_drm_shutdown, .driver.pm =3D &nouveau_pm_ops, }; =20 diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouvea= u/nouveau_drv.h index 25fca98a20bc..78a91686006b 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); =20 #define NV_PRINTK(l,c,f,a...) do { = \ struct nouveau_cli *_cli =3D (c); \ diff --git a/drivers/gpu/drm/nouveau/nouveau_platform.c b/drivers/gpu/drm/n= ouveau/nouveau_platform.c index bf2dc7567ea4..511f3a0c6ee9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_platform.c +++ b/drivers/gpu/drm/nouveau/nouveau_platform.c @@ -49,6 +49,11 @@ static void nouveau_platform_remove(struct platform_devi= ce *pdev) nouveau_drm_device_remove(dev); } =20 +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 =3D { .iommu_bit =3D 34, @@ -93,4 +98,5 @@ struct platform_driver nouveau_platform_driver =3D { }, .probe =3D nouveau_platform_probe, .remove_new =3D nouveau_platform_remove, + .shutdown =3D nouveau_platform_shutdown, }; --=20 2.45.2.505.gda0bf45e8d-goog From nobody Thu Feb 12 10:55:16 2026 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9CAA12CDB2 for ; Wed, 12 Jun 2024 22:24:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718231094; cv=none; b=QIS/NFym4iaWVFVHt66VHrwlpqXmAL+HgocgPc/MfcxTVNDSmy0aauk2dMidFgSH6Sm7Kj30f4Xov6ne3yT3IJy6bU0d9jMQJfk52pJqn0GMhz+s2fQCTsNkVB/JqKVphr1N3f9rwpT47CNX2LygXNEjbLzbVCOF/nGOzLo0/BE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718231094; c=relaxed/simple; bh=t3yv9e1EzMXtPY6KnpScajrOJgyZidM/cqL/We5XO9Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CrZYAdkW8P8nv8vJTapm77gLUfzp+nCZvzhZ2SljjRLUfIDCitxZh+5L64aFNHC6NsvG8RkFYpon3wDe+RbCsYydCRGlgtsj6rpHFTeLk6A0nJEm2Gz1/ycAdyD7BBTrmp07hxOVCfsan6tNW29kyYfRASoGS/JyGCkqBBMIA58= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=dP8qkp8L; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="dP8qkp8L" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1f6fabe9da3so3886215ad.0 for ; Wed, 12 Jun 2024 15:24:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1718231092; x=1718835892; 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=zpmQn9g7cRN67S7SSaIwDQvRoODph3OOMStNp4IKliA=; b=dP8qkp8Lg+k1/d/wQ+63ftRNYeBDI742xoAoNOkKSXgBoCNZwuqLk53ZeuwlGJZcC0 FQDIeJ9qBrZU80fkWx1sghO6+QYEkKyRe0ZJC3In/r/sp1hHKsocsqzF1jR2+I0aMsY1 SUq2rwVbxT5xYl18m99gcxyNbZDd1lgBRAq14= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718231092; x=1718835892; 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=zpmQn9g7cRN67S7SSaIwDQvRoODph3OOMStNp4IKliA=; b=FNn/ixG0AWaFANvSjOSJWuihuMfPu1Aqcgy/g/a+GmwKCGjHsM/qFv11IkZ2IqE2OD Zl0fEdCpWRsI/ai6s2dHmgIgZ5FHcAvXC6B8V6kTMy8rrnmsR6PdZyeT71ZH02WrM4ag O6SfSWw1j0vJSDFKmIe75T9no3yT2r173Lvot5fPxPX2o2YrIhBp6YzFMdT+2Iw7RXP0 2YAStKtS8/UMjjvc31GQSs0VVa58ufgV4+gnOS5UeSB39gGOvhPLDJVdnGcrr7vJBC4f y074tKlQ2PI/M+AwbgzxtM4bw4Wwj8AijSXBiLaJ783lUqDxZC5DVChC7a1JUHSvOGY6 EpZA== X-Forwarded-Encrypted: i=1; AJvYcCUeMuQa4TrzSlQiG13VA+SEkphfC2UmcDgVWg2Lpd9gJPgABMflx7u2NKb2MgZtvmMk4H1iCs+vf4TDf3p7i9Ij1H6woABBgBWyz/e9 X-Gm-Message-State: AOJu0Yyxh1mgbmbO2xdaOSIwfiGwJDxrY5MOlHez5NjcVYYlpsCs8Lat NKZFi7aXs14YCDDk/MNjKANUFMND1EAAZdY5itxto8RIKJuIu/wMfBrzEAl3OQ== X-Google-Smtp-Source: AGHT+IEw5ujOqNAyOIoLP8KuspnMOnAtd7Hh5dDQKTX8TBm9/CzqJoj2TsY6aejmqFawCaR9pN4o7w== X-Received: by 2002:a17:902:e750:b0:1f7:2a95:f2f8 with SMTP id d9443c01a7336-1f83b55e32cmr41999395ad.14.1718231091823; Wed, 12 Jun 2024 15:24:51 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:2816:6a42:9074:18cc]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6f30acda9sm87914105ad.198.2024.06.12.15.24.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 15:24:51 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , Daniel Vetter , David Airlie , Jonathan Hunter , Mikko Perttunen , Thierry Reding , linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 3/8] drm/tegra: Call drm_atomic_helper_shutdown() at shutdown time Date: Wed, 12 Jun 2024 15:23:43 -0700 Message-ID: <20240612152336.v2.3.Ifb4450979b62976fd5a98847dade2e5b377d47c8@changeid> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog In-Reply-To: <20240612222435.3188234-1-dianders@chromium.org> References: <20240612222435.3188234-1-dianders@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Acked-by: Thierry Reding --- 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 03d1c76aec2d..d9f0728c3afd 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -1330,6 +1330,11 @@ static int host1x_drm_remove(struct host1x_device *d= ev) return 0; } =20 +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) { @@ -1398,6 +1403,7 @@ static struct host1x_driver host1x_drm_driver =3D { }, .probe =3D host1x_drm_probe, .remove =3D host1x_drm_remove, + .shutdown =3D host1x_drm_shutdown, .subdevs =3D host1x_drm_subdevs, }; =20 --=20 2.45.2.505.gda0bf45e8d-goog From nobody Thu Feb 12 10:55:16 2026 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D02512D1F4 for ; Wed, 12 Jun 2024 22:24:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718231095; cv=none; b=WkP666S4Q+L5S8ckHhl6TsWyxF/j9cySPxNPdiMX3Cnusq5vYDabEIO+06b3CUjEPEfgWY9k+qhZd7OmaOmhjMzmdBnBb8QEK7MKhq74SQR1I0JlDdLPM8Q2fVsJQ/2k9TUouzVK/Lk1sp6nT6POof68IUE76gRd9FnK1/ulpSU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718231095; c=relaxed/simple; bh=8xjZTpeFcaE74g6l02h1dDzTdoSJ+H05F9AhpsSAsWE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZgbIVEIfAigNQYkOkVMMMYCvHBjR8M6BC/P08du2upRERdayZ1e94hgbkkjGX2ntXJEnswBwOefMG/wXFJOudiaSPAT4d4mtm2PBIoCid1YZdIu2P+121/nRI5yywsAPA94FM6ic3V13vuV1Z8xDdrAFa7qFbhUw99BJXkqkxxQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=MvJMW5+0; arc=none smtp.client-ip=209.85.215.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="MvJMW5+0" Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-656d8b346d2so289184a12.2 for ; Wed, 12 Jun 2024 15:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1718231093; x=1718835893; 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=cG9YsnvV0dqFs63XW3w7FcDwXhGHgBYJnS7/vNMDsUI=; b=MvJMW5+0l3kvsauUsrvS9g4K8VmDgpAjlIooetS/QiOpUPnU+e5mc1Vy0Z5p7WP0tU 3JgJ5R6A65bK8Lp9r/kpH1dq3xRDKPrIYyWWiHWpW0sH3Mo2z9bthTfBWfpSt0S5ou3Z t3bemCAkGEk2o/hN8GGxNSaB3r8PrtyvVStSw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718231093; x=1718835893; 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=cG9YsnvV0dqFs63XW3w7FcDwXhGHgBYJnS7/vNMDsUI=; b=Qfj7I/xfaRG5nIeFsS+Qhy1li15wpHjmGZAENGlt6uuv3BnBuUWxjBvGINoWKg67F6 EalvAe8xX8TJOAKCoTUJrUAUxQhvbFsZ9SWDVePXIcssMXF4xSLzPHUmPv1ungw8Ud2L 3RzqBDS+v0IBhEhIefmkoI0Gcp9nSs0PzVaTZLuCkcHVpJ9/1f2KFB00lGCKnQXCFVTD qa0GFM0F1fJ6oXDOkdCbJ5yd+H7T1koe/YHz+L9UY7vW5XeMa8NrFs3YMjS+Pc5ntsf7 4FeHpileymNVQX4QZ5Ws50FEYs7QxD+CB3mUSziGhfkfBvmjG1l05Ynaxc2SpcH6Mb88 v95Q== X-Forwarded-Encrypted: i=1; AJvYcCUxSdvEFIXcvaHeMVd+6PPT0Al2JAKrXWf6PTmIcSyabBOHHjZvHmMipd9kljdhnHDHAZYFwC2Fql//JsE9R1XNz4dxlTZS4xBuZkco X-Gm-Message-State: AOJu0YxmcQvLTUjBDIFg9YMzvNRohUSWfy6lmubTbyuLpe61mMq0fp3S 05HlYJ/kYJ0petUTFBFkwb806ti4/7iQpjo5AxymNCCtWQZpHGi1CspFmOQEKg== X-Google-Smtp-Source: AGHT+IGI/wCAa9iSAbUyULm8uaZzcZmzyBGn6eSxHSxLyKPWYAONixriz1scQsX3eltdmrQaRYhqHw== X-Received: by 2002:a17:903:1cd:b0:1f7:234b:4f28 with SMTP id d9443c01a7336-1f83b60954cmr37501915ad.25.1718231093331; Wed, 12 Jun 2024 15:24:53 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:2816:6a42:9074:18cc]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6f30acda9sm87914105ad.198.2024.06.12.15.24.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 15:24:52 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , Alexey Brodkin , Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [PATCH v2 4/8] drm/arcpgu: Call drm_atomic_helper_shutdown() at shutdown time Date: Wed, 12 Jun 2024 15:23:44 -0700 Message-ID: <20240612152336.v2.4.I8a0a246fea222059881d01a8fff2adcf7ef3d7a4@changeid> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog In-Reply-To: <20240612222435.3188234-1-dianders@chromium.org> References: <20240612222435.3188234-1-dianders@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 4f8f3172379e..85b21f5aac55 100644 --- a/drivers/gpu/drm/tiny/arcpgu.c +++ b/drivers/gpu/drm/tiny/arcpgu.c @@ -412,6 +412,11 @@ static void arcpgu_remove(struct platform_device *pdev) arcpgu_unload(drm); } =20 +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[] =3D { {.compatible =3D "snps,arcpgu"}, {} @@ -422,6 +427,7 @@ MODULE_DEVICE_TABLE(of, arcpgu_of_table); static struct platform_driver arcpgu_platform_driver =3D { .probe =3D arcpgu_probe, .remove_new =3D arcpgu_remove, + .shutdown =3D arcpgu_shutdown, .driver =3D { .name =3D "arcpgu", .of_match_table =3D arcpgu_of_table, --=20 2.45.2.505.gda0bf45e8d-goog From nobody Thu Feb 12 10:55:16 2026 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22DC712D1ED for ; Wed, 12 Jun 2024 22:24:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718231097; cv=none; b=nmNSwSP7FYj3WrwRbN8XJ7ufMuDUFX9SbmWC2fHgDTuYxvPqzL4482tO6C4G93mmzjvNZT+576uowz/6pgLk+z/0+k7zW5hlwAZOiW9+e0TAHrPhAnW9UfcpUi/apeGLbgqVT/S6P+gprNudDBf3PQZ39RmK/HWpzPDkhlzKmjQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718231097; c=relaxed/simple; bh=NRArsyGf8TAn/F8FIKbUDBSYg38BW5LqqhcOU6lhGSw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ClyFFLF6NmB5PopTc77J1txP9Vk5th0wbQ6lEPMzJQeGfdE9nFBxApJEoh1bV9IbxOJ6fYTdzDtAZRQOUplGBuoudEAqMb60Zui902kWTv7CkKTBKPNeEz8W8y3M1fNp2rJkzFWiZiWomj8HV92GczxcpWTGCBhW4COls1GHogE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=TyGaBUem; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="TyGaBUem" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1f4a5344ec7so2679185ad.1 for ; Wed, 12 Jun 2024 15:24:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1718231095; x=1718835895; 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=moW+vuchPBzwhuLa9D90CyqT2Qzy5nveIbqumh1IepQ=; b=TyGaBUemiF8mB0SmycQkbC7KPJmVJgGqAxux2xx7yKhZLCDlYcMYxt9i9AkVDP6VFg 4iUtGR+uVUWam8l9KeERsrF3HD/XXcQ+ptI5BpdVS7NcFnb4LLGso3Ph8j3gcvA4Imlc 2467oEyWhfTrEBZ5vu9gALeyO+D8Y56eN1sLw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718231095; x=1718835895; 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=moW+vuchPBzwhuLa9D90CyqT2Qzy5nveIbqumh1IepQ=; b=d/bpq23BLinpSbChzGV4sMA8fwCmWOWxs7S4qS9Q3Sxfl7aHCGlG4uVHMuVXFZeUSF wxNuxsd1qeVgUyO6i7PY9zUAoZSGj+xTmrrjLTWv++mFIQB7FyMG0qE7jbzd0uq2HbDK q8XP5eUhd8fLBxkVjXFvhIvWXGiT06uzWKf2mk61HdMFL49kbqWeSEdpMmo0yF1qzCbj LVwXJVfoLpVoVTGQHUFTanx7lTWUOy951ZMBVswzLxSP1GkDwOVBljX7Pmal7tNsWzEq N8jfkD3sd3/7crMd740hqMH4NDnJn+g/VHll/DH2G46QrrzGNqyd5AdgJQnW16UtHCCs p94A== X-Forwarded-Encrypted: i=1; AJvYcCXmsPBJhBdrUuWwv9o+4U+bH6gbP+wEgU1HymR1XCyuDfVmCAQ4Oy1GuFKFdxYmCt1cUdSgaf3cbXkSUmbe0j5OUnDxIXGYbK2jSDap X-Gm-Message-State: AOJu0Yw57NAtm4Ee+753f7/QAjdTXh7BNxJzm/w7JpaLc1xo3Z2HNnZN 8+7MXvtHwzWwZB9/21Az1nZmw854wkhs0/eA2NWPCVjEDsNQwqziXdZnLaHSBQ== X-Google-Smtp-Source: AGHT+IHBAtSsNRsCiipiSSmdPtxdIvkO4DzXuXDcDLjyV0KBNSghL6hedDrLySr08oXr7dCUGUp9XA== X-Received: by 2002:a17:902:fc46:b0:1f2:fee2:82ed with SMTP id d9443c01a7336-1f84e425a39mr11905935ad.30.1718231095482; Wed, 12 Jun 2024 15:24:55 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:2816:6a42:9074:18cc]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6f30acda9sm87914105ad.198.2024.06.12.15.24.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 15:24:54 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , Baolin Wang , Chunyan Zhang , Daniel Vetter , David Airlie , Kieran Bingham , Maarten Lankhorst , Orson Zhai , Rob Herring , Sam Ravnborg , Steven Price , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [PATCH v2 5/8] drm/sprd: Call drm_atomic_helper_shutdown() at remove time Date: Wed, 12 Jun 2024 15:23:45 -0700 Message-ID: <20240612152336.v2.5.I7a2dd349cb52bae53280d0a49e22cc27b923274b@changeid> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog In-Reply-To: <20240612222435.3188234-1-dianders@chromium.org> References: <20240612222435.3188234-1-dianders@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. While making this patch, I noticed that the bind() function of this driver is using "devm". That's probably a bug. As per kernel docs [1] "the lifetime of the aggregate driver does not align with any of the underlying struct device instances. Therefore devm cannot be used and all resources acquired or allocated in this callback must be explicitly released in the unbind callback". Fixing that is outside the scope of this commit. [1] https://docs.kernel.org/driver-api/component.html (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_dr= m.c index a74cd0caf645..d4453430dd1f 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; } =20 @@ -122,10 +123,11 @@ static void sprd_drm_unbind(struct device *dev) struct drm_device *drm =3D dev_get_drvdata(dev); =20 drm_dev_unregister(drm); - drm_kms_helper_poll_fini(drm); + drm_atomic_helper_shutdown(drm); =20 component_unbind_all(drm->dev, drm); + dev_set_drvdata(dev, NULL); } =20 static const struct component_master_ops drm_component_ops =3D { --=20 2.45.2.505.gda0bf45e8d-goog From nobody Thu Feb 12 10:55:16 2026 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D21112DD92 for ; Wed, 12 Jun 2024 22:24:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718231099; cv=none; b=IIen62yDJWuuSv+VF1Py8MomRQT8gWcxCWWE4BlaJ35acLQitEU1HwSfUdcG7mY6qDRu1XjkNU56miRXkbzeOG5EfcshUbSb30TXoSU85cgw009p1uwBvDkFqa4DKT+1Kx+kFM2l4tWfohlCi+qkrpqUVajiaDDgCr82G/yp/kw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718231099; c=relaxed/simple; bh=2wkzVnCDA5HjRFr52Hnwqtvv2KLUsgP9ff53wxCjhiA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t+xJjcpz5vio2fVCBivuQtj3i4A++Jy7ErWyK+Ogpxci1zOWbGNygxtTM8ikjPbDbd569QrbdvJxTcuJ9etkgm9cXl/fj/IM6sFqcL+x+4a8J+W0kQPSJ/BeHOWk0fhvnpoRMPrJgHSqy6ep3xwgHAM7oZiihro5/oG0n5tZgUQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=E2twhUfI; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="E2twhUfI" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1f6f38b1ab0so3402155ad.1 for ; Wed, 12 Jun 2024 15:24:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1718231098; x=1718835898; 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=eCLxsF8rhWGGZr+97E/MrTNjYe+fnMrZ7mNGuOaWySo=; b=E2twhUfI3UXvTzABAPalO9ey+rGv7+WluUm849XY25JKXhidHjEG5oX1UmK8i46xs0 O7KZhiz56+jMrpQ8Q1LkHLKawH3Ep7vt/8F7Rkk/SFCM1T9iR8ftXNnPK+d/BkxV4ytm 6rrzcUJEQ1czsItMzX3oKy6pXAiUV6hOS7BBQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718231098; x=1718835898; 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=eCLxsF8rhWGGZr+97E/MrTNjYe+fnMrZ7mNGuOaWySo=; b=dd6b8CzSFHVa5FyfFgsxTzPAtqFwNnQs3JK3Cl3D9l2on3ckvcxJrIOvzF5/Rg1qf0 bhT35SIET4vPP+QP6MM0mVvCti4YcKRJVEGqQmm+1VXsx3rmW9ppVepgW4uGSG2+I9+4 iAq/RFQFWNvotwjpbBkElti0x4PFjdmz+SoAF/Dxc6ky4NiXLN63d9ft8qd+H0GjPxnm bfM7Uj0awFxhGsQiaw993sTFwBeK9xt/dByPea6GrMucroYVsVH1rZ1k0045e/lSF+Il RiOR+/KLIw4K+wA6vet4C7q9DBotEpJAQlAK40y5vFHxnDqotwhp09tYUKp3nOxlJ8nC +xZw== X-Forwarded-Encrypted: i=1; AJvYcCWmy2b2dqe1JVxqE8u0lhIVp9pehEWzrLXmWZb9Md9sMJCcg5UiYYE/8F4sf2A856Fxk73HvIS1uPAOyOeDyTpVeBrOCQn6hGOLJNPq X-Gm-Message-State: AOJu0YyKxNcKC88M7IcINw4yugnxNyCme3+fR9SeiyGuzVNmHBpK5Iog 6zKJOBQluMJi4tLfZ2kW+p/910SXDPXDbYrGfAXVtev16etE4ZGx/EQVMdOe4g== X-Google-Smtp-Source: AGHT+IFXmBDxj4j5xao5roMZtZUT3z8AsYTNgifgJ+RUUK1gO4l9UAxZFVxYo9uWh5aBe2pfsNj1Pg== X-Received: by 2002:a17:903:2307:b0:1f7:1ca3:d0d3 with SMTP id d9443c01a7336-1f83b565d56mr34307215ad.4.1718231097634; Wed, 12 Jun 2024 15:24:57 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:2816:6a42:9074:18cc]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6f30acda9sm87914105ad.198.2024.06.12.15.24.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 15:24:56 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , Daniel Vetter , David Airlie , Maarten Lankhorst , Patrik Jakobsson , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [PATCH v2 6/8] drm/gma500: Call drm_helper_force_disable_all() at shutdown/remove time Date: Wed, 12 Jun 2024 15:23:46 -0700 Message-ID: <20240612152336.v2.6.I1be622999c3b23f28f077fc75bb0319396a216e9@changeid> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog In-Reply-To: <20240612222435.3188234-1-dianders@chromium.org> References: <20240612222435.3188234-1-dianders@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =20 #include +#include #include #include #include @@ -485,6 +486,12 @@ static void psb_pci_remove(struct pci_dev *pdev) struct drm_device *dev =3D pci_get_drvdata(pdev); =20 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)); } =20 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 =3D { .id_table =3D pciidlist, .probe =3D psb_pci_probe, .remove =3D psb_pci_remove, + .shutdown =3D psb_pci_shutdown, .driver.pm =3D &psb_pm_ops, }; =20 --=20 2.45.2.505.gda0bf45e8d-goog From nobody Thu Feb 12 10:55:16 2026 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90B281DFF0 for ; Wed, 12 Jun 2024 22:28:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718231324; cv=none; b=sNSSPX7ph7gDZb+7RVrsLS6ezORLGSTVioY90/gpSM9Qqvzq/tZcQYn7VAhesfRISRFgYKhWXFVECE+Jy2kqPOeexgQanAdi6qJ5SKcNmgO5GGsfnnCHvlcPu/gVHEFCbMc54J5630AwRRysyBNRUlUhruWFG0hfuPqHRahkmjE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718231324; c=relaxed/simple; bh=ovszzoD+l1HTEFhiU4/Ym/jkxpe19V1Bxj8HyByAAeY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=s59oaM3gKm3oGR8fIsOnHpW3BsTiYeJY9MA3yK4RX/l54JnnwX5SCCTFfKPvJesH+FHR5ypfzY3udN5gbS37Dp9rgIwH6WVgSAvxxwUOhpGU3G6fMMmwCLq8UY0P+KiAGaQd8zkEpqRgdXq9SKxrDWpypwgi7T2mMb8Q3T3H20Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=kdMw/eYn; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="kdMw/eYn" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1f7028196f2so3372695ad.2 for ; Wed, 12 Jun 2024 15:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1718231322; x=1718836122; 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=L/jWWU1pq804c3ou2ews3riGNTGElQFQ1wAS5cHqZxA=; b=kdMw/eYnIS9YM2lPJCLnDePC1E13EH3z6QdYHe7Wymd/aDP757eYh2RjCllrknQJTn bvl1Pj2Rvv+ydAq2DNodyxmJ9rkseErPa6ESw+9k3sf+CAODnWc4BGcRLwklajA/7hrQ 22DKMtVYrnIE5nCk5h+ZPaPETLPs0LWg7D8bc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718231322; x=1718836122; 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=L/jWWU1pq804c3ou2ews3riGNTGElQFQ1wAS5cHqZxA=; b=bsmIOFJjGPz2BBZvcs1QtGMTXS+S3IKujCTumCDWA1QM57lBNj2SRmxB5EijpEmGzU oLUpHqxGDCC7sNXE+poJtvOjUOhc1xXZB8Sa3ldBs2HDjrZvoGXyhMVTvekwcKQqRwyS uFqJm9jsOn61G0qiFiAF2E27uH9GLj4TGaCiNdnPwarjR5cSuX6sEviZXUCOuSqHoKVZ +Qpg4/gAQ/GsabHDBwKOz6ECTxb1SeTCf3FosVjqSsLf1c774DeLpvN7o/+BMaNu8oUu 8NLUqSOinlYxOUyCAA9VicKU9bfPYgRp0GlT3LEAmgojB4DY+hgH5GZWSY7BGKSQCsxP Tz3A== X-Forwarded-Encrypted: i=1; AJvYcCUdMTlwcF/3pAgq74tKmyXQjY1cVGl9X25DsYhWUmEtD14kA12570BYGY8UfUIOG+NFjmo5TYs+MvLuICCV69XQs28c9AS/IzMvfA17 X-Gm-Message-State: AOJu0Yy05ns1mC43rHLF9e4kyJ7+XYM8gV6b46j0f+cxVAERCEWRVsJ1 CKN7bj4P1sES0dJO2V4qXZ8mvj+WR8L9m/RdfcZgeMzzGuLpz6pmWRtNLQVb5g== X-Google-Smtp-Source: AGHT+IF/TlcvLXIfZfu54yCkggfRcKPb4J9ZvGiYz9EXPf3MwPKKQhOCuUiLPrDC9MOJJ/dvVbiIOQ== X-Received: by 2002:a17:903:234a:b0:1f7:187f:cb5b with SMTP id d9443c01a7336-1f83b7f5871mr39623195ad.64.1718231321795; Wed, 12 Jun 2024 15:28:41 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:2816:6a42:9074:18cc]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6f336d172sm87788575ad.247.2024.06.12.15.28.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 15:28:41 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , Xinhui Pan , Daniel Vetter , David Airlie , amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 7/8] drm/radeon: Call drm_helper_force_disable_all() at shutdown/remove time Date: Wed, 12 Jun 2024 15:28:03 -0700 Message-ID: <20240612152752.v2.7.I022cfc2dcd30e77d4f7005a2d912dd7ab76c0338@changeid> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog In-Reply-To: <20240612222435.3188234-1-dianders@chromium.org> References: <20240612222435.3188234-1-dianders@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 Cc: Alex Deucher Cc: Christian K=C3=B6nig Cc: Xinhui Pan 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/r= adeon_drv.c index 7bf08164140e..9ea7f163a731 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -38,6 +38,7 @@ #include =20 #include +#include #include #include #include @@ -330,7 +331,9 @@ radeon_pci_remove(struct pci_dev *pdev) { struct drm_device *dev =3D pci_get_drvdata(pdev); =20 - drm_put_dev(dev); + drm_dev_unregister(dev); + drm_helper_force_disable_all(dev); + drm_dev_put(dev); } =20 static void @@ -341,6 +344,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)); =20 #if defined(CONFIG_PPC64) || defined(CONFIG_MACH_LOONGSON64) /* --=20 2.45.2.505.gda0bf45e8d-goog From nobody Thu Feb 12 10:55:16 2026 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E52484D11 for ; Wed, 12 Jun 2024 22:28:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718231329; cv=none; b=jM34jtIIylp0jlj/KB1M9bVF9VlDjU/w9c1TBZYYvhAtFYTFzGqWW5Ic+FL5O0Jssd6zNZyafdnIKvH8DIsls7kFQwGlk2TexWztqz6K1XwF/iB8Lsb2Bfpj34Yx2ViD5Y1XINdbMAliFJZNJ2JD0DcYMl4hENKDbV9kodxGk5c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718231329; c=relaxed/simple; bh=0YYBkjwBMNK9jlWYzSWYFWWhvwfI5jrnzT5YzQooxbQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GxAZqRUB06NbjDrZhJpuMGxLkk7CT/z1VlSeXh6/R6nUPVDJVXgCSRyZEnX6qSIPpo/KsRKx6/5HdWl13oTLWJYI9WimSxdKUVz7AJeN0ER6/QBERv4weT2DHb3pLf2yewQ9/yImkmwWMGMdO/KqqC7fByaaCYE9sE3PGZO1J1Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=gfkHK+Ch; arc=none smtp.client-ip=209.85.216.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="gfkHK+Ch" Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-2c2dee9d9a1so240504a91.3 for ; Wed, 12 Jun 2024 15:28:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1718231327; x=1718836127; 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=GlLfBbnX9FblBpW76gVStblANR7z9T1g0t5a6w4/nbU=; b=gfkHK+ChkSFh+w/NVzSJJsuTIMrRcp/tKjaMKQciHGSPZTSKHm9kkkN4oS8mUlftDU rHFBs54t4sO4htN/cEEBqRYs9aJijgUnE8Z3yU3ik9zEoJa7v7IQUy/DTgBXDDTiKZa7 pbZ/Ej/owDBNt2fYjo1tCKY/LErTho2b0e1lA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718231327; x=1718836127; 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=GlLfBbnX9FblBpW76gVStblANR7z9T1g0t5a6w4/nbU=; b=YIRunZ8H4lN8uiEFuYqYv6U2TO9O69w+RoINfpxl41DH8rMDEUunOlHJgWFkZdivGN v58yjqgvcUl36vI1x8shUZP5GeagiJMzeBZvWF4waKagalmyA36PNCxOxgN8/JIWA1Gl 1V6Me0s4ApPZU1GWp1evNGSO3aPqhKeAtii2ZsONiIH2klSYPhP32u373gSp0ewRpAfr 5zQsn8BqaDQSGoNKL3lNFVLItiV8bMI+fhkFUsr4QsIhEdXMKKXttPcj8j0+BY3TVHzA HEj/C1b8YXrPfGt5cp3HiM3QkqZeGqVItnIDpv+MBK6lEuNFvIWjvalKk3QKlj3hmwwD nnlQ== X-Forwarded-Encrypted: i=1; AJvYcCVBFCyjhiYozwDauL/bbAtY2XV88hjaZRMjObUEbwB1FCE845hjWoXDrcIc2TdfM0Pp0epFd4umpT26XHgCnUqvBkPXFpStT6Ig6ZVa X-Gm-Message-State: AOJu0Yz56SvtgctOsWND4MFi6W1BNrtTZDNtHtJwgymKDctqixC5Icwg TsGICcFFj6bgpoM2ol9FecGjougicn47fBe9g0AWQBJpFx92SCLfnsAD6NGwTw== X-Google-Smtp-Source: AGHT+IHPZkmR/uiNsfI6yDfoiz6DjupPzvyE09FKeunOtYBdIdMpSm5jxkYUgJB/lptf93zhOTJSfQ== X-Received: by 2002:a17:90b:4ad2:b0:2c4:ab32:b723 with SMTP id 98e67ed59e1d1-2c4ab32b8c3mr2926957a91.29.1718231327185; Wed, 12 Jun 2024 15:28:47 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:2816:6a42:9074:18cc]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6f336d172sm87788575ad.247.2024.06.12.15.28.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 15:28:46 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , Xinhui Pan , =?UTF-8?q?Andr=C3=A9=20Almeida?= , Aurabindo Pillai , Candice Li , Daniel Vetter , David Airlie , Hamza Mahfooz , Hawking Zhang , Le Ma , Lijo Lazar , Ma Jun , Mario Limonciello , Shashank Sharma , Srinivasan Shanmugam , Thomas Zimmermann , Victor Lu , amd-gfx@lists.freedesktop.org, chenxuebing , linux-kernel@vger.kernel.org Subject: [PATCH v2 8/8] drm/amdgpu: Call drm_atomic_helper_shutdown() at shutdown time Date: Wed, 12 Jun 2024 15:28:04 -0700 Message-ID: <20240612152752.v2.8.I27914059cc822b52db9bf72b4013b525b60e06fd@changeid> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog In-Reply-To: <20240612222435.3188234-1-dianders@chromium.org> References: <20240612222435.3188234-1-dianders@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 Cc: Alex Deucher Cc: Christian K=C3=B6nig Cc: Xinhui Pan 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/amdg= pu/amdgpu.h index f87d53e183c3..c202a1d5ff5f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -1197,6 +1197,7 @@ static inline struct amdgpu_device *amdgpu_ttm_adev(s= truct 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); =20 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/a= md/amdgpu/amdgpu_device.c index 861ccff78af9..a8c4b8412e04 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -4531,6 +4531,16 @@ void amdgpu_device_fini_hw(struct amdgpu_device *ade= v) =20 } =20 +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 ea14f1c8f430..b34bf9259d5c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -2409,6 +2409,8 @@ amdgpu_pci_shutdown(struct pci_dev *pdev) struct drm_device *dev =3D pci_get_drvdata(pdev); struct amdgpu_device *adev =3D drm_to_adev(dev); =20 + amdgpu_device_shutdown_hw(adev); + if (amdgpu_ras_intr_triggered()) return; =20 --=20 2.45.2.505.gda0bf45e8d-goog