Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1567486rdh; Mon, 25 Sep 2023 17:46:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGYk8SffXmF02QBgjvua2YKu/RTjA8jJxYwdcBev5iZcJXScIDN/973juTgKR+qqRbvg8B X-Received: by 2002:a05:6808:a93:b0:3a9:bb4f:9efd with SMTP id q19-20020a0568080a9300b003a9bb4f9efdmr8988512oij.29.1695689203070; Mon, 25 Sep 2023 17:46:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695689203; cv=none; d=google.com; s=arc-20160816; b=EFk7BxAU+6xtGnOm/qhmAUAMLexGDHeo09S47Un5ModPPLfEM+490MsVRDIC3ix+x8 mAjSdLdBYG1fQ63FF3vWoP5COmWwUK8t/4KvN7sBE6AXBU3LUeFVQTgVExt1lqE/mNDb mVKDmO7+HwclRj8N0Alr1sHpKGcg8rRRAgJxYK605xdQxOaxGnhOeO/+E7MLH/P6Z0Zt qGSy5XQUNjyFT7knkMERPQdqEbhiW4UIVuQcoLaHx3zwOddxi58eHV3ocHehx78/+5zL ZmI0GLbvzGKcAdyLH+EeaEvwlwL3oeB1/Rw1sOYqohX1i5N+VfwzwrQMecx0hE1j8mU/ 4pcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=7kX39Ca8A6vbWsrSc61cEoyakqRV/gh0/WoLN88Nm/E=; fh=3emGGmuZu5CNogR4d+OgNckw+woUjr6YPwhmk0eosNc=; b=yu+OO/fmTcsgo2DXaMt4umalhu9422usFo13HtibMNL4rElSPwpKz1yRFk6N3Gyfek yOqQcG0WPI3E+9k1OyeCHTeUWW5jEoBDy9zAYdJ6OW6B+U7N5k8RpcuyPIhWdFuGk7ry VmO3khuJ5zNbBqRD/AlI2vT5VBMQdIQ3ToGvncuaZ4neBYPv8jUrGAWEW8vxE4vAcS9B wR9o0coO3xNEGNEvBJ3JAsTilEhalLe4s1Yp1BHQ8XOcrheeOzZop9BHoPu5XhoTtgc+ qQaLxrKlt+Xuxb3zVYuovw6IPgw78URb4xeVoPEBWBGf6QUac76pwTMN8tkfzeTK8qxx EH8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Gz8BQBkd; 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 Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id h17-20020aa786d1000000b00690de92ffe3si10561110pfo.309.2023.09.25.17.46.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 17:46:43 -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=Gz8BQBkd; 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 C4B3E82DE87C; Mon, 25 Sep 2023 10:05:03 -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 S231352AbjIYREy (ORCPT + 99 others); Mon, 25 Sep 2023 13:04:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjIYREx (ORCPT ); Mon, 25 Sep 2023 13:04:53 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 956EA107 for ; Mon, 25 Sep 2023 10:04:46 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-32172a50356so6516696f8f.0 for ; Mon, 25 Sep 2023 10:04:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695661484; x=1696266284; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=7kX39Ca8A6vbWsrSc61cEoyakqRV/gh0/WoLN88Nm/E=; b=Gz8BQBkdbg5rrf87gVpS5UyOR7X0XOmjWQaNwS14lB5VLYZOzBlyLf8ytI1Cnd4cP5 n/T2wMo+Ixj04buDMfx/BR8hYRXmW+1NEhqvBeO4h9o1CsVOJ9uStzJoSs+YM7ysQO6p l3199YTk56/gx9zQf4wjy+n11MqzIfv4Nov4Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695661484; x=1696266284; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7kX39Ca8A6vbWsrSc61cEoyakqRV/gh0/WoLN88Nm/E=; b=eWFGJ3aP8iWeIE4qHYgyX1TRTwWXemCxqsvNDSNjijwq7xxB73jFOAFBeRHI5FEgR+ TXBqsV+dHAKKeYY+BKRAfsIbIAJGNI+7Y2RITSA7a3Kn1xqSYDK9L/wubuLQarf6Jpvn CE075ZCdhYlmNxXXh8FufYGSShIO35ECenhi+++tbjfjOkuCtN459BJkZ349TkV6XS4m 3tV9yGDbu44+Zqk9e4dVwm4r0y56uxl3eGBEEzrr1x2K6v6xp8Oe22VRIZaiCEYq+hP0 DK5aQ3OkEsjb5QKQ9nTaYOnftaZEY26b48j+DhuNWB2XqRCDafAGMGIyc0wd3Sm8BgOY vKaw== X-Gm-Message-State: AOJu0YzYrir32ja8Kkogfdf1yR27EEo9gM4Bm5qMjPvRQuJpqzZRw3ob N60ryMf9eCxb0SxhCKZpeOmZe+Y1QUqPT7DRXK9Y9UiU X-Received: by 2002:a5d:5384:0:b0:31f:ef77:67e8 with SMTP id d4-20020a5d5384000000b0031fef7767e8mr6894970wrv.13.1695661484112; Mon, 25 Sep 2023 10:04:44 -0700 (PDT) Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com. [209.85.208.41]) by smtp.gmail.com with ESMTPSA id mh2-20020a170906eb8200b0099cc3c7ace2sm6646491ejb.140.2023.09.25.10.04.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Sep 2023 10:04:43 -0700 (PDT) Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-51e24210395so876a12.0 for ; Mon, 25 Sep 2023 10:04:43 -0700 (PDT) X-Received: by 2002:a50:a699:0:b0:525:573c:6444 with SMTP id e25-20020a50a699000000b00525573c6444mr6897edc.1.1695661483259; Mon, 25 Sep 2023 10:04:43 -0700 (PDT) MIME-Version: 1.0 References: <20230921192749.1542462-1-dianders@chromium.org> <20230921122641.RFT.v2.7.I27914059cc822b52db9bf72b4013b525b60e06fd@changeid> In-Reply-To: From: Doug Anderson Date: Mon, 25 Sep 2023 10:04:27 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFT PATCH v2 07/12] drm/amdgpu: Call drm_atomic_helper_shutdown() at shutdown time To: "Deucher, Alexander" Cc: "dri-devel@lists.freedesktop.org" , Maxime Ripard , "Zhang, Bokun" , "Zhang, Hawking" , "Zhu, James" , "Zhao, Victor" , "Pan, Xinhui" , "airlied@gmail.com" , "amd-gfx@lists.freedesktop.org" , "Koenig, Christian" , "daniel@ffwll.ch" , "Kuehling, Felix" , "jim.cromie@gmail.com" , "Ma, Le" , "Lazar, Lijo" , "linux-kernel@vger.kernel.org" , "maarten.lankhorst@linux.intel.com" , "Limonciello, Mario" , "mdaenzer@redhat.com" , "Zhang, Morris" , "SHANMUGAM, SRINIVASAN" , "tzimmermann@suse.de" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 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]); Mon, 25 Sep 2023 10:05:03 -0700 (PDT) Hi, On Mon, Sep 25, 2023 at 8:57=E2=80=AFAM Deucher, Alexander wrote: > > [Public] > > > -----Original Message----- > > From: Douglas Anderson > > Sent: Thursday, September 21, 2023 3:27 PM > > To: dri-devel@lists.freedesktop.org; Maxime Ripard > > Cc: Douglas Anderson ; Zhang, Bokun > > ; Zhang, Hawking ; > > Zhu, James ; Zhao, Victor ; > > Pan, Xinhui ; airlied@gmail.com; Deucher, Alexander > > ; amd-gfx@lists.freedesktop.org; Koenig, > > Christian ; daniel@ffwll.ch; Kuehling, Felix > > ; jim.cromie@gmail.com; Ma, Le > > ; Lazar, Lijo ; linux- > > kernel@vger.kernel.org; maarten.lankhorst@linux.intel.com; Limonciello, > > Mario ; mdaenzer@redhat.com; Zhang, > > Morris ; SHANMUGAM, SRINIVASAN > > ; tzimmermann@suse.de > > Subject: [RFT PATCH v2 07/12] drm/amdgpu: Call > > drm_atomic_helper_shutdown() at shutdown time > > > > Based on grepping through the source code this driver appears to be mis= sing 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 cle= anly > > powered off at system shutdown time. > > > > The fact that we should call drm_atomic_helper_shutdown() in the case o= f 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 thi= s call at > > shutdown time but the logic is a bit hard for me to follow. I'd appreci= ate if > > anyone who actually knows what this should look like could illuminate m= e, 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(struc= t > > 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) { > > This needs a better name since its only for displays. Also maybe move it= into amdgpu_display.c since it's really about turning off the displays. T= hat said is this really even needed? The driver already calls its suspend = functionality to turn off all of the hardware and put it into a quiescent s= tate before shutdown. Basically shares the same code we use for suspend. As per my comment above, for this driver, my patch was a "plea for help". I have no idea if it's really needed or if suspend handles it. My main concerns are: a) If it's possible that someone out there is using this DRM driver with a "drm_panel" then we need to make sure the panel gets disabled / unprepared properly at shutdown time. The goal is to remove the special logic in some panel drivers that disables the panel at shutdown time. The guidance I got from Maxime is that we should be relying on the DRM driver to disable panels at shutdown time and not have extra per-panel code for it. b) It is documented that DRM driers call drm_atomic_helper_shutdown() at shutdown time. Even if things are working today, it's always possible that something will change later and break for drivers that aren't doing this. If you're confident that everything is great for the "amdgpu" driver then I'm happy to drop this patch and not consider it a blocker for the eventual removal of the code in the individual panels drivers. If, after reading this, you conclude that some sort of patch is needed, I'd love it if you could test/post a patch yourself and then I'll drop this patch from my series. -Doug