Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp626954pxv; Thu, 15 Jul 2021 11:54:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVfown1hCUB5vqL5ftJl2Bpr9sh/fF0n6FGf2cCvYhrFp8a7rZsevDgY1T2jTuXarzdWyh X-Received: by 2002:a92:8750:: with SMTP id d16mr3671101ilm.281.1626375248524; Thu, 15 Jul 2021 11:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626375248; cv=none; d=google.com; s=arc-20160816; b=mk9Fya/NUeEZSDg6CZKCKoCo+MsELKC8IXRcRiPkr4m55X3C54/Fw77gB7T/zIrAaO htWm5kcxC1d8tT4MNG3APf/Arl9EaBOKE58qP6pVWzyCu4rCL3l7caTS84fQwpL0ot6b QT3YZ0eFYSCswFOavQsx+Ug+cAewsl7lQLOEIYmn3eruTeQQyG7QY9RSyr9OHU+sbW73 Dz/WQU2nx3SGzD67W7F1fq1yByWX/S5yZ1s1DDhmE3ybdJPJt72CldLcJEjHZq4j0uhd KYDX9UwnAs6nMNftwxu7wq9m4NREH7rElpoeMZJQEIoTzCMTyE1MNGtu2svXGtXZHjG9 iTBA== 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=+WaCfVeQDhIhr1DCzh4uib4pAtXSiw3LePoglG2dvMQ=; b=J1tuts/yXsB367hkFP5Z4dCO0SMFCtUfgQ+ENnQCe/CDbvEs6GckJ0MpWnLUgwI0hM QxzpwArmSeIIMPy7TCNloAfzs7845/gHWnbn48Cax0sWQHdGXZ+zLMemiicWJeAEabkP J4jndGNrDNe2A+T7+Ve2XyEZOwrievpUFsuj09EI+YT1aeGGz8os/ICckMDD2IgC8GNB P9xmxFVhXuhV25qyHEpPxRdJXNxFcSp4fiMLH/HfV1zLUVht44yqQebUarBT7ppn85mf Pw54AJ2ZeYdNvEXJQNry6FCAyMeIWZyvtMZpbutgWYoqrgRgGhMKWmoBQbbNuVhlo2A/ lGFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zAVeNBBA; 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 y15si6482080ilv.136.2021.07.15.11.53.55; Thu, 15 Jul 2021 11:54:08 -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=zAVeNBBA; 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 S239660AbhGOS4H (ORCPT + 99 others); Thu, 15 Jul 2021 14:56:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:53064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239983AbhGOSu6 (ORCPT ); Thu, 15 Jul 2021 14:50:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0611F613DC; Thu, 15 Jul 2021 18:48:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626374884; bh=FpXv05j5ov1KxBl3Y58dYnCzDu2V3IJY+Ifx2h/hag4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zAVeNBBAiluoJBED38hNZpft0kxJ5t5PWl//mVuEKnaLD6KjbCIEm+Kds4GfHS3ca CMYkazBW3/4mPrQq/xtd0mYRJR8Uuj/Aqlj5v7tpG8+fegTxqIwNn1iCJPMCA9sNJv j1AvTa2DwlnBqwOX+GhNm3A8dYFbh9LcJqjyfrPY= 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.10 068/215] drm/amd/display: Fix off-by-one error in DML Date: Thu, 15 Jul 2021 20:37:20 +0200 Message-Id: <20210715182611.391703267@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182558.381078833@linuxfoundation.org> References: <20210715182558.381078833@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 d66e89283c48..2663f1b31842 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