Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2617898lqt; Mon, 22 Apr 2024 16:59:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVlt11e+goKpY3/s4UBHTtmzVzU81+QnTutrRGJli4VTd17tSyzbbnMIyzMQQuzk6lhVGTfZd5j1h27I71nDEvW3A1HJhMibupS5UzP0w== X-Google-Smtp-Source: AGHT+IF5SQveuCMjCr4u6IyCRgPFxTk6DQmWiIFhuzqhbffWuwruFH1FcpESaRw5GoTCbBnjEIC9 X-Received: by 2002:a17:90a:e60f:b0:2ac:3af6:915b with SMTP id j15-20020a17090ae60f00b002ac3af6915bmr1473400pjy.1.1713830340523; Mon, 22 Apr 2024 16:59:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713830340; cv=pass; d=google.com; s=arc-20160816; b=DAuuKpp9rvU/m5WDdqdjBGpCWD8b4YvX32C9FNafywwThLKLH6Xv7TZnjPgcENpl4z Ecg1SglMpoaV36W3bld6eBI4ewbw4TiioctgfAOcsgf2AaO5Pdpw+zuxt4WZ2nB92xeh B+acaWtzxpBv2A3EEPQMJaQ7Z+S7qixfUvQUFPzh44kQfN+3k0rprxqM01vp93YhS8D9 YITxniq0I63kovluGix1oXfSsgYj9N/ZGILAtlTguGALGqvdhGWdLjNtOURq/aJ4PstC 9fACJZqQ2jrMBWYsByYua1jrvoOWBHK8A9fFTuaPL2Zsf6u464MBW4hLZjaAvL/eBJ7J NNxw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=QL5rTF/CDW/AKKCleNioGyHGsj7WHriPgZlfS4BDd0s=; fh=/1ttgQCX0O6KhMzGX6FSMW9Fj03zUHweZUwpSClXd9o=; b=nkOVns0GCwXK/p4lbFTPv3Bku+Ps14i4je9etMWS4O7THV1ub3ATGvJScuS4DASeZg ggoTdBAXEFansl+P0a7J1bNpAh1LCqkq3CA+uLnh41CQk3sDq+EQPfPJmgVci+a6stUU lpHwudD90priO18KkgVf75AKK3dBgkv3SGGHSa9QfHFPwetHZAAMnenpV+s+eKXXwJI5 bQhDI+0HfJQwXjKiye0mLchP/yWOIIm40r9YDHE56zzKAhVQ7SiWIYd/CpX4qUuXP/ae xGQ1koXIvf+QD6o9WZjhK320G3EfLMeTCW2z7Fub2dBxIBSR36R+g/MO7StRe1xp6Io8 lb6g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FbZLotf0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-154234-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154234-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id j13-20020a17090a7e8d00b002a539f46c08si8626011pjl.39.2024.04.22.16.59.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 16:59:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-154234-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FbZLotf0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-154234-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154234-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4B1B928569F for ; Mon, 22 Apr 2024 23:57:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 862C51586F7; Mon, 22 Apr 2024 23:54:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FbZLotf0" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97FF7158218; Mon, 22 Apr 2024 23:54:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713830076; cv=none; b=ueK0oP5kEq3Gwd21rIQbNaxjiKYFIQoYfzAZ5YUMUUKyOOsumV9axGaSkCkyRw9fpPWC9XgAFTLuugtOxTGU+9EPFU5U50s1FrmgPzqJRbTZHJru6twpZWSnwlHDYgrs1w8vNjliSeHbTNxs5/BS+6uBHn/92OCWywLEf69hSdQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713830076; c=relaxed/simple; bh=s/cS+r5Skd0CLL3WqzoLK7BYfysJc2pEY9A2/bw6eTA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QSBBPxcVMaXMYVJeE0SjwD+63X+r/uLOsMv/36HvhVVYhQMwvezYGZTY917OPvA2dTfyyGXEcPMzvKMNrfoFAqagWue2uv9fJmwhzKxX0i6bwAkfnLqUcj59iVcrbVsHuYRh2Gjk/gLag3ImnC4yYBNLDFO7l4zPMUeVbvSMfF4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FbZLotf0; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4371DC113CC; Mon, 22 Apr 2024 23:54:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713830076; bh=s/cS+r5Skd0CLL3WqzoLK7BYfysJc2pEY9A2/bw6eTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FbZLotf0Tj1r1KtOKY1SnjznK7bWkdQ22WQ+JDK1BqYKDSukMuVdcQaGT8N1zDkmo bIy3ryR2J8M3SGK0RfnIg5laAPO3MnKI3K/KU5HI2wwwna26iFndMwOj4RqDCXVlVC tIWFCvyEbh3rEdF3jB7bv+joRn7Imdg+Ekze7iA9V87iFLd8I0iceiWG+wmGo3K0bz mQb5SWhHDEkn1Bw75rTgSj3tILbN6MbnRuTuhq0BvdRddSmfS5f3nXNFaJmlsitDe5 JQvU2/VGh6C9w1MkReuFjxZhv1psxCeQZnBxH0mVhTToApsPQPwDXzcTmhJ4LECvBo qIuZyOG5lYXMw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jacek Lawrynowicz , Jeffrey Hugo , Sasha Levin , stanislaw.gruszka@linux.intel.com, ogabbay@kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.8 17/43] accel/ivpu: Remove d3hot_after_power_off WA Date: Mon, 22 Apr 2024 19:14:03 -0400 Message-ID: <20240422231521.1592991-17-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240422231521.1592991-1-sashal@kernel.org> References: <20240422231521.1592991-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.8.7 Content-Transfer-Encoding: 8bit From: Jacek Lawrynowicz [ Upstream commit e3caadf1f9dfc9d62b5ffc3bd73ebac0c8f26b3f ] Always enter D3hot after entering D0i3 an all platforms. This minimizes power usage. Signed-off-by: Jacek Lawrynowicz Reviewed-by: Jeffrey Hugo Link: https://patchwork.freedesktop.org/patch/msgid/20240402104929.941186-3-jacek.lawrynowicz@linux.intel.com Signed-off-by: Sasha Levin --- drivers/accel/ivpu/ivpu_drv.c | 20 ++++++++++---------- drivers/accel/ivpu/ivpu_drv.h | 3 +-- drivers/accel/ivpu/ivpu_hw_37xx.c | 4 +--- drivers/accel/ivpu/ivpu_pm.c | 7 ++----- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c index b35c7aedca03e..bad1ccc81ad73 100644 --- a/drivers/accel/ivpu/ivpu_drv.c +++ b/drivers/accel/ivpu/ivpu_drv.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (C) 2020-2023 Intel Corporation + * Copyright (C) 2020-2024 Intel Corporation */ #include @@ -371,12 +371,15 @@ int ivpu_shutdown(struct ivpu_device *vdev) { int ret; - ivpu_prepare_for_reset(vdev); + /* Save PCI state before powering down as it sometimes gets corrupted if NPU hangs */ + pci_save_state(to_pci_dev(vdev->drm.dev)); ret = ivpu_hw_power_down(vdev); if (ret) ivpu_warn(vdev, "Failed to power down HW: %d\n", ret); + pci_set_power_state(to_pci_dev(vdev->drm.dev), PCI_D3hot); + return ret; } @@ -543,11 +546,11 @@ static int ivpu_dev_init(struct ivpu_device *vdev) /* Power up early so the rest of init code can access VPU registers */ ret = ivpu_hw_power_up(vdev); if (ret) - goto err_power_down; + goto err_shutdown; ret = ivpu_mmu_global_context_init(vdev); if (ret) - goto err_power_down; + goto err_shutdown; ret = ivpu_mmu_init(vdev); if (ret) @@ -584,10 +587,8 @@ static int ivpu_dev_init(struct ivpu_device *vdev) ivpu_mmu_reserved_context_fini(vdev); err_mmu_gctx_fini: ivpu_mmu_global_context_fini(vdev); -err_power_down: - ivpu_hw_power_down(vdev); - if (IVPU_WA(d3hot_after_power_off)) - pci_set_power_state(to_pci_dev(vdev->drm.dev), PCI_D3hot); +err_shutdown: + ivpu_shutdown(vdev); err_xa_destroy: xa_destroy(&vdev->submitted_jobs_xa); xa_destroy(&vdev->context_xa); @@ -610,9 +611,8 @@ static void ivpu_bo_unbind_all_user_contexts(struct ivpu_device *vdev) static void ivpu_dev_fini(struct ivpu_device *vdev) { ivpu_pm_disable(vdev); + ivpu_prepare_for_reset(vdev); ivpu_shutdown(vdev); - if (IVPU_WA(d3hot_after_power_off)) - pci_set_power_state(to_pci_dev(vdev->drm.dev), PCI_D3hot); ivpu_jobs_abort_all(vdev); ivpu_job_done_consumer_fini(vdev); diff --git a/drivers/accel/ivpu/ivpu_drv.h b/drivers/accel/ivpu/ivpu_drv.h index 069ace4adb2d1..e7a9e849940ea 100644 --- a/drivers/accel/ivpu/ivpu_drv.h +++ b/drivers/accel/ivpu/ivpu_drv.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (C) 2020-2023 Intel Corporation + * Copyright (C) 2020-2024 Intel Corporation */ #ifndef __IVPU_DRV_H__ @@ -87,7 +87,6 @@ struct ivpu_wa_table { bool punit_disabled; bool clear_runtime_mem; - bool d3hot_after_power_off; bool interrupt_clear_with_0; bool disable_clock_relinquish; bool disable_d0i3_msg; diff --git a/drivers/accel/ivpu/ivpu_hw_37xx.c b/drivers/accel/ivpu/ivpu_hw_37xx.c index 32bb772e03cf9..5e392b6823764 100644 --- a/drivers/accel/ivpu/ivpu_hw_37xx.c +++ b/drivers/accel/ivpu/ivpu_hw_37xx.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (C) 2020-2023 Intel Corporation + * Copyright (C) 2020-2024 Intel Corporation */ #include "ivpu_drv.h" @@ -75,7 +75,6 @@ static void ivpu_hw_wa_init(struct ivpu_device *vdev) { vdev->wa.punit_disabled = false; vdev->wa.clear_runtime_mem = false; - vdev->wa.d3hot_after_power_off = true; REGB_WR32(VPU_37XX_BUTTRESS_INTERRUPT_STAT, BUTTRESS_ALL_IRQ_MASK); if (REGB_RD32(VPU_37XX_BUTTRESS_INTERRUPT_STAT) == BUTTRESS_ALL_IRQ_MASK) { @@ -86,7 +85,6 @@ static void ivpu_hw_wa_init(struct ivpu_device *vdev) IVPU_PRINT_WA(punit_disabled); IVPU_PRINT_WA(clear_runtime_mem); - IVPU_PRINT_WA(d3hot_after_power_off); IVPU_PRINT_WA(interrupt_clear_with_0); } diff --git a/drivers/accel/ivpu/ivpu_pm.c b/drivers/accel/ivpu/ivpu_pm.c index a15d30d0943af..2d706cb29a5a5 100644 --- a/drivers/accel/ivpu/ivpu_pm.c +++ b/drivers/accel/ivpu/ivpu_pm.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (C) 2020-2023 Intel Corporation + * Copyright (C) 2020-2024 Intel Corporation */ #include @@ -58,15 +58,12 @@ static int ivpu_suspend(struct ivpu_device *vdev) { int ret; - /* Save PCI state before powering down as it sometimes gets corrupted if NPU hangs */ - pci_save_state(to_pci_dev(vdev->drm.dev)); + ivpu_prepare_for_reset(vdev); ret = ivpu_shutdown(vdev); if (ret) ivpu_err(vdev, "Failed to shutdown VPU: %d\n", ret); - pci_set_power_state(to_pci_dev(vdev->drm.dev), PCI_D3hot); - return ret; } -- 2.43.0