Received: by 2002:ab2:6f44:0:b0:1fd:c486:4f03 with SMTP id l4csp31042lqq; Wed, 12 Jun 2024 15:33:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUjLeLWkLIPgVlogyPP45opJRGggaL3Ctslu8704wT0J7iIPauFDsvyTzNU8f+5q5cebbWx6hOzgcElHHaM0F2dM1wjmFaO9LGVqBLnMQ== X-Google-Smtp-Source: AGHT+IHJOotQIcrMjm6pqZ0gOzYHB4IBFR4dsUE52//XG2zUG82firLd+byK4bI5uf2OXn1jDhlN X-Received: by 2002:a50:ab08:0:b0:57c:70be:6558 with SMTP id 4fb4d7f45d1cf-57caab12e75mr2532680a12.27.1718231619400; Wed, 12 Jun 2024 15:33:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718231619; cv=pass; d=google.com; s=arc-20160816; b=OHONXHAIxcXNxNWFlqx8pFu7hMPg063MgdULqAk3lWmMz5xL0tkGOFPD55iXzkrQF+ 9rwj2T563X7tGZEjvjeFvIcIyms2Q/4scYZua5qevZsxSQJUWD8VTFWp8pxaMviHhTA6 Brn7emcC5v64qLNZ9aHPGX588ySMncDQp8zjpyzaQWQ5EqRrc/6lNd1AAo9guw6CVTkx LNCzcimQOnIggjYOhM89G9HWMkvfGgCWXvinhofwjhQH0nSjz3LsqN/CziLYx9ZNQSCe wdSC9pz+LT4trFA0PjMvyq1OFVG8xrTHP93vm7AucXDNbCR5efYaNkoS5AvOCUFEUWZw b7YQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=hvJdqdXbOsMsvfolWLIhz5jKfl0lZRFyGewDbo4ybFE=; fh=+vx5/F9Tx0+YmDicf3CdQj/jykEtA9n0RAC8K/GG9bI=; b=Ewr8f9Rhu7Du8vkEpoTT8OYoUdKr4s39J2F6OdAGf94ikXRSj/av8xKQ5JaTurW7yw r8EeqjGKkRbZZmt6hJ2b9CcaNhpr8FpvATWGsZsAac2bQ1kq7ojMrMkfhl1s5UwoKm+P mePrXmUArz6pl12a/PNaZbTWkW4hnhLzfw8vzcHX6bKKJB0eEGcjDt1WH6mZZ6mDa52U NwuPsZ1Va1rnPEaztfvErt3KyTAitTi+Nj3ySz7300VBIY2e7QEGtcVUdOHhz5knnVYZ 8uGz78iUVe7WSZ6oUgxlGj15kfSG+KXihYoKoDO/iMj7UVc2ftzZrKjgdbj1T1FrdmWI Qv1Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XXfhtB10; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-212315-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212315-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57cb7441181si48381a12.377.2024.06.12.15.33.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 15:33:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212315-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XXfhtB10; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-212315-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212315-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6B7B31F245C5 for ; Wed, 12 Jun 2024 22:24:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7637B12B177; Wed, 12 Jun 2024 22:24:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="XXfhtB10" 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 D884255C08 for ; Wed, 12 Jun 2024 22:24:43 +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=1718231085; cv=none; b=iVaFXiYcV3NPSvuKgrO6wJztxBjJlYko7iHtcVyJW2RMmgFqOUKPK8GRYJSlISDh2P2VxXaawb3YId6F3DXB4aCWm0xnBsxa89a0bzmKloiLJT6ko9dG4MdNLqSDVyR6Dkhbos1bHyoYzf8LEvn4oYgL5wxLvkAIDkTX/7UWaVY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718231085; c=relaxed/simple; bh=p/wmu+4wYl/wqNke/QhUcX7EKLyt1KgUpm4CzyEB4AE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=RDK5GhZAz9YMpE/NjLjh/4D48WfJ7fmr1hNCvgcs4ctJaLEsTge8vwpAiqzkhf2SVUaRwWjYQKtYO4f14g0RtLPqRGdxwKktkFaHx/UR6O9+qHfc+VPeMOGqwS8TuZjJAyaiFVgIf2r6rEi56uoK6SHJS5m6Xhq/RD01buDNjAI= 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=XXfhtB10; 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 Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1f47f07acd3so4101545ad.0 for ; Wed, 12 Jun 2024 15:24:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1718231083; x=1718835883; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=hvJdqdXbOsMsvfolWLIhz5jKfl0lZRFyGewDbo4ybFE=; b=XXfhtB10ztNzpumwlwt2rnGNCPYoTiOj7Tws/arWbAR+ymXKP27s9nmRy8iMvm9SIG 79+6AXFi/l4jdaF1lF4nBhozQWSUhZlS/NAKeKP1pQK6KGl9io3EPEdBdYkrQUIFA3Qn 3Gx8QEtZ4osTugneQmGVpo3XaV1sBgysHGRG0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718231083; x=1718835883; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hvJdqdXbOsMsvfolWLIhz5jKfl0lZRFyGewDbo4ybFE=; b=plQRzf3545mhcE8etrQsSmmBk/bVDXjGYzmVRPwrz6Ab2R3yhKDObQ6rtWTYVZtLFa SNlUuXH1GnjZiVVvqWn2f1aqGLwOTkLIwp8JZyTTPKDC+HUbtMYcYd6hCuAzpgHGL14i j3EbjRbXtlORAOddu3BRAX6zy7nwnkWBy+h25znMGxlqquURsI9qQCn6z5GQ3ZvJPhvJ hmMIAhgoO29JdzqMqPDcXpcF/ho2oVnFxf+KegLYaV4TOsL81nmSIquvzvf1sa5hnM1I foiogXBEZ+vdKgr7Mgay3uBYYHpletbQr8BrhYkU0J/dJ7fL3JiHoOSXe+dNLkwdGgHn 8k1g== X-Forwarded-Encrypted: i=1; AJvYcCVsZRI7Qb1GSc4pZLDmFfISk2uXBIa56+r52zgVs/OFVRJDvarzkF41EQa+p/u5DQLzC4fN7ppp2cnaCXmM/1f9dYo4FZM65oeWMWcP X-Gm-Message-State: AOJu0YymKjc9f+vbAiU23wzZVawcFfR4mkkCHnrLcpG1KWKyIeBK9Is3 XVjeenjuifnxZ7nZAeBUHSUaA121ScRlUhsrvIiLHpmdt6BZbUCi7z/iNdup5Q== X-Received: by 2002:a17:902:e851:b0:1f6:65d3:296 with SMTP id d9443c01a7336-1f83b637bdcmr34717685ad.29.1718231083000; Wed, 12 Jun 2024 15:24:43 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 15:24:42 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , Alex Deucher , Alexey Brodkin , =?UTF-8?q?Andr=C3=A9=20Almeida?= , Anitha Chrisanthus , Aurabindo Pillai , Baolin Wang , Candice Li , =?UTF-8?q?Christian=20K=C3=B6nig?= , Chunyan Zhang , Daniel Vetter , Danilo Krummrich , David Airlie , Edmund Dea , Hamza Mahfooz , Hawking Zhang , Jonathan Hunter , Karol Herbst , Kieran Bingham , Le Ma , Lijo Lazar , Lyude Paul , Ma Jun , Maarten Lankhorst , Mario Limonciello , Mikko Perttunen , Orson Zhai , "Pan, Xinhui" , Patrik Jakobsson , Rob Herring , Sam Ravnborg , Shashank Sharma , Srinivasan Shanmugam , Steven Price , Thierry Reding , Thomas Zimmermann , Victor Lu , amd-gfx@lists.freedesktop.org, chenxuebing , linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, nouveau@lists.freedesktop.org Subject: [PATCH v2 0/8] drm: make leftover drivers call drm_atomic_helper_shutdown() at the right times Date: Wed, 12 Jun 2024 15:23:40 -0700 Message-ID: <20240612222435.3188234-1-dianders@chromium.org> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog 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: 8bit This patch series is the leftovers of a patch series sent in September 2023 [1] in an attempt to get some of the patches landed finally. This patch series originally came about after a _long_ discussion between me and Maxime Ripard in response to a different patch I sent out [2]. As part of that discussion, we realized that it would be good if DRM drivers consistently called drm_atomic_helper_shutdown() properly at shutdown and driver remove time as it's documented that they should do. The eventual goal of this would be to enable removing some hacky code from panel drivers where they had to hook into shutdown themselves because the DRM driver wasn't calling them. It turns out that quite a lot of drivers seemed to be missing drm_atomic_helper_shutdown() in one or both places that it was supposed to be. This patch series attempts to fix all the drivers that I was able to identify. NOTE: fixing this wasn't exactly cookie cutter. Each driver has its own unique way of setting itself up and tearing itself down. Some drivers also use the component model, which adds extra fun. I've made my best guess at solving this and I've run a bunch of compile tests (specifically, allmodconfig for amd64, arm64, and powerpc). That being said, these code changes are not totally trivial and I've done zero real testing on them. Making these patches was also a little mind numbing and I'm certain my eyes glazed over at several points when writing them. What I'm trying to say is to please double-check that I didn't do anything too silly, like cast your driver's drvdata to the wrong type. Even better, test these patches! Apparently most of these drivers now land through drm-misc [3], so hopefully they can land. The two that don't (amdgpu and radeon) are the ones I'm most ucertain about anyway so I've stuck them at the end. If I've totally buggered those up feel free to take my patch as a bug report and submit your own proper fix. ...or if there's some reason that we don't need to do anything for those drivers then let me know and we can drop them. I'd like to call out a few drivers that I _didn't_ fix in this series and why. If any of these drivers should be fixed then please yell. - DRM drivers backed by usb_driver (like gud, gm12u320, udl): I didn't add the call to drm_atomic_helper_shutdown() at shutdown time because there's no ".shutdown" callback for them USB drivers. Given that USB is hotpluggable, I'm assuming that they are robust against this and the special shutdown callback isn't needed. - ofdrm and simpledrm: These didn't have drm_atomic_helper_shutdown() in either shutdown or remove, but I didn't add it. I think that's OK since they're sorta special and not really directly controlling hardware power sequencing. - virtio, vkms, vmwgfx, xen: I believe these are all virtual (thus they wouldn't directly drive a panel) and adding the shutdown didn't look straightforward, so I skipped them. I've let each patch in the series get CCed straight from get_maintainer. That means not everyone will have received every patch but everyone should be on the cover letter. I know some people dislike this but when touching this many drivers there's not much choice. dri-devel and lkml have been CCed and lore/lei exist, so hopefully that's enough for folks. I'm happy to add people to the whole series for future posts. [1] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230804140605.RFC.4.I930069a32baab6faf46d6b234f89613b5cec0f14@changeid [3] https://lore.kernel.org/r/Zmm6_27GikpmT3HQ@phenom.ffwll.local Changes in v2: - Gathered whatever hadn't landed, rebased, and reposted. Douglas Anderson (8): drm/kmb: Call drm_atomic_helper_shutdown() at shutdown time drm/nouveau: Call drm_atomic_helper_shutdown() or equiv at shutdown time drm/tegra: Call drm_atomic_helper_shutdown() at shutdown time drm/arcpgu: Call drm_atomic_helper_shutdown() at shutdown time drm/sprd: Call drm_atomic_helper_shutdown() at remove time drm/gma500: Call drm_helper_force_disable_all() at shutdown/remove time drm/radeon: Call drm_helper_force_disable_all() at shutdown/remove time drm/amdgpu: Call drm_atomic_helper_shutdown() at shutdown time 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 ++ drivers/gpu/drm/gma500/psb_drv.c | 8 ++++++++ drivers/gpu/drm/kmb/kmb_drv.c | 6 ++++++ 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 ++++++ drivers/gpu/drm/radeon/radeon_drv.c | 7 ++++++- drivers/gpu/drm/sprd/sprd_drm.c | 4 +++- drivers/gpu/drm/tegra/drm.c | 6 ++++++ drivers/gpu/drm/tiny/arcpgu.c | 6 ++++++ 14 files changed, 78 insertions(+), 2 deletions(-) -- 2.45.2.505.gda0bf45e8d-goog