From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4123BFEE4E4 for ; Sat, 28 Feb 2026 09:19:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 051F010E287; Sat, 28 Feb 2026 09:19:14 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="hbyjrClz"; dkim-atps=neutral Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by gabe.freedesktop.org (Postfix) with ESMTPS id 54BDE10EC51 for ; Sat, 28 Feb 2026 01:12:36 +0000 (UTC) Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2add623cb27so17707205ad.3 for ; Fri, 27 Feb 2026 17:12:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772241156; x=1772845956; darn=lists.freedesktop.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=T7pjsQqLYlC7MiskgqQ4KF6moeG8nJU49gJ0m6tNxws=; b=hbyjrClzWGhcUE6RtdZsT7pqX1DdY6bguxBqELnfKHbhy5n2xQXNmZm6uBy3ao8jJv 95iMUnwztpgrv5T7TFmkTCot4DM42E4DK3kOQNEcuK0kw1Ypf3zjcLLgjbChaxaiS1EX iZVp56vtQgV9FYMHhebp4fwxnjwCVAHiPldTOcPqI1u6fft8ojH1JotWGtn8AlyQ0eCI LFWiXnA6evU7XjsmqIx/+vFfC4XXEwI70uG4sbDe6Cs8oBSAU2LW/qLeiJrDxmiR0xCr qGDulL7v+uJabc8XyPMW4k3tQ8b/fNIDkA5fnZbgY71ZDliuqJqwifIPXFrJxGZmslvb QqCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772241156; x=1772845956; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=T7pjsQqLYlC7MiskgqQ4KF6moeG8nJU49gJ0m6tNxws=; b=PhnUEBXwX4Z4Fzw59wLnZ8CnPEbhjN03Xx6zhJ/z6SWL0llotV0lh6GyIpuNFIKDU7 zEHYK2LxClLU5YOs+CXv59birRb8hDkDTtPv1Jpn4iWBPHHHGJA/AlENOgs0Y1CGZv9p 7viZscY3O4pqzN8ycWMfz0Es6K0mmJlzrlQXcgN+FmQ0InmayFXgE/ABslN4hS0PYJJ9 BOPgQbobP+1jI5W5s4VJ8FFM047xYuWz6U5kNCMawuLjhzU5wo7+aroZHryFI3mXDsGV 3+XAZKFCsELms+O8RqmsKQMG1oU6Jk5BQ0vjlN7K+v9JjjmwHlxMv6UUPF7aUumCutVa mRfg== X-Forwarded-Encrypted: i=1; AJvYcCV2XaD6tbFsZ0GRSBMuJrP2x8kchD88X8VFHg4xauowmvgo/0lCl2JAV3hfagqQy5MHoi9IAh31@lists.freedesktop.org X-Gm-Message-State: AOJu0YzVzJS3vRsY3h00qj5My1c2cKFSObK02ZNQQ2nBCAJ+muhTZNCj vj4iHJRv0uYQtjwXsbWxF3EteCKEyKvUdFS+/DNxNx1NSq64uUJOCH4T X-Gm-Gg: ATEYQzzt03ixXlr7aCBa4QUyhSV8jkHutHDDk2a6O7pzNG1WnWlk3q18tv9K8LI7MLS ADLB1ZSpBv042A8G9euAisgKUu+N6ijJvGPQv9/P4Rh9Fem69aEQ9lH0PPf7TFx7+njcUfUi8oN Lye3yy7/joUOA/+IGBEAvWR6aiDRv/BXHxyI1upfL0+YOtO6S4y6bXyGn0Dfdkl4GKbUkqpR+CQ M6iFJlVUcHRwo+kh5cn/bqOys8GR6Wy+GxrODOQOksTDoPuayvvbAAUu5Vi2gedcMQUxQ4Pdt9P zGbuNDV2Az+4CPVU5SD3gL0XxYe1kNpfRVlOBDY7fRlA7OyIAWOBw09LoqaSYElq/RFVfaLn0xX ONY0+dy3tfKpoSQo8KxrJ8Ik5LPolzQ4Gl9SQIfri6SgBfO5+c9svURop4+88TczEKwmdERAlDG FqJcRfOgSkeMU6BXvPW5veKLsSImHFVLyWAwnSVbciZfB1priYRPCvRw== X-Received: by 2002:a17:902:e84f:b0:2a9:62ce:1c0c with SMTP id d9443c01a7336-2ae2e251993mr44077005ad.6.1772241155506; Fri, 27 Feb 2026 17:12:35 -0800 (PST) Received: from ryzen ([2601:644:8000:56f5::8bd]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2adfb6f46c2sm75772845ad.89.2026.02.27.17.12.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Feb 2026 17:12:34 -0800 (PST) From: Rosen Penev To: stable@vger.kernel.org Cc: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , Harry Wentland , Leo Li , Rodrigo Siqueira , Evan Quan , Sasha Levin , Mario Limonciello , Eliav Farber , Lijo Lazar , Ma Jun , Greg Kroah-Hartman , Zhigang Luo , Srinivasan Shanmugam , Bert Karwatzki , Ray Wu , Wayne Lin , Roman Li , Hersen Wu , Wentao Liang , amd-gfx@lists.freedesktop.org (open list:RADEON and AMDGPU DRM DRIVERS), dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH for 6.1 2/2] drm/amdgpu: clarify DC checks Date: Fri, 27 Feb 2026 17:12:13 -0800 Message-ID: <20260228011213.423524-3-rosenp@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260228011213.423524-1-rosenp@gmail.com> References: <20260228011213.423524-1-rosenp@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Sat, 28 Feb 2026 09:19:10 +0000 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" From: Alex Deucher [ Upstream commit d09ef243035b75a6d403ebfeb7e87fa20d7e25c6 ] There are several places where we don't want to check if a particular asic could support DC, but rather, if DC is enabled. Set a flag if DC is enabled and check for that rather than if a device supports DC or not. Acked-by: Christian König Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 32 ++++++++++--------- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 4 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 + .../gpu/drm/amd/pm/powerplay/amd_powerplay.c | 2 +- 8 files changed, 25 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index dcb5de01a220..c4287e09658f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -1071,6 +1071,7 @@ struct amdgpu_device { struct work_struct reset_work; bool job_hang; + bool dc_enabled; }; static inline struct amdgpu_device *drm_to_adev(struct drm_device *ddev) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c index 5fa7f6d8aa30..9ced0c60ec8b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c @@ -857,7 +857,7 @@ int amdgpu_acpi_init(struct amdgpu_device *adev) struct amdgpu_atif *atif = &amdgpu_acpi_priv.atif; if (atif->notifications.brightness_change) { - if (amdgpu_device_has_dc_support(adev)) { + if (adev->dc_enabled) { #if defined(CONFIG_DRM_AMD_DC) struct amdgpu_display_manager *dm = &adev->dm; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c index 3cca3f07f34d..11bfbf1d6a3d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c @@ -1981,7 +1981,7 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev) amdgpu_ta_if_debugfs_init(adev); #if defined(CONFIG_DRM_AMD_DC) - if (amdgpu_device_has_dc_support(adev)) + if (adev->dc_enabled) dtn_debugfs_init(adev); #endif diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 535cc74c5880..a43f18defa7a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -4402,25 +4402,27 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon) amdgpu_ras_resume(adev); - /* - * Most of the connector probing functions try to acquire runtime pm - * refs to ensure that the GPU is powered on when connector polling is - * performed. Since we're calling this from a runtime PM callback, - * trying to acquire rpm refs will cause us to deadlock. - * - * Since we're guaranteed to be holding the rpm lock, it's safe to - * temporarily disable the rpm helpers so this doesn't deadlock us. - */ + if (adev->mode_info.num_crtc) { + /* + * Most of the connector probing functions try to acquire runtime pm + * refs to ensure that the GPU is powered on when connector polling is + * performed. Since we're calling this from a runtime PM callback, + * trying to acquire rpm refs will cause us to deadlock. + * + * Since we're guaranteed to be holding the rpm lock, it's safe to + * temporarily disable the rpm helpers so this doesn't deadlock us. + */ #ifdef CONFIG_PM - dev->dev->power.disable_depth++; + dev->dev->power.disable_depth++; #endif - if (!amdgpu_device_has_dc_support(adev)) - drm_helper_hpd_irq_event(dev); - else - drm_kms_helper_hotplug_event(dev); + if (!adev->dc_enabled) + drm_helper_hpd_irq_event(dev); + else + drm_kms_helper_hotplug_event(dev); #ifdef CONFIG_PM - dev->dev->power.disable_depth--; + dev->dev->power.disable_depth--; #endif + } adev->in_suspend = false; if (adev->enable_mes) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c index 98cce09684f2..f9692e724409 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -534,7 +534,7 @@ uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev, */ if ((bo_flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC) && amdgpu_bo_support_uswc(bo_flags) && - amdgpu_device_has_dc_support(adev) && + adev->dc_enabled && adev->mode_info.gpu_vm_support) domain |= AMDGPU_GEM_DOMAIN_GTT; #endif @@ -1330,7 +1330,7 @@ int amdgpu_display_modeset_create_props(struct amdgpu_device *adev) "dither", amdgpu_dither_enum_list, sz); - if (amdgpu_device_has_dc_support(adev)) { + if (adev->dc_enabled) { adev->mode_info.abm_level_property = drm_property_create_range(adev_to_drm(adev), 0, "abm level", 0, 4); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 055e05b2cb22..3c01bb464248 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -2530,7 +2530,7 @@ static int amdgpu_runtime_idle_check_display(struct device *dev) if (ret) return ret; - if (amdgpu_device_has_dc_support(adev)) { + if (adev->dc_enabled) { struct drm_crtc *crtc; drm_for_each_crtc(crtc, drm_dev) { diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index f7fbc7932bb5..0d41a13c9019 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -4842,6 +4842,7 @@ static int dm_early_init(void *handle) adev_to_drm(adev)->dev, &dev_attr_s3_debug); #endif + adev->dc_enabled = true; return 0; } diff --git a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c index ab8ae7464664..9bf85ca607c3 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +++ b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c @@ -1567,7 +1567,7 @@ static void pp_pm_compute_clocks(void *handle) struct pp_hwmgr *hwmgr = handle; struct amdgpu_device *adev = hwmgr->adev; - if (!amdgpu_device_has_dc_support(adev)) { + if (!adev->dc_enabled) { amdgpu_dpm_get_active_displays(adev); adev->pm.pm_display_cfg.num_display = adev->pm.dpm.new_active_crtc_count; adev->pm.pm_display_cfg.vrefresh = amdgpu_dpm_get_vrefresh(adev); -- 2.53.0