Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6146201iog; Thu, 23 Jun 2022 12:17:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tY/Hd9azE8UJRY3W3GcZDok/6J4tsO6uVpajqc+NZtLMVK6dBpQR9wb2z07LG1kt/6bGQp X-Received: by 2002:a17:902:ef4c:b0:16a:1e2b:e96 with SMTP id e12-20020a170902ef4c00b0016a1e2b0e96mr23881210plx.27.1656011872628; Thu, 23 Jun 2022 12:17:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656011872; cv=none; d=google.com; s=arc-20160816; b=kQq8+qeKxUg4Eo814h4zIud87oWcfZxFjZPX+GDAJ1Ej/XEKSM4XT3beR6bCNDoDtf 3fwqS6DJcCf5E1gRwlqqzetzuOr2GryhvaRCWp0u7EXcsBCoqVoYzCNEgNRGwnYtcW1A +pbGBKzSeFp9GCBx98GFeRrNOur4Fpk2fh59vhZcsLD6Pn99PeLtAtLEdB3ugr2PkLTD TFMKKZjmhWYHY2NcIyC3ohmMaOz3abnuKhD7c2MrLPvrAGnkCPtxnHlT4G+wRmf8esh0 0wSbQK9H5DJYFbXM3NNSJM/loQuXQM+ap+IlojJuGlJT9E0LXy+VR8qABDhD0zAC75+i d6cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xNwMFUoBLr+Mht9d2/HQdwyM8sLGTOf0HcEPkzGstO4=; b=R298w3+EEDG5u+7O4/xjBOm6Q/m7lOvYjOgx6XPQtbFHOAH01sofFDX3U0E6eRhjGh UD+N9Wp03sYxXienArixc0hIgmk5h7U2p5NCv6g/41hG9iMgbOzHGkYgQPOjN/+t2xpa r0e3girfk2QWBrNeXDmE4m3citVQuvdrlW87wriWjo80/hypCUcUb7P/p//R8+eZfWtH nf7YpUnvaunpYuUm7lfrlzeS2+nuihHHPUjwYgtj0SFK4IAdC2k/4GhnXiaiarvQt6g7 5+KrOAhYhBPL6xaTgG6kwuyLOx1ifRlYotUPlgyc6kAOPomhgfdoYyZMTsUC5Ox1xnx3 v/FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pq7BfSUo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t6-20020a170902e84600b00153b640ed90si472435plg.38.2022.06.23.12.17.41; Thu, 23 Jun 2022 12:17:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pq7BfSUo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235243AbiFWRvI (ORCPT + 99 others); Thu, 23 Jun 2022 13:51:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235245AbiFWRuD (ORCPT ); Thu, 23 Jun 2022 13:50:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28B9DA4E25; Thu, 23 Jun 2022 10:12:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E37C8B82490; Thu, 23 Jun 2022 17:12:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52C48C3411B; Thu, 23 Jun 2022 17:11:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656004319; bh=ZPveG1qtBko62rmc1Q9DuVC9fq5IAG68KyUJL+S6yus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pq7BfSUo17LyZUkdMd0KglTea7bNn4sNrcdDne0N1A8y1vme/fzJhXIp9isdlpish eIUZsvwZxt6ucf1AFF/OwaBffs/C9ISlKnVqodULkSsodNHDQnj2ws5ZlAeBdiXWpY XRVci1UbFWNuKG4s0ZIWlk0eldN6khp9fOFcfeuA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Wheeler , Mikita Lipski , Rodrigo Siqueira , Nicholas Kazlauskas , Alex Deucher , "Limonciello, Mario" Subject: [PATCH 5.15 2/9] drm/amd/display: Dont reinitialize DMCUB on s0ix resume Date: Thu, 23 Jun 2022 18:44:45 +0200 Message-Id: <20220623164322.363030419@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164322.288837280@linuxfoundation.org> References: <20220623164322.288837280@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Nicholas Kazlauskas commit 79d6b9351f086e0f914a26915d96ab52286ec46c upstream. [Why] PSP will suspend and resume DMCUB. Driver should just wait for DMCUB to finish the auto load before continuining instead of placing it into reset, wiping its firmware state and reinitializing. If we don't let DMCUB fully finish initializing for S0ix then some state will be lost and screen corruption can occur due to incorrect address translation. [How] Use dmub_srv callbacks to determine in DMCUB is running and wait for auto-load to complete before continuining. In S0ix DMCUB will be running and DAL fw so initialize will skip. In S3 DMCUB will not be running and we will do a full hardware init. In S3 DMCUB will be running but will not be DAL fw so we will also do a full hardware init. Tested-by: Daniel Wheeler Reviewed-by: Mikita Lipski Acked-by: Rodrigo Siqueira Signed-off-by: Nicholas Kazlauskas Signed-off-by: Alex Deucher Cc: "Limonciello, Mario" Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 30 +++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -989,6 +989,32 @@ static int dm_dmub_hw_init(struct amdgpu return 0; } +static void dm_dmub_hw_resume(struct amdgpu_device *adev) +{ + struct dmub_srv *dmub_srv = adev->dm.dmub_srv; + enum dmub_status status; + bool init; + + if (!dmub_srv) { + /* DMUB isn't supported on the ASIC. */ + return; + } + + status = dmub_srv_is_hw_init(dmub_srv, &init); + if (status != DMUB_STATUS_OK) + DRM_WARN("DMUB hardware init check failed: %d\n", status); + + if (status == DMUB_STATUS_OK && init) { + /* Wait for firmware load to finish. */ + status = dmub_srv_wait_for_auto_load(dmub_srv, 100000); + if (status != DMUB_STATUS_OK) + DRM_WARN("Wait for DMUB auto-load failed: %d\n", status); + } else { + /* Perform the full hardware initialization. */ + dm_dmub_hw_init(adev); + } +} + #if defined(CONFIG_DRM_AMD_DC_DCN) static void mmhub_read_system_context(struct amdgpu_device *adev, struct dc_phy_addr_space_config *pa_config) { @@ -2268,9 +2294,7 @@ static int dm_resume(void *handle) amdgpu_dm_outbox_init(adev); /* Before powering on DC we need to re-initialize DMUB. */ - r = dm_dmub_hw_init(adev); - if (r) - DRM_ERROR("DMUB interface failed to initialize: status=%d\n", r); + dm_dmub_hw_resume(adev); /* power on hardware */ dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D0);