Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp372759pxb; Fri, 22 Apr 2022 02:52:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFV8CukoQ1dR3kN7P7KADPziOgj0uiXx8IxrtxJ7JLvsgkJi/afCZW0z7UTKHpqg3Ve94a X-Received: by 2002:a17:902:748b:b0:15c:3d1b:8a4d with SMTP id h11-20020a170902748b00b0015c3d1b8a4dmr1553169pll.85.1650621168376; Fri, 22 Apr 2022 02:52:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650621168; cv=none; d=google.com; s=arc-20160816; b=QPTy4cjdhr/c3itJTWsD1yfynkUOgp9XsWk2P4cnRr8JTlgR4NnZ0cpaUwMKQ2dn3n feT2HoNU/5cM437NJFSittDNNf4pjMBTwOKmhUZPU2eBo6W1j4cXUe2sh0tzzfNFVX/e AiD0qucvDuC66oE+gxA8WfPB/RzVHKwUh6ppuHLb0b3svCjKgbG+SY8vYi0IBB/Uvs5u G9t5PA7b3Ho84XAr5Wt83JWajbUcvHyPfn2OrQauQq4/W5BZhrv9SsvWytKqnl79gqgm 4X+JBW4P8aRytRNu8qQm6k+raxba9E4uAaYpKyXR3yae2NXol8bxtEVxO/durjo6MZ3C yNLg== 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=xltaxvcWMtZVErFdUNWw2Z0qlRBx+K9LAluwEC9a5m8=; b=iG3+nZVkrHSgIKwtd/ClgMt4THOSsDGej7Y3i6t+SR8VczSo4xbQSIQU4xZ9rxToyZ AwS3IZhuiw+yf/6863fa5ob2AsAT6dztlRSGyIFw92dH+D2hrfpe4VGaF/jVgb1DaOiT Fh13eGriw8Df5l+P/WfjD0lcw8/qCtU6DW1DNFhFn6ulrt2AUHP9MmAz3q33UuIS7DSu sIwGgPTnEX6c/6nvf6I0+Md96xpIqqF/GCbuIQTW5YDiXieqOfmp5WN7PEAXButlm505 I7aYv8KU+YlxaAfwQIJPDoXfQKeruX6j1U1mhC6TEauxrNb7P/e7Gc0viTO+yyirxjkh z1vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=inXO2O38; 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 f66-20020a636a45000000b003a668d66218si7202455pgc.510.2022.04.22.02.52.32; Fri, 22 Apr 2022 02:52:48 -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=inXO2O38; 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 S238161AbiDRMVT (ORCPT + 99 others); Mon, 18 Apr 2022 08:21:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238391AbiDRMUu (ORCPT ); Mon, 18 Apr 2022 08:20:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E53C81A066; Mon, 18 Apr 2022 05:17: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 dfw.source.kernel.org (Postfix) with ESMTPS id 8020860EDF; Mon, 18 Apr 2022 12:17:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A4F6C385A1; Mon, 18 Apr 2022 12:17:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650284223; bh=0mGRXubScxlPMVJ0gUmaxSC28zNamm6DAykf27O5S2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=inXO2O38NXyYSWJb2xxw4Gr+xKmGtJu9qZf/U5LRkUaUh6PrByyI19aOzFoN6qrVk XOdu00oeygXYVc9h0Rfj1ZXgxcM3PW6y9yG4m4qQ7P0agI4swLJPrF2BTYLxTxjSUQ nKL/Vt4Ii/zWNPbAcxid5+0Grl29hH3ev/G+YiIQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai-Heng Feng , Alex Deucher Subject: [PATCH 5.17 013/219] drm/amdgpu: Ensure HDA function is suspended before ASIC reset Date: Mon, 18 Apr 2022 14:09:42 +0200 Message-Id: <20220418121203.852515758@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121203.462784814@linuxfoundation.org> References: <20220418121203.462784814@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: Kai-Heng Feng commit 887f75cfd0da44c19dda93b2ff9e70ca8792cdc1 upstream. DP/HDMI audio on AMD PRO VII stops working after S3: [ 149.450391] amdgpu 0000:63:00.0: amdgpu: MODE1 reset [ 149.450395] amdgpu 0000:63:00.0: amdgpu: GPU mode1 reset [ 149.450494] amdgpu 0000:63:00.0: amdgpu: GPU psp mode1 reset [ 149.983693] snd_hda_intel 0000:63:00.1: refused to change power state from D0 to D3hot [ 150.003439] amdgpu 0000:63:00.0: refused to change power state from D0 to D3hot ... [ 155.432975] snd_hda_intel 0000:63:00.1: CORB reset timeout#2, CORBRP = 65535 The offending commit is daf8de0874ab5b ("drm/amdgpu: always reset the asic in suspend (v2)"). Commit 34452ac3038a7 ("drm/amdgpu: don't use BACO for reset in S3 ") doesn't help, so the issue is something different. Assuming that to make HDA resume to D0 fully realized, it needs to be successfully put to D3 first. And this guesswork proves working, by moving amdgpu_asic_reset() to noirq callback, so it's called after HDA function is in D3. Fixes: daf8de0874ab5b ("drm/amdgpu: always reset the asic in suspend (v2)") Signed-off-by: Kai-Heng Feng Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -2276,18 +2276,23 @@ static int amdgpu_pmops_suspend(struct d { struct drm_device *drm_dev = dev_get_drvdata(dev); struct amdgpu_device *adev = drm_to_adev(drm_dev); - int r; if (amdgpu_acpi_is_s0ix_active(adev)) adev->in_s0ix = true; else adev->in_s3 = true; - r = amdgpu_device_suspend(drm_dev, true); - if (r) - return r; + return amdgpu_device_suspend(drm_dev, true); +} + +static int amdgpu_pmops_suspend_noirq(struct device *dev) +{ + struct drm_device *drm_dev = dev_get_drvdata(dev); + struct amdgpu_device *adev = drm_to_adev(drm_dev); + if (!adev->in_s0ix) - r = amdgpu_asic_reset(adev); - return r; + return amdgpu_asic_reset(adev); + + return 0; } static int amdgpu_pmops_resume(struct device *dev) @@ -2528,6 +2533,7 @@ static const struct dev_pm_ops amdgpu_pm .prepare = amdgpu_pmops_prepare, .complete = amdgpu_pmops_complete, .suspend = amdgpu_pmops_suspend, + .suspend_noirq = amdgpu_pmops_suspend_noirq, .resume = amdgpu_pmops_resume, .freeze = amdgpu_pmops_freeze, .thaw = amdgpu_pmops_thaw,