Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp854595pxk; Thu, 17 Sep 2020 19:11:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsgrt/tidli3InI7IELXPlSY9PpbAkdnFZ4W7ZZs2tyUV9H5Xq10VfqTnpqtVJEP/K4sWe X-Received: by 2002:a05:6402:45a:: with SMTP id p26mr38185503edw.8.1600395070665; Thu, 17 Sep 2020 19:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600395070; cv=none; d=google.com; s=arc-20160816; b=nQ+jlwnLUD/3FqS0TiWdyWDDH7O/QPj/tyW288mPxQ3VCVR3MM+5zkKj4Dx6B5LAGc VRxZVGftOI0eTeJ6rO2WxvJlEF7k1p1nbzIbSszdLGRh3gSnspOksdQqjWHeldm9wzdi dg8+JWSSYTrZmbBJpHR72lAzvbYLYqeCfLEsF9IQHGC0bGIJFLii8XhgU1Qy7E7njCEb geKsPOKamb1hUa/PJ7rwPf79397542ejKl61ARGkMymBSGL+cr8DXdFIo/GoL9GpUf4B bg8uiX24nqTXz17hAFFk/Egqn+rgtLSSiUgAK+oS3ad6MOpKmPUMLmczv7rwRmqF3qwx nUhA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ba4YfePLB+Ihw0+huLoJAGO4XRLB+WiO/sd4ngGvJ/A=; b=FS9mLYH4yp1JWsJoi4TJPmLnxAXlQ/MC3QWzVnIJwb4m1zYgPiVuTiqckKefP+Pdxu jkZOlHbfkHlyQtoXhp7Lm8mNHP03nSJPDAMbWIbHC52ki+D4RI1t99hd928ehJM+C5rZ j07Ev0LRuYrarQbyQbW9+QT+Wot3vYlgRT97FgyzDULUeJ4KPgrER84XLJWXRHRolhY9 PWJNTh4SWRCYbFhz0JLn0QD9izI6ABYxXdCrR7440G8pFIWBQnjNAwpvgVaGjgIEsX5i /rssAgsGvui+83MHFCmpQbyam9g7NFsO5u41nkvqcbFV1km1xX7+SpP+oC+AV4RagDkA avyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tbY0crE8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p2si1199167ejf.310.2020.09.17.19.10.47; Thu, 17 Sep 2020 19:11:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tbY0crE8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726326AbgIRCGm (ORCPT + 99 others); Thu, 17 Sep 2020 22:06:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:56036 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726205AbgIRCGg (ORCPT ); Thu, 17 Sep 2020 22:06:36 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2BCFD23770; Fri, 18 Sep 2020 02:06:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394795; bh=ffDT/WKFTgV67vs+6P5VHGIfYyVvsSViiPmyQrIFwe0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tbY0crE8KOFG/32kJXkzQyL1R8WNS+Q/niwTxJpKAxaWGHJ5gDm1fLNSdOfsrm+2u pH/wmDPj5/sEQGd5PqMYwIAhXLxLx9nxzUHOUl0YFIZCsZnDq0tucZdiifFd9Pc1un xC82E5N/MT29JsVD1V6G7hGLr3dEdeuCuhRPuNAQ= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Evan Quan , Alex Deucher , Sasha Levin , dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.4 265/330] drm/amd/powerplay: try to do a graceful shutdown on SW CTF Date: Thu, 17 Sep 2020 22:00:05 -0400 Message-Id: <20200918020110.2063155-265-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Evan Quan [ Upstream commit 9495220577416632675959caf122e968469ffd16 ] Normally this(SW CTF) should not happen. And by doing graceful shutdown we can prevent further damage. Signed-off-by: Evan Quan Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../gpu/drm/amd/powerplay/hwmgr/smu_helper.c | 21 +++++++++++++++---- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 7 +++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c index d09690fca4520..414added3d02c 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c @@ -22,6 +22,7 @@ */ #include +#include #include "hwmgr.h" #include "pp_debug.h" @@ -593,12 +594,18 @@ int phm_irq_process(struct amdgpu_device *adev, uint32_t src_id = entry->src_id; if (client_id == AMDGPU_IRQ_CLIENTID_LEGACY) { - if (src_id == VISLANDS30_IV_SRCID_CG_TSS_THERMAL_LOW_TO_HIGH) + if (src_id == VISLANDS30_IV_SRCID_CG_TSS_THERMAL_LOW_TO_HIGH) { pr_warn("GPU over temperature range detected on PCIe %d:%d.%d!\n", PCI_BUS_NUM(adev->pdev->devfn), PCI_SLOT(adev->pdev->devfn), PCI_FUNC(adev->pdev->devfn)); - else if (src_id == VISLANDS30_IV_SRCID_CG_TSS_THERMAL_HIGH_TO_LOW) + /* + * SW CTF just occurred. + * Try to do a graceful shutdown to prevent further damage. + */ + dev_emerg(adev->dev, "System is going to shutdown due to SW CTF!\n"); + orderly_poweroff(true); + } else if (src_id == VISLANDS30_IV_SRCID_CG_TSS_THERMAL_HIGH_TO_LOW) pr_warn("GPU under temperature range detected on PCIe %d:%d.%d!\n", PCI_BUS_NUM(adev->pdev->devfn), PCI_SLOT(adev->pdev->devfn), @@ -609,12 +616,18 @@ int phm_irq_process(struct amdgpu_device *adev, PCI_SLOT(adev->pdev->devfn), PCI_FUNC(adev->pdev->devfn)); } else if (client_id == SOC15_IH_CLIENTID_THM) { - if (src_id == 0) + if (src_id == 0) { pr_warn("GPU over temperature range detected on PCIe %d:%d.%d!\n", PCI_BUS_NUM(adev->pdev->devfn), PCI_SLOT(adev->pdev->devfn), PCI_FUNC(adev->pdev->devfn)); - else + /* + * SW CTF just occurred. + * Try to do a graceful shutdown to prevent further damage. + */ + dev_emerg(adev->dev, "System is going to shutdown due to SW CTF!\n"); + orderly_poweroff(true); + } else pr_warn("GPU under temperature range detected on PCIe %d:%d.%d!\n", PCI_BUS_NUM(adev->pdev->devfn), PCI_SLOT(adev->pdev->devfn), diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c index c4d8c52c6b9ca..6c4405622c9bb 100644 --- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c +++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "pp_debug.h" #include "amdgpu.h" @@ -1538,6 +1539,12 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev, PCI_BUS_NUM(adev->pdev->devfn), PCI_SLOT(adev->pdev->devfn), PCI_FUNC(adev->pdev->devfn)); + /* + * SW CTF just occurred. + * Try to do a graceful shutdown to prevent further damage. + */ + dev_emerg(adev->dev, "System is going to shutdown due to SW CTF!\n"); + orderly_poweroff(true); break; case THM_11_0__SRCID__THM_DIG_THERM_H2L: pr_warn("GPU under temperature range detected on PCIe %d:%d.%d!\n", -- 2.25.1