Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2391767lqp; Sun, 24 Mar 2024 17:24:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWPQtB7DEtum3j4/O77Y4qLMwDpwj8iuiVUiCvUaz8VVWcd6OTkwjZtdWeRmf48tQ1nxLLh67GGXzesV3fkodEbwUJM1i3VAmz1xxWxZw== X-Google-Smtp-Source: AGHT+IEd4JR/d0WYorArjln7G7l6O9xVQv8hQe0xxEB2BeW7DG8tHF7tgEZYZFxi3XByup0Jc6Pd X-Received: by 2002:a05:6a00:9399:b0:6ea:9329:58bb with SMTP id ka25-20020a056a00939900b006ea932958bbmr7481720pfb.15.1711326259071; Sun, 24 Mar 2024 17:24:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711326259; cv=pass; d=google.com; s=arc-20160816; b=YZrDZoaOGO/yvVBQPPqS6dOOeA3JCDtRG/YEWkGAE1CrqeI+d2u9CXRgBMUNXxqys8 qCvHSFhvk8SYXBBJg3/mh+S+toYzo9E3sMltiWK9lUIyzBH2b7P993lL6vadSlwR+vnw O2cQPWcsMZZhcrlKqoHZn3jVtxwzkpj5mVMD72nC+0wP+E5sTMc2PNpu9VhdugyNlEk/ Cdraes32GfSxjoemnn9XVHzZGDqsKODrmHTYrnpBr1GtblsXDClSS3nwm94HINQxlsHl Bd0cgwHgYsTJmeL9et8wLQ4FKpcpSWiF49pCgkyZU6AZy3+yBDtN5STfUxIBsIhCkx3T APrg== 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=WqrcaJlAZKCJL1e0eOQBm7EXPwQ3LJcyMw4SOg/F0Hw=; fh=EsWK2iPuTuPFEHKIE0LFv2HP816E3zwz6+sCEIrhs84=; b=eYOViQi8F7Y57xaGzuOFoNfEDkHEhsMlLcjUTa4UvYtIt31tlIPdcsqUJCE3fQ939U 1GxyFa8IOxMyMK0vyEkPIkJ/JcNg6s+e7CqrJKwUKRUx9+jYur5H2mosdxRwlVZRNFJk 8wgaUL4rQ4pZCRLsjof/FtYpzypcNxJTiAydsc0nf0aDpnrIuXtCADuZhVOtpCdSIjZ6 3C+3wixQfxbBUk2zwlQjKrEV7BBcJhwWNNX0W3qSEFP30sL1i0EWQ1FN8EClaFB2ccX/ sa3/snyD+EiJ9Gtzqgbt0j3GYGa4Diq+yynvafy/A4VFrX2tQOQqTKbi2W7ZhrrgprJ6 WVTw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BQmGjhFQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113387-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113387-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. [139.178.88.99]) by mx.google.com with ESMTPS id d188-20020a6336c5000000b005dc952f426asi6546517pga.850.2024.03.24.17.24.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:24:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113387-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BQmGjhFQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113387-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113387-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 B11452832D6 for ; Mon, 25 Mar 2024 00:24:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0604F1A1A59; Sun, 24 Mar 2024 22:43:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BQmGjhFQ" 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 12E576F069; Sun, 24 Mar 2024 22:43:09 +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=1711320189; cv=none; b=GHD0VRU9iwV7xb0mf1+EgodRTOCcwFhcO9EM1ca6pENig+heCQ/eRs1LbG+mJeskK1+1mEEc0SRtK9lugq0IImqtoWY8x4boq2Uq2BtY8RY9s6LRiJcHZevu42QGsm31TQCguA2Vp3Gtq3KKX6Ck/feZZfh2sr2zg3SkjtRske4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320189; c=relaxed/simple; bh=okEQuZP1sVnZKuW4XEr/n2UmKDYtlMnxJ+hncEvAIqQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UxeLuGoA3Bn/RiJ5KoQ/bsBkxE+HcxWdt3THERQeXqWAyLRDOvSK5U2mBIrbMitQNM4suiM3Bqff0uiO3a8dIeZL4IQkKGbBfNEqhzjPoA6ixqPdRXapSRxJw6EbJIzyFB6Di2+jmk5UvB2Hmu4hciC8gszQ8TvWLTBD+GkHun0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BQmGjhFQ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 238C3C43399; Sun, 24 Mar 2024 22:43:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320188; bh=okEQuZP1sVnZKuW4XEr/n2UmKDYtlMnxJ+hncEvAIqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BQmGjhFQJu85jlvisklh6j4fVZLtSUfqXWIiq5SPY+F72M08Xd2AuNZVib331iRRe UoLycUH30uoEgdGRs1zUAaTkrYN305ohBNj4ER+e0XpKW91avSRIqGBWplL4Q5EjVY D8F7zSn3xIe37aZF/CVzY25hLntaJUU9Fl3rA6y6tDKspOuwkop9kyvDTx2G4Dj5s1 n55fUWPwlcqKMyA4+6qvJUGC/H/0nW04WRA2SHaBLRp7R77U9RSfn02U8/CxiV18n7 CE3lVRZRwHRszeuU/Iv8MEtFwInSF0s01ooyi6fsU1naNYzhbRs84Cx/cHISRfFF8L 9pyqiMRW2+qXw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Asad Kamal , Lijo Lazar , Le Ma , Alex Deucher , Sasha Levin Subject: [PATCH 6.8 496/715] drm/amd/pm: Fix esm reg mask use to get pcie speed Date: Sun, 24 Mar 2024 18:31:15 -0400 Message-ID: <20240324223455.1342824-497-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-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 Content-Transfer-Encoding: 8bit From: Asad Kamal [ Upstream commit b485b899e5b8f83723833feca30a1a1e3df778df ] Fix mask used for esm ctrl register to get pcie link speed on smu_v11_0_3, smu_v13_0_2 & smu_v13_0_6 Fixes: 511a95552ec8 ("drm/amd/pm: Add SMU 13.0.6 support") Fixes: c05d1c401572 ("drm/amd/swsmu: add aldebaran smu13 ip support (v3)") Fixes: f1c378593153 ("drm/amd/powerplay: add Arcturus support for gpu metrics export") Signed-off-by: Asad Kamal Reviewed-by: Lijo Lazar Reviewed-by: Le Ma Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 4 ++-- drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 4 ++-- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c index bcad42534da46..1d96eb274d72d 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c @@ -2272,8 +2272,8 @@ static uint16_t arcturus_get_current_pcie_link_speed(struct smu_context *smu) /* TODO: confirm this on real target */ esm_ctrl = RREG32_PCIE(smnPCIE_ESM_CTRL); - if ((esm_ctrl >> 15) & 0x1FFFF) - return (uint16_t)(((esm_ctrl >> 8) & 0x3F) + 128); + if ((esm_ctrl >> 15) & 0x1) + return (uint16_t)(((esm_ctrl >> 8) & 0x7F) + 128); return smu_v11_0_get_current_pcie_link_speed(smu); } diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c index dd9bcbd630a1f..ca0d5a5b204ad 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c @@ -1682,8 +1682,8 @@ static int aldebaran_get_current_pcie_link_speed(struct smu_context *smu) /* TODO: confirm this on real target */ esm_ctrl = RREG32_PCIE(smnPCIE_ESM_CTRL); - if ((esm_ctrl >> 15) & 0x1FFFF) - return (((esm_ctrl >> 8) & 0x3F) + 128); + if ((esm_ctrl >> 15) & 0x1) + return (((esm_ctrl >> 8) & 0x7F) + 128); return smu_v13_0_get_current_pcie_link_speed(smu); } diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c index 7e1941cf17964..78491b04df108 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c @@ -2060,8 +2060,8 @@ static int smu_v13_0_6_get_current_pcie_link_speed(struct smu_context *smu) /* TODO: confirm this on real target */ esm_ctrl = RREG32_PCIE(smnPCIE_ESM_CTRL); - if ((esm_ctrl >> 15) & 0x1FFFF) - return (((esm_ctrl >> 8) & 0x3F) + 128); + if ((esm_ctrl >> 15) & 0x1) + return (((esm_ctrl >> 8) & 0x7F) + 128); speed_level = (RREG32_PCIE(smnPCIE_LC_SPEED_CNTL) & PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE_MASK) -- 2.43.0