Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp652349pxv; Thu, 15 Jul 2021 12:31:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6BFJrOMHVrRkzzXHqFh9PXg7NIB3yzq79JCHZoiWE7vbXTL+BMtU8ftZOitndgEZChLVq X-Received: by 2002:a17:906:60d3:: with SMTP id f19mr7374571ejk.413.1626377511009; Thu, 15 Jul 2021 12:31:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626377511; cv=none; d=google.com; s=arc-20160816; b=aKy8VYjyC66fD+cxUPNInAvc8s8JRyTxmTpZYRcCgE8AxnFopAvP36K7cQp4/eMmAH 7MO9lSDJxELXmB4ivRMiNYXSR1m46GycRLCErNpaP43/H9L6t0lBzx7M2M3YoFjv0Qzd QPEmoNQIyKq1yyZdn54KgA5gvxkWihAClhYmdaQywmyz2BB8O03PPABumXvoLzcV8AsH 8XQWR+JmUgSjBVlWssIPH8THRg1C8HJwfFkQPZ/qMopgpCqqqicubC5Xfc+yWjbF9sAN kKTSC8zAufz7YxuEO3MqdP6oKkT0W6fSt6qgwLan/NmMLtjaPq4zbmNm32MlPOB63w+y rA3A== 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=uu9aDPvAkCilWmeZDBLJgyjsP6lWjVvdChs/kyLLRFo=; b=s2F+MzB5vdVfBeNoXasU8/DZBn1eHOB4s5Qpo5oTmo89R/Oepeaj3bUZ2GYNChQgPu IjhIk5biQyd4csxOPhew1C9HpnP/fwCbLx7OYu+6GQ/1Cts5ivcbA3Vtx01CX1JdEVWW T3q5B396584xeXUEzFm+JnIxt+Ej7owVIbnOAVtK5tGyoghedG93pHIF3wdZ2rjxLzNv bVh3LIwjagVnPsNVfUq4qmMrxgaiqlB+i452D62tPNDqZhVDYtKusBXHlux8rUPitquC ZN5AdCP0gWDYr7mZ/7HGURlr5fee2JabHEUP1AjbmIXwXBP+uNKvrIySHTLeNV04zOv/ BH4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SCnsIs+N; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y20si8092807edv.174.2021.07.15.12.31.28; Thu, 15 Jul 2021 12:31:50 -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=@linuxfoundation.org header.s=korg header.b=SCnsIs+N; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245620AbhGOTcA (ORCPT + 99 others); Thu, 15 Jul 2021 15:32:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:46340 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243827AbhGOTKI (ORCPT ); Thu, 15 Jul 2021 15:10:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 07B04613DF; Thu, 15 Jul 2021 19:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626376005; bh=XG2alfW7p0og5n94F1WMOp1RHZFRNXwJcmw3c7IxHrQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SCnsIs+Nt+B620o0iXu7Q4afSyB6BxbQ/tbs5/8ye4T4IWRiQyMtNeDymfd++b46p UUGIG+/VKD7Ep6n8x5qliLFnSaNnI7DBECi6rZZjySLYrCQ3yakBg/MJFj03VpU0M4 9xLmjNcht9XMcsRAppHCWAsozvF+1zQHpRjMCjMU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wesley Chalmers , Dmytro Laktyushkin , Stylon Wang , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.13 087/266] drm/amd/display: Fix off-by-one error in DML Date: Thu, 15 Jul 2021 20:37:22 +0200 Message-Id: <20210715182629.584732698@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wesley Chalmers [ Upstream commit e4e3678260e9734f6f41b4325aac0b171833a618 ] [WHY] For DCN30 and later, there is no data in DML arrays indexed by state at index num_states. Signed-off-by: Wesley Chalmers Reviewed-by: Dmytro Laktyushkin Acked-by: Stylon Wang Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../amd/display/dc/dml/dcn30/display_mode_vba_30.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c index af7d57602b2c..db6bb7ea5316 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c @@ -2053,7 +2053,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman v->DISPCLKWithoutRamping, v->DISPCLKDPPCLKVCOSpeed); v->MaxDispclkRoundedToDFSGranularity = RoundToDFSGranularityDown( - v->soc.clock_limits[mode_lib->soc.num_states].dispclk_mhz, + v->soc.clock_limits[mode_lib->soc.num_states - 1].dispclk_mhz, v->DISPCLKDPPCLKVCOSpeed); if (v->DISPCLKWithoutRampingRoundedToDFSGranularity > v->MaxDispclkRoundedToDFSGranularity) { @@ -3958,20 +3958,20 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) { v->PlaneRequiredDISPCLKWithoutODMCombine = v->PixelClock[k] * (1.0 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0) * (1.0 + v->DISPCLKRampingMargin / 100.0); - if ((v->PlaneRequiredDISPCLKWithoutODMCombine >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states] - && v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states])) { + if ((v->PlaneRequiredDISPCLKWithoutODMCombine >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states - 1] + && v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states - 1])) { v->PlaneRequiredDISPCLKWithoutODMCombine = v->PixelClock[k] * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0); } v->PlaneRequiredDISPCLKWithODMCombine2To1 = v->PixelClock[k] / 2 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0) * (1 + v->DISPCLKRampingMargin / 100.0); - if ((v->PlaneRequiredDISPCLKWithODMCombine2To1 >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states] - && v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states])) { + if ((v->PlaneRequiredDISPCLKWithODMCombine2To1 >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states - 1] + && v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states - 1])) { v->PlaneRequiredDISPCLKWithODMCombine2To1 = v->PixelClock[k] / 2 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0); } v->PlaneRequiredDISPCLKWithODMCombine4To1 = v->PixelClock[k] / 4 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0) * (1 + v->DISPCLKRampingMargin / 100.0); - if ((v->PlaneRequiredDISPCLKWithODMCombine4To1 >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states] - && v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states])) { + if ((v->PlaneRequiredDISPCLKWithODMCombine4To1 >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states - 1] + && v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states - 1])) { v->PlaneRequiredDISPCLKWithODMCombine4To1 = v->PixelClock[k] / 4 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0); } -- 2.30.2