Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp72790pxh; Thu, 7 Apr 2022 14:21:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBrxTHL9EXWuzaa8KmvqoljkqKCxtqM3b+KmXSmsHQmWt734z9m1nybiZ+MicAAqhLKrRQ X-Received: by 2002:a17:90a:f48b:b0:1cb:2780:62a8 with SMTP id bx11-20020a17090af48b00b001cb278062a8mr3535282pjb.138.1649366476949; Thu, 07 Apr 2022 14:21:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649366476; cv=none; d=google.com; s=arc-20160816; b=jMgcsuzhjxNRVF/t5yI+1Afwwh+IRxyfuqTKWBCv8cuiuzIBx9Ja2HL8iWRXdFEaWA zmnJQq1pRmxx+TjoX95T810Dx8RbF7ESG9+J/PruRdOS/yRUxlqiSQWfg+7KEUeSz/JV tIgvR3fOUZ36rIl02uiNpkv+eFDjs+yx2SQ0MTSMVRzt2PfAg9w54VR5syo8oKBPSykh gowFhPFqgx3vL3JEQNH2WQcUEJl3nybzCvEKEsuoJfhmq28EWTpf98xoAdXmiEfT4Z/H QU8IKmkA3u5RkFMqqZZ1/n6TNn+eqFKElSmBh6K0yxAKBB4qJ8JIRSKU8JQVW5opcVGV Nmgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=JqDkTinK10x3zeolGbydLx/yEZJP4ImSGKmYcvP6lVQ=; b=RWLNC3b9By57NU8Z7I+0Ji/2mUycmCTfVSDB/fnxxu7nsNaX+W52Pv7jmeKoS0tw51 kzwE57xw/JD9bCksP4AjLKA4J1gGdweX4VelD9N0NDjn0n1SbYPLe8RLoREONezbbzlD Wm3AG31bgqZDXAacT/AizzHI7HAmhiFeRFgrn+hpSPmaPnBNjaGkOCxZfX/QJ2vwMSm9 dYTeFEdljll0uP2nPFZDigCVUBkZLdBRx7H+40UXevW0Y6SB6q2klJmQrML4wB+PNteW blQegNt02OAoThqdwcbyiTYbdmHzKNrtMK9hz3xbTrLekASQkZ32G8/BpJxDA7M9ek90 2dvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Cy0VXhmn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g1-20020a631101000000b00399f81e320esi6978380pgl.620.2022.04.07.14.21.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 14:21:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Cy0VXhmn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EAA7A2B3D5F; Thu, 7 Apr 2022 13:12:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345948AbiDGRKV (ORCPT + 99 others); Thu, 7 Apr 2022 13:10:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239064AbiDGRKT (ORCPT ); Thu, 7 Apr 2022 13:10:19 -0400 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE1A82CE03 for ; Thu, 7 Apr 2022 10:08:18 -0700 (PDT) Received: by mail-oi1-x231.google.com with SMTP id z8so6294247oix.3 for ; Thu, 07 Apr 2022 10:08:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JqDkTinK10x3zeolGbydLx/yEZJP4ImSGKmYcvP6lVQ=; b=Cy0VXhmnAEqP0lRJ0KQuwUy715TtVttVKnb19XsHu+WELC6cFz4o3We4LkuxtsJYIR Di3N1+8prGyIRhYxREa/bbeMsylUltqSC4+WRA7TqQv1qm8UCzeUwGYDYmw8YKHJEf9Z 04x1BYmO7f/FAI3j/O9jTgK0tyiQxdbUurLzX3Ymyxm03m1bvBllSiZgGdEfD0Ryrsyp MJHwx0eF5rHTH+brtzbUTyGdYEzq6lvEIZFtsiFGfXDAxewiOFiWrlfPMkot2B56Cw90 VaHAdRR1AQW3Qw4Ny+MBKI+761GiyxeWIsLhSVsmJLnE+7ZA6n4Q1XYWaV6p6NxlA8jp e2kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JqDkTinK10x3zeolGbydLx/yEZJP4ImSGKmYcvP6lVQ=; b=bXfcXmAHz9oGEhBa1keApm9gofymwqsTg+QLEfq7lzdrPhHmdqcUkMvObRU5IfAX+x e+H7ZI+cnzSnmXVqZsuOpJaKKhF1XnsDO7kUHHAa0CeWUMCS2YFWZnHzr7oQKknmORma LRGcmm34HUWDbPKZwxWcbC8zkyOl1jn/cBDKoltu1Bh1+o1bL64uIxJwwzuE+bVU1cHQ 6rHWdvrIoWyppZCIorjfY3SyMPgEXzdDYI0Rq+4J7C25vZ3VTgMsJ4mVs2tSdtkOioop +iKACDqFWtqUTKF0y7tZuinasqX1ESvAPAgRYun2ppNqOh+DTH8vNaL7uqnV4EYzWEKd 1qlQ== X-Gm-Message-State: AOAM533C47rnP/HZNiVbT2e5dyPGk24YQU9zu/h5cwA4F6CkaDHV4hOL 67HZKHYRYyO4kxauOYSlqDDUoGH9abmN8USIYEZIsDM/FNw= X-Received: by 2002:aca:6006:0:b0:2f9:c685:f4e2 with SMTP id u6-20020aca6006000000b002f9c685f4e2mr446739oib.200.1649351298327; Thu, 07 Apr 2022 10:08:18 -0700 (PDT) MIME-Version: 1.0 References: <20220407121230.132627-1-kai.heng.feng@canonical.com> In-Reply-To: <20220407121230.132627-1-kai.heng.feng@canonical.com> From: Alex Deucher Date: Thu, 7 Apr 2022 13:08:07 -0400 Message-ID: Subject: Re: [PATCH] drm/amdgpu: Ensure HDA function is suspended before ASIC reset To: Kai-Heng Feng Cc: "Deucher, Alexander" , Christian Koenig , xinhui pan , David Airlie , Maling list - DRI developers , LKML , amd-gfx list , Solomon Chiu , Mario Limonciello , Evan Quan , Luben Tuikov Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Thu, Apr 7, 2022 at 8:21 AM Kai-Heng Feng wrote: > > 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 As an aside, shouldn't device links order this properly already? I thought that was the whole point of them. We have quirks in PCI quirks.c to create device links for all GPU integrated peripherals (audio, usb, ucsi). Alex > > 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 > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 18 ++++++++++++------ > 1 file changed, 12 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > index bb1c025d90019..31f7229e7ea89 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > @@ -2323,18 +2323,23 @@ static int amdgpu_pmops_suspend(struct device *dev) > { > 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) > @@ -2575,6 +2580,7 @@ static const struct dev_pm_ops amdgpu_pm_ops = { > .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, > -- > 2.34.1 >